emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5aef2623a3: Cleanups to PGTK code


From: Po Lu
Subject: master 5aef2623a3: Cleanups to PGTK code
Date: Wed, 27 Apr 2022 07:19:53 -0400 (EDT)

branch: master
commit 5aef2623a37d9fe452b7072dbd12c7a24dd971e2
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/pgtkfns.c  | 207 ++++++++++------------------
 src/pgtkterm.c | 420 +++++++++++++++++++++++++--------------------------------
 src/pgtkterm.h |   8 +-
 3 files changed, 254 insertions(+), 381 deletions(-)

diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 1cab954a07..d1a72804cf 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -360,7 +360,8 @@ pgtk_set_name (struct frame *f, Lisp_Object name, int 
explicit)
    specified a name for the frame; the name will override any set by the
    redisplay code.  */
 static void
-x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+pgtk_explicitly_set_name (struct frame *f, Lisp_Object arg,
+                         Lisp_Object oldval)
 {
   pgtk_set_name (f, arg, true);
 }
@@ -467,13 +468,12 @@ pgtk_set_tab_bar_lines (struct frame *f, Lisp_Object 
value, Lisp_Object oldval)
   else
     nlines = 0;
 
-  x_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
+  pgtk_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
 }
 
-
 /* Set the pixel height of the tab bar of frame F to HEIGHT.  */
 void
-x_change_tab_bar_height (struct frame *f, int height)
+pgtk_change_tab_bar_height (struct frame *f, int height)
 {
   int unit = FRAME_LINE_HEIGHT (f);
   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
          pgtk_clear_under_internal_border (f);
        }
     }
-
 }
 
 static void
 pgtk_set_internal_border_width (struct frame *f, Lisp_Object arg,
-                            Lisp_Object oldval)
+                               Lisp_Object oldval)
 {
   int border = check_int_nonnegative (arg);
 
@@ -661,32 +660,17 @@ pgtk_set_icon_name (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
   unblock_input ();
 }
 
-/* This is the same as the xfns.c definition.  */
 static void
 pgtk_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   set_frame_cursor_types (f, arg);
 }
 
-/* called to set mouse pointer color, but all other terms use it to
-   initialize pointer types (and don't set the color ;) */
 static void
 pgtk_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
 }
 
-/**
- * pgtk_set_undecorated:
- *
- * Set frame F's `undecorated' parameter.  If non-nil, F's window-system
- * window is drawn without decorations, title, minimize/maximize boxes
- * and external borders.  This usually means that the window cannot be
- * dragged, resized, iconified, maximized or deleted with the mouse.  If
- * nil, draw the frame with all the elements listed above unless these
- * have been suspended via window manager settings.
- *
- * Some window managers may not honor this parameter.
- */
 static void
 pgtk_set_undecorated (struct frame *f, Lisp_Object new_value,
                   Lisp_Object old_value)
@@ -698,16 +682,6 @@ pgtk_set_undecorated (struct frame *f, Lisp_Object 
new_value,
     }
 }
 
-/**
- * pgtk_set_skip_taskbar:
- *
- * Set frame F's `skip-taskbar' parameter.  If non-nil, this should
- * remove F's icon from the taskbar associated with the display of F's
- * window-system window and inhibit switching to F's window via
- * <Alt>-<TAB>.  If nil, lift these restrictions.
- *
- * Some window managers may not honor this parameter.
- */
 static void
 pgtk_set_skip_taskbar (struct frame *f, Lisp_Object new_value,
                    Lisp_Object old_value)
@@ -719,18 +693,9 @@ pgtk_set_skip_taskbar (struct frame *f, Lisp_Object 
new_value,
     }
 }
 
