Here's the vertical divider shadow thickness specifier. When you drag
the divider, it will get a "pressed" look. The following set of patches must
be applied on top of Kirill's and my former ones.
*** WARNING: *** I've patched redisplay-msw.c to make it compile, but the
feature is not functional. I don't know msw, so I'll let someone else hack
it.
There is one thing I would have liked to discuss with Ben, but I'm not
allowed to give international phone calls :-( The thing is that currently,
`redisplay_output_window' checks for several flags in order to decide when to
redraw the dividers, including the windows_structure_changed flag. I've
decided to activate this flag when the shadow thickness is changed. I'm not
sure if it's really kludgy. I'm not sure it's worth adding a new flag either.
1998-05-13 Didier Verna <verna(a)inf.enst.fr>
* mouse.el (drag-window-divider): give the vertical divider a
pressed look when dragging it.
1998-05-12 Didier Verna <verna(a)inf.enst.fr>
* console.h (struct console_methods): the divider_width console
method now requires a struct window * argument.
* redisplay-x.c (x_divider_width): ditto. Plus remove
X_DIVIDER_WIDTH, X_DIVIDER_SHADOW_THICKNESS.
(x_output_vertical_divider): give a depressed look when the shadow
thickness is negative.
* console-stream.c (stream_divider_width): pass a struct window *
argument.
* redisplay-tty.c (tty_divider_width): ditto.
* window.c (window_right_gutter_width): totdi.
* redisplay.c (generate_modeline): ittod.
* scrollbar.c (update_scrollbar_instance): ttido.
* redisplay-msw.c (mswindows_divider_width): ottid.
WARNING: this enables to compile, but the feature is not functional.
* window.h (struct window): new field
vertical_divider_shadow_thickness.
* window.c (specifier_vars_of_window): new specifier
vertical-divider-shadow-thickness.
(vertical_divider_shadow_thickness_changed): new function to
inform redisplay that the window has changed.
(mark_window): handle new field vertical_divider_shadow_thickness
from struct window.
(allocate_window): ditto.
(saved_window_equal): toddi.
(Fset_window_configuration): totid.
(save_window_save): ttdio.
(struct saved_window): new field vertical_divider_shadow_thickness.
--- lisp/mouse.el.orig Tue May 12 20:25:05 1998
+++ lisp/mouse.el Wed May 13 09:36:47 1998
@@ -1412,11 +1412,12 @@
window-divider-map. You would not call it, but you may bind it to
other mouse buttons."
(interactive "e")
- (let ((window (event-window event))
- (frame (event-channel event))
- (last-timestamp (event-timestamp event))
- (doit t))
-
+ (letf* ((window (event-window event))
+ (frame (event-channel event))
+ (last-timestamp (event-timestamp event))
+ (doit t)
+ ((specifier-instance vertical-divider-shadow-thickness window)
+ (- (specifier-instance vertical-divider-shadow-thickness window))))
(while doit
(let ((old-right (caddr (window-pixel-edges window)))
(old-left (car (window-pixel-edges window)))
--- src/console.h.orig Tue May 12 18:38:10 1998
+++ src/console.h Tue May 12 18:40:09 1998
@@ -133,7 +133,7 @@
CONST Emchar *str, Charcount len);
void (*output_display_block_method) (struct window *, struct display_line *,
int, int, int, int, int, int, int);
- int (*divider_width_method) (void);
+ int (*divider_width_method) (struct window *);
int (*divider_height_method) (void);
int (*eol_cursor_width_method) (void);
void (*output_vertical_divider_method) (struct window *, int);
--- src/redisplay-x.c.orig Tue May 12 18:45:31 1998
+++ src/redisplay-x.c Tue May 12 20:18:30 1998
@@ -54,23 +54,16 @@
/* X_DIVIDER_LINE_WIDTH is the width of the line drawn in the gutter.
X_DIVIDER_SPACING is the amount of blank space on each side of the line.
- X_DIVIDER_SHADOW_THICKNESS is the size of shadows
- X_DIVIDER_WIDTH =
- X_DIVIDER_LINE_WIDTH + 2*X_DIVIDER_SPACING + 2*X_DIVIDER_SHADOW_THICKNESS
+ the shadow thickness is now a specifier.
*/
+#define X_DIVIDER_LINE_WIDTH 3
+#define X_DIVIDER_SPACING 2
+
/* Number of pixels below each line. */
/* #### implement me */
int x_interline_space;
-#define X_DIVIDER_LINE_WIDTH 3
-#define X_DIVIDER_SPACING 2
-#define X_DIVIDER_SHADOW_THICKNESS 2
-#define X_DIVIDER_WIDTH \
- (X_DIVIDER_LINE_WIDTH + \
- 2 * X_DIVIDER_SPACING + \
- 2 * X_DIVIDER_SHADOW_THICKNESS)
-
#define EOL_CURSOR_WIDTH 5
static void x_output_pixmap (struct window *w, struct display_line *dl,
@@ -290,9 +283,16 @@
divider_width is a device method.
****************************************************************************/
static int
-x_divider_width (void)
+x_divider_width (struct window *w)
{
- return X_DIVIDER_WIDTH;
+ int shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
+
+ /* the shadow thickness can be negative !! This means that the divider will
+ have a depressed look */
+ if (shadow_thickness < 0)
+ shadow_thickness = - shadow_thickness;
+
+ return X_DIVIDER_LINE_WIDTH + 2 * X_DIVIDER_SPACING + 2 * shadow_thickness;
}
/*****************************************************************************
@@ -1414,11 +1414,14 @@
int use_pixmap = 0;
int flip_gcs = 0;
unsigned long mask;
+ int x, y1, y2, width, shadow_thickness;
+
+ width = x_divider_width (w);
+ shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
+ x = WINDOW_RIGHT (w) - width;
+ y1 = WINDOW_TOP (w);
+ y2 = WINDOW_BOTTOM (w);
- int x = WINDOW_RIGHT (w) - X_DIVIDER_WIDTH;
- int y1 = WINDOW_TOP (w);
- int y2 = WINDOW_BOTTOM (w);
-
memset (&gcv, ~0, sizeof (XGCValues));
tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, MODELINE_INDEX);
@@ -1488,21 +1491,35 @@
gcv.foreground = background_pixel;
background_gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, mask);
+ /* possibly revert the GC's in case the shadow thickness is < 0.
+ This will give a depressed look to the divider */
+ if (shadow_thickness < 0)
+ {
+ GC temp;
+
+ temp = top_shadow_gc;
+ top_shadow_gc = bottom_shadow_gc;
+ bottom_shadow_gc = temp;
+
+ /* better avoid a Bad Adress XLib error ;-) */
+ shadow_thickness = - shadow_thickness;
+ }
+
/* Clear the divider area first. This needs to be done when a
window split occurs. */
if (clear)
- XClearArea (dpy, x_win, x, y1, X_DIVIDER_WIDTH, y2 - y1, False);
+ XClearArea (dpy, x_win, x, y1, width, y2 - y1, False);
/* Draw the divider line. */
XFillRectangle (dpy, x_win, background_gc,
- x + X_DIVIDER_SPACING + X_DIVIDER_SHADOW_THICKNESS, y1,
+ x + X_DIVIDER_SPACING + shadow_thickness, y1,
X_DIVIDER_LINE_WIDTH, y2 - y1);
-
+
/* Draw the shadows around the divider line */
x_output_shadows (f, x + X_DIVIDER_SPACING, y1,
- X_DIVIDER_WIDTH - 2 * X_DIVIDER_SPACING, y2 - y1,
+ width - 2 * X_DIVIDER_SPACING, y2 - y1,
top_shadow_gc, bottom_shadow_gc,
- background_gc, X_DIVIDER_SHADOW_THICKNESS);
+ background_gc, shadow_thickness);
}
/*****************************************************************************
--- src/console-stream.c.orig Tue May 12 18:55:41 1998
+++ src/console-stream.c Tue May 12 18:56:05 1998
@@ -201,7 +201,7 @@
}
static int
-stream_divider_width (void)
+stream_divider_width (struct window *w)
{
return 1;
}
--- src/redisplay-tty.c.orig Tue May 12 18:56:31 1998
+++ src/redisplay-tty.c Tue May 12 18:56:45 1998
@@ -120,7 +120,7 @@
divider_width is a console method.
****************************************************************************/
static int
-tty_divider_width (void)
+tty_divider_width (struct window *w)
{
return 1;
}
--- src/redisplay-msw.c.orig Tue May 12 18:57:07 1998
+++ src/redisplay-msw.c Tue May 12 18:57:35 1998
@@ -884,7 +884,7 @@
Return the width of the vertical divider.
****************************************************************************/
static int
-mswindows_divider_width (void)
+mswindows_divider_width (struct window *w)
{
if (divider_width == 0)
divider_width = (GetSystemMetrics (SM_CXSIZEFRAME)
--- src/redisplay.c.orig Tue May 12 19:30:36 1998
+++ src/redisplay.c Tue May 12 19:30:44 1998
@@ -8133,7 +8133,7 @@
if (window_needs_vertical_divider (*w))
{
int div_x_high = WINDOW_RIGHT (*w);
- int div_x_low = div_x_high - FRAMEMETH (f, divider_width, ());
+ int div_x_low = div_x_high - FRAMEMETH (f, divider_width, (*w));
int div_y_high = WINDOW_BOTTOM (*w);
#ifdef HAVE_SCROLLBARS
int div_y_low = (!NILP ((*w)->scrollbar_on_top_p)
--- src/scrollbar.c.orig Tue May 12 19:31:31 1998
+++ src/scrollbar.c Tue May 12 19:31:50 1998
@@ -470,7 +470,7 @@
? WINDOW_LEFT (w)
: (WINDOW_RIGHT (w) - scrollbar_width
- (window_needs_vertical_divider (w)
- ? FRAMEMETH (f, divider_width, ()) : 0)));
+ ? FRAMEMETH (f, divider_width, (w)) : 0)));
y_offset = WINDOW_TEXT_TOP (w) + f->scrollbar_y_offset;
}
else
--- src/window.c.orig Tue May 12 19:06:30 1998
+++ src/window.c Wed May 13 10:06:57 1998
@@ -71,6 +71,9 @@
/* Whether a modeline should be displayed. */
Lisp_Object Vhas_modeline_p;
+/* Thickness of shadow border around vertical dividers. */
+Lisp_Object Vvertical_divider_shadow_thickness;
+
/* Scroll if point lands on the bottom line and that line is partially
clipped. */
int scroll_on_clipped_lines;
@@ -154,6 +157,7 @@
((markobj) (window->display_table));
((markobj) (window->has_modeline_p));
((markobj) (window->modeline_shadow_thickness));
+ ((markobj) (window->vertical_divider_shadow_thickness));
#ifdef HAVE_SCROLLBARS
((markobj) (window->scrollbar_width));
((markobj) (window->scrollbar_height));
@@ -311,6 +315,7 @@
p->display_table = Qnil;
p->has_modeline_p = Qnil;
p->modeline_shadow_thickness = Qnil;
+ p->vertical_divider_shadow_thickness = Qnil;
#ifdef HAVE_SCROLLBARS
p->scrollbar_width = Qnil;
p->scrollbar_height = Qnil;
@@ -1057,7 +1062,7 @@
#endif
if (window_needs_vertical_divider (w))
- gutter += FRAMEMETH (XFRAME (WINDOW_FRAME (w)), divider_width, ());
+ gutter += FRAMEMETH (XFRAME (WINDOW_FRAME (w)), divider_width, (w));
return gutter;
}
@@ -4368,6 +4373,19 @@
MARK_WINDOWS_CHANGED (w);
}
+static void
+vertical_divider_shadow_thickness_changed (Lisp_Object specifier,
+ struct window *w,
+ Lisp_Object oldval)
+{
+ struct frame *f = XFRAME (w->frame);
+
+ MARK_WINDOWS_CHANGED (w);
+ /* This is to indicate to redisplay_output_window that it should redraw the
+ vertical divider. I'm not sure of the kludge-ness level of this ... */
+ MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f);
+}
+
/* also used in scrollbar.c */
void
some_window_value_changed (Lisp_Object specifier, struct window *w,
@@ -4508,6 +4526,7 @@
char start_at_line_beg; /* boolean */
Lisp_Object display_table;
Lisp_Object modeline_shadow_thickness;
+ Lisp_Object vertical_divider_shadow_thickness;
Lisp_Object has_modeline_p;
#ifdef HAVE_SCROLLBARS
Lisp_Object scrollbar_width;
@@ -4651,6 +4670,8 @@
win1->start_at_line_beg == win2->start_at_line_beg &&
internal_equal(win1->display_table, win2->display_table, 0) &&
EQ(win1->modeline_shadow_thickness, win2->modeline_shadow_thickness) &&
+ EQ(win1->vertical_divider_shadow_thickness,
+ win2->vertical_divider_shadow_thickness) &&
EQ(win1->has_modeline_p, win2->has_modeline_p) &&
#ifdef HAVE_SCROLLBARS
EQ(win1->scrollbar_width, win2->scrollbar_width) &&
@@ -4974,6 +4995,8 @@
w->modeline_hscroll = p->modeline_hscroll;
w->display_table = p->display_table;
w->modeline_shadow_thickness = p->modeline_shadow_thickness;
+ w->vertical_divider_shadow_thickness =
+ p->vertical_divider_shadow_thickness;
w->has_modeline_p = p->has_modeline_p;
#ifdef HAVE_SCROLLBARS
w->scrollbar_width = p->scrollbar_width;
@@ -5240,6 +5263,8 @@
p->modeline_hscroll = w->modeline_hscroll;
p->display_table = w->display_table;
p->modeline_shadow_thickness = w->modeline_shadow_thickness;
+ p->vertical_divider_shadow_thickness =
+ w->vertical_divider_shadow_thickness;
p->has_modeline_p = w->has_modeline_p;
#ifdef HAVE_SCROLLBARS
p->scrollbar_width = w->scrollbar_width;
@@ -5635,6 +5660,21 @@
modeline_shadow_thickness),
modeline_shadow_thickness_changed,
0, 0);
+
+ DEFVAR_SPECIFIER ("vertical-divider-shadow-thickness", &Vvertical_divider_shadow_thickness /*
+*How thick to draw shadows around the vertical dividers.
+This is a specifier; use `set-specifier' to change it.
+*/ );
+ Vvertical_divider_shadow_thickness = Fmake_specifier (Qinteger);
+ set_specifier_fallback (Vvertical_divider_shadow_thickness,
+ list1 (Fcons (Qnil, Qzero)));
+ Fadd_spec_to_specifier (Vvertical_divider_shadow_thickness, make_int (2),
+ Qnil, Qnil, Qnil);
+ set_specifier_caching (Vvertical_divider_shadow_thickness,
+ slot_offset (struct window,
+ vertical_divider_shadow_thickness),
+ vertical_divider_shadow_thickness_changed,
+ 0, 0);
DEFVAR_SPECIFIER ("has-modeline-p", &Vhas_modeline_p /*
*Whether the modeline should be displayed.
--- src/window.h.orig Tue May 12 19:00:04 1998
+++ src/window.h Tue May 12 19:04:39 1998
@@ -189,6 +189,9 @@
Lisp_Object modeline_shadow_thickness;
/* Non-nil means to display a modeline for the buffer. */
Lisp_Object has_modeline_p;
+ /* Thickness of vertical divider shadow, in pixels. If negative, draw as
+ recessed. */
+ Lisp_Object vertical_divider_shadow_thickness;
#ifdef HAVE_SCROLLBARS
/* Width of vertical scrollbars. */
Lisp_Object scrollbar_width;