From: Po Lu Date: Sun, 27 Mar 2022 11:53:49 +0000 (+0800) Subject: Clean up PGTK cursor blanking code X-Git-Tag: emacs-29.0.90~1931^2~889 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=46863b7dfa210e73244af9bc790222dd66d5051d;p=emacs.git Clean up PGTK cursor blanking code * src/pgtkterm.c (XTframe_rehighlight): Rename to `pgtk_frame_rehighlight_hook'. All callers changed. (x_toggle_visible_pointer): Rename to `pgtk_toggle_visible_pointer'. All callers changed. (x_setup_pointer_blanking, XTtoggle_invisible_pointer): Delete functions. (pgtk_create_terminal): Use new names for various hooks. (pgtk_term_init): Set up blank cursor directly. * src/pgtkterm.h (struct pgtk_display_info): Remove `toggle_visible_pointer'. --- diff --git a/src/pgtkterm.c b/src/pgtkterm.c index e00ed7fa85d..216b5ee7dd5 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -4697,16 +4697,17 @@ pgtk_frame_rehighlight (struct pgtk_display_info *dpyinfo) the appropriate X display info. */ static void -XTframe_rehighlight (struct frame *frame) +pgtk_frame_rehighlight_hook (struct frame *frame) { pgtk_frame_rehighlight (FRAME_DISPLAY_INFO (frame)); } -/* Toggle mouse pointer visibility on frame F by using invisible cursor. */ +/* Set whether or not the mouse pointer should be visible on frame + F. */ static void -x_toggle_visible_pointer (struct frame *f, bool invisible) +pgtk_toggle_invisible_pointer (struct frame *f, bool invisible) { Emacs_Cursor cursor; if (invisible) @@ -4718,22 +4719,6 @@ x_toggle_visible_pointer (struct frame *f, bool invisible) f->pointer_invisible = invisible; } -static void -x_setup_pointer_blanking (struct pgtk_display_info *dpyinfo) -{ - dpyinfo->toggle_visible_pointer = x_toggle_visible_pointer; - dpyinfo->invisible_cursor = - gdk_cursor_new_for_display (dpyinfo->gdpy, GDK_BLANK_CURSOR); -} - -static void -XTtoggle_invisible_pointer (struct frame *f, bool invisible) -{ - block_input (); - FRAME_DISPLAY_INFO (f)->toggle_visible_pointer (f, invisible); - unblock_input (); -} - /* The focus has changed. Update the frames as necessary to reflect the new situation. Note that we can't change the selected frame here, because the Lisp code we are interrupting might become confused. @@ -4790,13 +4775,13 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo) terminal->clear_frame_hook = pgtk_clear_frame; terminal->ring_bell_hook = pgtk_ring_bell; - terminal->toggle_invisible_pointer_hook = XTtoggle_invisible_pointer; + terminal->toggle_invisible_pointer_hook = pgtk_toggle_invisible_pointer; terminal->update_begin_hook = pgtk_update_begin; terminal->update_end_hook = pgtk_update_end; terminal->read_socket_hook = pgtk_read_socket; terminal->frame_up_to_date_hook = pgtk_frame_up_to_date; terminal->mouse_position_hook = pgtk_mouse_position; - terminal->frame_rehighlight_hook = XTframe_rehighlight; + terminal->frame_rehighlight_hook = pgtk_frame_rehighlight_hook; terminal->buffer_flipping_unblocked_hook = pgtk_buffer_flipping_unblocked_hook; terminal->frame_raise_lower_hook = pgtk_frame_raise_lower; terminal->frame_visible_invisible_hook = pgtk_make_frame_visible_invisible; @@ -5772,7 +5757,7 @@ x_focus_changed (gboolean is_enter, int state, } if (frame->pointer_invisible) - XTtoggle_invisible_pointer (frame, false); + pgtk_toggle_invisible_pointer (frame, false); } } @@ -6754,7 +6739,8 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name) init_sigio (dpyinfo->connection); } - x_setup_pointer_blanking (dpyinfo); + dpyinfo->invisible_cursor + = gdk_cursor_new_for_display (dpyinfo->gdpy, GDK_BLANK_CURSOR); xsettings_initialize (dpyinfo); diff --git a/src/pgtkterm.h b/src/pgtkterm.h index 4d2285cdb0a..8803b482cca 100644 --- a/src/pgtkterm.h +++ b/src/pgtkterm.h @@ -212,9 +212,6 @@ struct pgtk_display_info Unused if this display supports Xfixes extension. */ Emacs_Cursor invisible_cursor; - /* Function used to toggle pointer visibility on this display. */ - void (*toggle_visible_pointer) (struct frame *, bool); - /* The GDK cursor for scroll bars and popup menus. */ GdkCursor *xg_cursor;