Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# Local agent instructions
AGENTS.md
CLAUDE.MD



Expand Down
3 changes: 3 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ dot_radius = 6.0
# Start with the highlight effect enabled when the overlay launches
enabled = false

# Show a persistent ring while the highlight tool is active
show_on_highlight_tool = false

# Radius of the highlight circle in pixels (16 - 160)
radius = 24.0

Expand Down
6 changes: 6 additions & 0 deletions configurator/src/app/view/ui/click_highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ impl ConfiguratorApp {
self.defaults.click_highlight_enabled,
ToggleField::UiClickHighlightEnabled,
),
toggle_row(
"Show ring while highlight tool is active",
self.draft.click_highlight_show_on_highlight_tool,
self.defaults.click_highlight_show_on_highlight_tool,
ToggleField::UiClickHighlightShowOnHighlightTool,
),
toggle_row(
"Link highlight color to current pen",
self.draft.click_highlight_use_pen_color,
Expand Down
4 changes: 4 additions & 0 deletions configurator/src/models/config/draft/from_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ impl ConfigDraft {
status_dot_radius: format_float(config.ui.status_bar_style.dot_radius),

click_highlight_enabled: config.ui.click_highlight.enabled,
click_highlight_show_on_highlight_tool: config
.ui
.click_highlight
.show_on_highlight_tool,
click_highlight_use_pen_color: config.ui.click_highlight.use_pen_color,
click_highlight_radius: format_float(config.ui.click_highlight.radius),
click_highlight_outline_thickness: format_float(
Expand Down
1 change: 1 addition & 0 deletions configurator/src/models/config/draft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub struct ConfigDraft {
pub status_dot_radius: String,

pub click_highlight_enabled: bool,
pub click_highlight_show_on_highlight_tool: bool,
pub click_highlight_use_pen_color: bool,
pub click_highlight_radius: String,
pub click_highlight_outline_thickness: String,
Expand Down
3 changes: 3 additions & 0 deletions configurator/src/models/config/setters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ impl ConfigDraft {
self.ui_toolbar_force_inline = value;
}
ToggleField::UiClickHighlightEnabled => self.click_highlight_enabled = value,
ToggleField::UiClickHighlightShowOnHighlightTool => {
self.click_highlight_show_on_highlight_tool = value;
}
ToggleField::UiClickHighlightUsePenColor => self.click_highlight_use_pen_color = value,
ToggleField::PresenterHideStatusBar => self.presenter_hide_status_bar = value,
ToggleField::PresenterHideToolbars => self.presenter_hide_toolbars = value,
Expand Down
2 changes: 2 additions & 0 deletions configurator/src/models/config/to_config/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ impl ConfigDraft {
);

config.ui.click_highlight.enabled = self.click_highlight_enabled;
config.ui.click_highlight.show_on_highlight_tool =
self.click_highlight_show_on_highlight_tool;
config.ui.click_highlight.use_pen_color = self.click_highlight_use_pen_color;
parse_field(
&self.click_highlight_radius,
Expand Down
1 change: 1 addition & 0 deletions configurator/src/models/fields/toggles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub enum ToggleField {
UiToolbarShowToolPreview,
UiToolbarForceInline,
UiClickHighlightEnabled,
UiClickHighlightShowOnHighlightTool,
UiClickHighlightUsePenColor,
UiShowStatusBoardBadge,
UiShowStatusPageBadge,
Expand Down
2 changes: 2 additions & 0 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ text_color = [0.95, 0.96, 0.98, 1.0] # Near-white
# Click highlight styling (visual feedback for mouse clicks)
[ui.click_highlight]
enabled = false
show_on_highlight_tool = false
radius = 24.0
outline_thickness = 4.0
duration_ms = 750
Expand Down Expand Up @@ -295,6 +296,7 @@ enabled = true
- **Colors**: All RGBA values (0.0-1.0 range) with transparency control
- **Layout**: Padding, line height, dot size, border width all configurable
- **Click highlight**: Enable presenter-style click halos with adjustable radius, colors, and duration; by default the halo follows your current pen color (set `use_pen_color = false` to keep a fixed color)
- **Highlight tool ring**: `show_on_highlight_tool = true` keeps a persistent halo visible while the highlight tool is active
- **Context menu**: `ui.context_menu.enabled` toggles right-click / keyboard menus
- **GNOME fallback**: `preferred_output` pins the xdg-shell overlay to a specific monitor; `xdg_fullscreen` requests fullscreen instead of maximized

Expand Down
11 changes: 10 additions & 1 deletion src/backend/wayland/handlers/pointer/enter_leave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@ impl WaylandState {
);
self.set_pointer_focus(true);
self.set_pointer_over_toolbar(on_toolbar);
self.set_current_mouse(event.position.0 as i32, event.position.1 as i32);
if on_toolbar {
if let Some((sx, sy)) =
self.toolbar_surface_screen_coords(&event.surface, event.position)
{
self.set_current_mouse(sx as i32, sy as i32);
let (wx, wy) = self.zoomed_world_coords(sx, sy);
self.input_state.update_pointer_position(wx, wy);
} else {
self.set_current_mouse(event.position.0 as i32, event.position.1 as i32);
}
// Ensure pointer-driven visuals (e.g. eraser hover) update once on enter.
self.input_state.needs_redraw = true;
}
if !on_toolbar {
self.set_current_mouse(event.position.0 as i32, event.position.1 as i32);
let (wx, wy) = self.zoomed_world_coords(event.position.0, event.position.1);
self.input_state.update_pointer_position(wx, wy);
if self.input_state.eraser_mode == EraserMode::Stroke
Expand Down
10 changes: 10 additions & 0 deletions src/backend/wayland/handlers/pointer/motion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ impl WaylandState {
}
if on_toolbar {
self.set_pointer_over_toolbar(true);
if let Some((sx, sy)) =
self.toolbar_surface_screen_coords(&event.surface, event.position)
{
self.set_current_mouse(sx as i32, sy as i32);
let (wx, wy) = self.zoomed_world_coords(sx, sy);
self.input_state.update_pointer_position(wx, wy);
}
let evt = self.toolbar.pointer_motion(&event.surface, event.position);
if self.toolbar_dragging() {
// Use move_drag_intent if pointer_motion didn't return an intent
Expand All @@ -63,6 +70,9 @@ impl WaylandState {
return;
}
if self.pointer_over_toolbar() {
self.set_current_mouse(event.position.0 as i32, event.position.1 as i32);
let (wx, wy) = self.zoomed_world_coords(event.position.0, event.position.1);
self.input_state.update_pointer_position(wx, wy);
let evt = self.toolbar.pointer_motion(&event.surface, event.position);
if self.toolbar_dragging() {
// Use move_drag_intent if pointer_motion didn't return an intent
Expand Down
2 changes: 2 additions & 0 deletions src/backend/wayland/state/render/canvas/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ impl WaylandState {
// Render text cursor/buffer if in text mode
self.render_text_input_preview(ctx);

self.input_state.render_highlight_tool_ring(ctx, mx, my);

// Render click highlight overlays before UI so status/help remain legible
self.input_state.render_click_highlights(ctx, now);

Expand Down
2 changes: 1 addition & 1 deletion src/backend/wayland/state/toolbar/drag/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl WaylandState {

/// Convert a toolbar-local coordinate into a screen-relative coordinate so that
/// dragging continues to work even after the surface has moved.
pub(super) fn local_to_screen_coords(
pub(in crate::backend::wayland) fn local_to_screen_coords(
&self,
kind: MoveDragKind,
local_coord: (f64, f64),
Expand Down
13 changes: 13 additions & 0 deletions src/backend/wayland/state/toolbar/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ impl WaylandState {
| ToolbarEvent::ToggleFill(_)
| ToolbarEvent::ApplyPreset(_)
);
let persist_click_highlight = matches!(event, ToolbarEvent::ToggleHighlightToolRing(_));

if self.input_state.apply_toolbar_event(event) {
self.toolbar.mark_dirty();
Expand All @@ -121,6 +122,10 @@ impl WaylandState {
if persist_drawing {
self.save_drawing_preferences();
}

if persist_click_highlight {
self.save_click_highlight_preferences();
}
}
if let Some(action) = self.input_state.take_pending_preset_action() {
self.handle_preset_action(action);
Expand Down Expand Up @@ -200,6 +205,14 @@ impl WaylandState {
}
}

pub(in crate::backend::wayland) fn save_click_highlight_preferences(&mut self) {
self.config.ui.click_highlight.show_on_highlight_tool =
self.input_state.highlight_tool_ring_enabled();
if let Err(err) = self.config.save() {
log::warn!("Failed to persist click highlight preferences: {}", err);
}
}

pub(in crate::backend::wayland) fn handle_preset_action(
&mut self,
action: crate::input::state::PresetAction,
Expand Down
15 changes: 15 additions & 0 deletions src/backend/wayland/state/toolbar/visibility/access.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use super::*;
use crate::backend::wayland::toolbar::ToolbarFocusTarget;
use wayland_client::protocol::wl_surface;

impl WaylandState {
pub(in crate::backend::wayland) fn pointer_over_toolbar(&self) -> bool {
Expand Down Expand Up @@ -56,4 +58,17 @@ impl WaylandState {
pub(in crate::backend::wayland) fn inline_toolbars_render_active(&self) -> bool {
self.inline_toolbars_active() || self.toolbar_drag_preview_active()
}

pub(in crate::backend::wayland) fn toolbar_surface_screen_coords(
&self,
surface: &wl_surface::WlSurface,
position: (f64, f64),
) -> Option<(f64, f64)> {
let target = self.toolbar.focus_target_for_surface(surface)?;
let kind = match target {
ToolbarFocusTarget::Top => MoveDragKind::Top,
ToolbarFocusTarget::Side => MoveDragKind::Side,
};
Some(self.local_to_screen_coords(kind, position))
}
}
15 changes: 15 additions & 0 deletions src/backend/wayland/toolbar/layout/top/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ pub(super) fn build_hits(
});
x += btn_size + gap;

let highlight_x = x;
hits.push(HitRegion {
rect: (x, y, btn_size, btn_size),
event: ToolbarEvent::ToggleAllHighlight(!snapshot.any_highlight_active),
Expand All @@ -135,6 +136,20 @@ pub(super) fn build_hits(
.binding_for_action(Action::ToggleHighlightTool),
)),
});
if snapshot.highlight_tool_active {
let ring_y = y + btn_size + ToolbarLayoutSpec::TOP_ICON_FILL_OFFSET;
hits.push(HitRegion {
rect: (
highlight_x,
ring_y,
btn_size,
ToolbarLayoutSpec::TOP_ICON_FILL_HEIGHT,
),
event: ToolbarEvent::ToggleHighlightToolRing(!snapshot.highlight_tool_ring_enabled),
kind: HitKind::Click,
tooltip: Some("Highlight ring".to_string()),
});
}
x += btn_size + gap;
}

Expand Down
33 changes: 33 additions & 0 deletions src/backend/wayland/toolbar/render/top_strip/icons/utility_row.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use crate::backend::wayland::toolbar::events::HitKind;
use crate::backend::wayland::toolbar::format_binding_label;
use crate::backend::wayland::toolbar::hit::HitRegion;
use crate::backend::wayland::toolbar::layout::ToolbarLayoutSpec;
use crate::config::{Action, action_label};
use crate::toolbar_icons;
use crate::ui::toolbar::ToolbarEvent;
use crate::ui_text::UiTextStyle;

use super::super::super::widgets::constants::{FONT_FAMILY_DEFAULT, FONT_SIZE_SMALL};
use super::super::super::widgets::*;
use super::TopStripLayout;

Expand All @@ -19,6 +22,12 @@ pub(super) fn draw_utility_row(
) -> f64 {
let snapshot = layout.snapshot;
let hover = layout.hover;
let mini_label_style = UiTextStyle {
family: FONT_FAMILY_DEFAULT,
slant: cairo::FontSlant::Normal,
weight: cairo::FontWeight::Normal,
size: FONT_SIZE_SMALL,
};

let is_hover = hover
.map(|(hx, hy)| point_in_rect(hx, hy, x, y, btn_size, btn_size))
Expand Down Expand Up @@ -139,6 +148,30 @@ pub(super) fn draw_utility_row(
.binding_for_action(Action::ToggleHighlightTool),
)),
});
if snapshot.highlight_tool_active {
let ring_y = y + btn_size + ToolbarLayoutSpec::TOP_ICON_FILL_OFFSET;
let ring_h = ToolbarLayoutSpec::TOP_ICON_FILL_HEIGHT;
let ring_hover = hover
.map(|(hx, hy)| point_in_rect(hx, hy, x, ring_y, btn_size, ring_h))
.unwrap_or(false);
draw_mini_checkbox(
layout.ctx,
x,
ring_y,
btn_size,
ring_h,
snapshot.highlight_tool_ring_enabled,
ring_hover,
mini_label_style,
"Ring",
);
layout.hits.push(HitRegion {
rect: (x, ring_y, btn_size, ring_h),
event: ToolbarEvent::ToggleHighlightToolRing(!snapshot.highlight_tool_ring_enabled),
kind: HitKind::Click,
tooltip: Some("Highlight ring".to_string()),
});
}
x += btn_size + gap;
}

Expand Down
9 changes: 9 additions & 0 deletions src/config/types/click_highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ pub struct ClickHighlightConfig {
#[serde(default = "default_click_highlight_enabled")]
pub enabled: bool,

/// Show a persistent ring while the highlight tool is active
#[serde(default = "default_click_highlight_show_on_highlight_tool")]
pub show_on_highlight_tool: bool,

/// Radius of the highlight circle in pixels
#[serde(default = "default_click_highlight_radius")]
pub radius: f64,
Expand Down Expand Up @@ -37,6 +41,7 @@ impl Default for ClickHighlightConfig {
fn default() -> Self {
Self {
enabled: default_click_highlight_enabled(),
show_on_highlight_tool: default_click_highlight_show_on_highlight_tool(),
radius: default_click_highlight_radius(),
outline_thickness: default_click_highlight_outline(),
duration_ms: default_click_highlight_duration_ms(),
Expand All @@ -51,6 +56,10 @@ fn default_click_highlight_enabled() -> bool {
false
}

fn default_click_highlight_show_on_highlight_tool() -> bool {
false
}

fn default_click_highlight_radius() -> f64 {
24.0
}
Expand Down
29 changes: 29 additions & 0 deletions src/input/state/core/highlight_controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@ impl InputState {
self.click_highlight.enabled()
}

/// Returns whether the persistent highlight ring is enabled.
pub fn highlight_tool_ring_enabled(&self) -> bool {
self.click_highlight.show_on_highlight_tool()
}

/// Enables or disables the persistent highlight ring.
pub fn set_highlight_tool_ring_enabled(&mut self, enabled: bool) -> bool {
let (x, y) = self.last_pointer_position;
if self.click_highlight.set_show_on_highlight_tool(
enabled,
self.highlight_tool_active(),
x,
y,
&mut self.dirty_tracker,
) {
self.needs_redraw = true;
true
} else {
false
}
}

/// Toggle the click highlight feature and mark the frame for redraw.
pub fn toggle_click_highlight(&mut self) -> bool {
let enabled = self.click_highlight.toggle(&mut self.dirty_tracker);
Expand Down Expand Up @@ -49,6 +71,13 @@ impl InputState {
self.click_highlight.render(ctx, now);
}

/// Render a persistent highlight ring while the highlight tool is active.
pub fn render_highlight_tool_ring(&self, ctx: &CairoContext, x: i32, y: i32) {
if self.highlight_tool_active() {
self.click_highlight.render_tool_ring(ctx, x, y);
}
}

/// Returns the active tool considering overrides and drawing state.
pub fn active_tool(&self) -> Tool {
if let DrawingState::Drawing { tool, .. } = &self.state {
Expand Down
4 changes: 2 additions & 2 deletions src/input/state/core/menus/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl InputState {
let selection = self.selected_shape_ids().to_vec();
if selection.is_empty() {
let anchor = self.keyboard_canvas_menu_anchor();
self.update_pointer_position(anchor.0, anchor.1);
self.update_pointer_position_synthetic(anchor.0, anchor.1);
self.open_context_menu(anchor, Vec::new(), ContextMenuKind::Canvas, None);
self.pending_menu_hover_recalc = false;
self.set_context_menu_focus(None);
Expand All @@ -75,7 +75,7 @@ impl InputState {
})
.unwrap_or(false);
let anchor = self.keyboard_shape_menu_anchor(&selection);
self.update_pointer_position(anchor.0, anchor.1);
self.update_pointer_position_synthetic(anchor.0, anchor.1);
self.open_context_menu(anchor, selection, ContextMenuKind::Shape, None);
self.pending_menu_hover_recalc = false;
if !focus_edit || !self.focus_context_menu_command(MenuCommand::EditText) {
Expand Down
Loading