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 93586 - Allow shaking loose maximized windows (and moving maximized windows between workspaces using pick-up-and-drop)
Allow shaking loose maximized windows (and moving maximized windows between w...
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
unspecified
Other All
: High enhancement
: GNOME2.x
Assigned To: Metacity maintainers list
Metacity maintainers list
: 93188 93600 (view as bug list)
Depends on: 94111 95014
Blocks:
 
 
Reported: 2002-09-18 17:24 UTC by robert.kinsella
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Patch allows moving maximized windows between xinerama heads (3.70 KB, patch)
2002-11-16 09:44 UTC, Jürg Billeter
none Details | Review
Add "shake loose" and "hook in" features to Metacity and fix a multi-monitor work-area bug (7.75 KB, patch)
2003-02-06 14:51 UTC, Jürg Billeter
none Details | Review
Patch for shake loose / snap in, works only with patch of Bug 95014 (4.35 KB, patch)
2003-02-15 11:38 UTC, Jürg Billeter
none Details | Review
modified patch which fixes the problem with evolution that I observed. (4.17 KB, patch)
2003-02-22 02:25 UTC, Rob Adams
none Details | Review
Updated patch against metacity-2.5.2 (3.48 KB, patch)
2003-06-05 15:02 UTC, Jürg Billeter
none Details | Review
Updated patch as commented (4.67 KB, patch)
2003-06-11 08:48 UTC, Jürg Billeter
none Details | Review
patch in CVS (15.99 KB, patch)
2003-06-12 05:39 UTC, Havoc Pennington
none Details | Review

Description robert.kinsella 2002-09-18 17:24:46 UTC
Solaris sparc 9, Gnome nightly 16th Sept '02

Open any application, e.g. gnome-terminal.
Maximise the window, select alt-f7.

expected result:-
user should be able to move the window using the mouse or arrow keys.

actual result:- 
the window cannot be moved.

This can be a real problem if user experiences bug as reported in 91685 -
window borders go over edge of screen.
Comment 1 Calum Benson 2002-09-18 18:23:15 UTC
I'm not sure it's "expected"; no other desktop lets you move maximized
windows AFAIK.

It might be interesting to experiment with turning a maximized window
into a non-maximized-but-full-sized window when you tried to move it,
but I can imagine that might confusing too...
Comment 2 Havoc Pennington 2002-09-18 18:49:04 UTC
This bug is a dup, need to find the other one.

I don't think it's right in general to allow moving the window.

#91685 should just be fixed; it's never a bug that there's no way to
work around another bug, just fix the first bug. ;-)

I do think it would be nice to allow a maximized window to be "shaken
loose" if you grab it and move it far enough. At least you should be
able to drag a maximized window between xinerama heads. So I do want
to experiment there as Calum says. But I don't want clicking a
maximized window and moving just a few pixels to result in
unmaximizing; you should be able to click-to-focus on the titlebar for
example without fear of unmaximizing accidentally.
Comment 3 Havoc Pennington 2002-09-18 20:43:06 UTC
*** Bug 93600 has been marked as a duplicate of this bug. ***
Comment 4 Josh Waldren 2002-09-18 21:30:30 UTC
oh I didnt know it was a dup, sorry, its good that others feel the same:-)
Comment 5 Daryl Stimm 2002-09-22 01:54:37 UTC
Yeah I have been asking for this feature too, I would love to be able
to move a maximized window.
Comment 6 Havoc Pennington 2002-09-22 02:04:25 UTC
I'd take a patch for the "shake loose" feature (allow moving the
maximized window by unmaximizing it if the window is moved by some N
number of pixels threshold).
Comment 7 Calum Benson 2002-09-23 11:20:33 UTC
where N is some factor of the system drag and drop threshold and not
some hard-coded value I trust :)
Comment 8 Havoc Pennington 2002-09-24 20:31:39 UTC
*** Bug 93188 has been marked as a duplicate of this bug. ***
Comment 9 Heath Harrelson 2002-11-01 14:51:53 UTC
It be correct to close this bug and open a new one for the "shake
loose" enhancement, no?
Comment 10 Havoc Pennington 2002-11-01 16:14:18 UTC
Let's just change this one to the feature request.
Comment 11 Heath Harrelson 2002-11-01 16:36:59 UTC
Okay, thanks.
Comment 12 Jürg Billeter 2002-11-16 09:44:38 UTC
Created attachment 12336 [details] [review]
Patch allows moving maximized windows between xinerama heads
Comment 13 Jürg Billeter 2002-11-16 09:45:39 UTC
I'm also missing the feature to move maximized windows among xinerama
heads. I'm new in coding for gnome (linux generally) but I've tried to
implement something like that for my own purpose. Perhaps you can use
it altough it is not perfectly solved.

