Each control opened its own PopupWindow as tooltip. While one showed, Slint dropped every press outside it, so after resting on a button (the split toggle above all) the next click did nothing. Tooltips are now one input-transparent layer per window (Tips + TooltipLayer), filled in by StateLayer. Toggle buttons whose state the shell owns (sidebar, previews, split) no longer flip `checked` themselves, which broke their binding. Switching tabs or the split now updates, adds or removes single pane rows instead of rebuilding every pane view. xdnd_probe gains a `click` mode for real clicks under Xvfb. Co-Authored-By: Claude Opus 5.5 <[email protected]>
64 lines
2.4 KiB
Text
64 lines
2.4 KiB
Text
import { Theme } from "../theme.slint";
|
|
import { Motion } from "../motion.slint";
|
|
|
|
// The small label an icon-only control shows after hovering for `Motion.tooltip-delay`
|
|
// (StateLayer's `tooltip`). It fades in; it leaves at once with its popup.
|
|
export component Tooltip inherits Rectangle {
|
|
in property <string> text;
|
|
|
|
property <bool> shown;
|
|
init => {
|
|
self.shown = true;
|
|
}
|
|
|
|
background: Theme.inverse-surface;
|
|
border-radius: Theme.corner-xs;
|
|
height: 24px;
|
|
opacity: root.shown ? 1 : 0;
|
|
animate opacity {
|
|
duration: Motion.time(Motion.short3);
|
|
easing: Motion.standard;
|
|
}
|
|
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-2;
|
|
padding-right: Theme.space-2;
|
|
|
|
Text {
|
|
text: root.text;
|
|
color: Theme.inverse-on-surface;
|
|
font-size: Theme.body-small.size;
|
|
font-weight: Theme.body-small.weight;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The one tooltip of a window, drawn by its `TooltipLayer`. A control's StateLayer fills it
|
|
// in when its hover delay runs out and empties it again when the pointer leaves or presses.
|
|
// (Each control used to open a PopupWindow of its own: while one showed, Slint dropped every
|
|
// click outside it, so the second click on a button often did nothing.)
|
|
export global Tips {
|
|
in-out property <string> text;
|
|
// Window coordinates of the control's centre, its bottom and its top.
|
|
in-out property <length> x;
|
|
in-out property <length> bottom;
|
|
in-out property <length> top;
|
|
in-out property <bool> shown;
|
|
// Bumped by each control that shows the tooltip: only the latest one hides it.
|
|
in-out property <int> owner;
|
|
}
|
|
|
|
// Draws `Tips` above everything else in the window: place it last (`width: 100%;
|
|
// height: 100%;`). It has no touch area, so the pointer goes through it.
|
|
export component TooltipLayer inherits Rectangle {
|
|
if Tips.shown: tip := Tooltip {
|
|
text: Tips.text;
|
|
width: self.preferred-width;
|
|
x: clamp(Tips.x - self.width / 2, Theme.window-margin, max(Theme.window-margin, root.width - self.width - Theme.window-margin));
|
|
// Below the control, or above it when there is no room below.
|
|
y: Tips.bottom + Theme.space-1 + self.height + Theme.window-margin <= root.height
|
|
? Tips.bottom + Theme.space-1
|
|
: Tips.top - Theme.space-1 - self.height;
|
|
}
|
|
}
|