Skip to content

Conversation

puyral
Copy link

@puyral puyral commented Mar 11, 2025

This is a merge request closing #1246

This adds a small button to quickly activate/deactivate the touch scrolling on the canvas. For many situations, this is a very good workaround to inconsistent palm rejection.

Remaining to do:

  • the corresponding icon is black regardless of the theme. I couldn't figure out what takes care of the color of icons
  • activating inertial scrolling make mostly useless

Outside those two points, it has been working flawlessly on my (admittedly outdated) fork for the last 6 months.

@Doublonmousse
Copy link
Collaborator

For the first point, maybe check https://wiki.gnome.org/HowDoI(2f)CreateSymbolicIconsThatChangeColorAccordingToTheme.html (it's for gtk3 but I think it should suffice).

I think that's the absence of fill color that play a role in the theme working.
For example, there is a fill="#2e3436" in https://github.com/flxzt/rnote/blob/33fdab032faaf3bee41e9ed65e286f04988a00b0/crates/rnote-ui/data/icons/scalable/actions/add-page-symbolic.svg?short_path=1fc3354

I'm not sure I understand the second point. Can you explain in more detail ?

@puyral
Copy link
Author

puyral commented Mar 15, 2025

think that's the absence of fill color that play a role in the theme working.
For example, there is a fill="#2e3436" in https://github.com/flxzt/rnote/blob/33fdab032faaf3bee41e9ed65e286f04988a00b0/crates/rnote-ui/data/icons/scalable/actions/add-page-symbolic.svg?short_path=1fc3354

That was my understanding as well. But it didn't look good without the gray part. It seems to be possible to have some styling because some icons do it anyway... I'll look at the gnome documentation you linked because it seems to hold the answer I'm looking for.

I'm not sure I understand the second point. Can you explain in more detail ?

From what I understand, around here I'm "blocking" all events linked to drag motions. But apparently if it comes from the intertial/kinetic scrolling, it goes somewhere else (I'm not sure where). In practice this means that gtk still recognize the touch input and generate inertial scrolling for them which is then not ignored.
So with inertial scrolling activated, when the palm rejection fails it still move the canvas (even though you can't really move it "willingly").

@puyral puyral force-pushed the add-block-touch branch 2 times, most recently from c0a7f5f to 4e260c2 Compare April 6, 2025 19:12
@puyral puyral changed the title Draft: Option to disable touch scrolling feat: Option to disable touch scrolling Apr 6, 2025
@puyral
Copy link
Author

puyral commented Apr 6, 2025

A month later, I finally had time to work on this again ^^'

As far as I can tell, all the problems I listed above are fixed. I ended up changing the icon to another one straight from the gtk repository because I couldn't make it follow the theme...

@julianfairfax
Copy link

Could this maybe be looked at again? It would be practical to have this feature.

@puyral
Copy link
Author

puyral commented Jul 5, 2025

Well, I far as I can tell, my branch works (I've been using it since my last comment, and it hasn't crashed on me).

I need to rebase anyway because this is the version of rnote that I use, and an update is long overdue. I'll try to do that this weekend if I get the time.

@puyral puyral force-pushed the add-block-touch branch from 4e260c2 to 72247cd Compare July 12, 2025 09:50
@puyral puyral force-pushed the add-block-touch branch from 72247cd to da77986 Compare July 12, 2025 11:13
@puyral
Copy link
Author

puyral commented Jul 20, 2025

just so you know everything has been rebased and is apparently working.

self.touch_long_press_gesture
.set_propagation_phase(PropagationPhase::Capture);
} else {
// set everythinbg to `None`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

#[weak(rename_to=canvaswrapper)]
obj,
move |_, _, _| {
if canvaswrapper.block_touch() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the canvas drag gesture activate even with the propagation phase set to none ? or is it to stop a gesture in progress when clicking on the button ?

I think the latter could be done with https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/prelude/trait.GestureExt.html#method.set_state (EventSequenceState::Denied)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit unsure, I was following what block_pinch_zoom was doing, but it does not appear here. So maybe.

I would have to test again make sure, but I won't get access to my touch screen device for 3 more weeks...

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.

3 participants