1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:07:34 +00:00

WindowServer+MouseSettings: Toggle cursor highlighting with Super+H

Rather than enabling/disabling cursor highlighting by going into mouse
settings, you can now instead toggle it any time with Super+H. Mouse
settings now is only for customising the look of the highlighting.
This commit is contained in:
MacDue 2022-06-07 23:41:04 +01:00 committed by Linus Groh
parent 3c2c6790df
commit 5caf307ec0
5 changed files with 46 additions and 48 deletions

View file

@ -45,20 +45,20 @@
@GUI::Label {
autosize: true
text: "0%"
text: "Low"
}
@GUI::Slider {
name: "highlight_opacity_slider"
orientation: "Horizontal"
max: 230
min: 0
min: 30
value: 110
}
@GUI::Label {
autosize: true
text: "100%"
text: "High"
}
}
}
@ -79,20 +79,20 @@
@GUI::Label {
autosize: true
text: "Off"
text: "Small"
}
@GUI::Slider {
name: "highlight_radius_slider"
orientation: "Horizontal"
max: 60
min: 19
min: 20
value: 25
}
@GUI::Label {
autosize: true
text: "Largest"
text: "Large"
}
}
}

View file

@ -51,12 +51,10 @@ ErrorOr<void> HighlightPreviewWidget::reload_cursor()
void HighlightPreviewWidget::paint_preview(GUI::PaintEvent&)
{
GUI::Painter painter(*this);
if (m_radius > 0 && m_color.alpha() > 0) {
Gfx::AntiAliasingPainter aa_painter { painter };
Gfx::IntRect highlight_rect { 0, 0, m_radius * 2, m_radius * 2 };
highlight_rect.center_within(frame_inner_rect());
aa_painter.fill_ellipse(highlight_rect, m_color);
}
Gfx::AntiAliasingPainter aa_painter { painter };
Gfx::IntRect highlight_rect { 0, 0, m_radius * 2, m_radius * 2 };
highlight_rect.center_within(frame_inner_rect());
aa_painter.fill_ellipse(highlight_rect, m_color);
if (m_cursor_bitmap) {
auto cursor_rect = m_cursor_bitmap->rect();
if (m_cursor_params.frames() > 1)

View file

@ -52,10 +52,7 @@ Gfx::Color HighlightWidget::highlight_color()
int HighlightWidget::highlight_radius()
{
auto current_value = m_highlight_radius_slider->value();
if (current_value <= m_highlight_radius_slider->min())
return 0;
return current_value;
return m_highlight_radius_slider->value();
}
void HighlightWidget::apply_settings()