shutter-project / shutter

Screenshot tool for Linux
https://shutter-project.org/
GNU General Public License v3.0
526 stars 34 forks source link

"Section" doesn't work anymore with Gtk+ >= 2.18 (client-side windows) #25

Open Photon89 opened 4 years ago

Photon89 commented 4 years ago

http://library.gnome.org/devel/gtk/2.18/gtk-migrating-ClientSideWindows.html

We currently use XQueryTree (see: man XQueryTree) to query the window tree information of foreign windows. "GDK has been changed to use client-side windows. This means that there is no longer a 1-1 correspondence between GdkWindows and windows in the underlying window system."

Launchpad Details: #LP444358 Mario Kemper (Romario) - 2009-10-06 08:34:48 +0000

Photon89 commented 4 years ago

?!

Launchpad Details: #LPC Vadim Peretokin - 2009-10-06 12:05:15 +0000

Photon89 commented 4 years ago

Sorry for the short explanation - I was in a hurry.

The "Section" function queries the window tree information (a window consists of many subwindows) by calling an xlib function, XQueryTree. Before Gtk+ 2.18 most of the widgets had a corresponding xwindow. The information about the subwindows were used to detect them and draw a rectangle around them that illustrated their geometry.

The new Ubuntu release (Karmic Koala 9.10) delivers the latest Gnome and Gtk+ versions where GDK has been changed to use client-side windows. This means that the XServer no longer knows about the subwindow hierarchy of a Gtk+ window and we can't use the XQueryTree function any longer. Qt4.x does use something similar. You can test this with an Qt4.x application window like VirtualBox if you don't have a karmic installation available.

It is possible to query the children of a GDK-window, but this works only if your own application created that window. Shutter needs to get the children of foreign toplevel windows.

I don't have a clue how to fix that, but I'll send an e-Mail to the Gtk+ mailing list when I am back home. I'll post any answers here.

Launchpad Details: #LPC Mario Kemper (Romario) - 2009-10-06 12:32:58 +0000

Photon89 commented 4 years ago

One solution might be to use the accessibility framework: http://projects.gnome.org/accessibility/

Accerciser is using it (the python bindings) to query the structure of toplevel windows: http://live.gnome.org/GAP/PythonATSPI

There is also some work done to port AT-SPI to D-Bus (this would be the best solution for us): http://www.linuxfoundation.org/en/Accessibility/ATK/AT-SPI/AT-SPI_on_D-Bus

Launchpad Details: #LPC Mario Kemper (Romario) - 2009-10-06 13:12:54 +0000

Photon89 commented 4 years ago

Relevant thread (gtk-app-devel mailing list): http://markmail.org/thread/4at2gn6nsmdtmii5

Launchpad Details: #LPC Mario Kemper (Romario) - 2009-10-07 09:39:33 +0000