aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Rudalics2014-02-04 08:36:58 +0100
committerMartin Rudalics2014-02-04 08:36:58 +0100
commit764ec9e5f0adaff96b52252eea71eb30ef7cefa1 (patch)
tree1aaf762a76e795be19e9a2279db36b496b0d1e15 /src
parent6da8227cfa5bc7f428346e78d028a83a385f908f (diff)
downloademacs-764ec9e5f0adaff96b52252eea71eb30ef7cefa1.tar.gz
emacs-764ec9e5f0adaff96b52252eea71eb30ef7cefa1.zip
Improve window dividers code.
* faces.el (window-divider): New default value. Rewrite doc-string. (window-divider-first-pixel, window-divider-last-pixel): New faces. * dispextern.h (face_id): Add WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID and WINDOW_DIVIDER_LAST_PIXEL_FACE_ID. * w32term.c (w32_draw_window_divider): Handle first and last pixels specially. * w32term.h (w32_fill_area_abs): New function. * xdisp.c (x_draw_right_divider): Don't draw over bottom divider. * xfaces.c (realize_basic_faces): Handle new face ids. * xfns.c (Fx_create_frame): Call x_default_parameter for right and bottom divider width. * xterm.c (x_draw_window_divider): Handle first and last pixels specially.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/dispextern.h2
-rw-r--r--src/w32term.c42
-rw-r--r--src/w32term.h10
-rw-r--r--src/xdisp.c3
-rw-r--r--src/xfaces.c8
-rw-r--r--src/xfns.c4
-rw-r--r--src/xterm.c52
8 files changed, 112 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ac41dabafcd..ec003cd59b2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12014-02-03 Martin Rudalics <rudalics@gmx.at>
2
3 * dispextern.h (face_id): Add WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID
4 and WINDOW_DIVIDER_LAST_PIXEL_FACE_ID.
5 * w32term.c (w32_draw_window_divider): Handle first and last
6 pixels specially.
7 * w32term.h (w32_fill_area_abs): New function.
8 * xdisp.c (x_draw_right_divider): Don't draw over bottom
9 divider.
10 * xfaces.c (realize_basic_faces): Handle new face ids.
11 * xfns.c (Fx_create_frame): Call x_default_parameter for right
12 and bottom divider width.
13 * xterm.c (x_draw_window_divider): Handle first and last pixels
14 specially.
15
12014-02-03 Dmitry Antipov <dmantipov@yandex.ru> 162014-02-03 Dmitry Antipov <dmantipov@yandex.ru>
2 17
3 * print.c (Fexternal_debugging_output): Add cast to pacify 18 * print.c (Fexternal_debugging_output): Add cast to pacify
diff --git a/src/dispextern.h b/src/dispextern.h
index a5dd054c123..9ecd4ecdf7e 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1765,6 +1765,8 @@ enum face_id
1765 MENU_FACE_ID, 1765 MENU_FACE_ID,
1766 VERTICAL_BORDER_FACE_ID, 1766 VERTICAL_BORDER_FACE_ID,
1767 WINDOW_DIVIDER_FACE_ID, 1767 WINDOW_DIVIDER_FACE_ID,
1768 WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID,
1769 WINDOW_DIVIDER_LAST_PIXEL_FACE_ID,
1768 BASIC_FACE_ID_SENTINEL 1770 BASIC_FACE_ID_SENTINEL
1769}; 1771};
1770 1772
diff --git a/src/w32term.c b/src/w32term.c
index 03d5a0047bc..b77d01796d7 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -628,26 +628,38 @@ static void
628w32_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) 628w32_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1)
629{ 629{
630 struct frame *f = XFRAME (WINDOW_FRAME (w)); 630 struct frame *f = XFRAME (WINDOW_FRAME (w));
631 RECT r; 631 HDC hdc = get_frame_dc (f);
632 HDC hdc; 632 struct face *face = FACE_FROM_ID (f, WINDOW_DIVIDER_FACE_ID);
633 struct face *face; 633 struct face *face_first = FACE_FROM_ID (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
634 634 struct face *face_last = FACE_FROM_ID (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
635 r.left = x0; 635 unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f);
636 r.right = x1; 636 unsigned long color_first = (face_first
637 r.top = y0; 637 ? face_first->foreground
638 r.bottom = y1; 638 : FRAME_FOREGROUND_PIXEL (f));
639 639 unsigned long color_last = (face_last
640 hdc = get_frame_dc (f); 640 ? face_last->foreground
641 face = FACE_FROM_ID (f, WINDOW_DIVIDER_FACE_ID); 641 : FRAME_FOREGROUND_PIXEL (f));
642 if (face) 642
643 w32_fill_rect (f, hdc, face->foreground, &r); 643 if (y1 - y0 > x1 - x0 && x1 - x0 > 2)
644 /* Vertical. */
645 {
646 w32_fill_area_abs (f, hdc, color_first, x0, y0, x0 + 1, y1);
647 w32_fill_area_abs (f, hdc, color, x0 + 1, y0, x1 - 1, y1);
648 w32_fill_area_abs (f, hdc, color_last, x1 - 1, y0, x1, y1);
649 }
650 else if (x1 - x0 > y1 - y0 && y1 - y0 > 3)
651 /* Horizontal. */
652 {
653 w32_fill_area_abs (f, hdc, color_first, x0, y0, x1, y0 + 1);
654 w32_fill_area_abs (f, hdc, color, x0, y0 + 1, x1, y1 - 1);
655 w32_fill_area_abs (f, hdc, color_last, x0, y1 - 1, x1, y1);
656 }
644 else 657 else
645 w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r); 658 w32_fill_area_abs (f, hdc, color, x0, y0, x1, y1);
646 659
647 release_frame_dc (f, hdc); 660 release_frame_dc (f, hdc);
648} 661}
649 662
650
651/* End update of window W. 663/* End update of window W.
652 664
653 Draw vertical borders between horizontally adjacent windows, and 665 Draw vertical borders between horizontally adjacent windows, and
diff --git a/src/w32term.h b/src/w32term.h
index 5a1ae283137..f85e6bced8b 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -537,6 +537,16 @@ do { \
537 w32_fill_rect (f,hdc,pix,&rect); \ 537 w32_fill_rect (f,hdc,pix,&rect); \
538} while (0) 538} while (0)
539 539
540#define w32_fill_area_abs(f,hdc,pix,x0,y0,x1,y1) \
541do { \
542 RECT rect; \
543 rect.left = x0; \
544 rect.top = y0; \
545 rect.right = x1; \
546 rect.bottom = y1; \
547 w32_fill_rect (f,hdc,pix,&rect); \
548} while (0)
549
540#define w32_clear_rect(f,hdc,lprect) \ 550#define w32_clear_rect(f,hdc,lprect) \
541 w32_fill_rect (f, hdc, FRAME_BACKGROUND_PIXEL (f), lprect) 551 w32_fill_rect (f, hdc, FRAME_BACKGROUND_PIXEL (f), lprect)
542 552
diff --git a/src/xdisp.c b/src/xdisp.c
index b5dec35568a..0ca877d997f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -29277,7 +29277,8 @@ x_draw_right_divider (struct window *w)
29277 int x0 = WINDOW_RIGHT_EDGE_X (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w); 29277 int x0 = WINDOW_RIGHT_EDGE_X (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
29278 int x1 = WINDOW_RIGHT_EDGE_X (w); 29278 int x1 = WINDOW_RIGHT_EDGE_X (w);
29279 int y0 = WINDOW_TOP_EDGE_Y (w); 29279 int y0 = WINDOW_TOP_EDGE_Y (w);
29280 int y1 = WINDOW_BOTTOM_EDGE_Y (w); 29280 /* The bottom divider prevails. */
29281 int y1 = WINDOW_BOTTOM_EDGE_Y (w) - WINDOW_BOTTOM_DIVIDER_WIDTH (w);
29281 29282
29282 FRAME_RIF (f)->draw_window_divider (w, x0, x1, y0, y1); 29283 FRAME_RIF (f)->draw_window_divider (w, x0, x1, y0, y1);
29283 } 29284 }
diff --git a/src/xfaces.c b/src/xfaces.c
index f2d777a12b1..4271e47c36f 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -324,6 +324,8 @@ static Lisp_Object Qborder, Qmouse, Qmenu;
324Lisp_Object Qmode_line_inactive; 324Lisp_Object Qmode_line_inactive;
325static Lisp_Object Qvertical_border; 325static Lisp_Object Qvertical_border;
326static Lisp_Object Qwindow_divider; 326static Lisp_Object Qwindow_divider;
327static Lisp_Object Qwindow_divider_first_pixel;
328static Lisp_Object Qwindow_divider_last_pixel;
327 329
328/* The symbol `face-alias'. A symbols having that property is an 330/* The symbol `face-alias'. A symbols having that property is an
329 alias for another face. Value of the property is the name of 331 alias for another face. Value of the property is the name of
@@ -5249,6 +5251,10 @@ realize_basic_faces (struct frame *f)
5249 realize_named_face (f, Qmenu, MENU_FACE_ID); 5251 realize_named_face (f, Qmenu, MENU_FACE_ID);
5250 realize_named_face (f, Qvertical_border, VERTICAL_BORDER_FACE_ID); 5252 realize_named_face (f, Qvertical_border, VERTICAL_BORDER_FACE_ID);
5251 realize_named_face (f, Qwindow_divider, WINDOW_DIVIDER_FACE_ID); 5253 realize_named_face (f, Qwindow_divider, WINDOW_DIVIDER_FACE_ID);
5254 realize_named_face (f, Qwindow_divider_first_pixel,
5255 WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
5256 realize_named_face (f, Qwindow_divider_last_pixel,
5257 WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
5252 5258
5253 /* Reflect changes in the `menu' face in menu bars. */ 5259 /* Reflect changes in the `menu' face in menu bars. */
5254 if (FRAME_FACE_CACHE (f)->menu_face_changed_p) 5260 if (FRAME_FACE_CACHE (f)->menu_face_changed_p)
@@ -6452,6 +6458,8 @@ syms_of_xfaces (void)
6452 DEFSYM (Qmode_line_inactive, "mode-line-inactive"); 6458 DEFSYM (Qmode_line_inactive, "mode-line-inactive");
6453 DEFSYM (Qvertical_border, "vertical-border"); 6459 DEFSYM (Qvertical_border, "vertical-border");
6454 DEFSYM (Qwindow_divider, "window-divider"); 6460 DEFSYM (Qwindow_divider, "window-divider");
6461 DEFSYM (Qwindow_divider_first_pixel, "window-divider-first-pixel");
6462 DEFSYM (Qwindow_divider_last_pixel, "window-divider-last-pixel");
6455 DEFSYM (Qtty_color_desc, "tty-color-desc"); 6463 DEFSYM (Qtty_color_desc, "tty-color-desc");
6456 DEFSYM (Qtty_color_standard_values, "tty-color-standard-values"); 6464 DEFSYM (Qtty_color_standard_values, "tty-color-standard-values");
6457 DEFSYM (Qtty_color_by_index, "tty-color-by-index"); 6465 DEFSYM (Qtty_color_by_index, "tty-color-by-index");
diff --git a/src/xfns.c b/src/xfns.c
index debc707dba2..ff492dcf126 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3033,6 +3033,10 @@ This function is an internal primitive--use `make-frame' instead. */)
3033#endif 3033#endif
3034 "internalBorderWidth", "internalBorderWidth", 3034 "internalBorderWidth", "internalBorderWidth",
3035 RES_TYPE_NUMBER); 3035 RES_TYPE_NUMBER);
3036 x_default_parameter (f, parms, Qright_divider_width, make_number (0),
3037 NULL, NULL, RES_TYPE_NUMBER);
3038 x_default_parameter (f, parms, Qbottom_divider_width, make_number (0),
3039 NULL, NULL, RES_TYPE_NUMBER);
3036 x_default_parameter (f, parms, Qvertical_scroll_bars, 3040 x_default_parameter (f, parms, Qvertical_scroll_bars,
3037#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS) 3041#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
3038 Qright, 3042 Qright,
diff --git a/src/xterm.c b/src/xterm.c
index 685fdf40a70..e1873127276 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -510,15 +510,51 @@ static void
510x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) 510x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1)
511{ 511{
512 struct frame *f = XFRAME (WINDOW_FRAME (w)); 512 struct frame *f = XFRAME (WINDOW_FRAME (w));
513 struct face *face; 513 struct face *face = FACE_FROM_ID (f, WINDOW_DIVIDER_FACE_ID);
514 514 struct face *face_first = FACE_FROM_ID (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
515 face = FACE_FROM_ID (f, WINDOW_DIVIDER_FACE_ID); 515 struct face *face_last = FACE_FROM_ID (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
516 if (face) 516 unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f);
517 XSetForeground (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc, 517 unsigned long color_first = (face_first
518 face->foreground); 518 ? face_first->foreground
519 : FRAME_FOREGROUND_PIXEL (f));
520 unsigned long color_last = (face_last
521 ? face_last->foreground
522 : FRAME_FOREGROUND_PIXEL (f));
523 Display *display = FRAME_X_DISPLAY (f);
524 Window window = FRAME_X_WINDOW (f);
519 525
520 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 526 if (y1 - y0 > x1 - x0 && x1 - x0 > 2)
521 f->output_data.x->normal_gc, x0, y0, x1 - x0, y1 - y0); 527 /* Vertical. */
528 {
529 XSetForeground (display, f->output_data.x->normal_gc, color_first);
530 XFillRectangle (display, window, f->output_data.x->normal_gc,
531 x0, y0, 1, y1 - y0);
532 XSetForeground (display, f->output_data.x->normal_gc, color);
533 XFillRectangle (display, window, f->output_data.x->normal_gc,
534 x0 + 1, y0, x1 - x0 - 2, y1 - y0);
535 XSetForeground (display, f->output_data.x->normal_gc, color_last);
536 XFillRectangle (display, window, f->output_data.x->normal_gc,
537 x1 - 1, y0, 1, y1 - y0);
538 }
539 else if (x1 - x0 > y1 - y0 && y1 - y0 > 3)
540 /* Horizontal. */
541 {
542 XSetForeground (display, f->output_data.x->normal_gc, color_first);
543 XFillRectangle (display, window, f->output_data.x->normal_gc,
544 x0, y0, x1 - x0, 1);
545 XSetForeground (display, f->output_data.x->normal_gc, color);
546 XFillRectangle (display, window, f->output_data.x->normal_gc,
547 x0, y0 + 1, x1 - x0, y1 - y0 - 2);
548 XSetForeground (display, f->output_data.x->normal_gc, color_last);
549 XFillRectangle (display, window, f->output_data.x->normal_gc,
550 x0, y1 - 1, x1 - x0, 1);
551 }
552 else
553 {
554 XSetForeground (display, f->output_data.x->normal_gc, color);
555 XFillRectangle (display, window, f->output_data.x->normal_gc,
556 x0, y0, x1 - x0, y1 - y0);
557 }
522} 558}
523 559
524/* End update of window W. 560/* End update of window W.