GNOME Bugzilla – Bug 320881
Add accessors for _NET_ACTIVE_WINDOW and _NET_CLIENT_LIST_STACKING
Last modified: 2006-03-08 17:02:57 UTC
Attached patch from maemo-gtk adds gdk_screen_get_active_window() and gdk_screen_get_window_stack(), implemented using the properties mentioned in summary.
Created attachment 54424 [details] [review] Patch against HEAD implementing the functions
I don't think it makes sense to add wm-specific functions to gdk. This should really be left to libwnck
we already have wm-specific functions in gdk. usually the functions that make sense on an application level (rather than just a tasklist/wm-pager program) should go into gdk. i kinda see the point for gdk_screen_get_active_window() (that may be used by an application to decide whether it should grab focus or not), however i tend to agree with matthias that gdk_screen_get_window_stack() is prolly too wm specific to really make sense in gtk.
Mitch, what is your use case for get_active_window ?
I think Tim gave a good use case for get_active_window(). An app might decide whether to grab focus. I agree that get_window_stack() is a little more obscure, but then it's IMHO not too obscure to asume that an app wants to do different things depending on its position in the window stack. It's hard to draw a line between "belongs into gtk" and "belongs into libwnk", since it depends on the degree of "window management" an app wants to know about. I'm not overly keen on getting these functions in :) but they didn't seem useless when identifying maemo additions that are of general usefulness.
poked matthias on irc and he raised the issue of implementability on w32 and macos. accrodign to tml, the functions could be implementable on windows and according to andersca we might not be able to have them on macos. so i think we can commit these now and: - explain in the API docs that the functions may not work as well on non-X platforms (the docs can be adapted once other backends provide proper implementations) - we add NULL stubs to the w32 and macos backends when comitting (to avoid linkage errors due to missing functions).
Created attachment 60845 [details] [review] Patch updated according to comments above Here we go... But, I just noticed that the patch always calls gdk_window_foreign_new_for_display(). How is the app supposed to know which of the returned windows it owns? Shouldn't it return the existing GdkWindow for its own windows?
the use of gdk_window_foreign_new_for_display() is ok, it simply adds a reference for existing windows (according to the docs and code): http://developer.gnome.org/doc/API/2.0/gdk/gdk-X-Window-System-Interaction.html#gdk-window-foreign-new-for-display
Ah nice :) Does that mean the patch can go in?
You could use gdk_atom_intern_static_string, and I wonder why the docs speak about GdkWindow "wrappers", as opposed to GdkWindow objects. The docs should mention the EWMH (see how its done for other EWMH protocols) if (type_return != None) XFree (data); would be more obvious if it was if (data) XFree (data); The docs should mention how to free the return value. Other than that, the patch looks.
Created attachment 60903 [details] [review] Updated patch
Fixed in CVS: 2006-03-08 Michael Natterer <mitch@imendio.com> * gdk/gdkscreen.h * gdk/x11/gdkscreen-x11.c * gdk/gdk.symbols: added gdk_screen_get_active_window() and gdk_screen_get_window_stack() (patch from maemo-gtk). Fixes bug #320881. * gdk/directfb/gdkscreen-directfb.c * gdk/quartz/gdkscreen-quartz.c * gdk/win32/gdkscreen-win32.c: added the functions as stubs.