+Sun Apr 18 16:15:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ Support for _NET_WM_USER_TIME (bug 115650). Patch by Elijah
+ Newren.
+
+ * gdk/x11/gdkwindow-x11.[ch]: Add new internal function
+ _gdk_x11_set_user_time() to set the _NET_WM_USER_TIME property.
+
+ * gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add user_time field
+
+ * gdk/x11/gdkdisplay-x11.c: Add _NET_WM_USER_TIME to list of
+ precached atoms.
+
+ * gdk/x11/gdkinput-x11.c, gdk/x11/gdkevents-x11.c: Set the
+ property on user interaction.
+
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesel.c (open_new_dir): Tell the user to use
+Sun Apr 18 16:15:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ Support for _NET_WM_USER_TIME (bug 115650). Patch by Elijah
+ Newren.
+
+ * gdk/x11/gdkwindow-x11.[ch]: Add new internal function
+ _gdk_x11_set_user_time() to set the _NET_WM_USER_TIME property.
+
+ * gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add user_time field
+
+ * gdk/x11/gdkdisplay-x11.c: Add _NET_WM_USER_TIME to list of
+ precached atoms.
+
+ * gdk/x11/gdkinput-x11.c, gdk/x11/gdkevents-x11.c: Set the
+ property on user interaction.
+
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesel.c (open_new_dir): Tell the user to use
+Sun Apr 18 16:15:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ Support for _NET_WM_USER_TIME (bug 115650). Patch by Elijah
+ Newren.
+
+ * gdk/x11/gdkwindow-x11.[ch]: Add new internal function
+ _gdk_x11_set_user_time() to set the _NET_WM_USER_TIME property.
+
+ * gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add user_time field
+
+ * gdk/x11/gdkdisplay-x11.c: Add _NET_WM_USER_TIME to list of
+ precached atoms.
+
+ * gdk/x11/gdkinput-x11.c, gdk/x11/gdkevents-x11.c: Set the
+ property on user interaction.
+
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesel.c (open_new_dir): Tell the user to use
+Sun Apr 18 16:15:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ Support for _NET_WM_USER_TIME (bug 115650). Patch by Elijah
+ Newren.
+
+ * gdk/x11/gdkwindow-x11.[ch]: Add new internal function
+ _gdk_x11_set_user_time() to set the _NET_WM_USER_TIME property.
+
+ * gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add user_time field
+
+ * gdk/x11/gdkdisplay-x11.c: Add _NET_WM_USER_TIME to list of
+ precached atoms.
+
+ * gdk/x11/gdkinput-x11.c, gdk/x11/gdkevents-x11.c: Set the
+ property on user interaction.
+
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesel.c (open_new_dir): Tell the user to use
+Sun Apr 18 16:15:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ Support for _NET_WM_USER_TIME (bug 115650). Patch by Elijah
+ Newren.
+
+ * gdk/x11/gdkwindow-x11.[ch]: Add new internal function
+ _gdk_x11_set_user_time() to set the _NET_WM_USER_TIME property.
+
+ * gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add user_time field
+
+ * gdk/x11/gdkdisplay-x11.c: Add _NET_WM_USER_TIME to list of
+ precached atoms.
+
+ * gdk/x11/gdkinput-x11.c, gdk/x11/gdkevents-x11.c: Set the
+ property on user interaction.
+
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesel.c (open_new_dir): Tell the user to use
"_NET_WM_STATE_FULLSCREEN",
"_NET_WM_WINDOW_TYPE",
"_NET_WM_WINDOW_TYPE_NORMAL",
+ "_NET_WM_USER_TIME",
};
GType
display_x11->leader_window,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"),
XA_CARDINAL, 32, PropModeReplace, (guchar *) & pid, 1);
+
+ /* We don't yet know a valid time. */
+ display_x11->user_time = 0;
#ifdef HAVE_XKB
{
/* Startup notification */
gchar *startup_notification_id;
+ /* Time of most recent user interaction. */
+ gulong user_time;
+
/* Sets of atoms for DND */
guint base_dnd_atoms_precached : 1;
guint xdnd_atoms_precached : 1;
};
#endif
+void
+set_user_time (GdkWindow *window,
+ GdkEvent *event)
+{
+ g_return_if_fail (event != NULL);
+
+ window = gdk_window_get_toplevel (event->client.window);
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ /* If an event doesn't have a valid timestamp, we shouldn't use it
+ * to update the latest user interaction time.
+ */
+ if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
+ _gdk_x11_window_set_user_time (gdk_window_get_toplevel (window),
+ gdk_event_get_time (event));
+}
+
static gboolean
gdk_event_translate (GdkDisplay *display,
GdkEvent *event,
break;
}
translate_key_event (display, event, xevent);
+ set_user_time (window, event);
break;
case KeyRelease:
break;
}
+ set_user_time (window, event);
break;
case ButtonRelease:
event->button.x, event->button.y,
xdbe->button));
+ /* Update the timestamp of the latest user interaction, if the event has
+ * a valid timestamp.
+ */
+ if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (input_window->window),
+ gdk_event_get_time (event));
return TRUE;
}
event->key.keyval,
event->key.state));
+ /* Update the timestamp of the latest user interaction, if the event has
+ * a valid timestamp.
+ */
+ if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (input_window->window),
+ gdk_event_get_time (event));
return TRUE;
}
(xdme->is_hint) ? "true" : "false"));
+ /* Update the timestamp of the latest user interaction, if the event has
+ * a valid timestamp.
+ */
+ if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (input_window->window),
+ gdk_event_get_time (event));
return TRUE;
}
event->proximity.window = input_window->window;
event->proximity.time = xpne->time;
+ /* Update the timestamp of the latest user interaction, if the event has
+ * a valid timestamp.
+ */
+ if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (input_window->window),
+ gdk_event_get_time (event));
return TRUE;
}
gdk_x11_get_xatom_by_name_for_display (screen_x11->display, "WM_CLIENT_LEADER"),
XA_WINDOW, 32, PropModeReplace,
(guchar *) &GDK_DISPLAY_X11 (screen_x11->display)->leader_window, 1);
+
+ if (GDK_DISPLAY_X11 (screen_x11->display)->user_time != 0)
+ _gdk_x11_window_set_user_time (window, GDK_DISPLAY_X11 (screen_x11->display)->user_time);
}
/**
}
}
+/**
+ * _gdk_x11_window_set_user_time:
+ * @window: A toplevel #GdkWindow
+ * @timestamp: An XServer timestamp to which the property should be set
+ *
+ * The application can use this call to update the _NET_WM_USER_TIME
+ * property on a toplevel window. This property stores an Xserver
+ * time which represents the time of the last user input event
+ * received for this window. This property may be used by the window
+ * manager to alter the focus, stacking, and/or placement behavior of
+ * windows when they are mapped depending on whether the new window
+ * was created by a user action or is a "pop-up" window activated by a
+ * timer or some other event.
+ *
+ * Note that this property is automatically updated by GDK, so this
+ * function should only be used by applications which handle input
+ * events bypassing GDK.
+ **/
+void
+_gdk_x11_window_set_user_time (GdkWindow *window,
+ guint32 timestamp)
+{
+ GdkDisplay *display;
+ GdkDisplayX11 *display_x11;
+
+ g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
+ display = gdk_drawable_get_display (window);
+ display_x11 = GDK_DISPLAY_X11 (display);
+
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
+ gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_USER_TIME"),
+ XA_CARDINAL, 32, PropModeReplace,
+ (guchar *)×tamp, 1);
+
+ if (timestamp != GDK_CURRENT_TIME)
+ display_x11->user_time = timestamp;
+}
/**
* gdk_window_set_icon_list:
GType gdk_window_impl_x11_get_type (void);
-GdkToplevelX11 *_gdk_x11_window_get_toplevel (GdkWindow *window);
+GdkToplevelX11 *_gdk_x11_window_get_toplevel (GdkWindow *window);
+void _gdk_x11_window_set_user_time (GdkWindow *window,
+ guint32 timestamp);
G_END_DECLS