Changes to support do-not-focus-on-map hint in conjunction with

2004-05-05  Elijah Newren  <newren@math.utah.edu>

	Changes to support do-not-focus-on-map hint in conjunction with
	_NET_WM_USER_TIME (#115650):

	* gdk/gdkwindow.h (struct _GdkWindowObject): Add a new boolean
	field focus_on_map

	* gdk/gdkwindow.h (gdk_window_set_accept_focus): New function to
	set it.

	* gtk/gtkwindow.[hc]: Add a boolean property "focus_on_map"
	and gtk_window_get_focus_on_map() and gtk_window_set_focus_on_map().

	* gdk/win32/gdkwindow-win32.c (gdk_window_new):
	* gdk/linux-fb/gdkwindow-fb.c (gdk_window_new):
	* gdk/x11/gdkwindow-x11.c (gdk_window_new):
	Initialize the focus_on_map field to TRUE.

	* gdk/win32/gdkwindow-win32.c (gdk_window_set_focus_on_map):
	* gdk/linux-fb/gdkwindow-fb.c (gdk_window_set_focus_on_map):
	* gdk/x11/gdkwindow-x11.c (gdk_window_set_focus_on_map):
	* gdk/x11/gdkwindow-x11.c (setup_toplevel_window):
	Implementations for the various backends. The Win32 and linux-fb
	implementations set the focus_on_map field, but don't use it yet
	to actually implement noinput windows. The X implementation sets
	_NET_WM_USER_TIME to 0 if focus_on_map is FALSE (see the EWMH).

	* gdk/x11/gdkwindow-x11.h:
	* gdk/x11/gdkevents-x11.c (set_user_time):
	* gdk/x11/gdkinput-x11.c (_gdk_input_common_other_event):
	* gdk/x11/gdkwindow-x11.c (gdk_x11_window_set_user_time):
	s/_gdk_x11_window_set_user_time/gdk_x11_window_set_user_time/,
	since we want that function to be part of the public API.
This commit is contained in:
Elijah Newren
2004-05-06 02:57:01 +00:00
committed by Elijah Newren
parent 4ec2a42a4e
commit 5502f77eaf
17 changed files with 346 additions and 16 deletions

View File

@ -458,8 +458,10 @@ setup_toplevel_window (GdkWindow *window, GdkWindow *parent)
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);
if (!obj->focus_on_map)
gdk_x11_window_set_user_time(window, 0);
else 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);
}
/**
@ -543,6 +545,7 @@ gdk_window_new (GdkWindow *parent,
private->parent = (GdkWindowObject *)parent;
private->accept_focus = TRUE;
private->focus_on_map = TRUE;
xattributes_mask = 0;
@ -3312,7 +3315,44 @@ gdk_window_set_accept_focus (GdkWindow *window,
}
/**
* _gdk_x11_window_set_user_time:
* gdk_window_set_focus_on_map:
* @window: a toplevel #GdkWindow
* @focus_on_map: %TRUE if the window should receive input focus when mapped
*
* Setting @focus_on_map to %FALSE hints the desktop environment that the
* window doesn't want to receive input focus when it is mapped.
* focus_on_map should be turned off for windows that aren't triggered
* interactively (such as popups from network activity).
*
* On X, it is the responsibility of the window manager to interpret
* this hint. Window managers following the freedesktop.org window
* manager extension specification should respect it.
*
* Since: 2.6
**/
void
gdk_window_set_focus_on_map (GdkWindow *window,
gboolean focus_on_map)
{
GdkWindowObject *private;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
private = (GdkWindowObject *)window;
focus_on_map = focus_on_map != FALSE;
if (private->focus_on_map != focus_on_map)
{
private->focus_on_map = focus_on_map;
if ((!GDK_WINDOW_DESTROYED (window)) && (!private->focus_on_map))
gdk_x11_window_set_user_time (window, 0);
}
}
/**
* gdk_x11_window_set_user_time:
* @window: A toplevel #GdkWindow
* @timestamp: An XServer timestamp to which the property should be set
*
@ -3328,10 +3368,12 @@ gdk_window_set_accept_focus (GdkWindow *window,
* Note that this property is automatically updated by GDK, so this
* function should only be used by applications which handle input
* events bypassing GDK.
*
* Since: 2.6
**/
void
_gdk_x11_window_set_user_time (GdkWindow *window,
guint32 timestamp)
gdk_x11_window_set_user_time (GdkWindow *window,
guint32 timestamp)
{
GdkDisplay *display;
GdkDisplayX11 *display_x11;