shoes / shoes3

a tiny graphical app kit for ruby
http://walkabout.mvmanila.com
Other
179 stars 19 forks source link

Touchscreen scrolling by dragging content #447

Open mashedkeyboard opened 5 years ago

mashedkeyboard commented 5 years ago

I'm using Shoes on a touchscreen device - is it possible to enable scrolling by dragging on the content rather than only on the scrollbar, as you'd expect from other applications, in some way?

I can't see an obvious way to implement this from within the Shoes DSL.

ccoupe commented 4 years ago

Hi @mashedkeyboard . As you've noted, Shoes doesn't know about touch devices or drag. There are api's in the underlying Gtk3 and Cocoa libraries and perhaps we can get something working in Shoes. Perhaps re-purposing the wheelmethod would work for your example? I don't have a touch device to test with - what are you using and which OS ?

mashedkeyboard commented 4 years ago

I'm using Linux (Raspbian) with a Raspberry Pi Touch display.

ccoupe commented 4 years ago

Good - that's easier for me to work with than say a $2000 mac laptop. Which display? I might want one for my pi3. There aren't a lot of raspbian programs that use gtk3 (last I Iooked) - we need to know how gtk3 libs deal with that device starting with "Do they see it".

mashedkeyboard commented 4 years ago

It's the official Raspberry Pi touch display - nothing fancy :)

I'm not too familiar with GTK's inner workings - is there some debug output I could provide that would be useful?

ccoupe commented 4 years ago

Of course you want to try a web browser or two. There's boat load of stuff available if you set the right environment vars but don't do that - it's too hard, confusing and probably wont tell us what we want to know. I've got a Wacom tablet around here somewhere - not quite the same but maybe close enough for gtk3. Is there an applet or menu thing that you have to enable to use the touch screen? I could dig around the PI sites to learn but ...

I just installed a new SSD and a new version of Linux Mint so I'll be putting my system right for the next few days.

ccoupe commented 4 years ago

This shows that Gtk3 and the RPI Touchscreen can work together. It also demonstrates why someone would prefer to use Shoes instead of Gtk3. This bit of documentation describes the general Gtk3 event handling. It might be as easy as just setting the GDK_TOUCH_MASK and the built in emulation will work. Sadly, the pi build is the one that has issues with my new mint19 host.

ccoupe commented 4 years ago

@mashedkeyboard - I've got a beta for the pi with GDK_TOUCH_MASK enabled. Would you try it out with the touch screen and let me know what works and doesn't. Try the Manual->Furthermore->Sample->expert->curve-control-point and something that scrolls like Sample/simple/info and a click on the card in samples/good/cardflip.

Longer term, it might be pretty easy to create a 'touch' method like 'click' or 'motion'.

mashedkeyboard commented 4 years ago

Cheers, that was fast!

Conclusions:

I also checked Chromium, and that definitely supports scrolling on places other than the scrollbar.

ccoupe commented 4 years ago

Cheers, that was fast!

I like working on user requests that are interesting.

Currently, it's just treating touch like a second mouse with only one button. If your finger can fit on a scrollbar you might be able to drag it. Lot's of ifs, there. Providing a better mechanism is a little more complicated. I ordered a screen like yours and it should be here Friday. Lots of options for touch screens but I could tell that many of them could not work work with normal Gtk3 and Shoes. I also started a good test program - a rewrite of in Shoes. Reminds me why Shoes is fun.

ccoupe commented 4 years ago

Now that my touch screen is working, I can see some other missing support in Shoes. The menus in Cobbler drop down but can't be selected. Odd. My kiosk rewrite works fine although it hasn't been tested as a full screen. My wacom Graphire tablet behaves as a mouse even when set in tablet mode.

ccoupe commented 4 years ago

The good news is we can get touch events into Shoes. The raw events need to be passed to a new method 'touch' like 'motion', IFF there is a touch method declared by the script writer. samples/expert/curve-control point.rb doesn't work if we grab the events.

Looks like I'll want to implement GtkGestures on the GtkAltFixed container that Shoes uses. Not a place I like to play in, but we have to go where the bug is. @mashedkeyboard is asking for something like a drag or swipe gesture to be mapped to the current scrolling mechanism (assuming the widget or window is showing a scroll bar).

ccoupe commented 4 years ago

Another worthy place to look at. The 'gtk-3-examples' package installs an app 'gtk3-demo' which is really useful to see how the touch screen works - works well on my pi3. Note: they don't do menu selection either (gtk 3.24.5 - very new)

ccoupe commented 4 years ago

@mashedkeyboard , I've got another beta which can scroll the Shoes screen - in some situations but not all. It's an appimage so just download, chmod +x and run it from the cmdline - that requires a keyboard. It does not replace any shoes you might have installed.

ccoupe commented 4 years ago

I'm going to close this issue. The latest beta works OK on the pi touch screen for the original problem. There are related problems/issues however. Gestures are not handled - I lack an OSX trackpad for one. The menu non-support is a known Gtk3 bug for all app's with a touch screen. Note, closing the issue doesn't mean the discussion can't continue.