-/**
- * pgtk_set_override_redirect:
- *
- * Set frame F's `override_redirect' parameter which, if non-nil, hints
- * that the window manager doesn't want to deal with F.  Usually, such
- * frames have no decorations and always appear on top of all frames.
- *
- * Some window managers may not honor this parameter.
- */
 static void
 pgtk_set_override_redirect (struct frame *f, Lisp_Object new_value,
-                        Lisp_Object old_value)
+                           Lisp_Object old_value)
 {
   if (!EQ (new_value, old_value))
     {
@@ -745,9 +710,7 @@ pgtk_set_override_redirect (struct frame *f, Lisp_Object 
new_value,
     }
 }
 
-/* Set icon from FILE for frame F.  By using GTK functions the icon
-   may be any format that GdkPixbuf knows about, i.e. not just bitmaps.  */
-
+/* Set icon from FILE for frame F.  */
 bool
 xg_set_icon (struct frame *f, Lisp_Object file)
 {
@@ -969,59 +932,58 @@ unless TYPE is `png'.  */)
   return pgtk_cr_export_frames (frames, surface_type);
 }
 
-
-/* Note: see frame.c for template, also where generic functions are impl */
-frame_parm_handler pgtk_frame_parm_handlers[] = {
-  gui_set_autoraise,           /* generic OK */
-  gui_set_autolower,           /* generic OK */
-  pgtk_set_background_color,
-  pgtk_set_border_color,
-  gui_set_border_width,
-  pgtk_set_cursor_color,
-  pgtk_set_cursor_type,
-  gui_set_font,                        /* generic OK */
-  pgtk_set_foreground_color,
-  pgtk_set_icon_name,
-  pgtk_set_icon_type,
-  pgtk_set_child_frame_border_width,
-  pgtk_set_internal_border_width,      /* generic OK */
-  gui_set_right_divider_width,
-  gui_set_bottom_divider_width,
-  pgtk_set_menu_bar_lines,
-  pgtk_set_mouse_color,
-  x_explicitly_set_name,
-  gui_set_scroll_bar_width,    /* generic OK */
-  gui_set_scroll_bar_height,   /* generic OK */
-  pgtk_set_title,
-  gui_set_unsplittable,                /* generic OK */
-  gui_set_vertical_scroll_bars,        /* generic OK */
-  gui_set_horizontal_scroll_bars,      /* generic OK */
-  gui_set_visibility,          /* generic OK */
-  pgtk_set_tab_bar_lines,
-  pgtk_set_tool_bar_lines,
-  pgtk_set_scroll_bar_foreground,
-  pgtk_set_scroll_bar_background,
-  gui_set_screen_gamma,                /* generic OK */
-  gui_set_line_spacing,                /* generic OK, sets 
f->extra_line_spacing to int */
-  gui_set_left_fringe,         /* generic OK */
-  gui_set_right_fringe,                /* generic OK */
-  0,                           /* x_set_wait_for_wm */
-  gui_set_fullscreen,          /* generic OK */
-  gui_set_font_backend,                /* generic OK */
-  gui_set_alpha,
-  pgtk_set_sticky,
-  pgtk_set_tool_bar_position,
-  0,                           /* x_set_inhibit_double_buffering */
-  pgtk_set_undecorated,
-  pgtk_set_parent_frame,
-  pgtk_set_skip_taskbar,
-  pgtk_set_no_focus_on_map,
-  pgtk_set_no_accept_focus,
-  pgtk_set_z_group,
-  pgtk_set_override_redirect,
-  gui_set_no_special_glyphs,
-  pgtk_set_alpha_background,
-};
+frame_parm_handler pgtk_frame_parm_handlers[] =
+  {
+    gui_set_autoraise,         /* generic OK */
+    gui_set_autolower,         /* generic OK */
+    pgtk_set_background_color,
+    pgtk_set_border_color,
+    gui_set_border_width,
+    pgtk_set_cursor_color,
+    pgtk_set_cursor_type,
+    gui_set_font,              /* generic OK */
+    pgtk_set_foreground_color,
+    pgtk_set_icon_name,
+    pgtk_set_icon_type,
+    pgtk_set_child_frame_border_width,
+    pgtk_set_internal_border_width,    /* generic OK */
+    gui_set_right_divider_width,
+    gui_set_bottom_divider_width,
+    pgtk_set_menu_bar_lines,
+    pgtk_set_mouse_color,
+    pgtk_explicitly_set_name,
+    gui_set_scroll_bar_width,  /* generic OK */
+    gui_set_scroll_bar_height, /* generic OK */
+    pgtk_set_title,
+    gui_set_unsplittable,      /* generic OK */
+    gui_set_vertical_scroll_bars,      /* generic OK */
+    gui_set_horizontal_scroll_bars,    /* generic OK */
+    gui_set_visibility,                /* generic OK */
+    pgtk_set_tab_bar_lines,
+    pgtk_set_tool_bar_lines,
+    pgtk_set_scroll_bar_foreground,
+    pgtk_set_scroll_bar_background,
+    gui_set_screen_gamma,      /* generic OK */
+    gui_set_line_spacing,      /* generic OK, sets f->extra_line_spacing to 
int */
+    gui_set_left_fringe,       /* generic OK */
+    gui_set_right_fringe,      /* generic OK */
+    0,
+    gui_set_fullscreen,                /* generic OK */
+    gui_set_font_backend,      /* generic OK */
+    gui_set_alpha,
+    pgtk_set_sticky,
+    pgtk_set_tool_bar_position,
+    0,
+    pgtk_set_undecorated,
+    pgtk_set_parent_frame,
+    pgtk_set_skip_taskbar,
+    pgtk_set_no_focus_on_map,
+    pgtk_set_no_accept_focus,
+    pgtk_set_z_group,
+    pgtk_set_override_redirect,
+    gui_set_no_special_glyphs,
+    pgtk_set_alpha_background,
+  };
 
 
 /* Handler for signals raised during x_create_frame and
@@ -1186,7 +1148,7 @@ incorrect when you specify fractional scale factor in 
compositor.
 If you set scale factor by this function, it is used instead of Gdk's one.
 
 Pass nil as SCALE-FACTOR if you want to reset the specified monitor's
-scale factor. */ )
+scale factor.  */)
   (Lisp_Object monitor_model, Lisp_Object scale_factor)
 {
   CHECK_STRING (monitor_model);
@@ -2255,27 +2217,6 @@ DEFUN ("x-display-list", Fx_display_list, 
Sx_display_list, 0, 0, 0,
   return result;
 }
 
-
-DEFUN ("pgtk-hide-others", Fpgtk_hide_others, Spgtk_hide_others, 0, 0, 0,
-       doc: /* Hides all applications other than Emacs.  */)
-  (void)
-{
-  check_window_system (NULL);
-  return Qnil;
-}
-
-DEFUN ("pgtk-hide-emacs", Fpgtk_hide_emacs, Spgtk_hide_emacs, 1, 1, 0,
-       doc: /* If ON is non-nil, the entire Emacs application is hidden.
-Otherwise if Emacs is hidden, it is unhidden.
-If ON is equal to `activate', Emacs is unhidden and becomes
-the active application.  */)
-  (Lisp_Object on)
-{
-  check_window_system (NULL);
-  return Qnil;
-}
-
-
 DEFUN ("pgtk-font-name", Fpgtk_font_name, Spgtk_font_name, 1, 1, 0,
        doc: /* Determine font PostScript or family name for font NAME.
 NAME should be a string containing either the font name or an XLFD
@@ -2311,7 +2252,6 @@ check_x_display_info (Lisp_Object frame)
   return check_pgtk_display_info (frame);
 }
 
-
 void
 pgtk_set_scroll_bar_default_width (struct frame *f)
 {
@@ -2359,9 +2299,8 @@ pgtk_get_string_resource (XrmDatabase rdb, const char 
*name,
   return res;
 }
 
-
 Lisp_Object
-x_get_focus_frame (struct frame *frame)
+pgtk_get_focus_frame (struct frame *frame)
 {
   struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame);
   Lisp_Object focus;
@@ -2404,7 +2343,6 @@ DEFUN ("xw-color-values", Fxw_color_values, 
Sxw_color_values, 1, 2, 0,
     return Qnil;
 }
 
-
 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
        doc: /* Internal function called by `display-color-p', which see.  */)
   (Lisp_Object terminal)
@@ -2413,7 +2351,6 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, 
Sxw_display_color_p, 0, 1, 0,
   return Qt;
 }
 
-
 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, 
Sx_display_grayscale_p, 0, 1, 0,
        doc: /* Return t if the display supports shades of gray.
 Note that color displays do support shades of gray.
@@ -2425,7 +2362,6 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
   return Qnil;
 }
 
-
 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, 
Sx_display_pixel_width, 0, 1, 0,
        doc: /* Return the width in pixels of the display TERMINAL.
 The optional argument TERMINAL specifies which display to ask about.
@@ -2471,7 +2407,6 @@ each physical monitor, use 
`display-monitor-attributes-list'.  */)
   return make_fixnum (width);
 }
 
