Re: gdk_window_get_root_origin broke (on Win32) ?



Martyn Russell writes:
Looking at the ChangeLog the problem may have come from this bug fix:
http://bugzilla.gnome.org/show_bug.cgi?id=148526

No, I think it is because of the patch for
http://bugzilla.gnome.org/show_bug.cgi?id=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...

Now, 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
what window managers on X11 do, 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.

--tml





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]