tcorreabr / Parachute

Look at your windows and desktops from above.
GNU General Public License v3.0
356 stars 32 forks source link

Added ability to switch windows using touch screen #51

Closed samkottler closed 3 years ago

samkottler commented 4 years ago

resolves #50

tcorreabr commented 4 years ago

I had already tried to move TapHandler from ScreenComponent to DesktopComponent, but this brings some unwanted side-effects related to keyboard selection or clicking on an empty desktop area to exit Parachute. But I saw that you had the idea to add the "case Qt.NoButton" in the onTapped event, and maybe that alone will solve the error of not responding to a touch. Can you test this since I don't use a touchscreen device?

samkottler commented 4 years ago

As far as I can tell the touchsceen handler has to be in DesktopComponent because otherwise it can't figure out which window is actually selected. That being said, I don't think that my commit breaks anything with keyboard selection. The only thing is that seems to be broken is that clicking somewhere with no window doesn't close the overlay anymore. I will fix this.

samkottler commented 4 years ago

OK. I fixed the problem. Now TapHandler in ScreenComponent ignores the touchscreen and the TapHandler in DesktopComponent only looks at the touchscreen. So all existing code for mouse and keyboard selection should work identically to how it already does.

tcorreabr commented 3 years ago

I am trying another way to move the two TapHandlers of ScreenComponent to only one in DesktopComponent. I think the code would improve that way. Can you confirm if "case Qt.NoButton" works for touchscreens? I haven't found proper documentation on this. Thanks for your contribution.

samkottler commented 3 years ago

On my touch screen Qt.NoButton works but I'm not sure it will work for all touch screens. However, it will also potentially use that for other input devices too. I think maybe a better solution would be to have separate cases based on which input device was used. When I modified my commit I did this by making the tap handler ignore touchscreen events and making a separate one that only accepts touchscreen events. I think you could also look at event.device and have separate cases for DeviceType.mouse and DeviceType.touchScreen. This way you could avoid having to handle Qt.NoButton.

tcorreabr commented 3 years ago

For now I will avoid creating another TapHandler and will just treat Qt.NoButton. If the problem persists in any way, I will recover your code. Thanks!