-
 DEFUN ("x-display-pixel-height", Fx_display_pixel_height, 
Sx_display_pixel_height, 0, 1, 0,
        doc: /* Return the height in pixels of the display TERMINAL.
 The 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,
 
 /* Hide tooltip.  Delete its frame if DELETE is true.  */
 static Lisp_Object
-x_hide_tip (bool delete)
+pgtk_hide_tip (bool delete)
 {
   if (!NILP (tip_timer))
     {
@@ -3306,13 +3241,13 @@ Text larger than the specified size is clipped.  */)
                }
            }
 
-         x_hide_tip (delete);
+         pgtk_hide_tip (delete);
        }
       else
-       x_hide_tip (true);
+       pgtk_hide_tip (true);
     }
   else
-    x_hide_tip (true);
+    pgtk_hide_tip (true);
 
   tip_last_frame = frame;
   tip_last_string = string;
@@ -3439,7 +3374,7 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
 Value is t if tooltip was open, nil otherwise.  */)
   (void)
 {
-  return x_hide_tip (!tooltip_reuse_hidden_frame);
+  return pgtk_hide_tip (!tooltip_reuse_hidden_frame);
 }
 
 /* Return geometric attributes of FRAME.  According to the value of
@@ -3465,10 +3400,8 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
   int left_pos, top_pos;
 
   if (FRAME_GTK_OUTER_WIDGET (f))
-    {
-      gtk_window_get_position (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
-                              &left_pos, &top_pos);
-    }
+    gtk_window_get_position (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                            &left_pos, &top_pos);
   else
     {
       GtkAllocation alloc;
@@ -3912,7 +3845,6 @@ syms_of_pgtkfns (void)
     g_free (ver);
   }
 
-
   defsubr (&Spgtk_set_resource);
   defsubr (&Sxw_display_color_p);      /* this and next called directly by C 
code */
   defsubr (&Sx_display_grayscale_p);
@@ -3942,9 +3874,6 @@ syms_of_pgtkfns (void)
   defsubr (&Sx_display_list);
   defsubr (&Sx_gtk_debug);
 
-  defsubr (&Spgtk_hide_others);
-  defsubr (&Spgtk_hide_emacs);
-
   defsubr (&Sx_show_tip);
   defsubr (&Sx_hide_tip);
 
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index cf8a7c4816..c8c8bd0d85 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -1,4 +1,4 @@
-/* Pure Gtk+-3 communication module.      -*- coding: utf-8 -*-
+/* Communication module for window systems using GTK.
 
 Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2022 Free Software
 Foundation, Inc.
@@ -278,8 +278,9 @@ flip_cr_context (struct frame *f)
   if (cr != FRAME_CR_CONTEXT (f))
     {
       cairo_destroy (cr);
-      FRAME_CR_ACTIVE_CONTEXT (f) = cairo_reference (FRAME_CR_CONTEXT (f));
 
+      FRAME_CR_ACTIVE_CONTEXT (f)
+       = cairo_reference (FRAME_CR_CONTEXT (f));
     }
   unblock_input ();
 }
@@ -738,19 +739,19 @@ pgtk_wait_for_map_event (struct frame *f, bool 
multiple_times)
 {
   if (FLOATP (Vpgtk_wait_for_event_timeout))
     {
-      guint msec =
-       (guint) (XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000);
+      guint msec
+       = (guint) (XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000);
       int found = 0;
       int timed_out = 0;
-      gulong id =
-       g_signal_connect (FRAME_WIDGET (f), "map-event",
-                         G_CALLBACK
-                         (pgtk_make_frame_visible_wait_for_map_event_cb),
-                         &found);
-      guint src =
-       g_timeout_add (msec,
-                      pgtk_make_frame_visible_wait_for_map_event_timeout,
-                      &timed_out);
+      gulong id
+       = g_signal_connect (FRAME_WIDGET (f), "map-event",
+                           G_CALLBACK
+                           (pgtk_make_frame_visible_wait_for_map_event_cb),
+                           &found);
+      guint src
+       = g_timeout_add (msec,
+                        pgtk_make_frame_visible_wait_for_map_event_timeout,
+                        &timed_out);
 
       if (!multiple_times)
        {
@@ -764,6 +765,7 @@ pgtk_wait_for_map_event (struct frame *f, bool 
multiple_times)
        }
 
       g_signal_handler_disconnect (FRAME_WIDGET (f), id);
+
       if (!timed_out)
        g_source_remove (src);
     }
@@ -771,9 +773,6 @@ pgtk_wait_for_map_event (struct frame *f, bool 
multiple_times)
 
 void
 pgtk_make_frame_visible (struct frame *f)
-/* --------------------------------------------------------------------------
-     External: Show the window (X11 semantics)
-   -------------------------------------------------------------------------- 
*/
 {
   GtkWidget *win = FRAME_GTK_OUTER_WIDGET (f);
 
@@ -790,17 +789,11 @@ pgtk_make_frame_visible (struct frame *f)
 
 void
 pgtk_make_frame_invisible (struct frame *f)
-/* --------------------------------------------------------------------------
-     External: Hide the window (X11 semantics)
-   -------------------------------------------------------------------------- 
*/
 {
   gtk_widget_hide (FRAME_WIDGET (f));
 
-  /* Map events are emitted many times, and
-   * map_event() do SET_FRAME_VISIBLE(f, 1).
-   * I expect visible = 0, so process those map events here and
-   * SET_FRAME_VISIBLE(f, 0) after that.
-   */
+  /* Handle any pending map event(s), then make the frame visible
+     manually, to avoid race conditions.  */
   pgtk_wait_for_map_event (f, true);
 
   SET_FRAME_VISIBLE (f, 0);
@@ -938,7 +931,8 @@ pgtk_set_parent_frame (struct frame *f, Lisp_Object 
new_value,
 
       {
        GtkWidget *whbox_of_f = gtk_widget_get_parent (fixed);
-       /* Here, unhighlight can be called and may change 
border_color_css_provider. */
+       /* Here, unhighlight can be called and may change
+          border_color_css_provider.  */
        gtk_container_remove (GTK_CONTAINER (whbox_of_f), fixed);
 
        if (FRAME_GTK_OUTER_WIDGET (f))
@@ -959,7 +953,8 @@ pgtk_set_parent_frame (struct frame *f, Lisp_Object 
new_value,
        {
          xg_create_frame_outer_widgets (f);
          pgtk_set_event_handler (f);
-         gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget), 
fixed, TRUE, TRUE, 0);
+         gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget),
+                             fixed, TRUE, TRUE, 0);
          f->output_data.pgtk->preferred_width = alloc.width;
          f->output_data.pgtk->preferred_height = alloc.height;
          xg_wm_set_size_hint (f, 0, 0);
@@ -1216,7 +1211,6 @@ pgtk_set_glyph_string_clipping (struct glyph_string *s, 
cairo_t * cr)
     }
 }
 
