GNOME Bugzilla – Bug 119375
Add way to get default group leader window
Last modified: 2011-02-04 16:12:26 UTC
We should make the default leader window for the application a GdkWindow and have a way of retrieving it, maybe: GdkWindow *gdk_display_get_default_group (GdkDisplay *display); Other possibly useful additions to GDK in this area * Make gdk_window_set_group (window, NULL); restore the window back to the default group leader * gdk_window_get_group()
It would be nice to fix at least the simplest parts of bug 68557 for 2.4, which would require this.
Here is a patch, untested beyond compilation.
Created attachment 19046 [details] [review] patch
I dislike the use of gdk_window_foreign_new_for_display() here ... gdk_window_foreign_new_for_display() needs to do several round trips to the server and is really not meant for windows that GDK is creating itself. I think it shouldn't be too hard to make display_x11->leader_window a GdkWindow and just use gdk_window_new() for it.
Hmm, we already use gdk_window_foreign_new for self-created windows (cf motif_drag_gdk_window). Changing to gdk_window_new will a) incur some overhead, e.g. we would create a focus window, map it, add a bunch of unnecessary properties to the leader, etc. b) not entirely trivial, since it would be called while the display is not completely setup yet. gdk_window_new () assumes the display is completely initialized, e.g. it calls check_leader_window_title() which assumes leader_window to be already there). These complications are the reason why I went for the lazy creation of leader_gdk_window in the first place. If you want to avoid gdk_window_foreign_new despite a), we should probably go to a even more lazy initialization. That would mean replacing all direct uses of display->leader_window by _gdk_x11_display_get_leader_window () though, which would have to create the window if necessary.
Created attachment 21303 [details] [review] new patch
New patch which avoids the use of gdk_window_foreign_new_for_display (). This could probably be simplified by getting rid of leader_window altogether. Or rather, get rid of leader_gdk_window and make leader_window a GdkWindow.
Patch looks fine to commit