summaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-06-21 22:03:42 +0800
committerPo Lu <luangruo@yahoo.com>2022-06-21 22:05:21 +0800
commitbe35c92c90d455739a6ff9d4beefa2b35d044852 (patch)
tree19c5be6b9e09ccb45c58a5008f8f956f3ad92d57 /src/frame.c
parentb1af8c2c00aefe6aa554a468e65b6e07c9f14722 (diff)
downloademacs-be35c92c90d455739a6ff9d4beefa2b35d044852.tar.gz
emacs-be35c92c90d455739a6ff9d4beefa2b35d044852.tar.bz2
emacs-be35c92c90d455739a6ff9d4beefa2b35d044852.zip
Rewrite PGTK selection code from scratch
* src/frame.c (delete_frame): Clear selections and swallow special events. * src/keyboard.c (kbd_buffer_get_event, process_special_events): Also handle selection events on PGTK. * src/keyboard.h (union buffered_input_event): Include selection events on PGTK. * src/pgtkselect.c (symbol_to_gtk_clipboard, LOCAL_SELECTION): New functions and macros. (selection_type_to_quarks, get_func, clear_func): Delete functions. (pgtk_selection_init, pgtk_selection_lost): (pgtk_selection_usable): New functions. (Fpgtk_own_selection_internal, Fpgtk_disown_selection_internal) (Fpgtk_selection_exists_p, Fpgtk_selection_owner_p) (Fpgtk_get_selection_internal): Complete rewrite. (syms_of_pgtkselect): Update defsyms and add more hooks. * src/pgtkselect.h: Delete file. * src/pgtkterm.c (evq_enqueue): Set last user time based on the event. (pgtk_any_window_to_frame, button_event): Fix coding style. (pgtk_set_event_handler): Add selection events. (pgtk_find_selection_owner, pgtk_selection_event): New functions. (pgtk_term_init): Remove call to `pgtk_selection_init'. * src/pgtkterm.h (struct pgtk_display_info): New field `display'. (enum selection_input_event): New struct. New macros for accessing its fields.
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/frame.c b/src/frame.c
index c21461d49fe..c2f2f8e4642 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2176,6 +2176,17 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
x_clear_frame_selections (f);
#endif
+#ifdef HAVE_PGTK
+ if (FRAME_PGTK_P (f))
+ {
+ /* Do special selection events now, in case the window gets
+ destroyed by this deletion. Does this run Lisp code? */
+ swallow_events (false);
+
+ pgtk_clear_frame_selections (f);
+ }
+#endif
+
/* Free glyphs.
This function must be called before the window tree of the
frame is deleted because windows contain dynamically allocated