-
 /* Set SRC's clipping for output of glyph string DST.  This is called
    when we are drawing DST's left_overhang or right_overhang only in
    the area of SRC.  */
@@ -1235,7 +1229,6 @@ pgtk_set_glyph_string_clipping_exactly (struct 
glyph_string *src,
   cairo_clip (cr);
 }
 
-
 /* RIF:
    Compute left and right overhang of glyph string S.  */
 
@@ -1276,9 +1269,8 @@ pgtk_compute_glyph_string_overhangs (struct glyph_string 
*s)
     }
 }
 
-
-/* Fill rectangle X, Y, W, H with background color of glyph string S.  */
-
+/* Fill rectangle X, Y, W, H with background color of glyph string
+   S.  */
 static void
 pgtk_clear_glyph_string_rect (struct glyph_string *s, int x, int y,
                              int w, int h)
@@ -1288,7 +1280,6 @@ pgtk_clear_glyph_string_rect (struct glyph_string *s, int 
x, int y,
                        || s->hl != DRAW_CURSOR));
 }
 
-
 static void
 fill_background_by_face (struct frame *f, struct face *face, int x, int y,
                         int width, int height)
@@ -1330,7 +1321,6 @@ fill_background (struct glyph_string *s, int x, int y, 
int width, int height)
    background even if it wouldn't be drawn normally.  This is used
    when a string preceding S draws into the background of S, or S
    contains the first component of a composition.  */
-
 static void
 pgtk_draw_glyph_string_background (struct glyph_string *s, bool force_p)
 {
@@ -1383,7 +1373,6 @@ pgtk_draw_rectangle (struct frame *f, unsigned long 
color, int x, int y,
 }
 
 /* Draw the foreground of glyph string S.  */
-
 static void
 pgtk_draw_glyph_string_foreground (struct glyph_string *s)
 {
@@ -1430,7 +1419,6 @@ pgtk_draw_glyph_string_foreground (struct glyph_string *s)
 }
 
 /* Draw the foreground of composite glyph string S.  */
-
 static void
 pgtk_draw_composite_glyph_string_foreground (struct glyph_string *s)
 {
@@ -1521,7 +1509,6 @@ pgtk_draw_composite_glyph_string_foreground (struct 
glyph_string *s)
 
 
 /* Draw the foreground of glyph string S for glyphless characters.  */
-
 static void
 pgtk_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
 {
@@ -1783,8 +1770,10 @@ pgtk_setup_relief_colors (struct glyph_string *s)
       color = s->xgcv.background;
     }
 
-  if (TRUE)
+  if (!di->relief_background_valid_p
+      || di->relief_background != color)
     {
+      di->relief_background_valid_p = true;
       di->relief_background = color;
       pgtk_setup_relief_color (s->f, &di->white_relief, 1.2, 0x8000,
                               WHITE_PIX_DEFAULT (s->f));
@@ -1800,12 +1789,8 @@ pgtk_set_clip_rectangles (struct frame *f, cairo_t *cr,
   if (n > 0)
     {
       for (int i = 0; i < n; i++)
-       {
-         cairo_rectangle (cr,
-                          rectangles[i].x,
-                          rectangles[i].y,
-                          rectangles[i].width, rectangles[i].height);
-       }
+       cairo_rectangle (cr, rectangles[i].x, rectangles[i].y,
+                        rectangles[i].width, rectangles[i].height);
       cairo_clip (cr);
     }
 }
@@ -1823,7 +1808,7 @@ pgtk_draw_relief_rect (struct frame *f,
                       int left_x, int top_y, int right_x, int bottom_y,
                       int hwidth, int vwidth, bool raised_p, bool top_p,
                       bool bot_p, bool left_p, bool right_p,
-                      XRectangle * clip_rect)
+                      XRectangle *clip_rect)
 {
   unsigned long top_left_color, bottom_right_color;
   int corners = 0;
@@ -2142,11 +2127,7 @@ pgtk_draw_glyph_string_bg_rect (struct glyph_string *s, 
int x, int y, int w,
                                int h)
 {
   if (s->stippled_p)
-    {
-      /* Fill background with a stipple pattern.  */
-
-      fill_background (s, x, y, w, h);
-    }
+    fill_background (s, x, y, w, h);
   else
     pgtk_clear_glyph_string_rect (s, x, y, w, h);
 }
@@ -2227,9 +2208,9 @@ pgtk_draw_image_foreground (struct glyph_string *s)
          if (s->hl == DRAW_CURSOR)
            {
              int relief = eabs (s->img->relief);
-             pgtk_draw_rectangle (s->f, s->xgcv.foreground, x - relief, y - 
relief,
-                                  s->slice.width + relief*2 - 1,
-                                  s->slice.height + relief*2 - 1, false);
+             pgtk_draw_rectangle (s->f, s->xgcv.foreground, x - relief,
+                                  y - relief, s->slice.width + relief * 2 - 1,
+                                  s->slice.height + relief * 2 - 1, false);
            }
        }
       pgtk_end_cr_clip (s->f);
@@ -2278,23 +2259,21 @@ pgtk_draw_image_glyph_string (struct glyph_string *s)
       || s->img->pixmap == 0
       || s->width != s->background_width)
     {
-       {
-         int x = s->x;
-         int y = s->y;
-         int width = s->background_width;
+      int x = s->x;
+      int y = s->y;
+      int width = s->background_width;
 
-         if (s->first_glyph->left_box_line_p
-             && s->slice.x == 0)
-           {
-             x += box_line_hwidth;
-             width -= box_line_hwidth;
-           }
+      if (s->first_glyph->left_box_line_p
+         && s->slice.x == 0)
+       {
+         x += box_line_hwidth;
+         width -= box_line_hwidth;
+       }
 
-         if (s->slice.y == 0)
-           y += box_line_vwidth;
+      if (s->slice.y == 0)
+       y += box_line_vwidth;
 
-         pgtk_draw_glyph_string_bg_rect (s, x, y, width, height);
-       }
+      pgtk_draw_glyph_string_bg_rect (s, x, y, width, height);
 
       s->background_filled_p = true;
     }
@@ -2376,15 +2355,10 @@ pgtk_draw_stretch_glyph_string (struct glyph_string *s)
          pgtk_set_clip_rectangles (s->f, cr, &r, 1);
 
          if (s->face->stipple)
-           {
-             /* Fill background with a stipple pattern.  */
-             fill_background (s, x, y, w, h);
-           }
+           fill_background (s, x, y, w, h);
          else
-           {
-             pgtk_fill_rectangle (s->f, color, x, y, w, h,
-                                  true);
-           }
+           pgtk_fill_rectangle (s->f, color, x, y, w, h,
+                                true);
 
          pgtk_end_cr_clip (s->f);
        }
