From: Richard Stallman <rms@gnu.org>
Cc: eugene@ikz.ru, emacs-devel@gnu.org
Subject: Re: [eugene@ikz.ru: mouse-drag-vertical-line or mouse-drag-mode-line failed with complex window split]
Date: Mon, 19 Jun 2006 03:42:21 -0400 [thread overview]
Message-ID: <E1FsEOr-0005nv-Tu@fencepost.gnu.org> (raw)
In-Reply-To: <44925581.7060308@gmx.at> (message from martin rudalics on Fri, 16 Jun 2006 08:53:53 +0200)
Do these changes fix the remaining problems?
*** mouse.el 16 Mar 2006 15:21:13 -0500 1.297
--- mouse.el 18 Jun 2006 17:44:30 -0400
***************
*** 529,534 ****
--- 529,552 ----
(mouse-drag-mode-line-1 start-event nil))))
\f
+ (defun mouse-drag-vertical-line-rightward-window (window)
+ "Return a window that is immediately to the right of WINDOW, or nil."
+ (let ((bottom (nth 3 (window-inside-edges window)))
+ (left (nth 0 (window-inside-edges window)))
+ best best-right
+ (try (previous-window window)))
+ (while (not (eq try window))
+ (let ((try-top (nth 1 (window-inside-edges try)))
+ (try-bottom (nth 3 (window-inside-edges try)))
+ (try-right (nth 2 (window-inside-edges try))))
+ (if (and (< try-top bottom)
+ (>= try-bottom bottom)
+ (< try-right left)
+ (or (null best-right) (> try-right best-right)))
+ (setq best-right try-right best try)))
+ (setq try (previous-window try)))
+ best))
+
(defun mouse-drag-vertical-line (start-event)
"Change the width of a window by dragging on the vertical line."
(interactive "e")
***************
*** 594,600 ****
;; adjust the window on the left.
(if (eq which-side 'right)
(selected-window)
! (previous-window))))
(setq x (- (car (cdr mouse))
(if (eq which-side 'right) 0 2))
edges (window-edges window)
--- 612,619 ----
;; adjust the window on the left.
(if (eq which-side 'right)
(selected-window)
! (mouse-drag-vertical-line-rightward-window
! (selected-window)))))
(setq x (- (car (cdr mouse))
(if (eq which-side 'right) 0 2))
edges (window-edges window)
*** window.c 13 Jun 2006 19:07:16 -0400 1.549
--- window.c 18 Jun 2006 17:23:15 -0400
***************
*** 63,69 ****
static void window_scroll_line_based P_ ((Lisp_Object, int, int, int));
static int window_min_size_1 P_ ((struct window *, int));
static int window_min_size P_ ((struct window *, int, int, int *));
! static void size_window P_ ((Lisp_Object, int, int, int));
static int freeze_window_start P_ ((struct window *, void *));
static int window_fixed_size_p P_ ((struct window *, int, int));
static void enlarge_window P_ ((Lisp_Object, int, int));
--- 63,69 ----
static void window_scroll_line_based P_ ((Lisp_Object, int, int, int));
static int window_min_size_1 P_ ((struct window *, int));
static int window_min_size P_ ((struct window *, int, int, int *));
! static void size_window P_ ((Lisp_Object, int, int, int, int, int));
static int freeze_window_start P_ ((struct window *, void *));
static int window_fixed_size_p P_ ((struct window *, int, int));
static void enlarge_window P_ ((Lisp_Object, int, int));
***************
*** 2826,2842 ****
/* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set
WINDOW's width. Resize WINDOW's children, if any, so that they
! keep their proportionate size relative to WINDOW. Propagate
! WINDOW's top or left edge position to children. Delete windows
! that become too small unless NODELETE_P is non-zero.
If NODELETE_P is 2, that means we do delete windows that are
too small, even if they were too small before! */
static void
! size_window (window, size, width_p, nodelete_p)
Lisp_Object window;
int size, width_p, nodelete_p;
{
struct window *w = XWINDOW (window);
struct window *c;
--- 2826,2848 ----
/* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set
WINDOW's width. Resize WINDOW's children, if any, so that they
! keep their proportionate size relative to WINDOW.
!
! If FIRST_ONLY is 1, change only the first of WINDOW's children when
! they are in series. If LAST_ONLY is 1, change only the last of
! WINDOW's children when they are in series.
!
! Propagate WINDOW's top or left edge position to children. Delete
! windows that become too small unless NODELETE_P is non-zero.
If NODELETE_P is 2, that means we do delete windows that are
too small, even if they were too small before! */
static void
! size_window (window, size, width_p, nodelete_p, first_only, last_only)
Lisp_Object window;
int size, width_p, nodelete_p;
+ int first_only, last_only;
{
struct window *w = XWINDOW (window);
struct window *c;
***************
*** 2911,2916 ****
--- 2917,2923 ----
if (!NILP (*sideward))
{
+ /* We have a chain of parallel siblings whose size should all change. */
for (child = *sideward; !NILP (child); child = c->next)
{
c = XWINDOW (child);
***************
*** 2918,2926 ****
c->left_col = w->left_col;
else
c->top_line = w->top_line;
! size_window (child, size, width_p, nodelete_p);
}
}
else if (!NILP (*forward))
{
int fixed_size, each, extra, n;
--- 2925,2969 ----
c->left_col = w->left_col;
else
c->top_line = w->top_line;
! size_window (child, size, width_p, nodelete_p,
! first_only, last_only);
}
}
+ else if (!NILP (*forward) && last_only)
+ {
+ /* Change the last in a series of siblings. */
+ Lisp_Object last_child;
+ int child_size;
+
+ for (child = *forward; !NILP (child); child = c->next)
+ {
+ c = XWINDOW (child);
+ last_child = child;
+ }
+
+ child_size = XINT (width_p ? c->total_cols : c->total_lines);
+ size_window (last_child,
+ size - old_size + child_size,
+ width_p, nodelete_p, first_only, last_only);
+ }
+ else if (!NILP (*forward) && first_only)
+ {
+ /* Change the first in a series of siblings. */
+ int child_size;
+
+ child = *forward;
+ c = XWINDOW (child);
+
+ if (width_p)
+ c->left_col = w->left_col;
+ else
+ c->top_line = w->top_line;
+
+ child_size = XINT (width_p ? c->total_cols : c->total_lines);
+ size_window (child,
+ size - old_size + child_size,
+ width_p, nodelete_p, first_only, last_only);
+ }
else if (!NILP (*forward))
{
int fixed_size, each, extra, n;
***************
*** 2928,2934 ****
int last_pos, first_pos, nchildren, total;
int *new_sizes = NULL;
! /* Determine the fixed-size portion of the this window, and the
number of child windows. */
fixed_size = nchildren = nfixed = total = 0;
for (child = *forward; !NILP (child); child = c->next, ++nchildren)
--- 2971,2977 ----
int last_pos, first_pos, nchildren, total;
int *new_sizes = NULL;
! /* Determine the fixed-size portion of this window, and the
number of child windows. */
fixed_size = nchildren = nfixed = total = 0;
for (child = *forward; !NILP (child); child = c->next, ++nchildren)
***************
*** 2991,2997 ****
/* Set new height. Note that size_window also propagates
edge positions to children, so it's not a no-op if we
didn't change the child's size. */
! size_window (child, new_size, width_p, 1);
/* Remember the bottom/right edge position of this child; it
will be used to set the top/left edge of the next child. */
--- 3034,3040 ----
/* Set new height. Note that size_window also propagates
edge positions to children, so it's not a no-op if we
didn't change the child's size. */
! size_window (child, new_size, width_p, 1, first_only, last_only);
/* Remember the bottom/right edge position of this child; it
will be used to set the top/left edge of the next child. */
***************
*** 3010,3016 ****
int child_size;
c = XWINDOW (child);
child_size = width_p ? XINT (c->total_cols) : XINT (c->total_lines);
! size_window (child, child_size, width_p, 2);
}
}
}
--- 3053,3059 ----
int child_size;
c = XWINDOW (child);
child_size = width_p ? XINT (c->total_cols) : XINT (c->total_lines);
! size_window (child, child_size, width_p, 2, first_only, last_only);
}
}
}
***************
*** 3026,3032 ****
int height;
int nodelete;
{
! size_window (window, height, 0, nodelete);
}
--- 3069,3075 ----
int height;
int nodelete;
{
! size_window (window, height, 0, nodelete, 0, 0);
}
***************
*** 3041,3047 ****
int width;
int nodelete;
{
! size_window (window, width, 1, nodelete);
}
/* Change window heights in windows rooted in WINDOW by N lines. */
--- 3084,3090 ----
int width;
int nodelete;
{
! size_window (window, width, 1, nodelete, 0, 0);
}
/* Change window heights in windows rooted in WINDOW by N lines. */
***************
*** 4281,4288 ****
if (NILP (window))
{
! /* This can happen if WINDOW on the previous iteration was
! at top level of the tree and we did not exit. */
Fset_window_configuration (old_config);
error ("Specified window edge is fixed");
}
--- 4324,4331 ----
if (NILP (window))
{
! /* This happens if WINDOW on the previous iteration was
! at top level of the window tree. */
Fset_window_configuration (old_config);
error ("Specified window edge is fixed");
}
***************
*** 4296,4301 ****
--- 4339,4352 ----
{
if (! NILP (parent) && !NILP (XWINDOW (parent)->vchild))
first_parallel = XWINDOW (parent)->vchild;
+ else if (NILP (parent) && !NILP (p->next))
+ {
+ /* Handle the vertical chain of main window and minibuffer
+ which has no parent. */
+ first_parallel = window;
+ while (! NILP (XWINDOW (first_parallel)->prev))
+ first_parallel = XWINDOW (first_parallel)->prev;
+ }
}
else
{
***************
*** 4304,4311 ****
}
/* If this level's succession is in the desired dimension,
! and this window is the last one, its trailing edge is fixed. */
! if (NILP (XWINDOW (window)->next) && NILP (first_parallel))
{
Fset_window_configuration (old_config);
error ("Specified window edge is fixed");
--- 4355,4364 ----
}
/* If this level's succession is in the desired dimension,
! and this window is the last one, and there is no higher level,
! its trailing edge is fixed. */
! if (NILP (XWINDOW (window)->next) && NILP (first_parallel)
! && NILP (parent))
{
Fset_window_configuration (old_config);
error ("Specified window edge is fixed");
***************
*** 4347,4353 ****
XSETINT (CURBEG (p->next),
XINT (CURBEG (p->next)) + delta);
size_window (p->next, XINT (CURSIZE (p->next)) - delta,
! horiz_flag, 0);
break;
}
}
--- 4400,4406 ----
XSETINT (CURBEG (p->next),
XINT (CURBEG (p->next)) + delta);
size_window (p->next, XINT (CURSIZE (p->next)) - delta,
! horiz_flag, 0, 1, 0);
break;
}
}
***************
*** 4359,4365 ****
child = XWINDOW (child)->next)
if (! EQ (child, window))
size_window (child, XINT (CURSIZE (child)) + delta,
! horiz_flag, 0);
window = parent;
}
--- 4412,4418 ----
child = XWINDOW (child)->next)
if (! EQ (child, window))
size_window (child, XINT (CURSIZE (child)) + delta,
! horiz_flag, 0, 0, 1);
window = parent;
}
next prev parent reply other threads:[~2006-06-19 7:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-05 15:38 [eugene@ikz.ru: mouse-drag-vertical-line or mouse-drag-mode-line failed with complex window split] Richard Stallman
2006-06-11 19:32 ` Chong Yidong
2006-06-12 8:37 ` martin rudalics
2006-06-13 23:21 ` Richard Stallman
2006-06-13 23:40 ` Chong Yidong
2006-06-14 7:26 ` Eugene Vlasov
2006-06-14 12:33 ` martin rudalics
2006-06-15 0:24 ` Nick Roberts
2006-06-15 7:42 ` martin rudalics
2006-06-15 15:09 ` Richard Stallman
2006-06-15 20:51 ` Eugene Vlasov
2006-06-16 6:53 ` martin rudalics
2006-06-19 7:42 ` Richard Stallman [this message]
2006-06-19 12:38 ` martin rudalics
2006-06-19 19:18 ` Eugene Vlasov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1FsEOr-0005nv-Tu@fencepost.gnu.org \
--to=rms@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=eugene@ikz.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.