GNOME Bugzilla – Bug 149013
GDK and GTK screens have different sizes in win32
Last modified: 2004-12-22 21:47:04 UTC
We have a win32 workaround in Gaim for our tooltip shadows (we fetch the pixmap under where we draw the shadows) involving a bug as follows: In Win32, GDK gets the workarea that isn't occupied by toolbars (including the taskbar) and uses that region as the screen size. GTK returns positions based on a screen size that ignores these toolbars (the full sized dimensions). Since we want a pixmap with real X,Y coordinates, we need to find out the offset from GTK's screen to GDK's screen, and adjust the pixmaps we grab accordingly. GDK does not deal with toolbar position updates, so we're stuck restarting Gaim if that happens. As another example of this, try using the GtkColorPicker in Win32 with the taskbar or another on-top toolbar at the top and/or left of the screen. Pick the eyedropper and try to pick a color up from a window. Gtk will get the color for the pixel you clicked minus the width of the toolbar on the left/top because GDK's screen starts "later." I am not familiar with the GTK source or building in Win32, so I'm not quite prepared to touch this bug myself, but it seems like it would be relatively easy to fix, conceptually provided there isn't some good reason for the offset between the screens. The following windows API code gets the starting top and left coordinates of the work area (area not covered by toolbars), which we simply add to the GDK coordinates to find the right pixels on the GTK screen. RECT *workarea = g_malloc(sizeof(RECT)); SystemParametersInfo(SPI_GETWORKAREA, 0, (void *)workarea, 0); x += (workarea->left); y += (workarea->top); g_free(workarea); Also noteworthy, the space at the bottom or right of the screen of the width of the toolbars on the top or left is completely gibberish and renders as fragmented pieces of the screen pixmap.
I believe that this is essentially the same bug as <a href="http://bugzilla.gnome.org/show_bug.cgi?id=148526">148526</a>
more disscusion about the SPI_WORKAREA usage is in bug #145467
gdk/win32 no longer uses SPI_GETWORKAREA. Presumably it fixes this bug. Applied to HEAD and gtk-2-4: 2004-08-22 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdisplay-win32.c (enum_monitor, gdk_display_open): Report whole of (primary) monitor, including any taskbars. Excluding the taskbar area from the "root window" reported to GDK doesn't seem to be that useful although gdk/win32 had been doing it for a very long time. (#149013, see also #145467 and #148526)
That means this fix should land in GTK 2.4.8 source/binaries?
Yup.