-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] Detection of window grabbing #2
Comments
Yes, this also how GTK does it client side. If you have lots of widgets in the decorations, dragging can become a huge problem unless you allow the user to drag from the widget. Is this possible @Zren ? |
First I'll need to get rid of the I don't think we can tell KDecoration to ignore the "press button", letting it fall through to the titlebar "move" unfortunately. There doesn't seem to be a "move" function anywhere in KDecoration either. So KWin is probably handling it. There's a
We can use that with https://doc.qt.io/qt-5/qstylehints.html#startDragDistance-prop Breeze has a "SizeGrip" in the bottom right which manually sends a
We can probably try
|
Click the very edge of a AppMenu button then dragging. It should trigger the move event.
|
DecorationButton::isPressed() remains true however, even after releasing the mouse. Not only is there a visual bug, but due to how KDecoration mouse events work, this means that clicking an AppMenu button after the currently "pressed" button will not open it's menu on the first click. Instead it will "reset" the pressed state of the previously pressed button.
I've gotten it working, however I'm not able to reset the "pressed" state of the button, so there a visual and functional bug. The first button press to open a menu item will be gobbled up to set "pressed = false" of the previously dragged button. |
Try the I've found a workaround for |
Just tried this and it works just fine. Should we also apply this to other buttons like Close/Min/Max... ? |
One issue could be improved is that the grabbing window should become the active one. |
I deliberately limited the effect to just the appmenu with https://github.com/Zren/material-decoration/blob/master/src/Decoration.cc#L177 You can remove the if check if you want to try applying the affect to all buttons. |
@Zren what about scroll and right-click events. I could see right-click-anywhere to maximize being useful here. As an added bonus, you can configure the same behavior in gtk CSD system-wide, so you could even get consistent wm behavior between CSD and SSD. I personally think scroll up/down anywhere to maximize/restore is more natural though, so there is value in that as well, esp for people who don't care about gtk CSD. |
The default Application Menu accepts Left and Right click to activate. I can definitely pass through Middle Button and wheel events though.
Tbh, I don't really care about enforcing a standard atm, I'll just pass through RightClick events too. |
We can also setAccepted(false) of LeftButton. Unfortunately I don't think there's a way to detect when the titlebar starts the drag, so we can't run unPressAllButtons to fix the sticky button underneath the drag. It causes the (possibly) wrong menu to open on next click. So we're stuck with manually sending a move event to X11.
@Zren On Ubuntu, it is possible to call the menu item by pressing left mouse button (mouse-down event), select the entry by moving the cursor, and then select it by releasing the button (mouse-up action). The same behavior also applies in some KDE apps - for example context menus in Dolphin or on desktop behave this way, so it is possible to select some submenu entry within only one whole click event. However, this trick doesn't work with material-decoration menu - if you press mouse button over one of the menu buttons, and then move cursor down (while keeping mouse button pressed), whole window is getting moved. Thanks. |
How did unity differentiate a "mousedown+drag" to open a menu from a "mousedown+drag" to move a window? |
I guess it works the way that when initial click was over empty space - "move window" action gets triggered on cursor move, and when it was over the menu button - then, the menu dropdown behavior I described above. So basically menu bar should somehow consume mouse events to make it all work. Maybe event consuming will be handled by system itself, if the menu dropdown is opened immediately after 'mouse-down' event, instead of being opened only on releasing the mouse button (as it is in the current version)? |
So you want it to never move the window when you press a menu item? So you want an option that will:
|
Yes, sounds about right! |
Basically, somehow making the menu buttons behave as if they were not there when I click and drag, and so just move the window around.
I do not know if this is possible, as there may be issues with the window manager or something (I really do not know much about this), but it would certainly take it to the next level, to the point where I could see this system become the standard. It is just too space-efficient. I love it.
Thanks for the work you are doing here. I hope it brings many people in to work it all out.
The text was updated successfully, but these errors were encountered: