aboutsummaryrefslogtreecommitdiffstats
path: root/src/pgtkterm.c
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/pgtkterm.c
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/pgtkterm.c')
-rw-r--r--src/pgtkterm.c420
1 files changed, 180 insertions, 240 deletions
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. */