@@ -2402,6 +2376,7 @@ pgtk_draw_stretch_glyph_string (struct glyph_string *s)
          background_width -= text_left_x - x;
          x = text_left_x;
        }
+
       if (background_width > 0)
        pgtk_draw_glyph_string_bg_rect (s, x, s->y, background_width, 
s->height);
     }
@@ -2465,9 +2440,9 @@ pgtk_draw_glyph_string (struct glyph_string *s)
     /* We must clip just this glyph.  left_overhang part has already
        drawn when s->prev was drawn, and right_overhang part will be
        drawn later when s->next is drawn. */
-      pgtk_set_glyph_string_clipping_exactly (s, s, cr);
+    pgtk_set_glyph_string_clipping_exactly (s, s, cr);
   else
-      pgtk_set_glyph_string_clipping (s, cr);
+    pgtk_set_glyph_string_clipping (s, cr);
 
   switch (s->first_glyph->type)
     {
@@ -2614,10 +2589,8 @@ pgtk_draw_glyph_string (struct glyph_string *s)
            pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, s->y + dy,
                                 s->width, h, false);
          else
-           {
-             pgtk_fill_rectangle (s->f, s->face->overline_color, s->x,
-                                  s->y + dy, s->width, h, false);
-           }
+           pgtk_fill_rectangle (s->f, s->face->overline_color, s->x,
+                                s->y + dy, s->width, h, false);
        }
 
       /* Draw strike-through.  */
@@ -2639,10 +2612,8 @@ pgtk_draw_glyph_string (struct glyph_string *s)
            pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, glyph_y + dy,
                                 s->width, h, false);
          else
-           {
-             pgtk_fill_rectangle (s->f, s->face->strike_through_color, s->x,
-                                  glyph_y + dy, s->width, h, false);
-           }
+           pgtk_fill_rectangle (s->f, s->face->strike_through_color, s->x,
+                                glyph_y + dy, s->width, h, false);
        }
 
       if (s->prev)
@@ -2962,11 +2933,11 @@ pgtk_copy_bits (struct frame *f, cairo_rectangle_t 
*src_rect,
   cairo_t *cr;
   cairo_surface_t *surface;    /* temporary surface */
 
-  surface =
-    cairo_surface_create_similar (FRAME_CR_SURFACE (f),
-                                 CAIRO_CONTENT_COLOR_ALPHA,
-                                 (int) src_rect->width,
-                                 (int) src_rect->height);
+  surface
+    = cairo_surface_create_similar (FRAME_CR_SURFACE (f),
+                                   CAIRO_CONTENT_COLOR_ALPHA,
+                                   (int) src_rect->width,
+                                   (int) src_rect->height);
 
   cr = cairo_create (surface);
   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)
     }
 
   if (FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img != NULL)
-    {
-      gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
-                          FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img);
-    }
+    gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                        FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img);
+
   f->output_data.pgtk->icon_bitmap = bitmap_id;
 
   return false;
@@ -3453,10 +3423,10 @@ pgtk_define_fringe_bitmap (int which, unsigned short 
*bits, int h, int wd)
     {
       i = max_fringe_bmp;
       max_fringe_bmp = which + 20;
-      fringe_bmp =
-       (cairo_pattern_t **) xrealloc (fringe_bmp,
-                                      max_fringe_bmp *
-                                      sizeof (cairo_pattern_t *));
+      fringe_bmp
+       = (cairo_pattern_t **) xrealloc (fringe_bmp,
+                                        max_fringe_bmp *
+                                        sizeof (cairo_pattern_t *));
       while (i < max_fringe_bmp)
        fringe_bmp[i++] = 0;
     }
@@ -3608,11 +3578,9 @@ pgtk_show_hourglass (struct frame *f)
       struct timespec ts = make_timespec (0, 50 * 1000 * 1000);
       if (hourglass_atimer != NULL)
        cancel_atimer (hourglass_atimer);
-      hourglass_atimer =
-       start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL);
+      hourglass_atimer
+       = start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL);
     }
-
-  /* Cursor frequently stops animation. gtk's bug? */
 }
 
 static void