See attached patch (to 2.4.3).
Comment 14 Havoc Pennington 2002-11-16 17:17:41 UTC
So a UI question here is whether to move between monitors you need to
"shake loose" (thus unmaximizing the window), move the window, then 
re-maximize on the other monitor; or whether to just snap to xinerama 
monitors and don't allow shaking loose otherwise.

I'd lean a bit toward the "shake loose" since it solves the problem
more generally.
Comment 15 Jürg Billeter 2002-11-16 23:19:17 UTC
The problem with "shake loose" is that - as you've written - one has 
to re-maximize the window after moving it. I wouldn't prefer this 
method - I got used to it in Windows some time ago (with add-on 
tool).

A compromise is perhaps if we can add another function like "hook 
in" a window - the exact opposite of "shake loose". Probably this 
should only be enabled if the user had just before shaken the window 
loose. I hope you understand my idea despite my English. What do you 
think about it? When I get time, I'll try to implement it.
Comment 16 Havoc Pennington 2002-11-16 23:31:37 UTC
I can see some sort of "hook in" feature working well, though it will 
probably require some experimentation to make it smooth. Agree that 
it would probably only "auto-hook-in" if the window was maximized at
the start of the move operation.
Comment 17 Jürg Billeter 2003-02-06 14:49:00 UTC
I've implemented the shake loose and the hook/snap in feature. I 
just installed it on my main system, I definitively don't want to 
miss that anymore... ;)

BTW: During the tests I've found a bug in metacity: The 
meta_window_get_work_area() function returns sometimes a too large 
area. Concrete situation to reproduce the problem: Xinerama with two 
monitors, the secondary right monitor has more vertical pixels. 
Enable the standard gnome panels (one top, one bottom) and maximize 
a window on the left monitor. A port of the window will be covered 
by the bottom panel. I've (hopefully) fixed this bug and included it 
in the patch, because it is multi-monitor-related, too. Or is it too 
off-topic and shall I open an other bug?
Comment 18 Jürg Billeter 2003-02-06 14:51:00 UTC
Created attachment 14163 [details] [review]
Add "shake loose" and "hook in" features to Metacity and fix a multi-monitor work-area bug
Comment 19 Havoc Pennington 2003-02-06 17:12:17 UTC
Thanks for the patch, I'm out of town for a bit here but 
once I get back and put out any large fires I'll have a look at this
(and other pending metacity patches)
Comment 20 Rob Adams 2003-02-09 06:57:10 UTC
Xinerama work-areas are fixed in a (hopefully) definitive manner in
the per-xinerama work areas patch in #95014.  This is still pending,
and it will conflict pretty heavily with the changes you made to work
areas in this patch.

Try playing around with that patch and see if it fixes the problem
that you're describing.

