GNOME Bugzilla – Bug 448183
Changing position of a window by sending _NET_MOVERESIZE_WINDOW does not work
Last modified: 2008-05-22 19:40:16 UTC
+++ This bug was initially created as a clone of Bug #447413 +++ See the test available in bug 447413. It sends a resize & move request to the window manager. Resizing works, but moving doesn't. I've quickly traced this in metacity, and it seems the new position is correct in meta_window_move_resize_internal() when this debug message is printed: meta_topic (META_DEBUG_GEOMETRY, "Compensated for configure_request/do_gravity_adjust needing " "weird positioning; new pos %d,%d\n", new_rect.x, new_rect.y); And the new position is wrong when this is printed: meta_topic (META_DEBUG_GEOMETRY, "Syncing new client geometry %d,%d %dx%d, border: %s pos: %s size: %s\n", newx, newy, window->rect.width, window->rect.height, mask & CWBorderWidth ? "true" : "false", need_move_client ? "true" : "false", need_resize_client ? "true" : "false");
*** Bug 447413 has been marked as a duplicate of this bug. ***
Small update: You can use the wnckprop utility in svn head to play with this. If you do "wnckprop --set-x 10 --set-y 30", it works. If you do "wnckprop --set-width 100 --set-height 300", it works. If you do "wnckprop --set-x 10 --set-y 30 --set-width 100 --set-height 300", it doesn't work.
Created attachment 105459 [details] Metacity log snippet from sample code of bug 447413 With wnck and metacity trunks, none of these commands seem to work. I also tried with Compiz - it doesn't work either. However, using the test code from bug 447413, made resizing work. I can't grok why window movement doesn't work. I've attached what I estimate to be the relevant part of the metacity log.
I just ran the test from bug 447413 with Compiz as my WM and everything worked as expected (100x100 window at top left of screen).
As my log indicates it is constrain_size_increments() in constraints.c that is the culprit. It calls down into meta_rectangle_resize_with_gravity() in boxes.c in which the new window position is overwritten. Commenting out the lines (288 and 321 in rev.3572) overwriting the new rect positions in the case of N, NW, and NE gravity does indeed fix the bug. However it does also make the constraints when resizing in these directions non-functional.
The point of the meta_rectangle_resize_with_gravity() in constraints.c was to fix old resize bugs: 1) Window has min width 100 2) User grabs left edge of window and starts moving it right 3) We notice the window becomes too narrow, and grow it to the right size Step #3 is broken if we grow the wrong side. And we used to always grow the wrong side in this particular case. There were lots of variations on this theme, but the idea is simply that when *resizing* the constraints need to know what the position of the window was before the resize. For a *move AND resize*, the original position of the window is irrelevant. Unfortunately, the current code doesn't treat it as such. I'm pretty sure the fix is simply to pass &info->current as the first argument to meta_rectangle_resize_with_gravity when info->action_type == ACTION_MOVE_AND_RESIZE, and pass &info->orig (as it currently does) when info->action_type == ACTION_RESIZE. It looks like this fix is needed in three places in constraints.c. Vincent: I'm pretty sure we have some libwnck or metacity bugs requesting Mikkel's promised features in his blog, so as soon as he writes his little tool we can close out those bugs. Oh, and I'm pretty sure there's a number of other dups of this bug going back to the early 300xxx range. :-(
Created attachment 105578 [details] [review] Patch as described by Elijah Here's a stab at implementing what ELijah describes. It mskrd the test from bug 447413 work, but the wnckprop examples Vincent describes still doesn't work. Probably a bug in wnckprop..? The constraints still seem to work correctly after the patch is applied.
(In reply to comment #7) > Here's a stab at implementing what ELijah describes. It mskrd the test from bug > 447413 work, but the wnckprop examples Vincent describes still doesn't work. > Probably a bug in wnckprop..? Hrm. wnckprop is of course supposed to be perfect :-) Weird. If the patch is okay, please open a libwnck bug. (I still hope that wnckprop is perfect and that your patch is wrong in some way, though ;-))
Vincent: Sorry, see bug 517570 :-)
To round this up: With the wnckprop patch attached to bug 517570, I can confirm the behavior Vincent describes in comment 2. With both the patch for this bug, and for the wnck bug, everything works.
(In reply to comment #9) > Vincent: Sorry, see bug 517570 :-) Wasn't a bug in wnckprop, lalalala :-) (sorry for the spam, but it's really important to get this right publicly ;-))
Cool, thanks for fixing this. :) Anyone want to volunteer to find the duplicates? I'm pretty sure Magnus Therning had one floating around somewhere...
Digging around I was only able to find: Bug 118598 - Feature Request: Window Packing Bug 446789 - _NET_MOVERESIZE_WINDOW support fails Bug 148364 – Enhanced EWHM compliance There's an old tracker bug too, but it does not contain much related to this bug: Bug 155458 – TRACKER: moving & resizing bugs (and placement, if constraint related). Of those I think bug 446789 and bug 148364 could be closed, but I lack the developer pondus to do so.
*** Bug 446789 has been marked as a duplicate of this bug. ***
Thanks, committed. Marking as fixed.
*** Bug 534135 has been marked as a duplicate of this bug. ***