Skip to content

touchy: fit the window to the monitor#4131

Draft
grandixximo wants to merge 2 commits into
LinuxCNC:masterfrom
grandixximo:touchy-fit-monitor
Draft

touchy: fit the window to the monitor#4131
grandixximo wants to merge 2 commits into
LinuxCNC:masterfrom
grandixximo:touchy-fit-monitor

Conversation

@grandixximo
Copy link
Copy Markdown
Contributor

@grandixximo grandixximo commented Jun 5, 2026

Touchy's window could grow past the screen edge, worse after loading a large tool table, putting controls out of reach. The root cause is structural: a GtkNotebook sizes to its largest page, so the small visible page was forced as wide as the hidden Preferences page.

What this does:

  • Wraps each notebook page in a scroller, so the notebook sizes to the current page; oversized pages (Preferences, a long tool table) scroll instead of growing the window. This cuts the minimum width from 1346 to 1094 px and keeps the height in check.
  • Bounds the whole window to the monitor work area, so it can never exceed the screen.
  • Hides the handwheel column on the Preferences tab (you are not jogging there) so the settings page gets the full width.
  • If it still does not fit a small screen, offers once to shrink the fonts: Shrink to fit and save / Not now / Never ask again. It never asks when it already fits and never repeats once it fits; Not now is remembered per screen size, and a Preferences checkbox re-enables the offer after Never ask again.

Tested with the ui-smoke touchy tests and by hand at 1920x1080, 1366x768, 1280x1024, 1280x720, 1024x768 and 800x600 (all tabs, plus reload tool table).

@grandixximo grandixximo marked this pull request as draft June 5, 2026 06:56
@grandixximo
Copy link
Copy Markdown
Contributor Author

Fonts render too small, will push update soon

@grandixximo grandixximo force-pushed the touchy-fit-monitor branch from 12bd886 to 3a31a9b Compare June 5, 2026 08:16
@grandixximo
Copy link
Copy Markdown
Contributor Author

I reworked this from the earlier scroll/scale version. The key change is wrapping each notebook page so the window sizes to the visible page instead of the widest hidden one (Preferences); that also fixes the window growing after reload tool table that Andy reported, since the Status page now scrolls. Font shrinking is opt-in via a dialog, with a Preferences checkbox to re-enable it.

I am open to changes on any of this, the dialog wording, whether to hide the handwheel on Preferences, the readability floor, etc. I have screenshots at the resolutions above if useful.

@grandixximo grandixximo changed the title touchy: keep the window within the monitor touchy: fit the window to the monitor Jun 5, 2026
@grandixximo
Copy link
Copy Markdown
Contributor Author

rv_800x600_0_Startup it should fit now on 800x600 and I can add a test to check that it fits to avoid regressions in the phase 3 of smoke UI

@grandixximo grandixximo marked this pull request as ready for review June 5, 2026 08:49
@grandixximo
Copy link
Copy Markdown
Contributor Author

overlay_1024 Changing to hovering infobar to avoid slapping anyone on the face @BsAtHome

@grandixximo grandixximo force-pushed the touchy-fit-monitor branch from 3a31a9b to 59e3f19 Compare June 5, 2026 09:04
@hansu hansu mentioned this pull request Jun 5, 2026
@hansu
Copy link
Copy Markdown
Member

hansu commented Jun 5, 2026

Looks good 👍 , only the minimize/maximize icon in the title bar disappeared so you cannot use it windowed anymore.

