diff options
| author | Martin Rudalics | 2014-02-04 08:36:58 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2014-02-04 08:36:58 +0100 |
| commit | 764ec9e5f0adaff96b52252eea71eb30ef7cefa1 (patch) | |
| tree | 1aaf762a76e795be19e9a2279db36b496b0d1e15 /src/xterm.c | |
| parent | 6da8227cfa5bc7f428346e78d028a83a385f908f (diff) | |
| download | emacs-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/xterm.c')
| -rw-r--r-- | src/xterm.c | 52 |
1 files changed, 44 insertions, 8 deletions
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 | |||
| 510 | x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) | 510 | x_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. |