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

text/xml/diff view: zoom font size depending on ctrl+mousewheel #33

Merged
merged 8 commits into from
Nov 26, 2021

Conversation

bertsky
Copy link
Contributor

@bertsky bertsky commented Nov 18, 2021

No description provided.

@hnesk
Copy link
Owner

hnesk commented Nov 18, 2021

Thanks for the PR! I tried it and found 2 problems:

  1. Zooming with a touchpad is much too fast this way, maybe it would be better to respect delta_y (for a mouse wheel tick delta_y is +/-1 for a touchpad scroll event it is something around +/-0.01)
  2. I run into a GTK related crash if I zoom in too much.
    I'll look into it.

@bertsky
Copy link
Contributor Author

bertsky commented Nov 18, 2021

Yes, sry, I did not test with touch pad – you're right!

Some sensible upper and lower boundaries might be prudent anyway.

@bertsky
Copy link
Contributor Author

bertsky commented Nov 23, 2021

It's really strange. This works, but after zooming out too much, you cannot ever zoom back in. (Fortunately that's not true in reverse.) It's totally unclear why the layout/context does never get updated at that point. Maybe just a Gtk bug.

I fiddled with another API option, get_pango_context() instead of get_style_context(), and that does work in a way, and does not suffer from that problem (of snapping into a low resolution). But it only applies to the line numbers, not the actual text content. (Therefore I left this commented.)

But the upper and lower boundary should prevent the crash, and the mouse wheel sensitivity should be honoured now.

@bertsky
Copy link
Contributor Author

bertsky commented Nov 23, 2021

218eadf fixes #32

@hnesk
Copy link
Owner

hnesk commented Nov 26, 2021

Ok, now it works! The problem was that font.get_size() did not return the exact size it got via font.set_size(), but an int rounded to the next Pango.SCALE tick. The resulting size was too small trigger the next tick for small sizes.

@hnesk hnesk merged commit cd34055 into hnesk:master Nov 26, 2021
@bertsky
Copy link
Contributor Author

bertsky commented Nov 26, 2021

Ok, now it works! The problem was that font.get_size() did not return the exact size it got via font.set_size(), but an int rounded to the next Pango.SCALE tick. The resulting size was too small to trigger the next tick for small sizes.

Wow. That drove me crazy. Should have thought about that possibility!

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