GNOME Bugzilla – Bug 323820
Moving maximized windows between xineramas doesn't work properly
Last modified: 2006-09-28 01:00:49 UTC
As part of the "tear-off" unmaximizing code, it was possible to drag a window from one xinerama to the other without actually having it unmaximize by dragging the titlebar horizontally. Now, if you try that, it will repeatedly unmaximize and maximize the window but stay "stuck" on the old xinerama, unless you bring the titlebar far enough down to trigger the normal tear off, then drag it over, then hook it back into the top of the other xinerama. Also, when doing this, it sometimes seems to treat the xinerama boundary like a screen boundary instead of a regular edge.
*** Bug 333329 has been marked as a duplicate of this bug. ***
*** Bug 337534 has been marked as a duplicate of this bug. ***
See also bug 315622, which is kind of related, though about the old (intentional) behavior being unintuitive rather than about a bug in the new behavior being uncompatible with the old. For those not swamped with metacity bugs and interested in looking into this problem; the answer can probably be found between meta_window_get_work_area_current_xinerama(), setup_constraint_info(), constrain_maximization(), and update_move() (in the last function, I basically ignored the "remaximize" section of the code when rewriting the constraints as it was difficult at the time to grok and I couldn't test; I assumed leaving it alone despite other changes wouldn't cause problems but this bug seems to say otherwise).
I can confirm this bug. It worked in Ubuntu Breezy, but I now have Ubuntu Dapper flight6 (pre-release) and it doesn't work anymore. I don't think the old behaviour was unintuitive. Indeed, I discovered the functionality by "intuition" and I was very happy that this worked.
Hehe, the cause of the bug is pretty simple and will be easy to fix. Maximization means make the window the size of the workarea of "the xinerama". When you're moving a window though, there's two different xineramas to consider -- the one which best fits the previous position of the window and the one that best fits the new proposed position of the window. The current code always computes "the xinerama" as being the one corresponding to the old position of the window. Thus the reason for this bug. To fix this, just make setup_constraint_info() use the new position of the window instead of the old in computing info->work_area_xinerama and info->entire_xinerama. There is code in place_window_if_needed() that computes the xinerama this way, which may be helpful.
*** Bug 341879 has been marked as a duplicate of this bug. ***
*** Bug 344541 has been marked as a duplicate of this bug. ***
Created attachment 67302 [details] [review] Patch for constraints.c I created a patch as described in the comments above. To get the correct xinerama information, I used meta_screen_get_current_xinerama() that uses the location of the pointer. In fact meta_screen_get_xinerama_for_rect() would return the correct xinerama only when the cursor has passed half of the new screen, which is not the expected behaviour. Using the pointer makes sense as the user surely wants to put the window on the monitor where the cursor is, instead of the one with the major part of the window on it.
*** Bug 345382 has been marked as a duplicate of this bug. ***
I've tested this patch, and it works fine. (Am I allowed to confirm patches? I'm not sure.) Stéphane: thanks a whole lot! Just one thing: next time, please use the "-up" switches to cvs diff so that you get a unified diff; they're much easier for us to work with.
Crap, I missed this patch for the release yesterday since it was in the commented-on state. Doh! Sorry about that. Anyway, the patch looks good, I've just got a minor nit (besides the -up thing Thomas mentioned) -- the patch bases the xinerama decision on the mouse position rather than where the majority of the window is. While both should be fine, I think I'd prefer based off where the majority of the window is. Besides, that will allow us to avoid a roundtrip to the x-server. :) So, I made a minor change to the patch to do that and committed it. 2006-08-07 Elijah Newren <newren gmail com> * src/constraints.c (setup_constraint_info): patch from Stéphane Rosi to allow moving maximized windows between xineramas again. #323820 Thanks for the work!
*** Bug 334830 has been marked as a duplicate of this bug. ***