[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 61a312ba0c: Update last event time during DND operations
From: |
Po Lu |
Subject: |
master 61a312ba0c: Update last event time during DND operations |
Date: |
Thu, 16 Jun 2022 22:24:27 -0400 (EDT) |
branch: master
commit 61a312ba0cae10e8e19b7424540751a71d0170b1
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Update last event time during DND operations
* lisp/x-dnd.el (x-dnd-handle-xdnd, x-dnd-handle-motif): Set
last user time to provided timestamp.
* src/xfns.c (Fx_display_last_user_time): New function.
(syms_of_xfns): New defsubr.
* src/xterm.c (x_set_last_user_time_from_lisp): New function.
* src/xterm.h: Update prototypes.
---
lisp/x-dnd.el | 7 +++++--
src/xfns.c | 20 ++++++++++++++++++++
src/xterm.c | 9 +++++++++
src/xterm.h | 9 +++++----
4 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index 531a58f71f..81aa565818 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -137,6 +137,7 @@ any protocol specific data.")
(declare-function x-get-selection-internal "xselect.c"
(selection-symbol target-type &optional time-stamp terminal))
+(declare-function x-display-set-last-user-time "xfns.c")
(defconst x-dnd-xdnd-to-action
'(("XdndActionPrivate" . private)
@@ -621,7 +622,7 @@ FORMAT is 32 (not used). MESSAGE is the data part of an
XClientMessageEvent."
(intern (x-dnd-current-type window))
timestamp)))
success action)
-
+ (x-display-set-last-user-time timestamp)
(setq action (if value
(condition-case info
(x-dnd-drop-data event frame window value
@@ -861,6 +862,7 @@ Return a vector of atoms containing the selection targets."
timestamp
x
y)))
+ (x-display-set-last-user-time timestamp)
(x-send-client-message frame
dnd-source
frame
@@ -898,6 +900,7 @@ Return a vector of atoms containing the selection targets."
my-byteorder)
reply-flags
timestamp)))
+ (x-display-set-last-user-time timestamp)
(x-send-client-message frame
dnd-source
frame
@@ -956,7 +959,7 @@ Return a vector of atoms containing the selection targets."
(timestamp (x-dnd-get-motif-value
data 4 4 source-byteorder))
action)
-
+ (x-display-set-last-user-time timestamp)
(x-send-client-message frame
dnd-source
frame
diff --git a/src/xfns.c b/src/xfns.c
index 4cd03136e6..595f3fffff 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -9472,6 +9472,25 @@ DEFUN ("x-gtk-debug", Fx_gtk_debug, Sx_gtk_debug, 1, 1,
0,
#endif /* HAVE_GTK3 */
#endif /* USE_GTK */
+DEFUN ("x-display-set-last-user-time", Fx_display_last_user_time,
+ Sx_display_set_last_user_time, 1, 2, 0,
+ doc: /* Set the last user time of TERMINAL to TIME-OBJECT.
+TIME-OBJECT is the X server time, in milliseconds, of the last user
+interaction. This is the timestamp that `x-get-selection-internal'
+will use by default to fetch selection data.
+TERMINAL is the terminal on which the user interaction occurred. */)
+ (Lisp_Object time_object, Lisp_Object terminal)
+{
+ struct x_display_info *dpyinfo;
+ Time time;
+
+ dpyinfo = check_x_display_info (terminal);
+ CONS_TO_INTEGER (time_object, Time, time);
+
+ x_set_last_user_time_from_lisp (dpyinfo, time);
+ return Qnil;
+}
+
DEFUN ("x-internal-focus-input-context", Fx_internal_focus_input_context,
Sx_internal_focus_input_context, 1, 1, 0,
doc: /* Focus and set the client window of all focused frames' GTK
input context.
@@ -9937,6 +9956,7 @@ eliminated in future versions of Emacs. */);
defsubr (&Sx_hide_tip);
defsubr (&Sx_double_buffered_p);
defsubr (&Sx_begin_drag);
+ defsubr (&Sx_display_set_last_user_time);
tip_timer = Qnil;
staticpro (&tip_timer);
tip_frame = Qnil;
diff --git a/src/xterm.c b/src/xterm.c
index 45c96c5106..96fe75f41e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6921,6 +6921,7 @@ x_display_set_last_user_time (struct x_display_info
*dpyinfo, Time time)
#ifdef ENABLE_CHECKING
eassert (time <= X_ULONG_MAX);
#endif
+
dpyinfo->last_user_time = time;
#ifndef USE_GTK
@@ -6989,6 +6990,14 @@ x_display_set_last_user_time (struct x_display_info
*dpyinfo, Time time)
#endif
}
+void
+x_set_last_user_time_from_lisp (struct x_display_info *dpyinfo,
+ Time time)
+{
+ if (dpyinfo->last_user_time > time)
+ x_display_set_last_user_time (dpyinfo, time);
+}
+
/* Set S->gc to a suitable GC for drawing glyph string S in cursor
face. */
diff --git a/src/xterm.h b/src/xterm.h
index ad0df6bff9..17402f962c 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1427,10 +1427,11 @@ extern void x_unwind_errors_to (int);
extern void x_uncatch_errors (void);
extern void x_uncatch_errors_after_check (void);
extern void x_clear_errors (Display *);
-extern void x_set_window_size (struct frame *f, bool, int, int);
-extern void x_make_frame_visible (struct frame *f);
-extern void x_make_frame_invisible (struct frame *f);
-extern void x_iconify_frame (struct frame *f);
+extern void x_set_window_size (struct frame *, bool, int, int);
+extern void x_set_last_user_time_from_lisp (struct x_display_info *, Time);
+extern void x_make_frame_visible (struct frame *);
+extern void x_make_frame_invisible (struct frame *);
+extern void x_iconify_frame (struct frame *);
extern void x_free_frame_resources (struct frame *);
extern void x_wm_set_size_hint (struct frame *, long, bool);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 61a312ba0c: Update last event time during DND operations,
Po Lu <=