-Rob
Comment 21 Jürg Billeter 2003-02-09 16:09:06 UTC
Thanks for the clue with Bug 95014. I should have looked at the bug 
list first... I don't have access at my xinerama system at the 
moment. In about a week I'll test your patch and adapt my patch, so 
it will use the new xinerama work area calculation functions.
Comment 22 Jürg Billeter 2003-02-15 11:35:57 UTC
I adapted my patch to work well with the patch of Bug 95014 and use
one of its new functions.
Comment 23 Jürg Billeter 2003-02-15 11:38:49 UTC
Created attachment 14346 [details] [review]
Patch for shake loose / snap in, works only with patch of Bug 95014
Comment 24 Rob Adams 2003-02-15 18:35:31 UTC
Oh baby that patch rocks my world.  Totally sweet.  This is the kind
of thing that just makes life worth living.  This is elevated to "I
can no longer live without it" status, and I only applied it two
minutes ago.
Comment 25 Rob Adams 2003-02-20 17:01:09 UTC
there's something fishy going on here.  I usually run evolution
maximized on the right xinerama on my system.  When I start it up, it
starts on the left xinerama.  So I try to move it over to the right by
dragging without unmaximizing first.  Seems great.  But as soon as I
do an action that changes the evolution display (such as viewing a
different message, or changing the folder, but not clicking a menu or
button), it "pops" back to the old xinerama.  This only seems to
happen with evolution but there are probably other apps that this
affects.  It also only happens if I've moved it to another xinerama by
shaking it loose then snapping it in.
Comment 26 Rob Adams 2003-02-20 17:14:51 UTC
Another quick comment -- when the window is unmaximized, it should be
moved so that the titlebar is under the pointer.
Comment 27 Rob Adams 2003-02-22 02:25:45 UTC
Created attachment 14523 [details] [review]
modified patch which fixes the problem with evolution that I observed.
Comment 28 Havoc Pennington 2003-02-22 21:13:18 UTC
bug #94111 results in this patch being a bit confusing, since the 
current code is clearly hosed it's hard to know if this code 
is right. This may be something that's most efficient if 
I go in and sort it out myself.
Comment 29 Rob Adams 2003-02-22 21:48:05 UTC
Now that I think about it more, I wonder if this is a race condition
somewhere.  Really the only difference between what my modification
does and the original patch did is that maximizing gets put into the
idle queue rather than happening immediately.
Comment 30 Jürg Billeter 2003-03-05 19:23:28 UTC
Just to be sure: there is nothing concrete I can do, as I have to 
wait until Havoc isn't anymore as busy, or?
Comment 31 Havoc Pennington 2003-03-05 19:48:07 UTC
well I think bug #94111 needs sorting out, if someone wants to look 
at that and make it all rational that may speed things up. 
Otherwise I'll get to it when I can.
Comment 32 Calum Benson 2003-03-24 18:10:28 UTC
I haven't tried the patch but I notice it hard-codes a
shake_loose_threshold, which I presume is the amount you need to click
and drag before a maximised window becomes movable.

I'd say we ought to use the system drag threshold for this (as defined
in the Mouse Preferences dialog), or at least be some multiple of it.
Comment 33 Calum Benson 2003-03-25 18:33:52 UTC
See also bug #107776, which discusses the amount of snap/gravity
panels now have-- I think this "shaking loose" feature probably ought
to share that setting, so Havoc and Mark probably need to talk about
this :)
Comment 34 Kjartan Maraas 2003-05-11 15:39:20 UTC
This isn't Solaris specific, is it? Change the OS to reflect that?
Comment 35 Calum Benson 2003-05-12 11:46:59 UTC
No, it's not... changed to 'All'.
Comment 36 Jürg Billeter 2003-06-05 15:00:24 UTC
I've updated my patch to not (wrongly) multiply the
meta_window_{,un}maximize functions, this fixes an issue with a
wrongly saved rect after snap in. It's also updated to apply against
metacity-2.5.2 with my patch of Bug 94111.
Comment 37 Jürg Billeter 2003-06-05 15:02:29 UTC
Created attachment 17175 [details] [review]
Updated patch against metacity-2.5.2
Comment 38 Jürg Billeter 2003-06-06 09:14:34 UTC
I forgot to mention that the threshold is still hard-coded. I wanted
to change this but I couldn't find a nice way of using the already
defined drag and drop threshold. The only function I found was
gtk_drag_check_threshold () but it needs a GtkWidget wheras there is
none. If anyone has a suggestion for a better solution I'm happy to
update my patch.
Comment 39 Jürg Billeter 2003-06-10 08:24:55 UTC
Havoc, could you please comment? - I don't want to miss this feature
in Gnome 2.4.

