summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@math.utah.edu>2004-05-06 02:57:01 +0000
committerElijah Newren <newren@src.gnome.org>2004-05-06 02:57:01 +0000
commit5502f77eafdc207046d3cd14a47135f94ded827a (patch)
tree4fdcf0728c641508de8dae6a0623a52a5137772f
parent4ec2a42a4ee3c3a3b405eefa85f713f612369de9 (diff)
downloadgtk+-5502f77eafdc207046d3cd14a47135f94ded827a.tar.gz
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.
-rw-r--r--ChangeLog35
-rw-r--r--ChangeLog.pre-2-1035
-rw-r--r--ChangeLog.pre-2-635
-rw-r--r--ChangeLog.pre-2-835
-rw-r--r--docs/reference/gdk/gdk-sections.txt1
-rw-r--r--docs/reference/gdk/tmpl/windows.sgml9
-rw-r--r--docs/reference/gtk/gtk-sections.txt2
-rw-r--r--docs/reference/gtk/tmpl/gtkwindow.sgml9
-rw-r--r--gdk/gdkwindow.h3
-rw-r--r--gdk/linux-fb/gdkwindow-fb.c17
-rw-r--r--gdk/win32/gdkwindow-win32.c17
-rw-r--r--gdk/x11/gdkevents-x11.c4
-rw-r--r--gdk/x11/gdkinput-x11.c16
-rw-r--r--gdk/x11/gdkwindow-x11.c52
-rw-r--r--gdk/x11/gdkwindow-x11.h2
-rw-r--r--gtk/gtkwindow.c87
-rw-r--r--gtk/gtkwindow.h3
17 files changed, 346 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a0d83f8d4..359460a5ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+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.
+
Wed May 5 22:20:21 2004 Matthias Clasen <maclas@gmx.de>
Merge from 2.4:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 3a0d83f8d4..359460a5ab 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,38 @@
+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.
+
Wed May 5 22:20:21 2004 Matthias Clasen <maclas@gmx.de>
Merge from 2.4:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 3a0d83f8d4..359460a5ab 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,38 @@
+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.
+
Wed May 5 22:20:21 2004 Matthias Clasen <maclas@gmx.de>
Merge from 2.4:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 3a0d83f8d4..359460a5ab 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,38 @@
+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.
+
Wed May 5 22:20:21 2004 Matthias Clasen <maclas@gmx.de>
Merge from 2.4:
diff --git a/docs/reference/gdk/gdk-sections.txt b/docs/reference/gdk/gdk-sections.txt
index dd665b8f26..b0db5e301e 100644
--- a/docs/reference/gdk/gdk-sections.txt
+++ b/docs/reference/gdk/gdk-sections.txt
@@ -665,6 +665,7 @@ gdk_window_get_internal_paint_info
gdk_window_set_user_data
gdk_window_set_override_redirect
gdk_window_set_accept_focus
+gdk_window_set_focus_on_map
gdk_window_add_filter
gdk_window_remove_filter
GdkFilterFunc
diff --git a/docs/reference/gdk/tmpl/windows.sgml b/docs/reference/gdk/tmpl/windows.sgml
index 8a264b23df..b12ca3554c 100644
--- a/docs/reference/gdk/tmpl/windows.sgml
+++ b/docs/reference/gdk/tmpl/windows.sgml
@@ -750,6 +750,15 @@ Registers a window as a potential drop destination.
@accept_focus:
+<!-- ##### FUNCTION gdk_window_set_focus_on_map ##### -->
+<para>
+
+</para>
+
+@window:
+@focus_on_map:
+
+
<!-- ##### FUNCTION gdk_window_add_filter ##### -->
<para>
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index 229334b948..51c453a8de 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -4419,6 +4419,7 @@ gtk_window_set_type_hint
gtk_window_set_skip_taskbar_hint
gtk_window_set_skip_pager_hint
gtk_window_set_accept_focus
+gtk_window_set_focus_on_map
gtk_window_get_decorated
gtk_window_get_default_icon_list
gtk_window_get_default_size
@@ -4438,6 +4439,7 @@ gtk_window_get_type_hint
gtk_window_get_skip_taskbar_hint
gtk_window_get_skip_pager_hint
gtk_window_get_accept_focus
+gtk_window_get_focus_on_map
gtk_window_move
gtk_window_parse_geometry
gtk_window_reshow_with_initial_size
diff --git a/docs/reference/gtk/tmpl/gtkwindow.sgml b/docs/reference/gtk/tmpl/gtkwindow.sgml
index 38431d32bb..9c7adfc0b6 100644
--- a/docs/reference/gtk/tmpl/gtkwindow.sgml
+++ b/docs/reference/gtk/tmpl/gtkwindow.sgml
@@ -736,6 +736,15 @@ Deprecated alias for gtk_window_set_position().
@setting:
+<!-- ##### FUNCTION gtk_window_set_focus_on_map ##### -->
+<para>
+
+</para>
+
+@window:
+@setting:
+
+
<!-- ##### FUNCTION gtk_window_get_decorated ##### -->
<para>
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index bbc54c881c..83ce70391a 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -262,6 +262,7 @@ struct _GdkWindowObject
guint destroyed : 2;
guint accept_focus : 1;
+ guint focus_on_map : 1;
GdkEventMask event_mask;
};
@@ -321,6 +322,8 @@ void gdk_window_set_override_redirect (GdkWindow *window,
gboolean override_redirect);
void gdk_window_set_accept_focus (GdkWindow *window,
gboolean accept_focus);
+void gdk_window_set_focus_on_map (GdkWindow *window,
+ gboolean focus_on_map);
void gdk_window_add_filter (GdkWindow *window,
GdkFilterFunc function,
gpointer data);
diff --git a/gdk/linux-fb/gdkwindow-fb.c b/gdk/linux-fb/gdkwindow-fb.c
index 88af19f0c3..6f746df491 100644
--- a/gdk/linux-fb/gdkwindow-fb.c
+++ b/gdk/linux-fb/gdkwindow-fb.c
@@ -189,6 +189,7 @@ gdk_window_new (GdkWindow *parent,
private->parent = parent_private;
private->accept_focus = TRUE;
+ private->focus_on_map = TRUE;
if (attributes_mask & GDK_WA_X)
x = attributes->x;
@@ -2008,6 +2009,22 @@ gdk_window_set_accept_focus (GdkWindow *window,
private->accept_focus = accept_focus;
}
+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;
+}
+
void
gdk_window_set_icon (GdkWindow *window,
GdkWindow *icon_window,
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index ae67429e6c..79813cd67c 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -508,6 +508,7 @@ gdk_window_new (GdkWindow *parent,
private->parent = (GdkWindowObject *)parent;
private->accept_focus = TRUE;
+ private->focus_on_map = TRUE;
if (attributes_mask & GDK_WA_X)
private->x = attributes->x;
@@ -2228,6 +2229,22 @@ gdk_window_set_accept_focus (GdkWindow *window,
private->accept_focus = accept_focus;
}
+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;
+}
+
static HICON
pixbuf_to_hicon_alpha_winxp (GdkWindow *window,
GdkPixbuf *pixbuf)
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 37112363b7..6f31369af4 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -815,8 +815,8 @@ set_user_time (GdkWindow *window,
* 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));
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (window),
+ gdk_event_get_time (event));
}
static gboolean
diff --git a/gdk/x11/gdkinput-x11.c b/gdk/x11/gdkinput-x11.c
index f25ca8fd24..a920c27df5 100644
--- a/gdk/x11/gdkinput-x11.c
+++ b/gdk/x11/gdkinput-x11.c
@@ -588,8 +588,8 @@ _gdk_input_common_other_event (GdkEvent *event,
* 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));
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (input_window->window),
+ gdk_event_get_time (event));
return TRUE;
}
@@ -654,8 +654,8 @@ _gdk_input_common_other_event (GdkEvent *event,
* 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));
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (input_window->window),
+ gdk_event_get_time (event));
return TRUE;
}
@@ -690,8 +690,8 @@ _gdk_input_common_other_event (GdkEvent *event,
* 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));
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (input_window->window),
+ gdk_event_get_time (event));
return TRUE;
}
@@ -710,8 +710,8 @@ _gdk_input_common_other_event (GdkEvent *event,
* 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));
+ gdk_x11_window_set_user_time (gdk_window_get_toplevel (input_window->window),
+ gdk_event_get_time (event));
return TRUE;
}
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index da96795477..39e97d2b1e 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -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;
diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h
index 8dd75ea709..f76e061d4c 100644
--- a/gdk/x11/gdkwindow-x11.h
+++ b/gdk/x11/gdkwindow-x11.h
@@ -124,7 +124,7 @@ struct _GdkToplevelX11
GType gdk_window_impl_x11_get_type (void);
GdkToplevelX11 *_gdk_x11_window_get_toplevel (GdkWindow *window);
-void _gdk_x11_window_set_user_time (GdkWindow *window,
+void gdk_x11_window_set_user_time (GdkWindow *window,
guint32 timestamp);
G_END_DECLS
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index f80833d449..c07b0a50fe 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -75,6 +75,7 @@ enum {
PROP_SKIP_TASKBAR_HINT,
PROP_SKIP_PAGER_HINT,
PROP_ACCEPT_FOCUS,
+ PROP_FOCUS_ON_MAP,
PROP_DECORATED,
PROP_GRAVITY,
@@ -162,6 +163,7 @@ struct _GtkWindowPrivate
guint skips_taskbar : 1;
guint skips_pager : 1;
guint accept_focus : 1;
+ guint focus_on_map : 1;
};
static void gtk_window_class_init (GtkWindowClass *klass);
@@ -602,6 +604,21 @@ gtk_window_class_init (GtkWindowClass *klass)
G_PARAM_READWRITE));
/**
+ * GtkWindow:focus-on-map-hint:
+ *
+ * Whether the window should receive the input focus when mapped.
+ *
+ * Since: 2.6
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_FOCUS_ON_MAP,
+ g_param_spec_boolean ("focus_on_map",
+ P_("Focus on map"),
+ P_("TRUE if the window should receive the input focus when mapped."),
+ TRUE,
+ G_PARAM_READWRITE));
+
+ /**
* GtkWindow:decorated:
*
* Whether the window should be decorated by the window manager.
@@ -764,6 +781,7 @@ gtk_window_init (GtkWindow *window)
window->screen = gdk_screen_get_default ();
priv->accept_focus = TRUE;
+ priv->focus_on_map = TRUE;
colormap = _gtk_widget_peek_colormap ();
if (colormap)
@@ -859,6 +877,10 @@ gtk_window_set_property (GObject *object,
gtk_window_set_accept_focus (window,
g_value_get_boolean (value));
break;
+ case PROP_FOCUS_ON_MAP:
+ gtk_window_set_focus_on_map (window,
+ g_value_get_boolean (value));
+ break;
case PROP_DECORATED:
gtk_window_set_decorated (window, g_value_get_boolean (value));
break;
@@ -952,6 +974,10 @@ gtk_window_get_property (GObject *object,
g_value_set_boolean (value,
gtk_window_get_accept_focus (window));
break;
+ case PROP_FOCUS_ON_MAP:
+ g_value_set_boolean (value,
+ gtk_window_get_focus_on_map (window));
+ break;
case PROP_DECORATED:
g_value_set_boolean (value, gtk_window_get_decorated (window));
break;
@@ -2148,6 +2174,62 @@ gtk_window_get_accept_focus (GtkWindow *window)
}
/**
+ * gtk_window_set_focus_on_map:
+ * @window: a #GtkWindow
+ * @setting: %TRUE to let this window receive input focus on map
+ *
+ * Windows may set a hint asking the desktop environment not to receive
+ * the input focus when the window is mapped. This function sets this
+ * hint.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_window_set_focus_on_map (GtkWindow *window,
+ gboolean setting)
+{
+ GtkWindowPrivate *priv;
+
+ g_return_if_fail (GTK_IS_WINDOW (window));
+
+ priv = GTK_WINDOW_GET_PRIVATE (window);
+
+ setting = setting != FALSE;
+
+ if (priv->focus_on_map != setting)
+ {
+ priv->focus_on_map = setting;
+ if (GTK_WIDGET_REALIZED (window))
+ gdk_window_set_focus_on_map (GTK_WIDGET (window)->window,
+ priv->focus_on_map);
+ g_object_notify (G_OBJECT (window), "focus_on_map");
+ }
+}
+
+/**
+ * gtk_window_get_focus_on_map:
+ * @window: a #GtkWindow
+ *
+ * Gets the value set by gtk_window_set_focus_on_map().
+ *
+ * Return value: %TRUE if window should receive the input focus when
+ * mapped.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gtk_window_get_focus_on_map (GtkWindow *window)
+{
+ GtkWindowPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
+
+ priv = GTK_WINDOW_GET_PRIVATE (window);
+
+ return priv->focus_on_map;
+}
+
+/**
* gtk_window_set_destroy_with_parent:
* @window: a #GtkWindow
* @setting: whether to destroy @window with its transient parent
@@ -3915,6 +3997,11 @@ gtk_window_realize (GtkWidget *widget)
gdk_window_set_accept_focus (widget->window, TRUE);
else
gdk_window_set_accept_focus (widget->window, FALSE);
+
+ if (gtk_window_get_focus_on_map (window))
+ gdk_window_set_focus_on_map (widget->window, TRUE);
+ else
+ gdk_window_set_focus_on_map (widget->window, FALSE);
if (window->modal)
gdk_window_set_modal_hint (widget->window, TRUE);
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index da6b67a80b..bcf6963e00 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -204,6 +204,9 @@ gboolean gtk_window_get_skip_pager_hint (GtkWindow *window);
void gtk_window_set_accept_focus (GtkWindow *window,
gboolean setting);
gboolean gtk_window_get_accept_focus (GtkWindow *window);
+void gtk_window_set_focus_on_map (GtkWindow *window,
+ gboolean setting);
+gboolean gtk_window_get_focus_on_map (GtkWindow *window);
void gtk_window_set_destroy_with_parent (GtkWindow *window,
gboolean setting);
gboolean gtk_window_get_destroy_with_parent (GtkWindow *window);