@@ -3706,83 +3674,85 @@ recover_from_visible_bell (struct atimer *timer)
 static void
 pgtk_flash (struct frame *f)
 {
-  {
-    if (!FRAME_CR_CONTEXT (f))
-      return;
+  cairo_surface_t *surface_orig, *surface;
+  cairo_t *cr;
+  int width, height, flash_height, flash_left, flash_right;
+  struct timespec delay;
 
-    block_input ();
+  if (!FRAME_CR_CONTEXT (f))
+    return;
 
-    cairo_surface_t *surface_orig = FRAME_CR_SURFACE (f);
+  block_input ();
 
-    int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f);
-    int height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
-    cairo_surface_t *surface
-      = cairo_surface_create_similar (surface_orig, CAIRO_CONTENT_COLOR_ALPHA,
-                                     width, height);
+  surface_orig = FRAME_CR_SURFACE (f);
 
-    cairo_t *cr = cairo_create (surface);
-    cairo_set_source_surface (cr, surface_orig, 0, 0);
-    cairo_rectangle (cr, 0, 0, width, height);
-    cairo_clip (cr);
-    cairo_paint (cr);
+  width = FRAME_CR_SURFACE_DESIRED_WIDTH (f);
+  height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
+  surface = cairo_surface_create_similar (surface_orig,
+                                         CAIRO_CONTENT_COLOR_ALPHA,
+                                         width, height);
 
-    cairo_set_source_rgb (cr, 1, 1, 1);
-    cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
+  cr = cairo_create (surface);
+  cairo_set_source_surface (cr, surface_orig, 0, 0);
+  cairo_rectangle (cr, 0, 0, width, height);
+  cairo_clip (cr);
+  cairo_paint (cr);
 
+  cairo_set_source_rgb (cr, 1, 1, 1);
+  cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
+
+  /* Get the height not including a menu bar widget.  */
+  height = FRAME_PIXEL_HEIGHT (f);
+  /* Height of each line to flash.  */
+  flash_height = FRAME_LINE_HEIGHT (f);
+  /* These will be the left and right margins of the rectangles.  */
+  flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
+  flash_right = (FRAME_PIXEL_WIDTH (f)
+                - FRAME_INTERNAL_BORDER_WIDTH (f));
+  width = flash_right - flash_left;
+
+  /* If window is tall, flash top and bottom line.  */
+  if (height > 3 * FRAME_LINE_HEIGHT (f))
+    {
+      cairo_rectangle (cr,
+                      flash_left,
+                      (FRAME_INTERNAL_BORDER_WIDTH (f)
+                       + FRAME_TOP_MARGIN_HEIGHT (f)),
+                      width, flash_height);
+      cairo_fill (cr);
+
+      cairo_rectangle (cr,
+                      flash_left,
+                      (height - flash_height
+                       - FRAME_INTERNAL_BORDER_WIDTH (f)),
+                      width, flash_height);
+      cairo_fill (cr);
+    }
+  else
     {
-      /* Get the height not including a menu bar widget.  */
-      int height = FRAME_PIXEL_HEIGHT (f);
-      /* Height of each line to flash.  */
-      int flash_height = FRAME_LINE_HEIGHT (f);
-      /* These will be the left and right margins of the rectangles.  */
-      int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
-      int flash_right =
-       FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
-      int width = flash_right - flash_left;
-
-      /* If window is tall, flash top and bottom line.  */
-      if (height > 3 * FRAME_LINE_HEIGHT (f))
-       {
-         cairo_rectangle (cr,
-                          flash_left,
-                          (FRAME_INTERNAL_BORDER_WIDTH (f)
-                           + FRAME_TOP_MARGIN_HEIGHT (f)),
-                          width, flash_height);
-         cairo_fill (cr);
+      /* If it is short, flash it all.  */
+      cairo_rectangle (cr,
+                      flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
+                      width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
+      cairo_fill (cr);
+    }
 
-         cairo_rectangle (cr,
-                          flash_left,
-                          (height - flash_height
-                           - FRAME_INTERNAL_BORDER_WIDTH (f)),
-                          width, flash_height);
-         cairo_fill (cr);
-       }
-      else
-       {
-         /* If it is short, flash it all.  */
-         cairo_rectangle (cr,
-                          flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
-                          width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
-         cairo_fill (cr);
-       }
+  FRAME_X_OUTPUT (f)->cr_surface_visible_bell = surface;
 
-      FRAME_X_OUTPUT (f)->cr_surface_visible_bell = surface;
-      {
-       struct timespec delay = make_timespec (0, 50 * 1000 * 1000);
-       if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
-         {
-           cancel_atimer (FRAME_X_OUTPUT (f)->atimer_visible_bell);
-           FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
-         }
-       FRAME_X_OUTPUT (f)->atimer_visible_bell =
-         start_atimer (ATIMER_RELATIVE, delay, recover_from_visible_bell, f);
-      }
+  delay = make_timespec (0, 50 * 1000 * 1000);
 
+  if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
+    {
+      cancel_atimer (FRAME_X_OUTPUT (f)->atimer_visible_bell);
+      FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
     }
 
-    cairo_destroy (cr);
-    unblock_input ();
-  }
+  FRAME_X_OUTPUT (f)->atimer_visible_bell
+    = start_atimer (ATIMER_RELATIVE, delay, recover_from_visible_bell, f);
+
+
+  cairo_destroy (cr);
+  unblock_input ();
 }
 
 /* Make audible bell.  */
@@ -3863,8 +3833,9 @@ pgtk_send_scroll_bar_event (Lisp_Object window, enum 
scroll_bar_part part,
 
   EVENT_INIT (inev.ie);
 
-  inev.ie.kind =
-    horizontal ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT : SCROLL_BAR_CLICK_EVENT;
+  inev.ie.kind = (horizontal
+                 ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT
+                 : SCROLL_BAR_CLICK_EVENT);
   inev.ie.frame_or_window = window;
   inev.ie.arg = Qnil;
   inev.ie.timestamp = 0;
@@ -4013,8 +3984,6 @@ pgtk_set_toolkit_horizontal_scroll_bar_thumb (struct 
scroll_bar *bar,
   xg_set_toolkit_horizontal_scroll_bar_thumb (bar, portion, position, whole);
 }
 
-
-
 /* Create a scroll bar and return the scroll bar vector for it.  W is
    the Emacs window on which to create the scroll bar. TOP, LEFT,
    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,
   wset_vertical_scroll_bar (w, barobj);
 }
 
-
 static void
 pgtk_set_horizontal_scroll_bar (struct window *w, int portion, int whole,
                                int position)
@@ -4281,7 +4249,6 @@ pgtk_condemn_scroll_bars (struct frame *frame)
     }
 }
 
-
 /* Un-mark WINDOW's scroll bar for deletion in this judgment cycle.
    Note that WINDOW isn't necessarily condemned at all.  */
 
@@ -4505,7 +4472,7 @@ pgtk_query_frame_background_color (struct frame *f, 
Emacs_Color * bgcolor)
 }
 
 static void
-pgtk_free_pixmap (struct frame *_f, Emacs_Pixmap pixmap)
+pgtk_free_pixmap (struct frame *f, Emacs_Pixmap pixmap)
 {
   if (pixmap)
     {
@@ -4529,13 +4496,14 @@ pgtk_focus_frame (struct frame *f, bool noactivate)
     }
 }
 
-
 static void
-set_opacity_recursively (GtkWidget * w, gpointer data)
+set_opacity_recursively (GtkWidget *w, gpointer data)
 {
   gtk_widget_set_opacity (w, *(double *) data);
+
   if (GTK_IS_CONTAINER (w))
-    gtk_container_foreach (GTK_CONTAINER (w), set_opacity_recursively, data);
+    gtk_container_foreach (GTK_CONTAINER (w),
+                          set_opacity_recursively, data);
 }
 
 static void
@@ -4571,22 +4539,13 @@ pgtk_set_frame_alpha (struct frame *f)
 static void
 frame_highlight (struct frame *f)
 {
-  /* We used to only do this if Vx_no_window_manager was non-nil, but
-     the ICCCM (section 4.1.6) says that the window's border pixmap
-     and border pixel are window attributes which are "private to the
-     client", so we can always change it to whatever we want.  */
   block_input ();
-  /* I recently started to get errors in this XSetWindowBorder, depending on
-     the window-manager in use, tho something more is at play since I've been
-     using that same window-manager binary for ever.  Let's not crash just
-     because of this (bug#9310).  */
-
   GtkWidget *w = FRAME_WIDGET (f);
 
-  char *css =
-    g_strdup_printf ("decoration { border: solid %dpx #%06x; }",
-                    f->border_width,
-                    (unsigned int) FRAME_X_OUTPUT (f)->border_pixel & 
0x00ffffff);
+  char *css = g_strdup_printf ("decoration { border: solid %dpx #%06x; }",
+                              f->border_width,
+                              ((unsigned int) FRAME_X_OUTPUT (f)->border_pixel
+                               & 0x00ffffff));
 
   GtkStyleContext *ctxt = gtk_widget_get_style_context (w);
   GtkCssProvider *css_provider = gtk_css_provider_new ();
@@ -4611,27 +4570,26 @@ frame_highlight (struct frame *f)
 static void
 frame_unhighlight (struct frame *f)
 {
-  /* We used to only do this if Vx_no_window_manager was non-nil, but
-     the ICCCM (section 4.1.6) says that the window's border pixmap
-     and border pixel are window attributes which are "private to the
-     client", so we can always change it to whatever we want.  */
+  GtkWidget *w;
+  char *css;
+  GtkStyleContext *ctxt;
+  GtkCssProvider *css_provider, *old;
+
   block_input ();
-  /* Same as above for XSetWindowBorder (bug#9310).  */
 
-  GtkWidget *w = FRAME_WIDGET (f);
+  w = FRAME_WIDGET (f);
 
-  char *css =
-    g_strdup_printf ("decoration { border: dotted %dpx #ffffff; }",
-                    f->border_width);
+  css = g_strdup_printf ("decoration { border: dotted %dpx #ffffff; }",
+                        f->border_width);
 
-  GtkStyleContext *ctxt = gtk_widget_get_style_context (w);
-  GtkCssProvider *css_provider = gtk_css_provider_new ();
+  ctxt = gtk_widget_get_style_context (w);
+  css_provider = gtk_css_provider_new ();
   gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
   gtk_style_context_add_provider (ctxt, GTK_STYLE_PROVIDER (css_provider),
                                  GTK_STYLE_PROVIDER_PRIORITY_USER);
   g_free (css);
 
-  GtkCssProvider *old = FRAME_X_OUTPUT (f)->border_color_css_provider;
+  old = FRAME_X_OUTPUT (f)->border_color_css_provider;
   FRAME_X_OUTPUT (f)->border_color_css_provider = css_provider;
   if (old != NULL)
     {
@@ -4685,10 +4643,8 @@ pgtk_frame_rehighlight_hook (struct frame *frame)
   pgtk_frame_rehighlight (FRAME_DISPLAY_INFO (frame));
 }
 
-
 /* Set whether or not the mouse pointer should be visible on frame
    F.  */
-
 static void
 pgtk_toggle_invisible_pointer (struct frame *f, bool invisible)
 {
@@ -4700,6 +4656,10 @@ pgtk_toggle_invisible_pointer (struct frame *f, bool 
invisible)
   gdk_window_set_cursor (gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
                         cursor);
   f->pointer_invisible = invisible;
+
+  /* This is needed to make the pointer visible upon receiving a
+     motion notify event.  */
+  gdk_display_flush (FRAME_X_DISPLAY (f));
 }
 
 /* The focus has changed.  Update the frames as necessary to reflect
@@ -4745,9 +4705,6 @@ pgtk_buffer_flipping_unblocked_hook (struct frame *f)
 
 static struct terminal *
 pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
-/* --------------------------------------------------------------------------
-      Set up use of Gtk before we make the first connection.
-   -------------------------------------------------------------------------- 
*/
 {
   struct terminal *terminal;
 
@@ -4772,7 +4729,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
   terminal->menu_show_hook = pgtk_menu_show;
   terminal->activate_menubar_hook = pgtk_activate_menubar;
   terminal->popup_dialog_hook = pgtk_popup_dialog;
-  terminal->change_tab_bar_height_hook = x_change_tab_bar_height;
+  terminal->change_tab_bar_height_hook = pgtk_change_tab_bar_height;
   terminal->set_vertical_scroll_bar_hook = pgtk_set_vertical_scroll_bar;
   terminal->set_horizontal_scroll_bar_hook = pgtk_set_horizontal_scroll_bar;
   terminal->condemn_scroll_bars_hook = pgtk_condemn_scroll_bars;
@@ -4793,7 +4750,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
     = pgtk_set_scroll_bar_default_height;
   terminal->set_window_size_hook = pgtk_set_window_size;
   terminal->query_colors = pgtk_query_colors;
-  terminal->get_focus_frame = x_get_focus_frame;
+  terminal->get_focus_frame = pgtk_get_focus_frame;
   terminal->focus_frame_hook = pgtk_focus_frame;
   terminal->set_frame_offset_hook = pgtk_set_offset;
   terminal->free_pixmap = pgtk_free_pixmap;
@@ -4812,7 +4769,7 @@ struct pgtk_window_is_of_frame_recursive_t
 };
 
 static void
-pgtk_window_is_of_frame_recursive (GtkWidget * widget, gpointer data)
+pgtk_window_is_of_frame_recursive (GtkWidget *widget, gpointer data)
 {
   struct pgtk_window_is_of_frame_recursive_t *datap = data;
 
@@ -4828,14 +4785,13 @@ pgtk_window_is_of_frame_recursive (GtkWidget * widget, 
gpointer data)
       return;
     }
 
-  if (GTK_IS_CONTAINER (widget)) {
+  if (GTK_IS_CONTAINER (widget))
     gtk_container_foreach (GTK_CONTAINER (widget),
                           pgtk_window_is_of_frame_recursive, datap);
-  }
 }
 
 static bool
-pgtk_window_is_of_frame (struct frame *f, GdkWindow * window)
+pgtk_window_is_of_frame (struct frame *f, GdkWindow *window)
 {
   struct pgtk_window_is_of_frame_recursive_t data;
   data.window = window;
@@ -4848,7 +4804,7 @@ pgtk_window_is_of_frame (struct frame *f, GdkWindow * 
window)
 /* Like x_window_to_frame but also compares the window with the widget's
    windows.  */
 static struct frame *
-pgtk_any_window_to_frame (GdkWindow * window)
+pgtk_any_window_to_frame (GdkWindow *window)
 {
   Lisp_Object tail, frame;
   struct frame *f, *found = NULL;
@@ -4973,7 +4929,7 @@ pgtk_clear_under_internal_border (struct frame *f)
 }
 
 static gboolean
-pgtk_handle_draw (GtkWidget * widget, cairo_t * cr, gpointer * data)
+pgtk_handle_draw (GtkWidget *widget, cairo_t *cr, gpointer *data)
 {
   struct frame *f;
 
@@ -4999,19 +4955,11 @@ pgtk_handle_draw (GtkWidget * widget, cairo_t * cr, 
gpointer * data)
 }
 
 static void
-size_allocate (GtkWidget * widget, GtkAllocation * alloc,
+size_allocate (GtkWidget *widget, GtkAllocation *alloc,
               gpointer user_data)
 {
   struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
 
-  /* Between a frame is created and not shown, size is allocated and
-   * this handler is called.  When that, since the widget's window is
-   * NULL, we can't get f, pgtk_cr_update_surface_desired_size is not
-   * called, and its size is 0x0.  That causes empty frame.
-   *
-   * Fortunately since we know f in pgtk_set_event_handler, we can get
-   * it through user_data;
-   */
   if (!f)
     f = user_data;
 
@@ -5118,7 +5066,7 @@ pgtk_emacs_to_gtk_modifiers (struct pgtk_display_info 
*dpyinfo, int state)
 
 
 void
-pgtk_enqueue_string (struct frame *f, gchar * str)
+pgtk_enqueue_string (struct frame *f, gchar *str)
 {
   gunichar *ustr, *uptr;
 
@@ -5210,9 +5158,8 @@ key_press_event (GtkWidget *widget, GdkEvent *event, 
gpointer *user_data)
            return TRUE;
        }
 
-      state |=
-       pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f),
-                                    extra_keyboard_modifiers);
+      state |= pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f),
+                                           extra_keyboard_modifiers);
       modifiers = state;
 
       /* This will have to go some day...  */
@@ -5339,9 +5286,6 @@ key_press_event (GtkWidget *widget, GdkEvent *event, 
gpointer *user_data)
           || (orig_keysym & (1 << 28))
           || (keysym != GDK_KEY_VoidSymbol && nbytes == 0))
          && !(event->key.is_modifier
-              /* Gtk's modifier keys are different from Xlib's ones.
-               * I need to exclude them.
-               */
               || IsModifierKey (orig_keysym)
               /* The symbols from GDK_KEY_ISO_Lock
                  to GDK_KEY_ISO_Last_Group_Lock
@@ -5795,17 +5739,14 @@ note_mouse_movement (struct frame *frame,
 }
 
 static gboolean
-motion_notify_event (GtkWidget * widget, GdkEvent * event,
-                    gpointer * user_data)
+motion_notify_event (GtkWidget *widget, GdkEvent *event,
+                    gpointer *user_data)
 {
   union buffered_input_event inev;
   struct frame *f, *frame;
   struct pgtk_display_info *dpyinfo;
   Mouse_HLInfo *hlinfo;
 
-  /* This is needed to make pointer visible when motion_notify event */
-  pending_signals = true;
-
   EVENT_INIT (inev.ie);
   inev.ie.kind = NO_EVENT;
   inev.ie.arg = Qnil;
@@ -5827,6 +5768,7 @@ motion_notify_event (GtkWidget * widget, GdkEvent * event,
 
   if (f && xg_event_is_for_scrollbar (f, event, false))
     f = 0;
+
   if (f)
     {
       /* Maybe generate a SELECT_WINDOW_EVENT for
@@ -5871,11 +5813,9 @@ motion_notify_event (GtkWidget * widget, GdkEvent * 
event,
        help_echo_string = previous_help_echo_string;
     }
   else
-    {
-      /* If we move outside the frame, then we're
-         certainly no longer on any text in the frame.  */
-      clear_mouse_face (hlinfo);
-    }
+    /* If we move outside the frame, then we're
+       certainly no longer on any text in the frame.  */
+    clear_mouse_face (hlinfo);
 
   /* If the contents of the global variable help_echo_string
      has changed, generate a HELP_EVENT.  */
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index 16fd688288..20c161e63b 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -392,6 +392,10 @@ struct pgtk_output
      They are changed only when a different background is involved.  */
   unsigned long relief_background;
 
+  /* Whether or not a relief background has been computed for this
+     frame.  */
+  bool_bf relief_background_valid_p : 1;
+
   /* Keep track of focus.  May be EXPLICIT if we received a FocusIn for this
      frame, or IMPLICIT if we received an EnterNotify.
      FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
@@ -566,11 +570,11 @@ extern void pgtk_iconify_frame (struct frame *f);
 extern void pgtk_focus_frame (struct frame *f, bool noactivate);
 extern void pgtk_set_scroll_bar_default_width (struct frame *f);
 extern void pgtk_set_scroll_bar_default_height (struct frame *f);
-extern Lisp_Object x_get_focus_frame (struct frame *frame);
+extern Lisp_Object pgtk_get_focus_frame (struct frame *frame);
 
 extern void pgtk_frame_rehighlight (struct pgtk_display_info *dpyinfo);
 
-extern void x_change_tab_bar_height (struct frame *, int);
+extern void pgtk_change_tab_bar_height (struct frame *, int);
 
 extern struct pgtk_display_info *check_pgtk_display_info (Lisp_Object object);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]