Skip to content
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

Add double-click maximise support to the x11 displayserver for the move decoration #6

Open
wants to merge 7 commits into
base: client_decor
Choose a base branch
from

Conversation

Mervius
Copy link

@Mervius Mervius commented Sep 1, 2024

This removes the break in the move section of the buttonpress statement to allow the input event to propagate to the buttonrelease and be processed as a double click to maximise and restore when double-clicking with the left mouse button. (Technically, this also allows the input to propagate to the gui_input signal in the editor itself, so you could just comment out the "drag_event = true;" and implement it in the engine with a script instead. But I don't think the implementations for the windows and macos displayservers allow that so probably shouldn't have that inconsistency...)

There is also some weirdness where it sometimes only needs a single button press to maximise or restore upon clicking the move decoration and I'm not entirely sure why. Edit: thinking it's because a triple-click and beyond still count as a double-click, so get counted with this implementation.

This is a very rudimentary implementation (and probably just plain bad in general), but it appears to be mostly functional.

It might also be better to implement it in buttonpress(that way you can uncomment "drag_event = true;" to prevent the input reaching the rest of the engine) and only apply it upon buttonrelease to match more closely what real titlebars do. But doing that would require implementing a double-click detector that doesn't get broken out of in buttonpress in addition to the one that already exists in buttonrelease

@Mervius
Copy link
Author

Mervius commented Sep 4, 2024

I moved the location of the double-click maximise into the buttonpress part of the code and out of the buttonrelease and re-added the break. I just used the double-click code from the buttonrelease part since it is already there and functional. I wasn't sure how much of it was needed, so I used all of it. Now the input doesn't propagate to the engine anymore and also doesn't continue to try to drag the window after double-clicking to maximise.

It could probably be cut down some or have the double click code set to its own function to reduce duplication, but it is functional.

@bruvzg bruvzg force-pushed the client_decor branch 5 times, most recently from c5311ca to f8765c0 Compare November 24, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants