After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 320881 - Add accessors for _NET_ACTIVE_WINDOW and _NET_CLIENT_LIST_STACKING
Add accessors for _NET_ACTIVE_WINDOW and _NET_CLIENT_LIST_STACKING
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
2.8.x
Other All
: Normal enhancement
: Small API
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-11-07 14:47 UTC by Michael Natterer
Modified: 2006-03-08 17:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch against HEAD implementing the functions (5.08 KB, patch)
2005-11-07 14:49 UTC, Michael Natterer
none Details | Review
Patch updated according to comments above (7.95 KB, patch)
2006-03-07 16:34 UTC, Michael Natterer
none Details | Review
Updated patch (8.45 KB, patch)
2006-03-08 11:34 UTC, Michael Natterer
committed Details | Review

Description Michael Natterer 2005-11-07 14:47:44 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.
Comment 1 Michael Natterer 2005-11-07 14:49:29 UTC
Created attachment 54424 [details] [review]
Patch against HEAD implementing the functions
Comment 2 Matthias Clasen 2005-11-07 16:45:10 UTC
I don't think it makes sense to add wm-specific functions to gdk. 
This should really be left to libwnck
Comment 3 Tim Janik 2005-11-07 17:04:34 UTC
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.
Comment 4 Matthias Clasen 2005-11-07 19:47:06 UTC
Mitch, what is your use case for get_active_window ?
Comment 5 Michael Natterer 2005-12-19 12:32:21 UTC
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.
Comment 6 Tim Janik 2006-03-06 14:47:22 UTC
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).
Comment 7 Michael Natterer 2006-03-07 16:34:07 UTC
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?
Comment 8 Tim Janik 2006-03-07 17:04:08 UTC
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
Comment 9 Michael Natterer 2006-03-07 17:23:48 UTC
Ah nice :) Does that mean the patch can go in?
Comment 10 Matthias Clasen 2006-03-07 17:49:56 UTC
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.
Comment 11 Michael Natterer 2006-03-08 11:34:38 UTC
Created attachment 60903 [details] [review]
Updated patch
Comment 12 Michael Natterer 2006-03-08 17:02:57 UTC
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.