diff options
| author | Martin Rudalics | 2017-04-12 18:22:44 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2017-04-12 18:22:44 +0200 |
| commit | c25005eda1c5ad8dabb3ce815658bd3c637ae686 (patch) | |
| tree | d4c7e6bd2d2a9fe8cdc3345a0f84d6d0aa6d4987 /src/xterm.c | |
| parent | 8720f601e715e5f1d41f7cf863a525a1cc1bc12c (diff) | |
| download | emacs-c25005eda1c5ad8dabb3ce815658bd3c637ae686.tar.gz emacs-c25005eda1c5ad8dabb3ce815658bd3c637ae686.zip | |
New internal-border face and args for select-window and x-focus-frame
Add `internal-border' face and handle it whenever clearing the
internal border. If NORECORD equals the symbol
'mark-for-redisplay', `select-window' will not record the window
but still mark it for redisplay. The new argument NOACTIVATE
for `x-focus-frame' tries to not activate FRAME when set.
* lisp/faces.el (internal-border): New face.
* lisp/mwheel.el (mwheel-scroll): Select window to scroll with
`mark-for-redisplay'.
* lisp/scroll-bar.el (scroll-bar-drag)
(scroll-bar-horizontal-drag, scroll-bar-scroll-down)
(scroll-bar-scroll-up, scroll-bar-toolkit-scroll)
(scroll-bar-toolkit-horizontal-scroll): Select window to scroll
with `mark-for-redisplay'.
* lisp/window.el (handle-select-window): When
`focus-follows-mouse' is not 'auto-raise' try to not activate
FRAME.
* src/dispextern.h (face_id): Add INTERNAL_BORDER_FACE_ID.
* src/frame.c (Fx_focus_frame): New argument NOACTIVATE.
* src/frame.h (x_focus_frame): Update extern declaration.
* src/gtkutil.c (xg_clear_under_internal_border): Remove
function.
(xg_frame_resized, xg_frame_set_char_size): Call
x_clear_under_internal_border.
(xg_tool_bar_callback): Adapt x_focus_frame call.
* src/gtkutil.h (xg_clear_under_internal_border): Remove
declaration.
* src/nsfns.m (x_focus_frame): Add argument NOACTIVATE.
* src/w32fns.c (x_clear_under_internal_border): Fill border
with internal-border background if specified.
* src/w32term.h (x_clear_under_internal_border): Add extern
declaration.
* src/w32term.c (x_after_update_window_line): Fill border
with internal-border background if specified.
(w32_set_vertical_scroll_bar, w32_set_horizontal_scroll_bar)
(x_scroll_bar_clear, w32_read_socket): Call
x_clear_under_internal_border.
(x_focus_frame): New argument NOACTIVATE.
* src/window.c (select_window): Mark WINDOW for redisplay when
NORECORD equals 'mark-for-redisplay'.
(Fselect_window): Update doc-string.
(syms_of_window): Define Qmark_for_redisplay.
* src/xdisp.c (clear_garbaged_frames, echo_area_display)
(redisplay_internal): Call x_clear_under_internal_border.
* src/xfaces.c (lookup_basic_face): Handle `window-divider'
and `internal-border' faces.
(realize_basic_faces): Realize `internal-border' face.
(syms_of_xfaces): Define Qinternal_border.
* src/xfns.c (x_set_internal_border_width): Remove call for
xg_clear_under_internal_border.
(x_focus_frame): New argument NOACTIVATE. When non-nil try to not
activate frame.
* src/xterm.c (x_fill_rectangle): No more static.
(x_clear_under_internal_border, x_after_update_window_line):
Fill border with internal-border background if specified.
(xt_horizontal_action_hook): Rewrite.
(handle_one_xevent): Call x_clear_under_internal_border.
* src/xterm.h (x_fill_rectangle): Add extern declaration.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 104 |
1 files changed, 77 insertions, 27 deletions
diff --git a/src/xterm.c b/src/xterm.c index 4444a5c187a..8dc1067a688 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -714,7 +714,7 @@ x_reset_clip_rectangles (struct frame *f, GC gc) | |||
| 714 | #endif | 714 | #endif |
| 715 | } | 715 | } |
| 716 | 716 | ||
| 717 | static void | 717 | void |
| 718 | x_fill_rectangle (struct frame *f, GC gc, int x, int y, int width, int height) | 718 | x_fill_rectangle (struct frame *f, GC gc, int x, int y, int width, int height) |
| 719 | { | 719 | { |
| 720 | #ifdef USE_CAIRO | 720 | #ifdef USE_CAIRO |
| @@ -1295,8 +1295,12 @@ XTbuffer_flipping_unblocked_hook (struct frame *f) | |||
| 1295 | show_back_buffer (f); | 1295 | show_back_buffer (f); |
| 1296 | } | 1296 | } |
| 1297 | 1297 | ||
| 1298 | /* Clear under internal border if any (GTK has its own version). */ | 1298 | /** |
| 1299 | #ifndef USE_GTK | 1299 | * x_clear_under_internal_border: |
| 1300 | * | ||
| 1301 | * Clear area of frame F's internal border. If the internal border face | ||
| 1302 | * of F has been specified (is not null), fill the area with that face. | ||
| 1303 | */ | ||
| 1300 | void | 1304 | void |
| 1301 | x_clear_under_internal_border (struct frame *f) | 1305 | x_clear_under_internal_border (struct frame *f) |
| 1302 | { | 1306 | { |
| @@ -1305,17 +1309,39 @@ x_clear_under_internal_border (struct frame *f) | |||
| 1305 | int border = FRAME_INTERNAL_BORDER_WIDTH (f); | 1309 | int border = FRAME_INTERNAL_BORDER_WIDTH (f); |
| 1306 | int width = FRAME_PIXEL_WIDTH (f); | 1310 | int width = FRAME_PIXEL_WIDTH (f); |
| 1307 | int height = FRAME_PIXEL_HEIGHT (f); | 1311 | int height = FRAME_PIXEL_HEIGHT (f); |
| 1312 | #ifdef USE_GTK | ||
| 1313 | int margin = 0; | ||
| 1314 | #else | ||
| 1308 | int margin = FRAME_TOP_MARGIN_HEIGHT (f); | 1315 | int margin = FRAME_TOP_MARGIN_HEIGHT (f); |
| 1316 | #endif | ||
| 1317 | struct face *face = FACE_FROM_ID_OR_NULL (f, INTERNAL_BORDER_FACE_ID); | ||
| 1309 | 1318 | ||
| 1310 | block_input (); | 1319 | block_input (); |
| 1311 | x_clear_area (f, 0, 0, border, height); | 1320 | |
| 1312 | x_clear_area (f, 0, margin, width, border); | 1321 | if (face) |
| 1313 | x_clear_area (f, width - border, 0, border, height); | 1322 | { |
| 1314 | x_clear_area (f, 0, height - border, width, border); | 1323 | unsigned long color = face->background; |
| 1324 | Display *display = FRAME_X_DISPLAY (f); | ||
| 1325 | GC gc = f->output_data.x->normal_gc; | ||
| 1326 | |||
| 1327 | XSetForeground (display, gc, color); | ||
| 1328 | x_fill_rectangle (f, gc, 0, margin, width, border); | ||
| 1329 | x_fill_rectangle (f, gc, 0, 0, border, height); | ||
| 1330 | x_fill_rectangle (f, gc, width - border, 0, border, height); | ||
| 1331 | x_fill_rectangle (f, gc, 0, height - border, width, border); | ||
| 1332 | XSetForeground (display, gc, FRAME_FOREGROUND_PIXEL (f)); | ||
| 1333 | } | ||
| 1334 | else | ||
| 1335 | { | ||
| 1336 | x_clear_area (f, 0, 0, border, height); | ||
| 1337 | x_clear_area (f, 0, margin, width, border); | ||
| 1338 | x_clear_area (f, width - border, 0, border, height); | ||
| 1339 | x_clear_area (f, 0, height - border, width, border); | ||
| 1340 | } | ||
| 1341 | |||
| 1315 | unblock_input (); | 1342 | unblock_input (); |
| 1316 | } | 1343 | } |
| 1317 | } | 1344 | } |
| 1318 | #endif | ||
| 1319 | 1345 | ||
| 1320 | /* Draw truncation mark bitmaps, continuation mark bitmaps, overlay | 1346 | /* Draw truncation mark bitmaps, continuation mark bitmaps, overlay |
| 1321 | arrow bitmaps, or clear the fringes if no bitmaps are required | 1347 | arrow bitmaps, or clear the fringes if no bitmaps are required |
| @@ -1351,10 +1377,25 @@ x_after_update_window_line (struct window *w, struct glyph_row *desired_row) | |||
| 1351 | height > 0)) | 1377 | height > 0)) |
| 1352 | { | 1378 | { |
| 1353 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); | 1379 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); |
| 1380 | struct face *face = FACE_FROM_ID_OR_NULL (f, INTERNAL_BORDER_FACE_ID); | ||
| 1354 | 1381 | ||
| 1355 | block_input (); | 1382 | block_input (); |
| 1356 | x_clear_area (f, 0, y, width, height); | 1383 | if (face) |
| 1357 | x_clear_area (f, FRAME_PIXEL_WIDTH (f) - width, y, width, height); | 1384 | { |
| 1385 | unsigned long color = face->background; | ||
| 1386 | Display *display = FRAME_X_DISPLAY (f); | ||
| 1387 | |||
| 1388 | XSetForeground (display, f->output_data.x->normal_gc, color); | ||
| 1389 | x_fill_rectangle (f, f->output_data.x->normal_gc, | ||
| 1390 | 0, y, width, height); | ||
| 1391 | x_fill_rectangle (f, f->output_data.x->normal_gc, | ||
| 1392 | FRAME_PIXEL_WIDTH (f) - width, y, width, height); | ||
| 1393 | } | ||
| 1394 | else | ||
| 1395 | { | ||
| 1396 | x_clear_area (f, 0, y, width, height); | ||
| 1397 | x_clear_area (f, FRAME_PIXEL_WIDTH (f) - width, y, width, height); | ||
| 1398 | } | ||
| 1358 | unblock_input (); | 1399 | unblock_input (); |
| 1359 | } | 1400 | } |
| 1360 | } | 1401 | } |
| @@ -3849,11 +3890,11 @@ x_clear_area (struct frame *f, int x, int y, int width, int height) | |||
| 3849 | cairo_fill (cr); | 3890 | cairo_fill (cr); |
| 3850 | x_end_cr_clip (f); | 3891 | x_end_cr_clip (f); |
| 3851 | #else | 3892 | #else |
| 3852 | if (FRAME_X_DOUBLE_BUFFERED_P (f)) | 3893 | if (FRAME_X_DOUBLE_BUFFERED_P (f)) |
| 3853 | XFillRectangle (FRAME_X_DISPLAY (f), | 3894 | XFillRectangle (FRAME_X_DISPLAY (f), |
| 3854 | FRAME_X_DRAWABLE (f), | 3895 | FRAME_X_DRAWABLE (f), |
| 3855 | f->output_data.x->reverse_gc, | 3896 | f->output_data.x->reverse_gc, |
| 3856 | x, y, width, height); | 3897 | x, y, width, height); |
| 3857 | else | 3898 | else |
| 3858 | x_clear_area1 (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 3899 | x_clear_area1 (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 3859 | x, y, width, height, False); | 3900 | x, y, width, height, False); |
| @@ -5307,20 +5348,22 @@ xt_horizontal_action_hook (Widget widget, XtPointer client_data, String action_n | |||
| 5307 | x_send_scroll_bar_event (window_being_scrolled, | 5348 | x_send_scroll_bar_event (window_being_scrolled, |
| 5308 | scroll_bar_end_scroll, 0, 0, true); | 5349 | scroll_bar_end_scroll, 0, 0, true); |
| 5309 | w = XWINDOW (window_being_scrolled); | 5350 | w = XWINDOW (window_being_scrolled); |
| 5310 | bar = XSCROLL_BAR (w->horizontal_scroll_bar); | 5351 | if (!NILP (w->horizontal_scroll_bar)) |
| 5311 | |||
| 5312 | if (bar->dragging != -1) | ||
| 5313 | { | 5352 | { |
| 5314 | bar->dragging = -1; | 5353 | bar = XSCROLL_BAR (w->horizontal_scroll_bar); |
| 5315 | /* The thumb size is incorrect while dragging: fix it. */ | 5354 | if (bar->dragging != -1) |
| 5316 | set_horizontal_scroll_bar (w); | 5355 | { |
| 5317 | } | 5356 | bar->dragging = -1; |
| 5318 | window_being_scrolled = Qnil; | 5357 | /* The thumb size is incorrect while dragging: fix it. */ |
| 5358 | set_horizontal_scroll_bar (w); | ||
| 5359 | } | ||
| 5360 | window_being_scrolled = Qnil; | ||
| 5319 | #if defined (USE_LUCID) | 5361 | #if defined (USE_LUCID) |
| 5320 | bar->last_seen_part = scroll_bar_nowhere; | 5362 | bar->last_seen_part = scroll_bar_nowhere; |
| 5321 | #endif | 5363 | #endif |
| 5322 | /* Xt timeouts no longer needed. */ | 5364 | /* Xt timeouts no longer needed. */ |
| 5323 | toolkit_scroll_bar_interaction = false; | 5365 | toolkit_scroll_bar_interaction = false; |
| 5366 | } | ||
| 5324 | } | 5367 | } |
| 5325 | } | 5368 | } |
| 5326 | #endif /* not USE_GTK */ | 5369 | #endif /* not USE_GTK */ |
| @@ -7920,6 +7963,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7920 | event->xexpose.x, event->xexpose.y, | 7963 | event->xexpose.x, event->xexpose.y, |
| 7921 | event->xexpose.width, event->xexpose.height, | 7964 | event->xexpose.width, event->xexpose.height, |
| 7922 | 0); | 7965 | 0); |
| 7966 | x_clear_under_internal_border (f); | ||
| 7923 | #endif | 7967 | #endif |
| 7924 | } | 7968 | } |
| 7925 | 7969 | ||
| @@ -7935,6 +7979,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7935 | #endif | 7979 | #endif |
| 7936 | expose_frame (f, event->xexpose.x, event->xexpose.y, | 7980 | expose_frame (f, event->xexpose.x, event->xexpose.y, |
| 7937 | event->xexpose.width, event->xexpose.height); | 7981 | event->xexpose.width, event->xexpose.height); |
| 7982 | #ifdef USE_GTK | ||
| 7983 | x_clear_under_internal_border (f); | ||
| 7984 | #endif | ||
| 7938 | } | 7985 | } |
| 7939 | 7986 | ||
| 7940 | if (!FRAME_GARBAGED_P (f)) | 7987 | if (!FRAME_GARBAGED_P (f)) |
| @@ -7983,7 +8030,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7983 | event->xgraphicsexpose.y, | 8030 | event->xgraphicsexpose.y, |
| 7984 | event->xgraphicsexpose.width, | 8031 | event->xgraphicsexpose.width, |
| 7985 | event->xgraphicsexpose.height); | 8032 | event->xgraphicsexpose.height); |
| 7986 | show_back_buffer (f); | 8033 | #ifdef USE_GTK |
| 8034 | x_clear_under_internal_border (f); | ||
| 8035 | #endif | ||
| 8036 | show_back_buffer (f); | ||
| 7987 | } | 8037 | } |
| 7988 | #ifdef USE_X_TOOLKIT | 8038 | #ifdef USE_X_TOOLKIT |
| 7989 | else | 8039 | else |