Commit 3f6441ea authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Improve the GDK API for dealing with group leaders (#119375):

Wed Dec 10 00:06:24 2003  Matthias Clasen  <maclas@gmx.de>

	Improve the GDK API for dealing with group leaders (#119375):

	* gdk/gdkwindow.h:
	* gdk/x11/gdkwindow-x11.c (gdk_window_get_group): New function to
	get the group leader of a toplevel window as a GdkWindow.

	* gdk/gdkdisplay.h:
	* gdk/x11/gdkdisplay-x11.c (gdk_display_get_default_group): New
	function to get the default group leader as a GdkWindow.

	* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a field for
	the GdkWindow of the default group leader.

	* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Construct the GdkWindow
	for the default group leader.
parent 451c0775
Wed Dec 10 00:06:24 2003 Matthias Clasen <maclas@gmx.de>
Improve the GDK API for dealing with group leaders (#119375):
* gdk/gdkwindow.h:
* gdk/x11/gdkwindow-x11.c (gdk_window_get_group): New function to
get the group leader of a toplevel window as a GdkWindow.
* gdk/gdkdisplay.h:
* gdk/x11/gdkdisplay-x11.c (gdk_display_get_default_group): New
function to get the default group leader as a GdkWindow.
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a field for
the GdkWindow of the default group leader.
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Construct the GdkWindow
for the default group leader.
2003-12-09 Noah Levitt <nlevitt@columbia.edu>
* gdk/gdkkeysyms.h:
......
Wed Dec 10 00:06:24 2003 Matthias Clasen <maclas@gmx.de>
Improve the GDK API for dealing with group leaders (#119375):
* gdk/gdkwindow.h:
* gdk/x11/gdkwindow-x11.c (gdk_window_get_group): New function to
get the group leader of a toplevel window as a GdkWindow.
* gdk/gdkdisplay.h:
* gdk/x11/gdkdisplay-x11.c (gdk_display_get_default_group): New
function to get the default group leader as a GdkWindow.
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a field for
the GdkWindow of the default group leader.
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Construct the GdkWindow
for the default group leader.
2003-12-09 Noah Levitt <nlevitt@columbia.edu>
* gdk/gdkkeysyms.h:
......
Wed Dec 10 00:06:24 2003 Matthias Clasen <maclas@gmx.de>
Improve the GDK API for dealing with group leaders (#119375):
* gdk/gdkwindow.h:
* gdk/x11/gdkwindow-x11.c (gdk_window_get_group): New function to
get the group leader of a toplevel window as a GdkWindow.
* gdk/gdkdisplay.h:
* gdk/x11/gdkdisplay-x11.c (gdk_display_get_default_group): New
function to get the default group leader as a GdkWindow.
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a field for
the GdkWindow of the default group leader.
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Construct the GdkWindow
for the default group leader.
2003-12-09 Noah Levitt <nlevitt@columbia.edu>
* gdk/gdkkeysyms.h:
......
Wed Dec 10 00:06:24 2003 Matthias Clasen <maclas@gmx.de>
Improve the GDK API for dealing with group leaders (#119375):
* gdk/gdkwindow.h:
* gdk/x11/gdkwindow-x11.c (gdk_window_get_group): New function to
get the group leader of a toplevel window as a GdkWindow.
* gdk/gdkdisplay.h:
* gdk/x11/gdkdisplay-x11.c (gdk_display_get_default_group): New
function to get the default group leader as a GdkWindow.
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a field for
the GdkWindow of the default group leader.
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Construct the GdkWindow
for the default group leader.
2003-12-09 Noah Levitt <nlevitt@columbia.edu>
* gdk/gdkkeysyms.h:
......
Wed Dec 10 00:06:24 2003 Matthias Clasen <maclas@gmx.de>
Improve the GDK API for dealing with group leaders (#119375):
* gdk/gdkwindow.h:
* gdk/x11/gdkwindow-x11.c (gdk_window_get_group): New function to
get the group leader of a toplevel window as a GdkWindow.
* gdk/gdkdisplay.h:
* gdk/x11/gdkdisplay-x11.c (gdk_display_get_default_group): New
function to get the default group leader as a GdkWindow.
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a field for
the GdkWindow of the default group leader.
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Construct the GdkWindow
for the default group leader.
2003-12-09 Noah Levitt <nlevitt@columbia.edu>
* gdk/gdkkeysyms.h:
......
Wed Dec 10 00:09:51 2003 Matthias Clasen <maclas@gmx.de>
* gdk/gdk-sections.txt: Add gdk_window_get_group(),
gdk_display_get_default_group().
2003-12-08 Federico Mena Quintero <federico@ximian.com>
* gtk/migrating-GtkAction.sgml: New chapter about how to migrate
......
......@@ -143,6 +143,7 @@ gdk_display_supports_cursor_color
gdk_display_supports_cursor_alpha
gdk_display_get_default_cursor_size
gdk_display_get_maximal_cursor_size
gdk_display_get_default_group
<SUBSECTION Standard>
GDK_DISPLAY_OBJECT
......@@ -704,6 +705,7 @@ gdk_window_set_icon_name
gdk_window_set_transient_for
gdk_window_set_role
gdk_window_set_group
gdk_window_get_group
gdk_window_set_decorations
gdk_window_get_decorations
GdkWMDecoration
......
......@@ -157,6 +157,8 @@ void gdk_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
GdkWindow *gdk_display_get_default_group (GdkDisplay *display);
G_END_DECLS
#endif /* __GDK_DISPLAY_H__ */
......@@ -484,6 +484,7 @@ void gdk_window_set_icon_name (GdkWindow *window,
const gchar *name);
void gdk_window_set_group (GdkWindow *window,
GdkWindow *leader);
GdkWindow* gdk_window_get_group (GdkWindow *window);
void gdk_window_set_decorations (GdkWindow *window,
GdkWMDecoration decorations);
gboolean gdk_window_get_decorations (GdkWindow *window,
......
......@@ -138,6 +138,7 @@ gdk_display_open (const gchar *display_name)
Display *xdisplay;
GdkDisplay *display;
GdkDisplayX11 *display_x11;
GdkWindowAttr attr;
gint argc;
gchar **argv;
const char *sm_client_id;
......@@ -174,9 +175,19 @@ gdk_display_open (const gchar *display_name)
/*set the default screen */
display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)];
display_x11->leader_window = XCreateSimpleWindow (display_x11->xdisplay,
GDK_SCREEN_X11 (display_x11->default_screen)->xroot_window,
10, 10, 10, 10, 0, 0, 0);
attr.window_type = GDK_WINDOW_TOPLEVEL;
attr.wclass = GDK_INPUT_OUTPUT;
attr.x = 10;
attr.y = 10;
attr.width = 10;
attr.height = 10;
attr.event_mask = 0;
display_x11->leader_gdk_window = gdk_window_new (GDK_SCREEN_X11 (display_x11->default_screen)->root_window,
&attr, GDK_WA_X | GDK_WA_Y);
display_x11->leader_window = GDK_WINDOW_XID (display_x11->leader_gdk_window);
display_x11->leader_window_title_set = FALSE;
display_x11->gravity_works = GDK_UNKNOWN;
......@@ -557,6 +568,25 @@ gdk_display_flush (GdkDisplay *display)
XFlush (GDK_DISPLAY_XDISPLAY (display));
}
/**
* gdk_display_get_default_group:
* @display: a #GdkDisplay
*
* Returns the default group leader window for all toplevel windows
* on @display. This window is implicitly created by GDK.
* See gdk_window_set_group().
*
* Return value: The default group leader window for @display
*
* Since: 2.4
**/
GdkWindow *gdk_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_X11 (display)->leader_gdk_window;
}
/**
* gdk_x11_display_grab:
* @display: a #GdkDisplay
......
......@@ -109,6 +109,7 @@ struct _GdkDisplayX11
/* Session Management leader window see ICCCM */
Window leader_window;
GdkWindow *leader_gdk_window;
gboolean leader_window_title_set;
/* list of filters for client messages */
......
......@@ -370,7 +370,7 @@ check_leader_window_title (GdkDisplay *display)
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
if (!display_x11->leader_window_title_set)
if (display_x11->leader_window && !display_x11->leader_window_title_set)
{
set_wm_name (display,
display_x11->leader_window,
......@@ -3869,10 +3869,37 @@ gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
setting ? GDK_WINDOW_STATE_BELOW : 0);
}
/**
* gdk_window_get_group:
* @window: a toplevel #GdkWindow
*
* Returns the group leader window for @window. See gdk_window_set_group().
*
* Return value: the group leader window for @window
*
* Since: 2.4
**/
GdkWindow *
gdk_window_get_group (GdkWindow *window)
{
GdkToplevelX11 *toplevel;
g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD, NULL);
if (GDK_WINDOW_DESTROYED (window))
return NULL;
toplevel = _gdk_x11_window_get_toplevel (window);
return toplevel->group_leader;
}
/**
* gdk_window_set_group:
* @window: a toplevel #GdkWindow
* @leader: group leader window
* @leader: group leader window, or %NULL to restore the default group leader window
*
* Sets the group leader window for @window. By default,
* GDK sets the group leader for all toplevel windows
......@@ -3894,13 +3921,15 @@ gdk_window_set_group (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
g_return_if_fail (leader != NULL);
g_return_if_fail (GDK_IS_WINDOW (leader));
g_return_if_fail (leader == NULL || GDK_IS_WINDOW (leader));
if (GDK_WINDOW_DESTROYED (window) || (leader != NULL && GDK_WINDOW_DESTROYED (leader)))
return;
toplevel = _gdk_x11_window_get_toplevel (window);
if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (leader))
return;
if (leader == NULL)
leader = gdk_display_get_default_group (gdk_drawable_get_display (window));
if (toplevel->group_leader != leader)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment