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 763806 - GtkWindow: fallback title context menu only has "Close" item
GtkWindow: fallback title context menu only has "Close" item
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-03-17 11:18 UTC by LRN
Modified: 2016-03-21 15:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Improve window title context popup menu fallback (5.77 KB, patch)
2016-03-17 11:19 UTC, LRN
none Details | Review
Improve window title context popup menu fallback (7.34 KB, patch)
2016-03-18 09:40 UTC, LRN
accepted-commit_after_freeze Details | Review

Description LRN 2016-03-17 11:18:57 UTC
It looks pathetic. More items should be added.
Comment 1 LRN 2016-03-17 11:19:03 UTC
Created attachment 324169 [details] [review]
Improve window title context popup menu fallback

Add "Minimize", "Maximize", "Restore" and "Move" items to the menu.
Comment 2 LRN 2016-03-17 11:29:37 UTC
Now, i've been planning to also add "Resize", but that proved to be more difficult than i thought. In fact, even "Move" probably doesn't work the way it should work.

Specifically: the idea, AFAIU, is that you should be able to move window with keyboard arrow keys instead of moving the mouse (because if you have a mouse, you can just grab&drag). But this relies on backends not assuming that pointer device is used for drag-moving. W32 backend, for example, makes that assumption (well, my version of drag-move does; not sure about W32 WM version). Don't know about others.

"Resize" is even more troublesome, as you need to have a way to indicate which edge you want to grip (and after that you also have to resize using arrow keys, not the mouse). W32 WM does that by capturing the keyboard after "Resize" item is chosen and waiting for an arrow key, which indicates the edge; then it begins resize operation on that edge, using arrow keys.


So if "Move" relies on backends doing the right thing, "Resize" seems to require more magic, half of which doesn't seem like something GTK should be doing, it's more up to GDK's alley (well, it should be WM that does this in the first place, but fallback is for cases when WM does *not*).

(alternatively, i could just turn "Resize" into a submenu, with an item for each of the resize edges; cheap and dirty; then it'll be the same problem as "Move" has - force it to use keyboard).

Also, iconifying maximized windows directly leads to a lot of warnings (which is why my patch first unmaximizes a window, then iconifies it). You might want to have that looked at, regardless.
Comment 3 Matthias Clasen 2016-03-17 19:31:04 UTC
Please compare the code that was removed in 0ea1a526f93411f8a2aef60dcb5a429a7694ca99

There's conditions under which we should not show some of these items, and the old code respected them.
Comment 4 LRN 2016-03-18 09:40:34 UTC
Created attachment 324241 [details] [review]
Improve window title context popup menu fallback

v2:
* Merged in conditions from 0ea1a526f93411f8a2aef60dcb5a429a7694ca99
* Added "Always On Top" item from 0ea1a526f93411f8a2aef60dcb5a429a7694ca99
* Studied 0ea1a526f93411f8a2aef60dcb5a429a7694ca99, discovered that
  button=0 is a special value that means "use keyboard for move/resize".
  X11 GDK backend understands that. Other backends can be made to understand
  that (and handling keyboard resize/move is a task for GDK anyway).
  Added "Resize" item that uses button=0, changed "Move" to use button=0.
* Factored out often-used piece of code to get GDK window state into a
  function.
Comment 5 Matthias Clasen 2016-03-18 10:54:41 UTC
Review of attachment 324241 [details] [review]:

Looks generally ok now. Maybe the labels should have message context (ie C_("Window menu", "Close") ? ). Lets hold this until after 3.20.0
Comment 6 Christoph Reiter (lazka) 2016-03-18 19:58:26 UTC
Tested on OSX: move and resize don't really work, but this will make it easier to test/fix those actions.
Comment 7 Matthias Clasen 2016-03-21 02:09:11 UTC
works fine under metacity