Thx
Comment 40 Havoc Pennington 2003-06-11 04:45:17 UTC
I didn't try this patch out but it looks pretty reasonable and it's 
pretty much how I would implement the feature. Removing the 
has_move_func = FALSE for maximized windows should be correct 
based on my understanding of bug 94111.

As always, a few random comments:

 - the way to do the drag threshold is exactly the way 
   we're currently doing the double click timeout - you 
   may want to have a look at that, meta_ui_get_double_click_timeout()
or something in ui.c. Look at the source 
   code to gtk_drag_check_threshold() in gtk/gtkdnd.c also. You don't
want to 
   use gtk_drag_check_threshold() though since you only 
   care about the Y coordinate.

 - in the initial shake loose case, it seems you only update 
   saved_rect if the window has a frame. Don't you need to 
   handle the no-frame case? The idea here is so the shaken-loose 
   window appears at the current pointer position right?

 - I think updating the saved_rect could maybe use a short 
   comment saying why we're doing it. Or maybe just a comment 
   before all the shake loose stuff saying what the overall block 
   of code does. Maybe even break the shake loose code 
   into a separate function like check_shake_loose() but I'm 
   not sure that works out well, use your judgment.

 - "guint shaken_loose : 1" should be "unsigned int shaken_loose : 1"
    and should be up alongside other bitfields so they are all 
    packed together in memory

 - when moving between xineramas, can you think of a way to avoid 
   the flicker of unmaximizing then remaximizing? Would it 
   work to just meta_window_move_resize() over to the new Xinerama?

Anyhow, see what you think of these ideas and implement the ones that
make sense to you, attach a new patch and I think we'll go ahead and
put it in.

Thanks
Comment 41 Jürg Billeter 2003-06-11 08:46:07 UTC
Thx for your comments. I've updated my patch as following:

- According to your comments on bug 94111 I've adapted this patch to
work without a patch to bug 9411 and to reflect the intended use of
the variables, i.e. I've changed the META_WINDOW_ALLOWS_MOVE macro to
include maximized windows as the has_move_func shall be independent of
the maximized status.

- The double_click_time is implemented (in display.c BTW) as a member
variable of MetaDisplay whereas the value is once initialized and then
remains constant. I've left my threshold implementation as it is
because I don't know if you want me to add a shake_loose_threshold
member to MetaDisplay. If you intended to change it this way, I'll try
that. As far as I understand it, we can't use something similar to
gtk_drag_check_threshold as gtk uses widget attributes.

- The save_rect issue shall be fixed now, the repositioning works now
very nice. Thx for the hint, I don't know what I thought of while
doing this that badly...

- I've added some comments here and there.

- Changed the bitfield declaration as proposed but I don't understand
why this shall be a "unsigned int" wheras all other bitfields are
"guint"s.

- I couldn't find a way to avoid the flicker. I tried it in my first
two patches with meta_window_move_resize but that leads to the race
condition noticed and fixed by Rob. But as you didn't try out the
patch you couldn't see that one doesn't really notice the flicker and
as you can see in the code it only shows up when moving directly
between two heads (without ever going beyond the threshold). So I
don't think it's an issue.

I hope everything is ok now.
Comment 42 Jürg Billeter 2003-06-11 08:48:57 UTC
Created attachment 17431 [details] [review]
Updated patch as commented
Comment 43 Havoc Pennington 2003-06-11 15:51:20 UTC
Ah, on the unsigned int thing I was confused; normally I never use 
guint, but apparently I adopted that policy post-writing-metacity.

I think you must be looking at older source code for the
double_click_time thing; it's different in CVS.

I can polish up the remaining issues here and commit if you want.
Comment 44 Jürg Billeter 2003-06-11 16:00:16 UTC
Ah ok. Committing would be nice :)

Thx
Comment 45 Havoc Pennington 2003-06-12 05:39:33 UTC
Created attachment 17479 [details] [review]
patch in CVS
Comment 46 Havoc Pennington 2003-06-12 05:40:43 UTC
I checked in the attached patch, cleaned up some unrelated mess 
I stumbled on in the process.

If I broke things, please file new bugs for each specific breakage.

Thanks a lot!