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 149013 - GDK and GTK screens have different sizes in win32
GDK and GTK screens have different sizes in win32
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.4.x
Other Windows
: Normal minor
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-08-01 16:10 UTC by Kevin Stange
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kevin Stange 2004-08-01 16:10:55 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.
Comment 1 Daniel Atallah 2004-08-05 18:08:24 UTC
I believe that this is essentially the same bug as <a
href="http://bugzilla.gnome.org/show_bug.cgi?id=148526">148526</a>
Comment 2 Hans Breuer 2004-08-22 15:53:00 UTC
more disscusion about the SPI_WORKAREA usage is in bug #145467
Comment 3 Tor Lillqvist 2004-08-22 17:01:33 UTC
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)

Comment 4 Kevin Stange 2004-08-22 17:09:08 UTC
That means this fix should land in GTK 2.4.8 source/binaries?
Comment 5 Tor Lillqvist 2004-08-22 17:33:02 UTC
Yup.