static void x_check_font (struct frame *, struct font *);
#endif
+void
+x_display_set_last_user_time (struct x_display_info *dpyinfo, Time time)
+{
+ struct frame *focus_frame = dpyinfo->x_focus_frame;
+
+#ifdef ENABLE_CHECKING
+ eassert (t <= X_ULONG_MAX);
+#endif
+ dpyinfo->last_user_time = time;
+
+ if (focus_frame)
+ {
+ while (FRAME_PARENT_FRAME (focus_frame))
+ focus_frame = FRAME_PARENT_FRAME (focus_frame);
+
+ XChangeProperty (dpyinfo->display,
+ FRAME_OUTER_WINDOW (dpyinfo->x_focus_frame),
+ dpyinfo->Xatom_net_wm_user_time,
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &time, 1);
+ }
+}
+
/* Set S->gc to a suitable GC for drawing glyph string S in cursor
face. */
break;
case SelectionNotify:
- x_display_set_last_user_time (dpyinfo, event->xselection.time);
#ifdef USE_X_TOOLKIT
if (! x_window_to_frame (dpyinfo, event->xselection.requestor))
goto OTHER;
break;
case SelectionClear: /* Someone has grabbed ownership. */
- x_display_set_last_user_time (dpyinfo, event->xselectionclear.time);
#ifdef USE_X_TOOLKIT
if (! x_window_to_frame (dpyinfo, event->xselectionclear.window))
goto OTHER;
break;
case SelectionRequest: /* Someone wants our selection. */
- x_display_set_last_user_time (dpyinfo, event->xselectionrequest.time);
#ifdef USE_X_TOOLKIT
if (!x_window_to_frame (dpyinfo, event->xselectionrequest.owner))
goto OTHER;
break;
case PropertyNotify:
- x_display_set_last_user_time (dpyinfo, event->xproperty.time);
f = x_top_window_to_frame (dpyinfo, event->xproperty.window);
if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state)
{
goto OTHER;
case KeyPress:
-
x_display_set_last_user_time (dpyinfo, event->xkey.time);
ignore_next_mouse_click_timeout = 0;
#endif
case KeyRelease:
- x_display_set_last_user_time (dpyinfo, event->xkey.time);
#ifdef HAVE_X_I18N
/* Don't dispatch this event since XtDispatchEvent calls
XFilterEvent, and two calls in a row may freeze the
case MotionNotify:
{
- x_display_set_last_user_time (dpyinfo, event->xmotion.time);
previous_help_echo_string = help_echo_string;
help_echo_string = Qnil;
memset (&compose_status, 0, sizeof (compose_status));
dpyinfo->last_mouse_glyph_frame = NULL;
- x_display_set_last_user_time (dpyinfo, event->xbutton.time);
+
+ if (event->xbutton.type == ButtonPress)
+ x_display_set_last_user_time (dpyinfo, event->xbutton.time);
f = mouse_or_wdesc_frame (dpyinfo, event->xmotion.window);
if (f && event->xbutton.type == ButtonPress
goto XI_OTHER;
#endif
- x_display_set_last_user_time (dpyinfo, xi_event->time);
-
#ifdef HAVE_XWIDGETS
struct xwidget_view *xv = xwidget_view_from_window (xev->event);
double xv_total_x = 0.0;
bv.time = xev->time;
dpyinfo->last_mouse_glyph_frame = NULL;
- x_display_set_last_user_time (dpyinfo, xev->time);
+
+ if (xev->evtype == XI_ButtonPress)
+ x_display_set_last_user_time (dpyinfo, xev->time);
f = mouse_or_wdesc_frame (dpyinfo, xev->event);
}
case XI_KeyRelease:
- x_display_set_last_user_time (dpyinfo, xev->time);
-
#if defined HAVE_X_I18N || defined USE_GTK
- XKeyPressedEvent xkey;
-
- memset (&xkey, 0, sizeof xkey);
-
- xkey.type = KeyRelease;
- xkey.serial = xev->serial;
- xkey.send_event = xev->send_event;
- xkey.display = dpyinfo->display;
- xkey.window = xev->event;
- xkey.root = xev->root;
- xkey.subwindow = xev->child;
- xkey.time = xev->time;
- xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14))
- | (xev->group.effective << 13));
- xkey.keycode = xev->detail;
- xkey.same_screen = True;
+ XKeyPressedEvent xkey;
+
+ memset (&xkey, 0, sizeof xkey);
+
+ xkey.type = KeyRelease;
+ xkey.serial = xev->serial;
+ xkey.send_event = xev->send_event;
+ xkey.display = dpyinfo->display;
+ xkey.window = xev->event;
+ xkey.root = xev->root;
+ xkey.subwindow = xev->child;
+ xkey.time = xev->time;
+ xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14))
+ | (xev->group.effective << 13));
+ xkey.keycode = xev->detail;
+ xkey.same_screen = True;
#ifdef HAVE_X_I18N
- if (x_filter_event (dpyinfo, (XEvent *) &xkey))
- *finish = X_EVENT_DROP;
+ if (x_filter_event (dpyinfo, (XEvent *) &xkey))
+ *finish = X_EVENT_DROP;
#else
- f = x_any_window_to_frame (xkey->event);
+ f = x_any_window_to_frame (xkey->event);
- if (f && xg_filter_key (f, event))
- *finish = X_EVENT_DROP;
+ if (f && xg_filter_key (f, event))
+ *finish = X_EVENT_DROP;
#endif
#endif
case XI_GesturePinchEnd:
{
- x_display_set_last_user_time (dpyinfo, xi_event->time);
-
#if defined HAVE_XWIDGETS && HAVE_USABLE_XI_GESTURE_PINCH_EVENT
XIGesturePinchEvent *pev = (XIGesturePinchEvent *) xi_event;
struct xwidget_view *xvw = xwidget_view_from_window (pev->event);
void
x_make_frame_visible (struct frame *f)
{
+ struct x_display_info *dpyinfo;
+
if (FRAME_PARENT_FRAME (f))
{
if (!FRAME_VISIBLE_P (f))
block_input ();
gui_set_bitmap_icon (f);
+ dpyinfo = FRAME_DISPLAY_INFO (f);
if (! FRAME_VISIBLE_P (f))
{
&& ! f->output_data.x->asked_for_visible)
x_set_offset (f, f->left_pos, f->top_pos, 0);
+ if (dpyinfo->last_user_time)
+ XChangeProperty (dpyinfo->display,
+ FRAME_OUTER_WINDOW (f),
+ dpyinfo->Xatom_net_wm_user_time,
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &dpyinfo->last_user_time, 1);
+ else
+ XDeleteProperty (dpyinfo->display,
+ FRAME_OUTER_WINDOW (f),
+ dpyinfo->Xatom_net_wm_user_time);
+
f->output_data.x->asked_for_visible = true;
if (! EQ (Vx_no_window_manager, Qt))
ATOM_REFS_INIT ("_NET_WM_SYNC_REQUEST", Xatom_net_wm_sync_request)
ATOM_REFS_INIT ("_NET_WM_SYNC_REQUEST_COUNTER", Xatom_net_wm_sync_request_counter)
ATOM_REFS_INIT ("_NET_WM_FRAME_DRAWN", Xatom_net_wm_frame_drawn)
+ ATOM_REFS_INIT ("_NET_WM_USER_TIME", Xatom_net_wm_user_time)
/* Session management */
ATOM_REFS_INIT ("SM_CLIENT_ID", Xatom_SM_CLIENT_ID)
ATOM_REFS_INIT ("_XSETTINGS_SETTINGS", Xatom_xsettings_prop)