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 611313 - Window dragging from menubars/toolbars
Window dragging from menubars/toolbars
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.90.x
Other All
: Normal enhancement
: 3.0
Assigned To: gtk-bugs
gtk-bugs
: 621522 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-02-27 19:15 UTC by Cody Russell
Modified: 2014-08-14 20:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch for menubars (2.55 KB, patch)
2010-02-27 19:17 UTC, Cody Russell
none Details | Review
Updated patch (2.80 KB, patch)
2010-03-04 15:10 UTC, Cody Russell
none Details | Review
Add toolbar support (4.77 KB, patch)
2010-03-09 01:21 UTC, Cody Russell
none Details | Review
Move style property into GtkWidget (4.05 KB, patch)
2010-03-09 04:15 UTC, Cody Russell
none Details | Review
Properly disregards mouse events over GtkSeparatorToolItems (6.91 KB, patch)
2010-06-25 16:07 UTC, Ayan George
none Details | Review

Description Cody Russell 2010-02-27 19:15:21 UTC
So one thing that I was interested in doing as part of client-side-decorations was to make it so you can drag windows around from some of the 'chrome'-like regions of the window, which are typically things like menubars and toolbars.

At the moment when button press events pass down to the GtkWindow and it determines that it's in the inner part of the window then it goes into drag mode, but now it's clear that this is not a great idea.  Some apps handle button press events but still return FALSE (xchat-gnome, Evolution, WebKitGTK+) and going into window dragging mode creates problems.

So now I'm thinking of going a different direction with it, and attached to this bug is a first patch which implements support for this feature (via a style property) for menubars right now.  This does not depend upon c-s-d.
Comment 1 Cody Russell 2010-02-27 19:17:06 UTC
Created attachment 154862 [details] [review]
Proposed patch for menubars

This patch implements the proposed feature for menubars.  I'll implement another patch separately for toolbars.
Comment 2 Cody Russell 2010-02-27 19:35:39 UTC
Maybe the style property should be on GtkWindow though, because it seems stupid to have to specify this for menubars and toolbars separately in the theme.
Comment 3 Mikkel Kamstrup Erlandsen 2010-03-04 13:18:01 UTC
Add "See Also" bug: https://bugzilla.gnome.org/show_bug.cgi?id=500437
Comment 4 Cody Russell 2010-03-04 15:10:48 UTC
Created attachment 155231 [details] [review]
Updated patch
Comment 5 Matthias Clasen 2010-03-04 16:04:45 UTC
Looks ok in principle to me. 

Are you going to do the toolbar part too ?
Comment 6 Nikola Kovacs 2010-03-05 18:21:21 UTC
I have not tested the patch, but from experience with Chrome, I suspect this is going to cause problems with KDE 4.4 and its aero-snap (move window to top of screen to maximize, move away to unmaximize). Specifically, KWin unmaximizes a window as soon as it enters move mode (gtk_window_begin_move_drag), but this isn't a problem for KDE, because KWin windows don't enter move mode until you move the mouse or hold the mouse down for a few seconds on the titlebar.

See https://bugs.kde.org/show_bug.cgi?id=228819 and https://bugs.kde.org/show_bug.cgi?id=222100
Comment 7 Cody Russell 2010-03-05 19:41:01 UTC
It kind of seems like a KWin issue doesn't it?  compiz, and I think possibly metacity and mutter, have some kind of 'gravity' feature where if the window is maximized then you have to drag it a certain distance before it will unmaximize.  Chromium works just fine with that.

Either way, it's using _NET_WM_MOVERESIZE so KWin should be able to figure it out I think.
Comment 8 Cody Russell 2010-03-05 19:43:54 UTC
I guess what I mean is, why doesn't KWin behave the same way if an application invokes _NET_WM_MOVERESIZE?
Comment 9 Nikola Kovacs 2010-03-05 19:46:54 UTC
I don't know. All I know is that Chrome does something similar to what you're doing here (calling gtk_window_begin_move_drag when you click on the titlebar), and it has this bug.
Comment 10 Matthias Clasen 2010-03-07 20:59:09 UTC
One thing I'll point out is the we should respect drag-threshold here. Ie don't start moving immediately, but only after moving a certain distance with the button held.
Comment 11 Cody Russell 2010-03-09 01:21:10 UTC
Created attachment 155605 [details] [review]
Add toolbar support
Comment 12 Matthias Clasen 2010-03-09 03:59:15 UTC
I think you should move the style property to GtkWidget, probably, since I could see us adding this to the empty areas of status bars as well...
Comment 13 Cody Russell 2010-03-09 04:15:52 UTC
Created attachment 155612 [details] [review]
Move style property into GtkWidget
Comment 14 Cody Russell 2010-03-09 04:17:12 UTC
Or the empty areas of GtkNotebook.
Comment 15 Matthias Clasen 2010-03-10 07:03:00 UTC
Small complaints:

- There is a narrow band (1 pixel or so) on the left side between wm frame and first toolbutton/menuitem where I can drag the window, which I find mildly annoying

- What I find much more unexpected is that I get to drag the window by clicking on separators in the toolbar
Comment 16 Matthias Clasen 2010-05-30 23:11:43 UTC
Cody, we should wrap this up and get it committed.
Comment 17 Matthias Clasen 2010-06-14 21:41:27 UTC
*** Bug 621522 has been marked as a duplicate of this bug. ***
Comment 18 Ayan George 2010-06-25 16:07:31 UTC
Created attachment 164634 [details] [review]
Properly disregards mouse events over GtkSeparatorToolItems


The attached patch addresses the second complaint in the 15th comment -- that the window can be dragged by separators.
Comment 19 Matthias Clasen 2010-07-16 05:20:36 UTC
Committed the first patch together with a variation of the second (use an input-only event window for separators, and only eat button events if the separator is drawn (ie not just empty space).
Comment 20 Adam Smith 2014-08-14 20:23:35 UTC
Is there any chance this could be applied to the gtk-2-24 branch too?

I've been using it for a couple of months now and haven't found any problems so far.  I asked about this on launchpad to be included in Ubuntu (see https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/1332721 ) and they pointed me back in this direction....  I can raise a new gnome bug report if that is the best thing to do?