From 6f98f894f26730049feb99105224d475c553ff04 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 29 Oct 2026 22:54:24 +0100 Subject: [PATCH] Use native arrow cursors for game surfaces and controls (by Codex) --- assets/modern/select_menu.rcss | 2 +- assets/modern/theme.rcss | 11 +++++++--- assets/modern/widgets.rcss | 2 +- docs/new_ui/README.md | 2 ++ docs/new_ui/controls/cursors.md | 8 ++++++++ tests/modern_control_layout_tests.cpp | 29 ++++++++++++++++++++++++++- 6 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 docs/new_ui/controls/cursors.md diff --git a/assets/modern/select_menu.rcss b/assets/modern/select_menu.rcss index 9db0128..48bd66f 100644 --- a/assets/modern/select_menu.rcss +++ b/assets/modern/select_menu.rcss @@ -11,7 +11,7 @@ select selectarrow {width:10dp;height:10dp;border-bottom:2dp var(--muted);border .native-select-menu>.native-select-option {display:flex;align-items:center;justify-content:flex-start;gap:12dp;width:100%;min-height:72dp;margin:0;padding:10dp 14dp;border:0dp;border-radius:8dp;background-color:transparent;color:var(--text);text-align:left;font-size:1em;line-height:1.3;tab-index:none;} .native-select-menu.league>.native-select-option {gap:12dp;padding:10dp 14dp;border-radius:10dp;} .native-select-menu>.native-select-option:hover,.native-select-menu>.native-select-option.is-cursor,.native-select-menu>.native-select-option:focus {background-color:var(--select-popup-hover);} -.native-select-menu>.native-select-option:disabled {opacity:0.4;cursor:default;background-color:transparent;} +.native-select-menu>.native-select-option:disabled {opacity:0.4;cursor:arrow;background-color:transparent;} .native-select-check {display:flex;align-items:center;justify-content:center;width:28dp;min-width:28dp;flex-shrink:0;color:var(--accent);} .native-select-menu.league .native-select-check {width:34dp;min-width:34dp;} .native-select-check>.image-frame {flex-shrink:0;} diff --git a/assets/modern/theme.rcss b/assets/modern/theme.rcss index a4be86a..f7af8c5 100644 --- a/assets/modern/theme.rcss +++ b/assets/modern/theme.rcss @@ -24,16 +24,16 @@ body.matchday { #background {position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;} #canvas {position:absolute;width:3840dp;height:2160dp;overflow:hidden;} button,input,select,textarea {font-family:Modern;color:var(--text);font-size:32dp;} -button {padding:16dp 26dp;background-color:var(--soft);border:2dp var(--border);border-radius:14dp;cursor:pointer;text-align:center;tab-index:auto;} +button {padding:16dp 26dp;background-color:var(--soft);border:2dp var(--border);border-radius:14dp;cursor:arrow;text-align:center;tab-index:auto;} .control-button {display:flex;align-items:center;justify-content:center;} .control-label {display:block;} .choice.control-button {justify-content:flex-start;} button:hover {background-color:var(--hover);} -button:disabled,button[disabled] {opacity:0.4;cursor:default;tab-index:none;} +button:disabled,button[disabled] {opacity:0.4;cursor:arrow;tab-index:none;} button:focus-visible,input:focus-visible,select:focus-visible {border-color:var(--accent);} button.primary {background-color:var(--selected);border-color:var(--accent);} input,select,textarea {padding:14dp 20dp;border:2dp var(--border);border-radius:12dp;background-color:var(--input);tab-index:auto;} -select {width:520dp;padding-right:45dp;} +select {cursor:arrow;width:520dp;padding-right:45dp;} .row select,.toolbar select {flex:1;min-width:0;} select selectvalue {padding-right:24dp;} select selectarrow {width:10dp;height:10dp;margin-right:-12dp;margin-top:6dp;border-bottom:2dp var(--muted);border-right:2dp var(--muted);transform:rotate(45deg);} @@ -157,3 +157,8 @@ body.silver .app-tile {border-color:#edf7ff99;} .gallery-card h2 {font-size:32dp;margin-bottom:24dp;} .gallery-card p {font-size:26dp;color:var(--muted);margin:15dp 0;} .gallery-card button {font-size:26dp;} + +label,input[type=checkbox],input[type=radio],input[type=range] {cursor:arrow;} +/* Native SDL names: game controls use arrow, editing retains the I-beam. */ +input[type=text],input[type=search],input[type=number],input[type=password],textarea {cursor:text;} +a[href] {cursor:pointer;} diff --git a/assets/modern/widgets.rcss b/assets/modern/widgets.rcss index 9db9d7d..4df258f 100644 --- a/assets/modern/widgets.rcss +++ b/assets/modern/widgets.rcss @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-3.0-only */ .info-bar {z-index:1000;} -.desk-card {cursor:pointer;} +.desk-card {cursor:arrow;} .desk-card:focus-visible {border-color:var(--accent);} .desk-card-heading {height:70dp;display:flex;align-items:center;justify-content:space-between;gap:20dp;padding:22dp 30dp 12dp;font-size:25dp;line-height:1.2;color:var(--muted);} .desk-card-heading>span {display:block;min-width:0;flex:1;white-space:nowrap;overflow:hidden;} diff --git a/docs/new_ui/README.md b/docs/new_ui/README.md index 118a705..1b86be5 100644 --- a/docs/new_ui/README.md +++ b/docs/new_ui/README.md @@ -69,3 +69,5 @@ und Stand der Engine in [new_engine](../new_engine/README.md). - [Tatsächliche Hallentabellen](desktop/indoor/ENGINE.md): Original-Punkterangliste, Turnierwertung und Kaderabsprung. - [Tatsächliche Einstellungen/Automatik](desktop/settings/ENGINE.md): Originalgrenzen, Entwurf und atomare Übernahme. + +- [Mauszeiger](controls/cursors.md): Pfeil für Spielaktionen, Textcursor für Eingaben, keine Hyperlink-Hand auf Spielflächen. diff --git a/docs/new_ui/controls/cursors.md b/docs/new_ui/controls/cursors.md new file mode 100644 index 0000000..435c702 --- /dev/null +++ b/docs/new_ui/controls/cursors.md @@ -0,0 +1,8 @@ + +# Mauszeiger der Spieloberfläche + +Normale Spielschaltflächen, unsichtbare Bildflächen, Widgets und Dropdowns verwenden den gewöhnlichen Pfeil. Das gilt auch für gesperrte Optionen. Die Oberfläche signalisiert keine Weblink-Hand für Spielaktionen. Texteingaben behalten den Textcursor; tatsächliche Links können den Linkcursor verwenden. + +Native RmlUI-Styles benutzen dafür `arrow`, passend zu `SystemInterface_SDL`. Ein CSS-ähnliches `default` ist kein dort behandelter Cursorname und darf nicht als Rücksetzung vorausgesetzt werden. Der gemeinsame Eingabetest prüft echte Hit-Tests und den Cursor-Callback beim Wechsel vom Link zu aktiven/gesperrten Buttons, Widget und Dropdown sowie anschließend zum Textfeld, jeweils in drei Themes bei vier Dichten. + +Die HTML-Referenz lädt `cursor-policy.css` zuletzt. Diese Richtlinie überschreibt Skin-spezifische Handzeiger für Spielaktionen und erhält Text-/Linkcursor sowie den aktiven Ziehzustand. Geometrie, Daten, Spielregeln und Renderer bleiben unverändert. Framebufferaufnahmen enthalten den OS-Zeiger nicht; die interaktive Windows-Abnahme bleibt Human QA. diff --git a/tests/modern_control_layout_tests.cpp b/tests/modern_control_layout_tests.cpp index c4805d7..70cc9b6 100644 --- a/tests/modern_control_layout_tests.cpp +++ b/tests/modern_control_layout_tests.cpp @@ -40,6 +40,8 @@ struct Renderer final : Rml::RenderInterface { }; struct System final : Rml::SystemInterface { size_t stylesheet_errors = 0; + Rml::String cursor; + void SetMouseCursor(const Rml::String &name) override { cursor=name; } bool LogMessage(Rml::Log::Type type, const Rml::String &message) override { if ((type == Rml::Log::LT_WARNING || type == Rml::Log::LT_ERROR) && (message.find("property") != message.npos || @@ -98,6 +100,30 @@ struct ClickListener final : Rml::EventListener { ++clicks; } }; +void cursor_cases(Rml::Context &context, System &system, + const std::string &css, const std::string &theme, float density) { + auto *doc=context.LoadDocumentFromMemory( + "" + "Web link" + "" + "" + "
Widget
" + "" + "" + "
"); + require(doc,"Cursor fixture missing");doc->Show();context.Update(); + const auto hover=[&](const char *id) { + auto *node=doc->GetElementById(id);const auto p=node->GetAbsoluteOffset(Rml::BoxArea::Border),s=node->GetBox().GetSize(Rml::BoxArea::Border); + context.ProcessMouseMove(int(p.x+s.x/2),int(p.y+s.y/2),0);context.Update(); + }; + for(auto *id:{"cursor-button","cursor-disabled","cursor-widget","cursor-select"}) { + hover("cursor-link");require(system.cursor=="pointer","Actual link lost its pointer"); + hover(id);require(system.cursor=="arrow","Game control retained hyperlink/stale cursor"); + } + hover("cursor-input");require(system.cursor=="text","Text field lost editing cursor"); + doc->Close();context.Update(); + (void)density; +} void script_locator_cases(Rml::Context &context, float density) { struct Case { const char *transform; @@ -366,11 +392,12 @@ int main(int argc, char **argv) try { } doc->Close(); context->Update(); + cursor_cases(*context,system,css.str(),theme,density); script_locator_cases(*context,density); Rml::RemoveContext("controls"); } Rml::Shutdown(); - std::cout << "Control text, dropdown arrows, popup fonts and rich cards " + std::cout << "Control cursors, text, dropdown arrows, popup fonts and rich cards " "passed in 3 themes at 4 densities\n"; } catch (const std::exception &e) { std::cerr << e.what() << '\n';