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

Enhancement: Touchscreen/mouse interactions instead of keyboard #10

Open
jschwerdlin opened this issue Mar 12, 2021 · 8 comments
Open

Comments

@jschwerdlin
Copy link

I've got the 7" Pi touchscreen and was hoping to build this into the wall as a persistent display for my cameras, but would love to be able to interact via the touchscreen rather than a keyboard for obvious reasons

Ideal actions:
Double click on small video in grid to make it full screen
Double click on full screened video to go back to grid
Swipe left/right to go to the next/previous page of grid view or go to the next/previous camera in full screen mode

@jschwerdlin
Copy link
Author

FYI - I was able to hack something together by editing inputhandler.py, but it is VERY specialized to the RPi official 7" 800x480 screen with exactly 4 streams being shown. I only got the double click part working and it can be a bit flakey

Basically, in your event loop I added listening for BTN_TOUCH and EV_ABS. Any time I get a new position with ABS_X or ABS_Y I store it off.

I check for two clicks (BTN_TOUCH) events within 500ms of each other to declare a double click. If so and if we're already full screen, I inject a "0" keypress events into your queue to go back to the grid. If we're already in a grid, I inject a 1-4 keypress based on dividing the screen into quadrants and the most recent position reading to full screen the right stream.

It can be a bit flakey on the injection for some reason. It always detects the double click, but it seems that the event doesn't always cause an action to take place.

So, like I said, very specialized to that screen only (not a general screen and not a mouse) and to a 2x2 setup, but it could definitely be generalized. And maybe there is a more efficient way to trigger the events than injecting a fake keypress into the queue

@raspicamplayer
Copy link
Owner

@jschwerdlin Thanks for sharing, I may implement something similar for V2.

@jschwerdlin
Copy link
Author

FYI - I did fork your code and have committed into my fork so you can see the mods (I didn't do a pull request though). I fixed the flakey event injection and also was able to add swipe left/right support to change pages.

@cybermaus
Copy link

@raspicamplayer If you do get round to implementing such. I would suggest a mouse driver. My guess is that would also work for the touch screen, and it would work for normal monitors too, a cheap (wireless) mouse mouse is easier/cheaper/smaller to have nearby each monitor then a keyboard.

I am trying to figure out myself how to do this, but I am a bit of a noob in python. But I did get one fix/PR already, so who knows.

@cybermaus
Copy link

cybermaus commented Jul 17, 2021

I made a PR with a mouse gesture driver. #49

Somewhat similar to above, contained in InputHandler and injecting keystrokes. But using relative instead of absolute positioning. It should work for all grids and screen sizes.

@OtherwisePrickly
Copy link

@jschwerdlin I've just used your fork and it works great on a 1600x1200 touchscreen. @raspicamplayer thanks for making this great software.

@jschwerdlin
Copy link
Author

@Wilksj01 Glad you found it helpful. I'm guessing you had to make some mods though since the coordinate division is extremely tied to the 800x480 Pi screen, though I think it would be a really simple mod to work on a larger screen

@OtherwisePrickly
Copy link

OtherwisePrickly commented Jan 6, 2022

@jschwerdlin I just changed the lines where you listed the rules for upper left lower left etc with my resolution i.e. 800 for x rather than 400.

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

No branches or pull requests

4 participants