With the replacement of the deprecated table in the status (see #4135), the scrollbar isn't really needed, but let's keep it just in case :)

Touchy has no scrolling, so when content is larger than the display the
window grows past the screen edge and controls become unreachable. The
worst offender is structural: a GtkNotebook sizes to its largest page,
so the small visible page (the buttons) was forced as wide as the hidden
Preferences page, and the tall tool-table listing grew the window on
reload.

  - Wrap each notebook page in a scroller, so the notebook sizes to the
    current page and oversized pages (Preferences, a long tool table)
    scroll instead of growing the window. This alone keeps the height in
    check and cuts the width from 1346 to 1094 px.
  - Wrap the whole window in a scroller and bound it to the monitor work
    area, so it can never exceed the screen.
  - Hide the handwheel column on the Preferences tab (you are not jogging
    there) so the wide settings page gets the full width.
  - When the content still does not fit a narrow screen, float a
    non-modal info bar over the content offering to shrink the fonts:
    Shrink to fit and save / Not now / Never ask again. Accepting scales
    to the largest fitting size, rounds to whole points, saves them, and
    updates the pickers to match. It is only shown when it does not fit
    and never repeated once it fits; Not now is remembered per screen
    size (fit_skip_size) so it is not offered again until the screen
    changes, and Never ask again (fit_fonts) disables it entirely.
  - Add an 'Offer to shrink fonts to fit the screen' checkbox to
    Preferences / Display Options to re-enable the offer after Never ask
    again, and document the behaviour.
@grandixximo grandixximo force-pushed the touchy-fit-monitor branch from 59e3f19 to a705e7f Compare June 6, 2026 03:43
@grandixximo grandixximo marked this pull request as draft June 6, 2026 03:46
@grandixximo
Copy link
Copy Markdown
Contributor Author

grandixximo commented Jun 6, 2026

Marking this a draft for now: per the plan in #4135 it should land after the GTK3 conversion (#4135), so I will rebase this onto #4135 once that merges. It applies to master and works standalone in the meantime.

On the screenshots where the window has no title bar: that is only because the tests run under Xvfb with no window manager. On a normal desktop touchy keeps its title bar with minimize, maximize and close as usual, and close still fires the existing quit handler. This PR does not change that (and it now sets no max-size hint, so the maximize button is never affected either).

@hansu
Copy link
Copy Markdown
Member

hansu commented Jun 6, 2026

only the minimize/maximize icon in the title bar disappeared so you cannot use it windowed anymore.

I was talking about this:

grafik

It is gone with your commit:
grafik

@grandixximo
Copy link
Copy Markdown
Contributor Author

Try with the last commit

@hansu
Copy link
Copy Markdown
Member

hansu commented Jun 6, 2026

The icon is there but I cannot resize the window smaller than the size it got when started maximized (=screen size) even though I get the handle.

touchy-resize.mp4

- Window is now resizable smaller than screen (scroller max-content
  bounds the top end; min stays 0).
- Startup tab restored correctly after page-wrapping loop shifted it.
- Each page scroller accepts drag-to-pan (finger or mouse, 8px
  threshold so button taps are unaffected).
- Fix pre-existing TypeError in listing.on_select: button_release_event
  passes (widget, event) but signature accepted only one argument.
@grandixximo
Copy link
Copy Markdown
Contributor Author

Fixed in the latest commit. The scroller had its min-content pinned to the work area, which forced the window minimum to screen size. Now only the max is bounded, so it resizes smaller freely. Also added drag-to-pan on each page (finger or mouse) since touchy is a touchscreen UI.

@hansu
Copy link
Copy Markdown
Member

hansu commented Jun 6, 2026

Rescaling works now 👍

I can even scale it smaller than the space the widgets need. Not sure if that is good or bad :D

touchy-rescaling.mp4

@grandixximo
Copy link
Copy Markdown
Contributor Author

Well, following the mailing list, the window forcing its size would have the UI pop out of the monitor, and the user had to fight it, this PR solves the issue at the core, at most there is some stuff you don't see, and you have to scroll to get to it, and you can make font a bit smaller to fit, automatic resizing overlay helper also finds the fitting font size for you. No more fighting to fit, the window can be as small as the user needs it to be. I did not force a minimum size as system tray bars and window top bar can remove some unspecified amount of space system to system, we could force a minimum to view everything without scrolling, but I'm not sure that's necessarily what the user is looking for, I think flexibility solves the issue completely at the source, IMO there is no real user downside with being able to make the window extremely small.

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