GNOME Bugzilla – Bug 645032
Moving between monitors not working right for maximized windows
Last modified: 2011-03-21 23:59:27 UTC
When dragging a fullscreen window between two monitors in the overview things seem to be correct, and when initially exiting the overview it seems right. But, immediately the fullscreened window is then re-positioned to the monitor it was initially on.
Sorry, by fullscreened i really mean maximized.
Created attachment 183659 [details] [review] Add and export meta_window_move_to_monitor This is useful for DnD to another monitor in gnome-shell. In addition to a normal move it corrects the saved rect for maximized and fullscreened windows.
Created attachment 183660 [details] [review] Use the new meta_window_move_to_monitor function
Review of attachment 183659 [details] [review]: ::: src/core/window.c @@ +4682,3 @@ + * @monitor: desired monitor index + * + * Moves the window so that it is positioned on the monitor with index @monitor. I think you should say there with the frame at 0, 0, and if that's something that might change later, say that too. That is, make it clear whether bug 645029 is here or this has defined code and bug 645029 is something that has to be handled by the caller. @@ +4703,3 @@ + /* For maximized or fullscreened windows, we really move + the saved_rect to the new screen so that they unmaximize there too */ + if (META_WINDOW_MAXIMIZED (window) || window->fullscreen) What about tiled windows or horizontally/vertically only maximized windows? I think saved_rect can matter for these cases too. Is there any reason not to always move saved_rect to the new workspace? ::: src/meta/window.h @@ +96,3 @@ void meta_window_move(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw); void meta_window_move_frame(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw); +void meta_window_move_to_monitor (MetaWindow *window, gboolean user_op, int monitor); Some weird spaces
Review of attachment 183659 [details] [review]: ::: src/core/window.c @@ +4697,3 @@ + + x = geometry.x; + y = geometry.y; Also, do you want the monitor x/y or the workarea-within-monitor x/y?
Review of attachment 183660 [details] [review]: Might be good to have a very brief body explaining why it's better this way. Looks good to commit when the Mutter patch lands
The idea is not to position at 0,0 but at a "good" place. To be defined later as bug 645029 is actually implemented. However, fmueller already has some code for this, so i expect new patches soon.
Created attachment 183927 [details] [review] Add and export meta_window_move_to_monitor This is useful for DnD to another monitor in gnome-shell. In addition to a normal move it corrects the saved rect for maximized and fullscreened windows. Updated patch to keep the relative window position and use the work area rather than the entire monitor space.
Created attachment 183928 [details] [review] Remove user_op parameter of meta_window_move_to_monitor() Even when the function is called due to a user action, the actual window placement is still entirely up to mutter, so it makes sense to have additional constrains (like fitting the window to the monitor) apply to the actual position. This patch is meant to be merged with the previous one, if we can agree on the rationale.
Created attachment 183929 [details] [review] Adjust to removal of user_op parameter in move_to_monitor() To be merged with attachment 183660 [details] [review] if the user_op parameter is removed.
Review of attachment 183927 [details] [review]: ::: src/core/window.c @@ +4810,3 @@ + scale_y = (double)new_area.height / old_area.height; + + /* move the window, so that the center is at the same relative position */ While this helps making sure we would not accidentally end up on another monitor I don't think this is what users expect, is it? If the window is in the top left corner, don't we still want it in the top-left corner on the new monitor?
Review of attachment 183928 [details] [review]: Yeah, i agree with this.
Not going to review my own patches :)
Created attachment 183991 [details] [review] Add and export meta_window_move_to_monitor This is useful for DnD to another monitor in gnome-shell. In addition to a normal move it corrects the saved rect for maximized and fullscreened windows. Merged the user_op parameter removal patch, went back to positioning relative to the top-left corner.
Created attachment 183992 [details] [review] Use the new meta_window_move_to_monitor function Merged attachment 183660 [details] [review] and attachment 183929 [details] [review].
Review of attachment 183991 [details] [review]: Seems fine to me, though I think we might want to tweek the algorithm in the future. I think it's more intuitive to keep the ratio of "space to left"/"space to right" than the relative position of the upper left corner. If I have a window all the way to the right of the screen, I probably want it their on the new monitor too.
Comment on attachment 183991 [details] [review] Add and export meta_window_move_to_monitor Attachment 183991 [details] pushed as c5d1d2d - Add and export meta_window_move_to_monitor (In reply to comment #16) > Review of attachment 183991 [details] [review]: > Seems fine to me, though I think we might want to tweek the algorithm in the > future. I think it's more intuitive to keep the ratio of "space to left"/"space > to right" than the relative position of the upper left corner. If I have a > window all the way to the right of the screen, I probably want it their on the > new monitor too. Yeah, I agree that this will need some future tweaking - we'll also need to take the frame decoration into account (which is not part of the user_rect iirc).
Attachment 183992 [details] pushed as 8282db4 - Use the new meta_window_move_to_monitor function