GNOME Bugzilla – Bug 763806
GtkWindow: fallback title context menu only has "Close" item
Last modified: 2016-03-21 15:52:00 UTC
It looks pathetic. More items should be added.
Created attachment 324169 [details] [review] Improve window title context popup menu fallback Add "Minimize", "Maximize", "Restore" and "Move" items to the menu.
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.
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.
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.
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
Tested on OSX: move and resize don't really work, but this will make it easier to test/fix those actions.
works fine under metacity