aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-04-27 19:19:01 +0800
committerPo Lu2022-04-27 19:19:01 +0800
commit5aef2623a37d9fe452b7072dbd12c7a24dd971e2 (patch)
tree0cb5d2d245e443b8d7b1074fe2e75a9c99fc126b /src
parentd4e3e548f5519e98c2fc842daf73a6acac7faa70 (diff)
downloademacs-5aef2623a37d9fe452b7072dbd12c7a24dd971e2.tar.gz
emacs-5aef2623a37d9fe452b7072dbd12c7a24dd971e2.zip
Cleanups to PGTK code
* src/pgtkfns.c (pgtk_explicitly_set_name, pgtk_set_tab_bar_lines) (pgtk_change_tab_bar_height, pgtk_set_child_frame_border_width) (pgtk_set_internal_border_width, pgtk_set_cursor_type) (pgtk_set_mouse_color, pgtk_set_override_redirect, xg_set_icon) (pgtk_frame_parm_handlers, Fpgtk_set_monitor_scale_factor) (pgtk_set_scroll_bar_default_width, pgtk_get_focus_frame) (pgtk_hide_tip, Fx_show_tip, Fx_hide_tip, frame_geometry) (syms_of_pgtkfns): Clean up coding style and delete incorrect comments that mostly duplicate what is in xfns.c, and fix comment coding style. Also rename functions from `x_' to `pgtk_'. * src/pgtkterm.c (pgtk_setup_relief_colors): Fix relief caching with new flag. (pgtk_draw_relief_rect, flip_cr_context, pgtk_wait_for_map_event) (pgtk_make_frame_visible, pgtk_make_frame_invisible) (pgtk_set_parent_frame, pgtk_draw_glyph_string_foreground) (pgtk_draw_composite_glyph_string_foreground) (pgtk_draw_glyphless_glyph_string_foreground) (pgtk_set_clip_rectangles, pgtk_draw_glyph_string_bg_rect) (pgtk_draw_image_foreground, pgtk_draw_image_glyph_string) (pgtk_draw_stretch_glyph_string, pgtk_draw_glyph_string) (pgtk_copy_bits, pgtk_bitmap_icon, pgtk_define_fringe_bitmap) (pgtk_show_hourglass, pgtk_flash, pgtk_send_scroll_bar_event) (pgtk_free_pixmap, set_opacity_recursively, frame_highlight) (frame_unhighlight, pgtk_toggle_invisible_pointer) (pgtk_create_terminal, pgtk_window_is_of_frame_recursive) (pgtk_window_is_of_frame, pgtk_any_window_to_frame) (pgtk_handle_draw, size_allocate, pgtk_enqueue_string) (key_press_event, motion_notify_event): Fix coding style and some minor bugs. * src/pgtkterm.h (struct pgtk_output): New field for tracking relief color status, update prototypes.
Diffstat (limited to 'src')
-rw-r--r--src/pgtkfns.c207
-rw-r--r--src/pgtkterm.c420
-rw-r--r--src/pgtkterm.h8
3 files changed, 254 insertions, 381 deletions
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 1cab954a076..d1a72804cfe 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -360,7 +360,8 @@ pgtk_set_name (struct frame *f, Lisp_Object name, int explicit)
360 specified a name for the frame; the name will override any set by the 360 specified a name for the frame; the name will override any set by the
361 redisplay code. */ 361 redisplay code. */
362static void 362static void
363x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 363pgtk_explicitly_set_name (struct frame *f, Lisp_Object arg,
364 Lisp_Object oldval)
364{ 365{
365 pgtk_set_name (f, arg, true); 366 pgtk_set_name (f, arg, true);
366} 367}
@@ -467,13 +468,12 @@ pgtk_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
467 else 468 else
468 nlines = 0; 469 nlines = 0;
469 470
470 x_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); 471 pgtk_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
471} 472}
472 473
473
474/* Set the pixel height of the tab bar of frame F to HEIGHT. */ 474/* Set the pixel height of the tab bar of frame F to HEIGHT. */
475void 475void
476x_change_tab_bar_height (struct frame *f, int height) 476pgtk_change_tab_bar_height (struct frame *f, int height)
477{ 477{
478 int unit = FRAME_LINE_HEIGHT (f); 478 int unit = FRAME_LINE_HEIGHT (f);
479 int old_height = FRAME_TAB_BAR_HEIGHT (f); 479 int old_height = FRAME_TAB_BAR_HEIGHT (f);
@@ -578,12 +578,11 @@ pgtk_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object
578 pgtk_clear_under_internal_border (f); 578 pgtk_clear_under_internal_border (f);
579 } 579 }
580 } 580 }
581
582} 581}
583 582
584static void 583static void
585pgtk_set_internal_border_width (struct frame *f, Lisp_Object arg, 584pgtk_set_internal_border_width (struct frame *f, Lisp_Object arg,
586 Lisp_Object oldval) 585 Lisp_Object oldval)
587{ 586{
588 int border = check_int_nonnegative (arg); 587 int border = check_int_nonnegative (arg);
589 588
@@ -661,32 +660,17 @@ pgtk_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
661 unblock_input (); 660 unblock_input ();
662} 661}
663 662
664/* This is the same as the xfns.c definition. */
665static void 663static void
666pgtk_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 664pgtk_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
667{ 665{
668 set_frame_cursor_types (f, arg); 666 set_frame_cursor_types (f, arg);
669} 667}
670 668
671/* called to set mouse pointer color, but all other terms use it to
672 initialize pointer types (and don't set the color ;) */
673static void 669static void
674pgtk_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 670pgtk_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
675{ 671{
676} 672}
677 673
678/**
679 * pgtk_set_undecorated:
680 *
681 * Set frame F's `undecorated' parameter. If non-nil, F's window-system
682 * window is drawn without decorations, title, minimize/maximize boxes
683 * and external borders. This usually means that the window cannot be
684 * dragged, resized, iconified, maximized or deleted with the mouse. If
685 * nil, draw the frame with all the elements listed above unless these
686 * have been suspended via window manager settings.
687 *
688 * Some window managers may not honor this parameter.
689 */
690static void 674static void
691pgtk_set_undecorated (struct frame *f, Lisp_Object new_value, 675pgtk_set_undecorated (struct frame *f, Lisp_Object new_value,
692 Lisp_Object old_value) 676 Lisp_Object old_value)
@@ -698,16 +682,6 @@ pgtk_set_undecorated (struct frame *f, Lisp_Object new_value,
698 } 682 }
699} 683}
700 684
701/**
702 * pgtk_set_skip_taskbar:
703 *
704 * Set frame F's `skip-taskbar' parameter. If non-nil, this should
705 * remove F's icon from the taskbar associated with the display of F's
706 * window-system window and inhibit switching to F's window via
707 * <Alt>-<TAB>. If nil, lift these restrictions.
708 *
709 * Some window managers may not honor this parameter.
710 */
711static void 685static void
712pgtk_set_skip_taskbar (struct frame *f, Lisp_Object new_value, 686pgtk_set_skip_taskbar (struct frame *f, Lisp_Object new_value,
713 Lisp_Object old_value) 687 Lisp_Object old_value)
@@ -719,18 +693,9 @@ pgtk_set_skip_taskbar (struct frame *f, Lisp_Object new_value,
719 } 693 }
720} 694}
721 695
722/**
723 * pgtk_set_override_redirect:
724 *
725 * Set frame F's `override_redirect' parameter which, if non-nil, hints
726 * that the window manager doesn't want to deal with F. Usually, such
727 * frames have no decorations and always appear on top of all frames.
728 *
729 * Some window managers may not honor this parameter.
730 */
731static void 696static void
732pgtk_set_override_redirect (struct frame *f, Lisp_Object new_value, 697pgtk_set_override_redirect (struct frame *f, Lisp_Object new_value,
733 Lisp_Object old_value) 698 Lisp_Object old_value)
734{ 699{
735 if (!EQ (new_value, old_value)) 700 if (!EQ (new_value, old_value))
736 { 701 {
@@ -745,9 +710,7 @@ pgtk_set_override_redirect (struct frame *f, Lisp_Object new_value,
745 } 710 }
746} 711}
747 712
748/* Set icon from FILE for frame F. By using GTK functions the icon 713/* Set icon from FILE for frame F. */
749 may be any format that GdkPixbuf knows about, i.e. not just bitmaps. */
750
751bool 714bool
752xg_set_icon (struct frame *f, Lisp_Object file) 715xg_set_icon (struct frame *f, Lisp_Object file)
753{ 716{
@@ -969,59 +932,58 @@ unless TYPE is `png'. */)
969 return pgtk_cr_export_frames (frames, surface_type); 932 return pgtk_cr_export_frames (frames, surface_type);
970} 933}
971 934
972 935frame_parm_handler pgtk_frame_parm_handlers[] =
973/* Note: see frame.c for template, also where generic functions are impl */ 936 {
974frame_parm_handler pgtk_frame_parm_handlers[] = { 937 gui_set_autoraise, /* generic OK */
975 gui_set_autoraise, /* generic OK */ 938 gui_set_autolower, /* generic OK */
976 gui_set_autolower, /* generic OK */ 939 pgtk_set_background_color,
977 pgtk_set_background_color, 940 pgtk_set_border_color,
978 pgtk_set_border_color, 941 gui_set_border_width,
979 gui_set_border_width, 942 pgtk_set_cursor_color,
980 pgtk_set_cursor_color, 943 pgtk_set_cursor_type,
981 pgtk_set_cursor_type, 944 gui_set_font, /* generic OK */
982 gui_set_font, /* generic OK */ 945 pgtk_set_foreground_color,
983 pgtk_set_foreground_color, 946 pgtk_set_icon_name,
984 pgtk_set_icon_name, 947 pgtk_set_icon_type,
985 pgtk_set_icon_type, 948 pgtk_set_child_frame_border_width,
986 pgtk_set_child_frame_border_width, 949 pgtk_set_internal_border_width, /* generic OK */
987 pgtk_set_internal_border_width, /* generic OK */ 950 gui_set_right_divider_width,
988 gui_set_right_divider_width, 951 gui_set_bottom_divider_width,
989 gui_set_bottom_divider_width, 952 pgtk_set_menu_bar_lines,
990 pgtk_set_menu_bar_lines, 953 pgtk_set_mouse_color,
991 pgtk_set_mouse_color, 954 pgtk_explicitly_set_name,
992 x_explicitly_set_name, 955 gui_set_scroll_bar_width, /* generic OK */
993 gui_set_scroll_bar_width, /* generic OK */ 956 gui_set_scroll_bar_height, /* generic OK */
994 gui_set_scroll_bar_height, /* generic OK */ 957 pgtk_set_title,
995 pgtk_set_title, 958 gui_set_unsplittable, /* generic OK */
996 gui_set_unsplittable, /* generic OK */ 959 gui_set_vertical_scroll_bars, /* generic OK */
997 gui_set_vertical_scroll_bars, /* generic OK */ 960 gui_set_horizontal_scroll_bars, /* generic OK */
998 gui_set_horizontal_scroll_bars, /* generic OK */ 961 gui_set_visibility, /* generic OK */
999 gui_set_visibility, /* generic OK */ 962 pgtk_set_tab_bar_lines,
1000 pgtk_set_tab_bar_lines, 963 pgtk_set_tool_bar_lines,
1001 pgtk_set_tool_bar_lines, 964 pgtk_set_scroll_bar_foreground,
1002 pgtk_set_scroll_bar_foreground, 965 pgtk_set_scroll_bar_background,
1003 pgtk_set_scroll_bar_background, 966 gui_set_screen_gamma, /* generic OK */
1004 gui_set_screen_gamma, /* generic OK */ 967 gui_set_line_spacing, /* generic OK, sets f->extra_line_spacing to int */
1005 gui_set_line_spacing, /* generic OK, sets f->extra_line_spacing to int */ 968 gui_set_left_fringe, /* generic OK */
1006 gui_set_left_fringe, /* generic OK */ 969 gui_set_right_fringe, /* generic OK */
1007 gui_set_right_fringe, /* generic OK */ 970 0,
1008 0, /* x_set_wait_for_wm */ 971 gui_set_fullscreen, /* generic OK */
1009 gui_set_fullscreen, /* generic OK */ 972 gui_set_font_backend, /* generic OK */
1010 gui_set_font_backend, /* generic OK */ 973 gui_set_alpha,
1011 gui_set_alpha, 974 pgtk_set_sticky,
1012 pgtk_set_sticky, 975 pgtk_set_tool_bar_position,
1013 pgtk_set_tool_bar_position, 976 0,
1014 0, /* x_set_inhibit_double_buffering */ 977 pgtk_set_undecorated,
1015 pgtk_set_undecorated, 978 pgtk_set_parent_frame,
1016 pgtk_set_parent_frame, 979 pgtk_set_skip_taskbar,
1017 pgtk_set_skip_taskbar, 980 pgtk_set_no_focus_on_map,
1018 pgtk_set_no_focus_on_map, 981 pgtk_set_no_accept_focus,
1019 pgtk_set_no_accept_focus, 982 pgtk_set_z_group,
1020 pgtk_set_z_group, 983 pgtk_set_override_redirect,
1021 pgtk_set_override_redirect, 984 gui_set_no_special_glyphs,
1022 gui_set_no_special_glyphs, 985 pgtk_set_alpha_background,
1023 pgtk_set_alpha_background, 986 };
1024};
1025 987
1026 988
1027/* Handler for signals raised during x_create_frame and 989/* Handler for signals raised during x_create_frame and
@@ -1186,7 +1148,7 @@ incorrect when you specify fractional scale factor in compositor.
1186If you set scale factor by this function, it is used instead of Gdk's one. 1148If you set scale factor by this function, it is used instead of Gdk's one.
1187 1149
1188Pass nil as SCALE-FACTOR if you want to reset the specified monitor's 1150Pass nil as SCALE-FACTOR if you want to reset the specified monitor's
1189scale factor. */ ) 1151scale factor. */)
1190 (Lisp_Object monitor_model, Lisp_Object scale_factor) 1152 (Lisp_Object monitor_model, Lisp_Object scale_factor)
1191{ 1153{
1192 CHECK_STRING (monitor_model); 1154 CHECK_STRING (monitor_model);
@@ -2255,27 +2217,6 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
2255 return result; 2217 return result;
2256} 2218}
2257 2219
2258
2259DEFUN ("pgtk-hide-others", Fpgtk_hide_others, Spgtk_hide_others, 0, 0, 0,
2260 doc: /* Hides all applications other than Emacs. */)
2261 (void)
2262{
2263 check_window_system (NULL);
2264 return Qnil;
2265}
2266
2267DEFUN ("pgtk-hide-emacs", Fpgtk_hide_emacs, Spgtk_hide_emacs, 1, 1, 0,
2268 doc: /* If ON is non-nil, the entire Emacs application is hidden.
2269Otherwise if Emacs is hidden, it is unhidden.
2270If ON is equal to `activate', Emacs is unhidden and becomes
2271the active application. */)
2272 (Lisp_Object on)
2273{
2274 check_window_system (NULL);
2275 return Qnil;
2276}
2277
2278
2279DEFUN ("pgtk-font-name", Fpgtk_font_name, Spgtk_font_name, 1, 1, 0, 2220DEFUN ("pgtk-font-name", Fpgtk_font_name, Spgtk_font_name, 1, 1, 0,
2280 doc: /* Determine font PostScript or family name for font NAME. 2221 doc: /* Determine font PostScript or family name for font NAME.
2281NAME should be a string containing either the font name or an XLFD 2222NAME should be a string containing either the font name or an XLFD
@@ -2311,7 +2252,6 @@ check_x_display_info (Lisp_Object frame)
2311 return check_pgtk_display_info (frame); 2252 return check_pgtk_display_info (frame);
2312} 2253}
2313 2254
2314
2315void 2255void
2316pgtk_set_scroll_bar_default_width (struct frame *f) 2256pgtk_set_scroll_bar_default_width (struct frame *f)
2317{ 2257{
@@ -2359,9 +2299,8 @@ pgtk_get_string_resource (XrmDatabase rdb, const char *name,
2359 return res; 2299 return res;
2360} 2300}
2361 2301
2362
2363Lisp_Object 2302Lisp_Object
2364x_get_focus_frame (struct frame *frame) 2303pgtk_get_focus_frame (struct frame *frame)
2365{ 2304{
2366 struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); 2305 struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame);
2367 Lisp_Object focus; 2306 Lisp_Object focus;
@@ -2404,7 +2343,6 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
2404 return Qnil; 2343 return Qnil;
2405} 2344}
2406 2345
2407
2408DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, 2346DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
2409 doc: /* Internal function called by `display-color-p', which see. */) 2347 doc: /* Internal function called by `display-color-p', which see. */)
2410 (Lisp_Object terminal) 2348 (Lisp_Object terminal)
@@ -2413,7 +2351,6 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
2413 return Qt; 2351 return Qt;
2414} 2352}
2415 2353
2416
2417DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, 0, 1, 0, 2354DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, 0, 1, 0,
2418 doc: /* Return t if the display supports shades of gray. 2355 doc: /* Return t if the display supports shades of gray.
2419Note that color displays do support shades of gray. 2356Note that color displays do support shades of gray.
@@ -2425,7 +2362,6 @@ If omitted or nil, that stands for the selected frame's display. */)
2425 return Qnil; 2362 return Qnil;
2426} 2363}
2427 2364
2428
2429DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, 0, 1, 0, 2365DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, 0, 1, 0,
2430 doc: /* Return the width in pixels of the display TERMINAL. 2366 doc: /* Return the width in pixels of the display TERMINAL.
2431The optional argument TERMINAL specifies which display to ask about. 2367The optional argument TERMINAL specifies which display to ask about.
@@ -2471,7 +2407,6 @@ each physical monitor, use `display-monitor-attributes-list'. */)
2471 return make_fixnum (width); 2407 return make_fixnum (width);
2472} 2408}
2473 2409
2474
2475DEFUN ("x-display-pixel-height", Fx_display_pixel_height, Sx_display_pixel_height, 0, 1, 0, 2410DEFUN ("x-display-pixel-height", Fx_display_pixel_height, Sx_display_pixel_height, 0, 1, 0,
2476 doc: /* Return the height in pixels of the display TERMINAL. 2411 doc: /* Return the height in pixels of the display TERMINAL.
2477The optional argument TERMINAL specifies which display to ask about. 2412The optional argument TERMINAL specifies which display to ask about.
@@ -3066,7 +3001,7 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx,
3066 3001
3067/* Hide tooltip. Delete its frame if DELETE is true. */ 3002/* Hide tooltip. Delete its frame if DELETE is true. */
3068static Lisp_Object 3003static Lisp_Object
3069x_hide_tip (bool delete) 3004pgtk_hide_tip (bool delete)
3070{ 3005{
3071 if (!NILP (tip_timer)) 3006 if (!NILP (tip_timer))
3072 { 3007 {
@@ -3306,13 +3241,13 @@ Text larger than the specified size is clipped. */)
3306 } 3241 }
3307 } 3242 }
3308 3243
3309 x_hide_tip (delete); 3244 pgtk_hide_tip (delete);
3310 } 3245 }
3311 else 3246 else
3312 x_hide_tip (true); 3247 pgtk_hide_tip (true);
3313 } 3248 }
3314 else 3249 else
3315 x_hide_tip (true); 3250 pgtk_hide_tip (true);
3316 3251
3317 tip_last_frame = frame; 3252 tip_last_frame = frame;
3318 tip_last_string = string; 3253 tip_last_string = string;
@@ -3439,7 +3374,7 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
3439Value is t if tooltip was open, nil otherwise. */) 3374Value is t if tooltip was open, nil otherwise. */)
3440 (void) 3375 (void)
3441{ 3376{
3442 return x_hide_tip (!tooltip_reuse_hidden_frame); 3377 return pgtk_hide_tip (!tooltip_reuse_hidden_frame);
3443} 3378}
3444 3379
3445/* Return geometric attributes of FRAME. According to the value of 3380/* Return geometric attributes of FRAME. According to the value of
@@ -3465,10 +3400,8 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
3465 int left_pos, top_pos; 3400 int left_pos, top_pos;
3466 3401
3467 if (FRAME_GTK_OUTER_WIDGET (f)) 3402 if (FRAME_GTK_OUTER_WIDGET (f))
3468 { 3403 gtk_window_get_position (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
3469 gtk_window_get_position (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 3404 &left_pos, &top_pos);
3470 &left_pos, &top_pos);
3471 }
3472 else 3405 else
3473 { 3406 {
3474 GtkAllocation alloc; 3407 GtkAllocation alloc;
@@ -3912,7 +3845,6 @@ syms_of_pgtkfns (void)
3912 g_free (ver); 3845 g_free (ver);
3913 } 3846 }
3914 3847
3915
3916 defsubr (&Spgtk_set_resource); 3848 defsubr (&Spgtk_set_resource);
3917 defsubr (&Sxw_display_color_p); /* this and next called directly by C code */ 3849 defsubr (&Sxw_display_color_p); /* this and next called directly by C code */
3918 defsubr (&Sx_display_grayscale_p); 3850 defsubr (&Sx_display_grayscale_p);
@@ -3942,9 +3874,6 @@ syms_of_pgtkfns (void)
3942 defsubr (&Sx_display_list); 3874 defsubr (&Sx_display_list);
3943 defsubr (&Sx_gtk_debug); 3875 defsubr (&Sx_gtk_debug);
3944 3876
3945 defsubr (&Spgtk_hide_others);
3946 defsubr (&Spgtk_hide_emacs);
3947
3948 defsubr (&Sx_show_tip); 3877 defsubr (&Sx_show_tip);
3949 defsubr (&Sx_hide_tip); 3878 defsubr (&Sx_hide_tip);
3950 3879
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index cf8a7c4816d..c8c8bd0d85e 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -1,4 +1,4 @@
1/* Pure Gtk+-3 communication module. -*- coding: utf-8 -*- 1/* Communication module for window systems using GTK.
2 2
3Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2022 Free Software 3Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2022 Free Software
4Foundation, Inc. 4Foundation, Inc.
@@ -278,8 +278,9 @@ flip_cr_context (struct frame *f)
278 if (cr != FRAME_CR_CONTEXT (f)) 278 if (cr != FRAME_CR_CONTEXT (f))
279 { 279 {
280 cairo_destroy (cr); 280 cairo_destroy (cr);
281 FRAME_CR_ACTIVE_CONTEXT (f) = cairo_reference (FRAME_CR_CONTEXT (f));
282 281
282 FRAME_CR_ACTIVE_CONTEXT (f)
283 = cairo_reference (FRAME_CR_CONTEXT (f));
283 } 284 }
284 unblock_input (); 285 unblock_input ();
285} 286}
@@ -738,19 +739,19 @@ pgtk_wait_for_map_event (struct frame *f, bool multiple_times)
738{ 739{
739 if (FLOATP (Vpgtk_wait_for_event_timeout)) 740 if (FLOATP (Vpgtk_wait_for_event_timeout))
740 { 741 {
741 guint msec = 742 guint msec
742 (guint) (XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000); 743 = (guint) (XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000);
743 int found = 0; 744 int found = 0;
744 int timed_out = 0; 745 int timed_out = 0;
745 gulong id = 746 gulong id
746 g_signal_connect (FRAME_WIDGET (f), "map-event", 747 = g_signal_connect (FRAME_WIDGET (f), "map-event",
747 G_CALLBACK 748 G_CALLBACK
748 (pgtk_make_frame_visible_wait_for_map_event_cb), 749 (pgtk_make_frame_visible_wait_for_map_event_cb),
749 &found); 750 &found);
750 guint src = 751 guint src
751 g_timeout_add (msec, 752 = g_timeout_add (msec,
752 pgtk_make_frame_visible_wait_for_map_event_timeout, 753 pgtk_make_frame_visible_wait_for_map_event_timeout,
753 &timed_out); 754 &timed_out);
754 755
755 if (!multiple_times) 756 if (!multiple_times)
756 { 757 {
@@ -764,6 +765,7 @@ pgtk_wait_for_map_event (struct frame *f, bool multiple_times)
764 } 765 }
765 766
766 g_signal_handler_disconnect (FRAME_WIDGET (f), id); 767 g_signal_handler_disconnect (FRAME_WIDGET (f), id);
768
767 if (!timed_out) 769 if (!timed_out)
768 g_source_remove (src); 770 g_source_remove (src);
769 } 771 }
@@ -771,9 +773,6 @@ pgtk_wait_for_map_event (struct frame *f, bool multiple_times)
771 773
772void 774void
773pgtk_make_frame_visible (struct frame *f) 775pgtk_make_frame_visible (struct frame *f)
774/* --------------------------------------------------------------------------
775 External: Show the window (X11 semantics)
776 -------------------------------------------------------------------------- */
777{ 776{
778 GtkWidget *win = FRAME_GTK_OUTER_WIDGET (f); 777 GtkWidget *win = FRAME_GTK_OUTER_WIDGET (f);
779 778
@@ -790,17 +789,11 @@ pgtk_make_frame_visible (struct frame *f)
790 789
791void 790void
792pgtk_make_frame_invisible (struct frame *f) 791pgtk_make_frame_invisible (struct frame *f)
793/* --------------------------------------------------------------------------
794 External: Hide the window (X11 semantics)
795 -------------------------------------------------------------------------- */
796{ 792{
797 gtk_widget_hide (FRAME_WIDGET (f)); 793 gtk_widget_hide (FRAME_WIDGET (f));
798 794
799 /* Map events are emitted many times, and 795 /* Handle any pending map event(s), then make the frame visible
800 * map_event() do SET_FRAME_VISIBLE(f, 1). 796 manually, to avoid race conditions. */
801 * I expect visible = 0, so process those map events here and
802 * SET_FRAME_VISIBLE(f, 0) after that.
803 */
804 pgtk_wait_for_map_event (f, true); 797 pgtk_wait_for_map_event (f, true);
805 798
806 SET_FRAME_VISIBLE (f, 0); 799 SET_FRAME_VISIBLE (f, 0);
@@ -938,7 +931,8 @@ pgtk_set_parent_frame (struct frame *f, Lisp_Object new_value,
938 931
939 { 932 {
940 GtkWidget *whbox_of_f = gtk_widget_get_parent (fixed); 933 GtkWidget *whbox_of_f = gtk_widget_get_parent (fixed);
941 /* Here, unhighlight can be called and may change border_color_css_provider. */ 934 /* Here, unhighlight can be called and may change
935 border_color_css_provider. */
942 gtk_container_remove (GTK_CONTAINER (whbox_of_f), fixed); 936 gtk_container_remove (GTK_CONTAINER (whbox_of_f), fixed);
943 937
944 if (FRAME_GTK_OUTER_WIDGET (f)) 938 if (FRAME_GTK_OUTER_WIDGET (f))
@@ -959,7 +953,8 @@ pgtk_set_parent_frame (struct frame *f, Lisp_Object new_value,
959 { 953 {
960 xg_create_frame_outer_widgets (f); 954 xg_create_frame_outer_widgets (f);
961 pgtk_set_event_handler (f); 955 pgtk_set_event_handler (f);
962 gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget), fixed, TRUE, TRUE, 0); 956 gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget),
957 fixed, TRUE, TRUE, 0);
963 f->output_data.pgtk->preferred_width = alloc.width; 958 f->output_data.pgtk->preferred_width = alloc.width;
964 f->output_data.pgtk->preferred_height = alloc.height; 959 f->output_data.pgtk->preferred_height = alloc.height;
965 xg_wm_set_size_hint (f, 0, 0); 960 xg_wm_set_size_hint (f, 0, 0);
@@ -1216,7 +1211,6 @@ pgtk_set_glyph_string_clipping (struct glyph_string *s, cairo_t * cr)
1216 } 1211 }
1217} 1212}
1218 1213
1219
1220/* Set SRC's clipping for output of glyph string DST. This is called 1214/* Set SRC's clipping for output of glyph string DST. This is called
1221 when we are drawing DST's left_overhang or right_overhang only in 1215 when we are drawing DST's left_overhang or right_overhang only in
1222 the area of SRC. */ 1216 the area of SRC. */
@@ -1235,7 +1229,6 @@ pgtk_set_glyph_string_clipping_exactly (struct glyph_string *src,
1235 cairo_clip (cr); 1229 cairo_clip (cr);
1236} 1230}
1237 1231
1238
1239/* RIF: 1232/* RIF:
1240 Compute left and right overhang of glyph string S. */ 1233 Compute left and right overhang of glyph string S. */
1241 1234
@@ -1276,9 +1269,8 @@ pgtk_compute_glyph_string_overhangs (struct glyph_string *s)
1276 } 1269 }
1277} 1270}
1278 1271
1279 1272/* Fill rectangle X, Y, W, H with background color of glyph string
1280/* Fill rectangle X, Y, W, H with background color of glyph string S. */ 1273 S. */
1281
1282static void 1274static void
1283pgtk_clear_glyph_string_rect (struct glyph_string *s, int x, int y, 1275pgtk_clear_glyph_string_rect (struct glyph_string *s, int x, int y,
1284 int w, int h) 1276 int w, int h)
@@ -1288,7 +1280,6 @@ pgtk_clear_glyph_string_rect (struct glyph_string *s, int x, int y,
1288 || s->hl != DRAW_CURSOR)); 1280 || s->hl != DRAW_CURSOR));
1289} 1281}
1290 1282
1291
1292static void 1283static void
1293fill_background_by_face (struct frame *f, struct face *face, int x, int y, 1284fill_background_by_face (struct frame *f, struct face *face, int x, int y,
1294 int width, int height) 1285 int width, int height)
@@ -1330,7 +1321,6 @@ fill_background (struct glyph_string *s, int x, int y, int width, int height)
1330 background even if it wouldn't be drawn normally. This is used 1321 background even if it wouldn't be drawn normally. This is used
1331 when a string preceding S draws into the background of S, or S 1322 when a string preceding S draws into the background of S, or S
1332 contains the first component of a composition. */ 1323 contains the first component of a composition. */
1333
1334static void 1324static void
1335pgtk_draw_glyph_string_background (struct glyph_string *s, bool force_p) 1325pgtk_draw_glyph_string_background (struct glyph_string *s, bool force_p)
1336{ 1326{
@@ -1383,7 +1373,6 @@ pgtk_draw_rectangle (struct frame *f, unsigned long color, int x, int y,
1383} 1373}
1384 1374
1385/* Draw the foreground of glyph string S. */ 1375/* Draw the foreground of glyph string S. */
1386
1387static void 1376static void
1388pgtk_draw_glyph_string_foreground (struct glyph_string *s) 1377pgtk_draw_glyph_string_foreground (struct glyph_string *s)
1389{ 1378{
@@ -1430,7 +1419,6 @@ pgtk_draw_glyph_string_foreground (struct glyph_string *s)
1430} 1419}
1431 1420
1432/* Draw the foreground of composite glyph string S. */ 1421/* Draw the foreground of composite glyph string S. */
1433
1434static void 1422static void
1435pgtk_draw_composite_glyph_string_foreground (struct glyph_string *s) 1423pgtk_draw_composite_glyph_string_foreground (struct glyph_string *s)
1436{ 1424{
@@ -1521,7 +1509,6 @@ pgtk_draw_composite_glyph_string_foreground (struct glyph_string *s)
1521 1509
1522 1510
1523/* Draw the foreground of glyph string S for glyphless characters. */ 1511/* Draw the foreground of glyph string S for glyphless characters. */
1524
1525static void 1512static void
1526pgtk_draw_glyphless_glyph_string_foreground (struct glyph_string *s) 1513pgtk_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
1527{ 1514{
@@ -1783,8 +1770,10 @@ pgtk_setup_relief_colors (struct glyph_string *s)
1783 color = s->xgcv.background; 1770 color = s->xgcv.background;
1784 } 1771 }
1785 1772
1786 if (TRUE) 1773 if (!di->relief_background_valid_p
1774 || di->relief_background != color)
1787 { 1775 {
1776 di->relief_background_valid_p = true;
1788 di->relief_background = color; 1777 di->relief_background = color;
1789 pgtk_setup_relief_color (s->f, &di->white_relief, 1.2, 0x8000, 1778 pgtk_setup_relief_color (s->f, &di->white_relief, 1.2, 0x8000,
1790 WHITE_PIX_DEFAULT (s->f)); 1779 WHITE_PIX_DEFAULT (s->f));
@@ -1800,12 +1789,8 @@ pgtk_set_clip_rectangles (struct frame *f, cairo_t *cr,
1800 if (n > 0) 1789 if (n > 0)
1801 { 1790 {
1802 for (int i = 0; i < n; i++) 1791 for (int i = 0; i < n; i++)
1803 { 1792 cairo_rectangle (cr, rectangles[i].x, rectangles[i].y,
1804 cairo_rectangle (cr, 1793 rectangles[i].width, rectangles[i].height);
1805 rectangles[i].x,
1806 rectangles[i].y,
1807 rectangles[i].width, rectangles[i].height);
1808 }
1809 cairo_clip (cr); 1794 cairo_clip (cr);
1810 } 1795 }
1811} 1796}
@@ -1823,7 +1808,7 @@ pgtk_draw_relief_rect (struct frame *f,
1823 int left_x, int top_y, int right_x, int bottom_y, 1808 int left_x, int top_y, int right_x, int bottom_y,
1824 int hwidth, int vwidth, bool raised_p, bool top_p, 1809 int hwidth, int vwidth, bool raised_p, bool top_p,
1825 bool bot_p, bool left_p, bool right_p, 1810 bool bot_p, bool left_p, bool right_p,
1826 XRectangle * clip_rect) 1811 XRectangle *clip_rect)
1827{ 1812{
1828 unsigned long top_left_color, bottom_right_color; 1813 unsigned long top_left_color, bottom_right_color;
1829 int corners = 0; 1814 int corners = 0;
@@ -2142,11 +2127,7 @@ pgtk_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w,
2142 int h) 2127 int h)
2143{ 2128{
2144 if (s->stippled_p) 2129 if (s->stippled_p)
2145 { 2130 fill_background (s, x, y, w, h);
2146 /* Fill background with a stipple pattern. */
2147
2148 fill_background (s, x, y, w, h);
2149 }
2150 else 2131 else
2151 pgtk_clear_glyph_string_rect (s, x, y, w, h); 2132 pgtk_clear_glyph_string_rect (s, x, y, w, h);
2152} 2133}
@@ -2227,9 +2208,9 @@ pgtk_draw_image_foreground (struct glyph_string *s)
2227 if (s->hl == DRAW_CURSOR) 2208 if (s->hl == DRAW_CURSOR)
2228 { 2209 {
2229 int relief = eabs (s->img->relief); 2210 int relief = eabs (s->img->relief);
2230 pgtk_draw_rectangle (s->f, s->xgcv.foreground, x - relief, y - relief, 2211 pgtk_draw_rectangle (s->f, s->xgcv.foreground, x - relief,
2231 s->slice.width + relief*2 - 1, 2212 y - relief, s->slice.width + relief * 2 - 1,
2232 s->slice.height + relief*2 - 1, false); 2213 s->slice.height + relief * 2 - 1, false);
2233 } 2214 }
2234 } 2215 }
2235 pgtk_end_cr_clip (s->f); 2216 pgtk_end_cr_clip (s->f);
@@ -2278,23 +2259,21 @@ pgtk_draw_image_glyph_string (struct glyph_string *s)
2278 || s->img->pixmap == 0 2259 || s->img->pixmap == 0
2279 || s->width != s->background_width) 2260 || s->width != s->background_width)
2280 { 2261 {
2281 { 2262 int x = s->x;
2282 int x = s->x; 2263 int y = s->y;
2283 int y = s->y; 2264 int width = s->background_width;
2284 int width = s->background_width;
2285 2265
2286 if (s->first_glyph->left_box_line_p 2266 if (s->first_glyph->left_box_line_p
2287 && s->slice.x == 0) 2267 && s->slice.x == 0)
2288 { 2268 {
2289 x += box_line_hwidth; 2269 x += box_line_hwidth;
2290 width -= box_line_hwidth; 2270 width -= box_line_hwidth;
2291 } 2271 }
2292 2272
2293 if (s->slice.y == 0) 2273 if (s->slice.y == 0)
2294 y += box_line_vwidth; 2274 y += box_line_vwidth;
2295 2275
2296 pgtk_draw_glyph_string_bg_rect (s, x, y, width, height); 2276 pgtk_draw_glyph_string_bg_rect (s, x, y, width, height);
2297 }
2298 2277
2299 s->background_filled_p = true; 2278 s->background_filled_p = true;
2300 } 2279 }
@@ -2376,15 +2355,10 @@ pgtk_draw_stretch_glyph_string (struct glyph_string *s)
2376 pgtk_set_clip_rectangles (s->f, cr, &r, 1); 2355 pgtk_set_clip_rectangles (s->f, cr, &r, 1);
2377 2356
2378 if (s->face->stipple) 2357 if (s->face->stipple)
2379 { 2358 fill_background (s, x, y, w, h);
2380 /* Fill background with a stipple pattern. */
2381 fill_background (s, x, y, w, h);
2382 }
2383 else 2359 else
2384 { 2360 pgtk_fill_rectangle (s->f, color, x, y, w, h,
2385 pgtk_fill_rectangle (s->f, color, x, y, w, h, 2361 true);
2386 true);
2387 }
2388 2362
2389 pgtk_end_cr_clip (s->f); 2363 pgtk_end_cr_clip (s->f);
2390 } 2364 }
@@ -2402,6 +2376,7 @@ pgtk_draw_stretch_glyph_string (struct glyph_string *s)
2402 background_width -= text_left_x - x; 2376 background_width -= text_left_x - x;
2403 x = text_left_x; 2377 x = text_left_x;
2404 } 2378 }
2379
2405 if (background_width > 0) 2380 if (background_width > 0)
2406 pgtk_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); 2381 pgtk_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
2407 } 2382 }
@@ -2465,9 +2440,9 @@ pgtk_draw_glyph_string (struct glyph_string *s)
2465 /* We must clip just this glyph. left_overhang part has already 2440 /* We must clip just this glyph. left_overhang part has already
2466 drawn when s->prev was drawn, and right_overhang part will be 2441 drawn when s->prev was drawn, and right_overhang part will be
2467 drawn later when s->next is drawn. */ 2442 drawn later when s->next is drawn. */
2468 pgtk_set_glyph_string_clipping_exactly (s, s, cr); 2443 pgtk_set_glyph_string_clipping_exactly (s, s, cr);
2469 else 2444 else
2470 pgtk_set_glyph_string_clipping (s, cr); 2445 pgtk_set_glyph_string_clipping (s, cr);
2471 2446
2472 switch (s->first_glyph->type) 2447 switch (s->first_glyph->type)
2473 { 2448 {
@@ -2614,10 +2589,8 @@ pgtk_draw_glyph_string (struct glyph_string *s)
2614 pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, s->y + dy, 2589 pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, s->y + dy,
2615 s->width, h, false); 2590 s->width, h, false);
2616 else 2591 else
2617 { 2592 pgtk_fill_rectangle (s->f, s->face->overline_color, s->x,
2618 pgtk_fill_rectangle (s->f, s->face->overline_color, s->x, 2593 s->y + dy, s->width, h, false);
2619 s->y + dy, s->width, h, false);
2620 }
2621 } 2594 }
2622 2595
2623 /* Draw strike-through. */ 2596 /* Draw strike-through. */
@@ -2639,10 +2612,8 @@ pgtk_draw_glyph_string (struct glyph_string *s)
2639 pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, glyph_y + dy, 2612 pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, glyph_y + dy,
2640 s->width, h, false); 2613 s->width, h, false);
2641 else 2614 else
2642 { 2615 pgtk_fill_rectangle (s->f, s->face->strike_through_color, s->x,
2643 pgtk_fill_rectangle (s->f, s->face->strike_through_color, s->x, 2616 glyph_y + dy, s->width, h, false);
2644 glyph_y + dy, s->width, h, false);
2645 }
2646 } 2617 }
2647 2618
2648 if (s->prev) 2619 if (s->prev)
@@ -2962,11 +2933,11 @@ pgtk_copy_bits (struct frame *f, cairo_rectangle_t *src_rect,
2962 cairo_t *cr; 2933 cairo_t *cr;
2963 cairo_surface_t *surface; /* temporary surface */ 2934 cairo_surface_t *surface; /* temporary surface */
2964 2935
2965 surface = 2936 surface
2966 cairo_surface_create_similar (FRAME_CR_SURFACE (f), 2937 = cairo_surface_create_similar (FRAME_CR_SURFACE (f),
2967 CAIRO_CONTENT_COLOR_ALPHA, 2938 CAIRO_CONTENT_COLOR_ALPHA,
2968 (int) src_rect->width, 2939 (int) src_rect->width,
2969 (int) src_rect->height); 2940 (int) src_rect->height);
2970 2941
2971 cr = cairo_create (surface); 2942 cr = cairo_create (surface);
2972 cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), -src_rect->x, 2943 cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), -src_rect->x,
@@ -3186,10 +3157,9 @@ pgtk_bitmap_icon (struct frame *f, Lisp_Object file)
3186 } 3157 }
3187 3158
3188 if (FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img != NULL) 3159 if (FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img != NULL)
3189 { 3160 gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
3190 gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 3161 FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img);
3191 FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img); 3162
3192 }
3193 f->output_data.pgtk->icon_bitmap = bitmap_id; 3163 f->output_data.pgtk->icon_bitmap = bitmap_id;
3194 3164
3195 return false; 3165 return false;
@@ -3453,10 +3423,10 @@ pgtk_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd)
3453 { 3423 {
3454 i = max_fringe_bmp; 3424 i = max_fringe_bmp;
3455 max_fringe_bmp = which + 20; 3425 max_fringe_bmp = which + 20;
3456 fringe_bmp = 3426 fringe_bmp
3457 (cairo_pattern_t **) xrealloc (fringe_bmp, 3427 = (cairo_pattern_t **) xrealloc (fringe_bmp,
3458 max_fringe_bmp * 3428 max_fringe_bmp *
3459 sizeof (cairo_pattern_t *)); 3429 sizeof (cairo_pattern_t *));
3460 while (i < max_fringe_bmp) 3430 while (i < max_fringe_bmp)
3461 fringe_bmp[i++] = 0; 3431 fringe_bmp[i++] = 0;
3462 } 3432 }
@@ -3608,11 +3578,9 @@ pgtk_show_hourglass (struct frame *f)
3608 struct timespec ts = make_timespec (0, 50 * 1000 * 1000); 3578 struct timespec ts = make_timespec (0, 50 * 1000 * 1000);
3609 if (hourglass_atimer != NULL) 3579 if (hourglass_atimer != NULL)
3610 cancel_atimer (hourglass_atimer); 3580 cancel_atimer (hourglass_atimer);
3611 hourglass_atimer = 3581 hourglass_atimer
3612 start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL); 3582 = start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL);
3613 } 3583 }
3614
3615 /* Cursor frequently stops animation. gtk's bug? */
3616} 3584}
3617 3585
3618static void 3586static void
@@ -3706,83 +3674,85 @@ recover_from_visible_bell (struct atimer *timer)
3706static void 3674static void
3707pgtk_flash (struct frame *f) 3675pgtk_flash (struct frame *f)
3708{ 3676{
3709 { 3677 cairo_surface_t *surface_orig, *surface;
3710 if (!FRAME_CR_CONTEXT (f)) 3678 cairo_t *cr;
3711 return; 3679 int width, height, flash_height, flash_left, flash_right;
3680 struct timespec delay;
3712 3681
3713 block_input (); 3682 if (!FRAME_CR_CONTEXT (f))
3683 return;
3714 3684
3715 cairo_surface_t *surface_orig = FRAME_CR_SURFACE (f); 3685 block_input ();
3716 3686
3717 int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f); 3687 surface_orig = FRAME_CR_SURFACE (f);
3718 int height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
3719 cairo_surface_t *surface
3720 = cairo_surface_create_similar (surface_orig, CAIRO_CONTENT_COLOR_ALPHA,
3721 width, height);
3722 3688
3723 cairo_t *cr = cairo_create (surface); 3689 width = FRAME_CR_SURFACE_DESIRED_WIDTH (f);
3724 cairo_set_source_surface (cr, surface_orig, 0, 0); 3690 height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
3725 cairo_rectangle (cr, 0, 0, width, height); 3691 surface = cairo_surface_create_similar (surface_orig,
3726 cairo_clip (cr); 3692 CAIRO_CONTENT_COLOR_ALPHA,
3727 cairo_paint (cr); 3693 width, height);
3728 3694
3729 cairo_set_source_rgb (cr, 1, 1, 1); 3695 cr = cairo_create (surface);
3730 cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE); 3696 cairo_set_source_surface (cr, surface_orig, 0, 0);
3697 cairo_rectangle (cr, 0, 0, width, height);
3698 cairo_clip (cr);
3699 cairo_paint (cr);
3731 3700
3701 cairo_set_source_rgb (cr, 1, 1, 1);
3702 cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
3703
3704 /* Get the height not including a menu bar widget. */
3705 height = FRAME_PIXEL_HEIGHT (f);
3706 /* Height of each line to flash. */
3707 flash_height = FRAME_LINE_HEIGHT (f);
3708 /* These will be the left and right margins of the rectangles. */
3709 flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
3710 flash_right = (FRAME_PIXEL_WIDTH (f)
3711 - FRAME_INTERNAL_BORDER_WIDTH (f));
3712 width = flash_right - flash_left;
3713
3714 /* If window is tall, flash top and bottom line. */
3715 if (height > 3 * FRAME_LINE_HEIGHT (f))
3716 {
3717 cairo_rectangle (cr,
3718 flash_left,
3719 (FRAME_INTERNAL_BORDER_WIDTH (f)
3720 + FRAME_TOP_MARGIN_HEIGHT (f)),
3721 width, flash_height);
3722 cairo_fill (cr);
3723
3724 cairo_rectangle (cr,
3725 flash_left,
3726 (height - flash_height
3727 - FRAME_INTERNAL_BORDER_WIDTH (f)),
3728 width, flash_height);
3729 cairo_fill (cr);
3730 }
3731 else
3732 { 3732 {
3733 /* Get the height not including a menu bar widget. */ 3733 /* If it is short, flash it all. */
3734 int height = FRAME_PIXEL_HEIGHT (f); 3734 cairo_rectangle (cr,
3735 /* Height of each line to flash. */ 3735 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
3736 int flash_height = FRAME_LINE_HEIGHT (f); 3736 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
3737 /* These will be the left and right margins of the rectangles. */ 3737 cairo_fill (cr);
3738 int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f); 3738 }
3739 int flash_right =
3740 FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
3741 int width = flash_right - flash_left;
3742
3743 /* If window is tall, flash top and bottom line. */
3744 if (height > 3 * FRAME_LINE_HEIGHT (f))
3745 {
3746 cairo_rectangle (cr,
3747 flash_left,
3748 (FRAME_INTERNAL_BORDER_WIDTH (f)
3749 + FRAME_TOP_MARGIN_HEIGHT (f)),
3750 width, flash_height);
3751 cairo_fill (cr);
3752 3739
3753 cairo_rectangle (cr, 3740 FRAME_X_OUTPUT (f)->cr_surface_visible_bell = surface;
3754 flash_left,
3755 (height - flash_height
3756 - FRAME_INTERNAL_BORDER_WIDTH (f)),
3757 width, flash_height);
3758 cairo_fill (cr);
3759 }
3760 else
3761 {
3762 /* If it is short, flash it all. */
3763 cairo_rectangle (cr,
3764 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
3765 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
3766 cairo_fill (cr);
3767 }
3768 3741
3769 FRAME_X_OUTPUT (f)->cr_surface_visible_bell = surface; 3742 delay = make_timespec (0, 50 * 1000 * 1000);
3770 {
3771 struct timespec delay = make_timespec (0, 50 * 1000 * 1000);
3772 if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
3773 {
3774 cancel_atimer (FRAME_X_OUTPUT (f)->atimer_visible_bell);
3775 FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
3776 }
3777 FRAME_X_OUTPUT (f)->atimer_visible_bell =
3778 start_atimer (ATIMER_RELATIVE, delay, recover_from_visible_bell, f);
3779 }
3780 3743
3744 if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
3745 {
3746 cancel_atimer (FRAME_X_OUTPUT (f)->atimer_visible_bell);
3747 FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
3781 } 3748 }
3782 3749
3783 cairo_destroy (cr); 3750 FRAME_X_OUTPUT (f)->atimer_visible_bell
3784 unblock_input (); 3751 = start_atimer (ATIMER_RELATIVE, delay, recover_from_visible_bell, f);
3785 } 3752
3753
3754 cairo_destroy (cr);
3755 unblock_input ();
3786} 3756}
3787 3757
3788/* Make audible bell. */ 3758/* Make audible bell. */
@@ -3863,8 +3833,9 @@ pgtk_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part part,
3863 3833
3864 EVENT_INIT (inev.ie); 3834 EVENT_INIT (inev.ie);
3865 3835
3866 inev.ie.kind = 3836 inev.ie.kind = (horizontal
3867 horizontal ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT : SCROLL_BAR_CLICK_EVENT; 3837 ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT
3838 : SCROLL_BAR_CLICK_EVENT);
3868 inev.ie.frame_or_window = window; 3839 inev.ie.frame_or_window = window;
3869 inev.ie.arg = Qnil; 3840 inev.ie.arg = Qnil;
3870 inev.ie.timestamp = 0; 3841 inev.ie.timestamp = 0;
@@ -4013,8 +3984,6 @@ pgtk_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar,
4013 xg_set_toolkit_horizontal_scroll_bar_thumb (bar, portion, position, whole); 3984 xg_set_toolkit_horizontal_scroll_bar_thumb (bar, portion, position, whole);
4014} 3985}
4015 3986
4016
4017
4018/* Create a scroll bar and return the scroll bar vector for it. W is 3987/* Create a scroll bar and return the scroll bar vector for it. W is
4019 the Emacs window on which to create the scroll bar. TOP, LEFT, 3988 the Emacs window on which to create the scroll bar. TOP, LEFT,
4020 WIDTH and HEIGHT are the pixel coordinates and dimensions of the 3989 WIDTH and HEIGHT are the pixel coordinates and dimensions of the
@@ -4166,7 +4135,6 @@ pgtk_set_vertical_scroll_bar (struct window *w, int portion, int whole,
4166 wset_vertical_scroll_bar (w, barobj); 4135 wset_vertical_scroll_bar (w, barobj);
4167} 4136}
4168 4137
4169
4170static void 4138static void
4171pgtk_set_horizontal_scroll_bar (struct window *w, int portion, int whole, 4139pgtk_set_horizontal_scroll_bar (struct window *w, int portion, int whole,
4172 int position) 4140 int position)
@@ -4281,7 +4249,6 @@ pgtk_condemn_scroll_bars (struct frame *frame)
4281 } 4249 }
4282} 4250}
4283 4251
4284
4285/* Un-mark WINDOW's scroll bar for deletion in this judgment cycle. 4252/* Un-mark WINDOW's scroll bar for deletion in this judgment cycle.
4286 Note that WINDOW isn't necessarily condemned at all. */ 4253 Note that WINDOW isn't necessarily condemned at all. */
4287 4254
@@ -4505,7 +4472,7 @@ pgtk_query_frame_background_color (struct frame *f, Emacs_Color * bgcolor)
4505} 4472}
4506 4473
4507static void 4474static void
4508pgtk_free_pixmap (struct frame *_f, Emacs_Pixmap pixmap) 4475pgtk_free_pixmap (struct frame *f, Emacs_Pixmap pixmap)
4509{ 4476{
4510 if (pixmap) 4477 if (pixmap)
4511 { 4478 {
@@ -4529,13 +4496,14 @@ pgtk_focus_frame (struct frame *f, bool noactivate)
4529 } 4496 }
4530} 4497}
4531 4498
4532
4533static void 4499static void
4534set_opacity_recursively (GtkWidget * w, gpointer data) 4500set_opacity_recursively (GtkWidget *w, gpointer data)
4535{ 4501{
4536 gtk_widget_set_opacity (w, *(double *) data); 4502 gtk_widget_set_opacity (w, *(double *) data);
4503
4537 if (GTK_IS_CONTAINER (w)) 4504 if (GTK_IS_CONTAINER (w))
4538 gtk_container_foreach (GTK_CONTAINER (w), set_opacity_recursively, data); 4505 gtk_container_foreach (GTK_CONTAINER (w),
4506 set_opacity_recursively, data);
4539} 4507}
4540 4508
4541static void 4509static void
@@ -4571,22 +4539,13 @@ pgtk_set_frame_alpha (struct frame *f)
4571static void 4539static void
4572frame_highlight (struct frame *f) 4540frame_highlight (struct frame *f)
4573{ 4541{
4574 /* We used to only do this if Vx_no_window_manager was non-nil, but
4575 the ICCCM (section 4.1.6) says that the window's border pixmap
4576 and border pixel are window attributes which are "private to the
4577 client", so we can always change it to whatever we want. */
4578 block_input (); 4542 block_input ();
4579 /* I recently started to get errors in this XSetWindowBorder, depending on
4580 the window-manager in use, tho something more is at play since I've been
4581 using that same window-manager binary for ever. Let's not crash just
4582 because of this (bug#9310). */
4583
4584 GtkWidget *w = FRAME_WIDGET (f); 4543 GtkWidget *w = FRAME_WIDGET (f);
4585 4544
4586 char *css = 4545 char *css = g_strdup_printf ("decoration { border: solid %dpx #%06x; }",
4587 g_strdup_printf ("decoration { border: solid %dpx #%06x; }", 4546 f->border_width,
4588 f->border_width, 4547 ((unsigned int) FRAME_X_OUTPUT (f)->border_pixel
4589 (unsigned int) FRAME_X_OUTPUT (f)->border_pixel & 0x00ffffff); 4548 & 0x00ffffff));
4590 4549
4591 GtkStyleContext *ctxt = gtk_widget_get_style_context (w); 4550 GtkStyleContext *ctxt = gtk_widget_get_style_context (w);
4592 GtkCssProvider *css_provider = gtk_css_provider_new (); 4551 GtkCssProvider *css_provider = gtk_css_provider_new ();
@@ -4611,27 +4570,26 @@ frame_highlight (struct frame *f)
4611static void 4570static void
4612frame_unhighlight (struct frame *f) 4571frame_unhighlight (struct frame *f)
4613{ 4572{
4614 /* We used to only do this if Vx_no_window_manager was non-nil, but 4573 GtkWidget *w;
4615 the ICCCM (section 4.1.6) says that the window's border pixmap 4574 char *css;
4616 and border pixel are window attributes which are "private to the 4575 GtkStyleContext *ctxt;
4617 client", so we can always change it to whatever we want. */ 4576 GtkCssProvider *css_provider, *old;
4577
4618 block_input (); 4578 block_input ();
4619 /* Same as above for XSetWindowBorder (bug#9310). */
4620 4579
4621 GtkWidget *w = FRAME_WIDGET (f); 4580 w = FRAME_WIDGET (f);
4622 4581
4623 char *css = 4582 css = g_strdup_printf ("decoration { border: dotted %dpx #ffffff; }",
4624 g_strdup_printf ("decoration { border: dotted %dpx #ffffff; }", 4583 f->border_width);
4625 f->border_width);
4626 4584
4627 GtkStyleContext *ctxt = gtk_widget_get_style_context (w); 4585 ctxt = gtk_widget_get_style_context (w);
4628 GtkCssProvider *css_provider = gtk_css_provider_new (); 4586 css_provider = gtk_css_provider_new ();
4629 gtk_css_provider_load_from_data (css_provider, css, -1, NULL); 4587 gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
4630 gtk_style_context_add_provider (ctxt, GTK_STYLE_PROVIDER (css_provider), 4588 gtk_style_context_add_provider (ctxt, GTK_STYLE_PROVIDER (css_provider),
4631 GTK_STYLE_PROVIDER_PRIORITY_USER); 4589 GTK_STYLE_PROVIDER_PRIORITY_USER);
4632 g_free (css); 4590 g_free (css);
4633 4591
4634 GtkCssProvider *old = FRAME_X_OUTPUT (f)->border_color_css_provider; 4592 old = FRAME_X_OUTPUT (f)->border_color_css_provider;
4635 FRAME_X_OUTPUT (f)->border_color_css_provider = css_provider; 4593 FRAME_X_OUTPUT (f)->border_color_css_provider = css_provider;
4636 if (old != NULL) 4594 if (old != NULL)
4637 { 4595 {
@@ -4685,10 +4643,8 @@ pgtk_frame_rehighlight_hook (struct frame *frame)
4685 pgtk_frame_rehighlight (FRAME_DISPLAY_INFO (frame)); 4643 pgtk_frame_rehighlight (FRAME_DISPLAY_INFO (frame));
4686} 4644}
4687 4645
4688
4689/* Set whether or not the mouse pointer should be visible on frame 4646/* Set whether or not the mouse pointer should be visible on frame
4690 F. */ 4647 F. */
4691
4692static void 4648static void
4693pgtk_toggle_invisible_pointer (struct frame *f, bool invisible) 4649pgtk_toggle_invisible_pointer (struct frame *f, bool invisible)
4694{ 4650{
@@ -4700,6 +4656,10 @@ pgtk_toggle_invisible_pointer (struct frame *f, bool invisible)
4700 gdk_window_set_cursor (gtk_widget_get_window (FRAME_GTK_WIDGET (f)), 4656 gdk_window_set_cursor (gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
4701 cursor); 4657 cursor);
4702 f->pointer_invisible = invisible; 4658 f->pointer_invisible = invisible;
4659
4660 /* This is needed to make the pointer visible upon receiving a
4661 motion notify event. */
4662 gdk_display_flush (FRAME_X_DISPLAY (f));
4703} 4663}
4704 4664
4705/* The focus has changed. Update the frames as necessary to reflect 4665/* The focus has changed. Update the frames as necessary to reflect
@@ -4745,9 +4705,6 @@ pgtk_buffer_flipping_unblocked_hook (struct frame *f)
4745 4705
4746static struct terminal * 4706static struct terminal *
4747pgtk_create_terminal (struct pgtk_display_info *dpyinfo) 4707pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
4748/* --------------------------------------------------------------------------
4749 Set up use of Gtk before we make the first connection.
4750 -------------------------------------------------------------------------- */
4751{ 4708{
4752 struct terminal *terminal; 4709 struct terminal *terminal;
4753 4710
@@ -4772,7 +4729,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
4772 terminal->menu_show_hook = pgtk_menu_show; 4729 terminal->menu_show_hook = pgtk_menu_show;
4773 terminal->activate_menubar_hook = pgtk_activate_menubar; 4730 terminal->activate_menubar_hook = pgtk_activate_menubar;
4774 terminal->popup_dialog_hook = pgtk_popup_dialog; 4731 terminal->popup_dialog_hook = pgtk_popup_dialog;
4775 terminal->change_tab_bar_height_hook = x_change_tab_bar_height; 4732 terminal->change_tab_bar_height_hook = pgtk_change_tab_bar_height;
4776 terminal->set_vertical_scroll_bar_hook = pgtk_set_vertical_scroll_bar; 4733 terminal->set_vertical_scroll_bar_hook = pgtk_set_vertical_scroll_bar;
4777 terminal->set_horizontal_scroll_bar_hook = pgtk_set_horizontal_scroll_bar; 4734 terminal->set_horizontal_scroll_bar_hook = pgtk_set_horizontal_scroll_bar;
4778 terminal->condemn_scroll_bars_hook = pgtk_condemn_scroll_bars; 4735 terminal->condemn_scroll_bars_hook = pgtk_condemn_scroll_bars;
@@ -4793,7 +4750,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
4793 = pgtk_set_scroll_bar_default_height; 4750 = pgtk_set_scroll_bar_default_height;
4794 terminal->set_window_size_hook = pgtk_set_window_size; 4751 terminal->set_window_size_hook = pgtk_set_window_size;
4795 terminal->query_colors = pgtk_query_colors; 4752 terminal->query_colors = pgtk_query_colors;
4796 terminal->get_focus_frame = x_get_focus_frame; 4753 terminal->get_focus_frame = pgtk_get_focus_frame;
4797 terminal->focus_frame_hook = pgtk_focus_frame; 4754 terminal->focus_frame_hook = pgtk_focus_frame;
4798 terminal->set_frame_offset_hook = pgtk_set_offset; 4755 terminal->set_frame_offset_hook = pgtk_set_offset;
4799 terminal->free_pixmap = pgtk_free_pixmap; 4756 terminal->free_pixmap = pgtk_free_pixmap;
@@ -4812,7 +4769,7 @@ struct pgtk_window_is_of_frame_recursive_t
4812}; 4769};
4813 4770
4814static void 4771static void
4815pgtk_window_is_of_frame_recursive (GtkWidget * widget, gpointer data) 4772pgtk_window_is_of_frame_recursive (GtkWidget *widget, gpointer data)
4816{ 4773{
4817 struct pgtk_window_is_of_frame_recursive_t *datap = data; 4774 struct pgtk_window_is_of_frame_recursive_t *datap = data;
4818 4775
@@ -4828,14 +4785,13 @@ pgtk_window_is_of_frame_recursive (GtkWidget * widget, gpointer data)
4828 return; 4785 return;
4829 } 4786 }
4830 4787
4831 if (GTK_IS_CONTAINER (widget)) { 4788 if (GTK_IS_CONTAINER (widget))
4832 gtk_container_foreach (GTK_CONTAINER (widget), 4789 gtk_container_foreach (GTK_CONTAINER (widget),
4833 pgtk_window_is_of_frame_recursive, datap); 4790 pgtk_window_is_of_frame_recursive, datap);
4834 }
4835} 4791}
4836 4792
4837static bool 4793static bool
4838pgtk_window_is_of_frame (struct frame *f, GdkWindow * window) 4794pgtk_window_is_of_frame (struct frame *f, GdkWindow *window)
4839{ 4795{
4840 struct pgtk_window_is_of_frame_recursive_t data; 4796 struct pgtk_window_is_of_frame_recursive_t data;
4841 data.window = window; 4797 data.window = window;
@@ -4848,7 +4804,7 @@ pgtk_window_is_of_frame (struct frame *f, GdkWindow * window)
4848/* Like x_window_to_frame but also compares the window with the widget's 4804/* Like x_window_to_frame but also compares the window with the widget's
4849 windows. */ 4805 windows. */
4850static struct frame * 4806static struct frame *
4851pgtk_any_window_to_frame (GdkWindow * window) 4807pgtk_any_window_to_frame (GdkWindow *window)
4852{ 4808{
4853 Lisp_Object tail, frame; 4809 Lisp_Object tail, frame;
4854 struct frame *f, *found = NULL; 4810 struct frame *f, *found = NULL;
@@ -4973,7 +4929,7 @@ pgtk_clear_under_internal_border (struct frame *f)
4973} 4929}
4974 4930
4975static gboolean 4931static gboolean
4976pgtk_handle_draw (GtkWidget * widget, cairo_t * cr, gpointer * data) 4932pgtk_handle_draw (GtkWidget *widget, cairo_t *cr, gpointer *data)
4977{ 4933{
4978 struct frame *f; 4934 struct frame *f;
4979 4935
@@ -4999,19 +4955,11 @@ pgtk_handle_draw (GtkWidget * widget, cairo_t * cr, gpointer * data)
4999} 4955}
5000 4956
5001static void 4957static void
5002size_allocate (GtkWidget * widget, GtkAllocation * alloc, 4958size_allocate (GtkWidget *widget, GtkAllocation *alloc,
5003 gpointer user_data) 4959 gpointer user_data)
5004{ 4960{
5005 struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget)); 4961 struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
5006 4962
5007 /* Between a frame is created and not shown, size is allocated and
5008 * this handler is called. When that, since the widget's window is
5009 * NULL, we can't get f, pgtk_cr_update_surface_desired_size is not
5010 * called, and its size is 0x0. That causes empty frame.
5011 *
5012 * Fortunately since we know f in pgtk_set_event_handler, we can get
5013 * it through user_data;
5014 */
5015 if (!f) 4963 if (!f)
5016 f = user_data; 4964 f = user_data;
5017 4965
@@ -5118,7 +5066,7 @@ pgtk_emacs_to_gtk_modifiers (struct pgtk_display_info *dpyinfo, int state)
5118 5066
5119 5067
5120void 5068void
5121pgtk_enqueue_string (struct frame *f, gchar * str) 5069pgtk_enqueue_string (struct frame *f, gchar *str)
5122{ 5070{
5123 gunichar *ustr, *uptr; 5071 gunichar *ustr, *uptr;
5124 5072
@@ -5210,9 +5158,8 @@ key_press_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data)
5210 return TRUE; 5158 return TRUE;
5211 } 5159 }
5212 5160
5213 state |= 5161 state |= pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f),
5214 pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f), 5162 extra_keyboard_modifiers);
5215 extra_keyboard_modifiers);
5216 modifiers = state; 5163 modifiers = state;
5217 5164
5218 /* This will have to go some day... */ 5165 /* This will have to go some day... */
@@ -5339,9 +5286,6 @@ key_press_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data)
5339 || (orig_keysym & (1 << 28)) 5286 || (orig_keysym & (1 << 28))
5340 || (keysym != GDK_KEY_VoidSymbol && nbytes == 0)) 5287 || (keysym != GDK_KEY_VoidSymbol && nbytes == 0))
5341 && !(event->key.is_modifier 5288 && !(event->key.is_modifier
5342 /* Gtk's modifier keys are different from Xlib's ones.
5343 * I need to exclude them.
5344 */
5345 || IsModifierKey (orig_keysym) 5289 || IsModifierKey (orig_keysym)
5346 /* The symbols from GDK_KEY_ISO_Lock 5290 /* The symbols from GDK_KEY_ISO_Lock
5347 to GDK_KEY_ISO_Last_Group_Lock 5291 to GDK_KEY_ISO_Last_Group_Lock
@@ -5795,17 +5739,14 @@ note_mouse_movement (struct frame *frame,
5795} 5739}
5796 5740
5797static gboolean 5741static gboolean
5798motion_notify_event (GtkWidget * widget, GdkEvent * event, 5742motion_notify_event (GtkWidget *widget, GdkEvent *event,
5799 gpointer * user_data) 5743 gpointer *user_data)
5800{ 5744{
5801 union buffered_input_event inev; 5745 union buffered_input_event inev;
5802 struct frame *f, *frame; 5746 struct frame *f, *frame;
5803 struct pgtk_display_info *dpyinfo; 5747 struct pgtk_display_info *dpyinfo;
5804 Mouse_HLInfo *hlinfo; 5748 Mouse_HLInfo *hlinfo;
5805 5749
5806 /* This is needed to make pointer visible when motion_notify event */
5807 pending_signals = true;
5808
5809 EVENT_INIT (inev.ie); 5750 EVENT_INIT (inev.ie);
5810 inev.ie.kind = NO_EVENT; 5751 inev.ie.kind = NO_EVENT;
5811 inev.ie.arg = Qnil; 5752 inev.ie.arg = Qnil;
@@ -5827,6 +5768,7 @@ motion_notify_event (GtkWidget * widget, GdkEvent * event,
5827 5768
5828 if (f && xg_event_is_for_scrollbar (f, event, false)) 5769 if (f && xg_event_is_for_scrollbar (f, event, false))
5829 f = 0; 5770 f = 0;
5771
5830 if (f) 5772 if (f)
5831 { 5773 {
5832 /* Maybe generate a SELECT_WINDOW_EVENT for 5774 /* Maybe generate a SELECT_WINDOW_EVENT for
@@ -5871,11 +5813,9 @@ motion_notify_event (GtkWidget * widget, GdkEvent * event,
5871 help_echo_string = previous_help_echo_string; 5813 help_echo_string = previous_help_echo_string;
5872 } 5814 }
5873 else 5815 else
5874 { 5816 /* If we move outside the frame, then we're
5875 /* If we move outside the frame, then we're 5817 certainly no longer on any text in the frame. */
5876 certainly no longer on any text in the frame. */ 5818 clear_mouse_face (hlinfo);
5877 clear_mouse_face (hlinfo);
5878 }
5879 5819
5880 /* If the contents of the global variable help_echo_string 5820 /* If the contents of the global variable help_echo_string
5881 has changed, generate a HELP_EVENT. */ 5821 has changed, generate a HELP_EVENT. */
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index 16fd688288e..20c161e63b9 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -392,6 +392,10 @@ struct pgtk_output
392 They are changed only when a different background is involved. */ 392 They are changed only when a different background is involved. */
393 unsigned long relief_background; 393 unsigned long relief_background;
394 394
395 /* Whether or not a relief background has been computed for this
396 frame. */
397 bool_bf relief_background_valid_p : 1;
398
395 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this 399 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this
396 frame, or IMPLICIT if we received an EnterNotify. 400 frame, or IMPLICIT if we received an EnterNotify.
397 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */ 401 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
@@ -566,11 +570,11 @@ extern void pgtk_iconify_frame (struct frame *f);
566extern void pgtk_focus_frame (struct frame *f, bool noactivate); 570extern void pgtk_focus_frame (struct frame *f, bool noactivate);
567extern void pgtk_set_scroll_bar_default_width (struct frame *f); 571extern void pgtk_set_scroll_bar_default_width (struct frame *f);
568extern void pgtk_set_scroll_bar_default_height (struct frame *f); 572extern void pgtk_set_scroll_bar_default_height (struct frame *f);
569extern Lisp_Object x_get_focus_frame (struct frame *frame); 573extern Lisp_Object pgtk_get_focus_frame (struct frame *frame);
570 574
571extern void pgtk_frame_rehighlight (struct pgtk_display_info *dpyinfo); 575extern void pgtk_frame_rehighlight (struct pgtk_display_info *dpyinfo);
572 576
573extern void x_change_tab_bar_height (struct frame *, int); 577extern void pgtk_change_tab_bar_height (struct frame *, int);
574 578
575extern struct pgtk_display_info *check_pgtk_display_info (Lisp_Object object); 579extern struct pgtk_display_info *check_pgtk_display_info (Lisp_Object object);
576 580