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 152481 - gdk_window_get_root_origin fails on Windows
gdk_window_get_root_origin fails on Windows
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
2.4.x
Other Windows
: High major
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-09-13 09:22 UTC by Martyn Russell
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case to demonstrate the bug. (1.26 KB, application/x-gzip)
2004-09-13 09:24 UTC, Martyn Russell
Details

Description Martyn Russell 2004-09-13 09:22:09 UTC
calling this function on Windows, with a window type of GTK_WINDOW_POPUP only
returns 0 for x and y.

calling gdk_window_get_position works fine.
Comment 1 Martyn Russell 2004-09-13 09:24:08 UTC
Created attachment 31525 [details]
test case to demonstrate the bug.
Comment 2 Tor Lillqvist 2004-09-13 22:09:51 UTC
This is caused by of the patch for bug #145481 . That patch added a
call to gdk_window_set_skip_taskbar_hint (window, TRUE) for
GDK_WINDOW_TEMP windows after they have been created, so that TEMP
windows aren't visible in the task manager.

Now, gdk_window_set_skip_taskbar_hint() works by setting the owner of
a toplevel window. The Win32 concepts of owner and parent windows are
often confused, but they are different. Toplevel windows can be owned,
but don't have to be. Toplevel windows don't have parents. The
GetParent() API furthers the confusion by actually returning *either*
the parent *or* owner of a window, and even more confusing, to set the
owner of a toplevel window you set something called GWL_HWNDPARENT...

The problem with gdk_window_get_root_origin() and TEMP windows is
actually in gdk_window_get_frame_extents(), which it calls. That
function has a quite bogus loop that claims to "find the frame window"
by calling GetParent() until the arriving at HWND_DESKTOP. This is
crap, leftovers from blindly copying what the X11 backend
does. Unlike how window managers on X11 work, in Windows the
"decorations" of toplevel windows aren't windows by themselves. There
is no "frame window". And the parent of toplevel windows isn't the
HWND_DEKSTOP either, unlike X11 where the root window is the ultimate
parent of all windows.

The loop in gdk_window_get_frame_extents() happens to work because the
value of HWND_DESKTOP is actually 0, so when GetParent() returns 0 for
errors or unowned toplevel windows, the code thinks it means the
desktop window... Thus it used to work, more or less by accident, but now when 
TEMP windows are owned, the loop finds the (hidden) owner window and thinks 
that it is a "frame window". Oooh aaah smack me harder.

That loop serves no purpose and can be removed altogether.

Comment 3 Tor Lillqvist 2004-09-15 18:37:55 UTC
Fixed in HEAD and gtk-2-4.