Keyboard focus ring — F6 enters, Tab cycles dock/bench/clip, Escape exits
Browse files at this commit- feat
- keyboard focus ring — F6 enters, Tab cycles dock/bench/clip, Escape exits
- STROKE_FOCUS in all palettes
- focused surface always mounted
10 changed files +338 -10
- crates/app/src/keymap.rs +21 -2
- crates/app/src/main.rs +9 -0
- crates/app/src/oracle.rs +4 -0
- crates/app/src/player/actions.rs +10 -0
- crates/app/src/tests/editing.rs +4 -1
- crates/app/src/tests/layout.rs +6 -0
- crates/app/src/tests/view.rs +90 -0
- crates/app/src/ui/dock_stance.rs +48 -3
- crates/app/src/ui/stance.rs +132 -4
- crates/app/src/ui/theme.rs +14 -0
crates/app/src/keymap.rsmodified+21 -2
| @@ -221,6 +221,12 @@ actions! { | |||
| 221 | /// this window is EDITOR." Always answerable, same as `Theme`: it is | 221 | /// this window is EDITOR." Always answerable, same as `Theme`: it is |
| 222 | /// about the editor and the project's own numbers, not about a clip. | 222 | /// about the editor and the project's own numbers, not about a clip. |
| 223 | Settings, | 223 | Settings, |
| 224 | + /// Moves the keyboard ring onto the dock (`ui::stance::Surface::Dock`, | ||
| 225 | + /// the cycle's first stop): the door into keyboard-only navigation | ||
| 226 | + /// (`ui::stance`'s Tab/Shift-Tab ring), which nothing else in the app | ||
| 227 | + /// opens. Bare Tab stays [`ActionId::Select`] at the root the whole time | ||
| 228 | + /// -- this only starts the ring, it never steals the clip-selection key. | ||
| 229 | + FocusPanels, | ||
| 224 | } | 230 | } |
| 225 | 231 | ||
| 226 | impl ActionId { | 232 | impl ActionId { |
| @@ -303,6 +309,7 @@ impl ActionId { | |||
| 303 | ActionId::Screenshot => "Save the frame on screen as a PNG", | 309 | ActionId::Screenshot => "Save the frame on screen as a PNG", |
| 304 | ActionId::SubtitleStyle => "Subtitle style: font and size…", | 310 | ActionId::SubtitleStyle => "Subtitle style: font and size…", |
| 305 | ActionId::Settings => "Settings: project and editor…", | 311 | ActionId::Settings => "Settings: project and editor…", |
| 312 | + ActionId::FocusPanels => "Move keyboard focus between panels", | ||
| 306 | } | 313 | } |
| 307 | } | 314 | } |
| 308 | 315 | ||
| @@ -383,6 +390,7 @@ impl ActionId { | |||
| 383 | ActionId::Screenshot => "screenshot", | 390 | ActionId::Screenshot => "screenshot", |
| 384 | ActionId::SubtitleStyle => "subtitle-style", | 391 | ActionId::SubtitleStyle => "subtitle-style", |
| 385 | ActionId::Settings => "settings", | 392 | ActionId::Settings => "settings", |
| 393 | + ActionId::FocusPanels => "focus-panels", | ||
| 386 | } | 394 | } |
| 387 | } | 395 | } |
| 388 | 396 | ||
| @@ -467,7 +475,11 @@ impl ActionId { | |||
| 467 | | ActionId::Fullscreen | 475 | | ActionId::Fullscreen |
| 468 | // The settings page: it changes no clip and no lane, only the | 476 | // The settings page: it changes no clip and no lane, only the |
| 469 | // project's own numbers and this window's preferences. | 477 | // project's own numbers and this window's preferences. |
| 470 | - | ActionId::Settings => Category::View, | 478 | + | ActionId::Settings |
| 479 | + // Moves the ring, not a clip or a lane: the same "how one is | ||
| 480 | + // looking/reaching, not what is being edited" shape as the rest | ||
| 481 | + // of this heading. | ||
| 482 | + | ActionId::FocusPanels => Category::View, | ||
| 471 | ActionId::Cut | 483 | ActionId::Cut |
| 472 | | ActionId::Regroup | 484 | | ActionId::Regroup |
| 473 | | ActionId::Detach | 485 | | ActionId::Detach |
| @@ -1232,6 +1244,13 @@ impl Keymap { | |||
| 1232 | // bare "," is WalkCutPrev, and nothing else answers to the | 1244 | // bare "," is WalkCutPrev, and nothing else answers to the |
| 1233 | // ctrl chord. | 1245 | // ctrl chord. |
| 1234 | b(ActionId::Settings, ",", true), | 1246 | b(ActionId::Settings, ",", true), |
| 1247 | + // The standard pane-cycle key on every desktop that has one | ||
| 1248 | + // (browsers, IDEs) -- free here, and Tab itself cannot spell | ||
| 1249 | + // this: bare Tab is already [`ActionId::Select`] at the root | ||
| 1250 | + // (a bare-key rebind would steal clip selection), and its | ||
| 1251 | + // shift pair is unspellable in this table's chord (`ctrl` | ||
| 1252 | + // only, see [`ActionId::Select`]'s own comment above). | ||
| 1253 | + b(ActionId::FocusPanels, "f6", false), | ||
| 1235 | ], | 1254 | ], |
| 1236 | } | 1255 | } |
| 1237 | } | 1256 | } |
| @@ -1510,7 +1529,7 @@ mod tests { | |||
| 1510 | #[test] | 1529 | #[test] |
| 1511 | fn every_default_stroke_reaches_its_action() { | 1530 | fn every_default_stroke_reaches_its_action() { |
| 1512 | let k = Keymap::defaults(); | 1531 | let k = Keymap::defaults(); |
| 1513 | - assert_eq!(k.entries().len(), 75); | 1532 | + assert_eq!(k.entries().len(), 76); |
| 1514 | // The cut odometer: bare walks one, `<`/`>` (what shift+,/shift+. | 1533 | // The cut odometer: bare walks one, `<`/`>` (what shift+,/shift+. |
| 1515 | // actually type) strides ten. | 1534 | // actually type) strides ten. |
| 1516 | assert_eq!(k.lookup(".", false), Some(ActionId::WalkCutNext)); | 1535 | assert_eq!(k.lookup(".", false), Some(ActionId::WalkCutNext)); |
crates/app/src/main.rsmodified+9 -0
| @@ -776,6 +776,12 @@ struct Player { | |||
| 776 | /// Wall clock of the first displayed frame -- the real-speed measurement. | 776 | /// Wall clock of the first displayed frame -- the real-speed measurement. |
| 777 | started: Option<Instant>, | 777 | started: Option<Instant>, |
| 778 | focus: FocusHandle, | 778 | focus: FocusHandle, |
| 779 | + /// The three focus-ring surfaces (`ui::stance::Surface`) Tab/Shift-Tab | ||
| 780 | + /// cycles between once one of them holds focus -- `focus` above stays | ||
| 781 | + /// the fallback none of these keys ever leave. | ||
| 782 | + focus_dock: FocusHandle, | ||
| 783 | + focus_bench: FocusHandle, | ||
| 784 | + focus_inspector: FocusHandle, | ||
| 779 | } | 785 | } |
| 780 | 786 | ||
| 781 | #[cfg(test)] | 787 | #[cfg(test)] |
| @@ -1057,6 +1063,9 @@ fn main() { | |||
| 1057 | dropped: 0, | 1063 | dropped: 0, |
| 1058 | started: None, | 1064 | started: None, |
| 1059 | focus: cx.focus_handle(), | 1065 | focus: cx.focus_handle(), |
| 1066 | + focus_dock: cx.focus_handle(), | ||
| 1067 | + focus_bench: cx.focus_handle(), | ||
| 1068 | + focus_inspector: cx.focus_handle(), | ||
| 1060 | }); | 1069 | }); |
| 1061 | // Nothing else takes focus, and without it the key listener | 1070 | // Nothing else takes focus, and without it the key listener |
| 1062 | // above is never reached. | 1071 | // above is never reached. |
crates/app/src/oracle.rsmodified+4 -0
| @@ -110,6 +110,10 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable { | |||
| 110 | if action == ActionId::Theme | 110 | if action == ActionId::Theme |
| 111 | || action == ActionId::Fullscreen | 111 | || action == ActionId::Fullscreen |
| 112 | || action == ActionId::SubtitleStyle | 112 | || action == ActionId::SubtitleStyle |
| 113 | + // Moving the keyboard ring is the same kind of always-there, | ||
| 114 | + // touches-no-timeline action as the three above: there is always a | ||
| 115 | + // dock/bench/inspector to land the ring on, export or no. | ||
| 116 | + || action == ActionId::FocusPanels | ||
| 113 | { | 117 | { |
| 114 | return Enable::Yes; | 118 | return Enable::Yes; |
| 115 | } | 119 | } |
crates/app/src/player/actions.rsmodified+10 -0
| @@ -165,6 +165,16 @@ impl Player { | |||
| 165 | window.toggle_fullscreen(); | 165 | window.toggle_fullscreen(); |
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 168 | + // The ring's own door: nothing else in the app ever calls | ||
| 169 | + // `window.focus` on one of the three surface handles | ||
| 170 | + // (`ui::stance::Surface`), so without this the Tab handlers those | ||
| 171 | + // surfaces carry (`stance.rs`'s `bench`, `dock_stance.rs`'s | ||
| 172 | + // `cycle_on_key_down`) are unreachable dead code -- the ring never | ||
| 173 | + // starts. Lands on the cycle's first stop (`stance::SURFACE_CYCLE` | ||
| 174 | + // -- the dock); a second Tab from there walks it same as ever. | ||
| 175 | + ActionId::FocusPanels => { | ||
| 176 | + self.focus_surface(crate::ui::stance::Surface::Dock, window, cx); | ||
| 177 | + } | ||
| 168 | // Nothing to cancel while nothing is exporting; the export guard in | 178 | // Nothing to cancel while nothing is exporting; the export guard in |
| 169 | // the key handler is what answers this one while there is. | 179 | // the key handler is what answers this one while there is. |
| 170 | ActionId::CancelExport => {} | 180 | ActionId::CancelExport => {} |
crates/app/src/tests/editing.rsmodified+4 -1
| @@ -924,7 +924,10 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() { | |||
| 924 | let allowed = action == ActionId::CancelExport | 924 | let allowed = action == ActionId::CancelExport |
| 925 | || action == ActionId::Theme | 925 | || action == ActionId::Theme |
| 926 | || action == ActionId::Fullscreen | 926 | || action == ActionId::Fullscreen |
| 927 | - || action == ActionId::SubtitleStyle; | 927 | + || action == ActionId::SubtitleStyle |
| 928 | + // Moving the ring touches no edit list either -- same kind of | ||
| 929 | + // thing as Fullscreen right above it. | ||
| 930 | + || action == ActionId::FocusPanels; | ||
| 928 | assert_eq!( | 931 | assert_eq!( |
| 929 | whole(action, busy).yes(), | 932 | whole(action, busy).yes(), |
| 930 | allowed, | 933 | allowed, |
crates/app/src/tests/layout.rsmodified+6 -0
| @@ -2664,6 +2664,12 @@ fn every_action_has_a_darkroom_widget_home_or_explicit_owner() { | |||
| 2664 | ), | 2664 | ), |
| 2665 | (ActionId::Crossfade, "fade parity owns crossfade controls"), | 2665 | (ActionId::Crossfade, "fade parity owns crossfade controls"), |
| 2666 | (ActionId::Dissolve, "fade parity owns dissolve controls"), | 2666 | (ActionId::Dissolve, "fade parity owns dissolve controls"), |
| 2667 | + ( | ||
| 2668 | + ActionId::FocusPanels, | ||
| 2669 | + "keyboard-only by design: a mouse already focuses whatever it \ | ||
| 2670 | + clicks, so a click-through door for \"move keyboard focus\" \ | ||
| 2671 | + has nothing to do that a click has not already done", | ||
| 2672 | + ), | ||
| 2667 | ( | 2673 | ( |
| 2668 | ActionId::Deselect, | 2674 | ActionId::Deselect, |
| 2669 | "clicking empty timeline space already clears the selection with the mouse; \ | 2675 | "clicking empty timeline space already clears the selection with the mouse; \ |
crates/app/src/tests/view.rsmodified+90 -0
| @@ -891,3 +891,93 @@ fn the_zoom_button_says_how_much_is_on_the_bed() { | |||
| 891 | assert_eq!(secs_label(1. / 60.), "0.02s"); | 891 | assert_eq!(secs_label(1. / 60.), "0.02s"); |
| 892 | assert_eq!(secs_label(4.5), "4.5s"); | 892 | assert_eq!(secs_label(4.5), "4.5s"); |
| 893 | } | 893 | } |
| 894 | + | ||
| 895 | +/// Keyboard focus v1 (`ui::stance::{Surface, next_surface, is_focus_cycle_key}`): | ||
| 896 | +/// Tab walks dock -> bench -> inspector -> dock, wrapping; Shift-Tab walks | ||
| 897 | +/// it backward. No gpui window harness exists in this crate to drive a real | ||
| 898 | +/// `KeyDownEvent` through -- this exercises the exact pure function every | ||
| 899 | +/// surface's `on_key_down` calls, which is where the cycle order actually | ||
| 900 | +/// lives. | ||
| 901 | +#[test] | ||
| 902 | +fn tab_cycles_dock_bench_inspector_and_wraps() { | ||
| 903 | + use crate::ui::stance::{Surface, next_surface}; | ||
| 904 | + | ||
| 905 | + assert_eq!(next_surface(Surface::Dock, false), Surface::Bench); | ||
| 906 | + assert_eq!(next_surface(Surface::Bench, false), Surface::Inspector); | ||
| 907 | + assert_eq!(next_surface(Surface::Inspector, false), Surface::Dock); | ||
| 908 | + | ||
| 909 | + // Shift-Tab is the exact reverse at every step. | ||
| 910 | + assert_eq!(next_surface(Surface::Dock, true), Surface::Inspector); | ||
| 911 | + assert_eq!(next_surface(Surface::Inspector, true), Surface::Bench); | ||
| 912 | + assert_eq!(next_surface(Surface::Bench, true), Surface::Dock); | ||
| 913 | +} | ||
| 914 | + | ||
| 915 | +/// The defect this closes: the dock mounts only one of its two tabs at a | ||
| 916 | +/// time (`dock_stance::render`'s `match src_active`), so focusing | ||
| 917 | +/// `focus_dock`/`focus_inspector` while the other tab is showing lands on a | ||
| 918 | +/// handle with no tree node -- gpui then dispatches no key listener at all, | ||
| 919 | +/// keyboard input is dead until a mouse click. `Player::focus_surface` | ||
| 920 | +/// (`ui::stance.rs`) flips the tab first via this pure decision so the | ||
| 921 | +/// surface being entered is always the one mounted. | ||
| 922 | +#[test] | ||
| 923 | +fn surface_wants_src_active_mounts_the_tab_before_focus_lands_on_it() { | ||
| 924 | + use crate::ui::stance::{Surface, surface_wants_src_active}; | ||
| 925 | + | ||
| 926 | + assert_eq!(surface_wants_src_active(Surface::Dock), Some(true)); | ||
| 927 | + assert_eq!(surface_wants_src_active(Surface::Inspector), Some(false)); | ||
| 928 | + // Bench has no dock tab of its own -- entering it must not disturb | ||
| 929 | + // whichever tab the dock was last left on. | ||
| 930 | + assert_eq!(surface_wants_src_active(Surface::Bench), None); | ||
| 931 | +} | ||
| 932 | + | ||
| 933 | +/// The root fallback guarantee (main.rs:1054's "every keybind hangs off the | ||
| 934 | +/// root FocusHandle"): a surface's own `on_key_down` answers Tab/Shift-Tab | ||
| 935 | +/// and nothing else -- `cx.stop_propagation()` is only ever reached from | ||
| 936 | +/// that one branch (`ui::stance::is_focus_cycle_key`), so every other key, | ||
| 937 | +/// still-pressed while a surface is focused, is left un-stopped and bubbles | ||
| 938 | +/// up the dispatch tree to the root's own `on_key_down` | ||
| 939 | +/// (gpui-0.2.2 `window.rs`'s `dispatch_key_down_up_event`, `Bubble` phase, | ||
| 940 | +/// walks the focused node's ancestors and stops only at | ||
| 941 | +/// `cx.stop_propagation()` -- verified by reading that function, not | ||
| 942 | +/// assumed). This asserts the gate itself: only "tab" is ever intercepted, | ||
| 943 | +/// so a keybind like space (play/pause) or "s" (split) is provably never | ||
| 944 | +/// swallowed by a focused surface. | ||
| 945 | +#[test] | ||
| 946 | +fn only_tab_is_intercepted_by_a_focused_surface_everything_else_reaches_root() { | ||
| 947 | + use crate::ui::stance::is_focus_cycle_key; | ||
| 948 | + | ||
| 949 | + assert!(is_focus_cycle_key("tab")); | ||
| 950 | + for key in ["space", "escape", "s", "c", "left", "right", "enter", "delete", "?"] { | ||
| 951 | + assert!(!is_focus_cycle_key(key), "{key} must bubble to the root"); | ||
| 952 | + } | ||
| 953 | +} | ||
| 954 | + | ||
| 955 | +/// The ring's other door, escape: [`ui::stance::is_focus_exit_key`] is the | ||
| 956 | +/// one branch a focused surface's `on_key_down` calls to hand focus back to | ||
| 957 | +/// the root (`Player::focus`) instead of letting escape bubble there on its | ||
| 958 | +/// own -- same pure-function-level check as the Tab gate above, since this | ||
| 959 | +/// crate has no window harness to drive a real `KeyDownEvent` through. | ||
| 960 | +#[test] | ||
| 961 | +fn escape_is_the_only_key_a_focused_surface_uses_to_leave_the_ring() { | ||
| 962 | + use crate::ui::stance::is_focus_exit_key; | ||
| 963 | + | ||
| 964 | + assert!(is_focus_exit_key("escape")); | ||
| 965 | + for key in ["tab", "space", "s", "c", "left", "right", "enter", "delete", "?"] { | ||
| 966 | + assert!(!is_focus_exit_key(key), "{key} must not exit the ring"); | ||
| 967 | + } | ||
| 968 | +} | ||
| 969 | + | ||
| 970 | +/// [`ActionId::FocusPanels`] is what starts the ring in the first place | ||
| 971 | +/// (`Player::act`'s `window.focus(&self.focus_dock)`) -- without a bound key | ||
| 972 | +/// reaching it, `next_surface`/`is_focus_cycle_key` above are unreachable | ||
| 973 | +/// dead code, exactly the defect this action closes. | ||
| 974 | +#[test] | ||
| 975 | +fn focus_panels_is_bound_and_lands_on_the_dock() { | ||
| 976 | + use keymap::{ActionId, Keymap}; | ||
| 977 | + | ||
| 978 | + let k = Keymap::defaults(); | ||
| 979 | + assert_eq!(k.lookup("f6", false), Some(ActionId::FocusPanels)); | ||
| 980 | + // Bare Tab must still mean Select at the root -- FocusPanels must not | ||
| 981 | + // have stolen it. | ||
| 982 | + assert_eq!(k.lookup("tab", false), Some(ActionId::Select)); | ||
| 983 | +} | ||
crates/app/src/ui/dock_stance.rsmodified+48 -3
| @@ -12,6 +12,7 @@ | |||
| 12 | //! [`clip_middle`]...), only the anatomy around them is new. | 12 | //! [`clip_middle`]...), only the anatomy around them is new. |
| 13 | 13 | ||
| 14 | use crate::ui::hitmap; | 14 | use crate::ui::hitmap; |
| 15 | +use crate::ui::stance::{Surface, is_focus_cycle_key, is_focus_exit_key, next_surface}; | ||
| 15 | use crate::ui::type_scale::{self, Typeset, head, label, mono}; | 16 | use crate::ui::type_scale::{self, Typeset, head, label, mono}; |
| 16 | use crate::*; | 17 | use crate::*; |
| 17 | use gpui::FontWeight; | 18 | use gpui::FontWeight; |
| @@ -817,7 +818,12 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem | |||
| 817 | /// filter, sort chips, rows, IMPORT, hint -- none of it the legacy | 818 | /// filter, sort chips, rows, IMPORT, hint -- none of it the legacy |
| 818 | /// Media/Audio/Text panel `library.rs` draws. That panel's row facts | 819 | /// Media/Audio/Text panel `library.rs` draws. That panel's row facts |
| 819 | /// ([`library_rows`]) are still what every row here is built from. | 820 | /// ([`library_rows`]) are still what every row here is built from. |
| 820 | -fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | 821 | +fn sources_tab( |
| 822 | + player: &Player, | ||
| 823 | + window: &mut Window, | ||
| 824 | + cx: &mut Context<Player>, | ||
| 825 | +) -> impl IntoElement { | ||
| 826 | + let focused = player.focus_dock.is_focused(window); | ||
| 821 | let sources = player | 827 | let sources = player |
| 822 | .session | 828 | .session |
| 823 | .as_ref() | 829 | .as_ref() |
| @@ -862,6 +868,11 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 862 | let filter_text: SharedString = player.dock_filter.clone().into(); | 868 | let filter_text: SharedString = player.dock_filter.clone().into(); |
| 863 | div() | 869 | div() |
| 864 | .id("dock-sources") | 870 | .id("dock-sources") |
| 871 | + .track_focus(&player.focus_dock) | ||
| 872 | + .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { | ||
| 873 | + cycle_on_key_down(Surface::Dock)(this, event, window, cx) | ||
| 874 | + })) | ||
| 875 | + .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS()))) | ||
| 865 | .flex_1() | 876 | .flex_1() |
| 866 | .min_h(px(0.)) | 877 | .min_h(px(0.)) |
| 867 | .flex() | 878 | .flex() |
| @@ -1077,8 +1088,10 @@ fn clip_tab( | |||
| 1077 | player: &Player, | 1088 | player: &Player, |
| 1078 | width: f32, | 1089 | width: f32, |
| 1079 | window_size: Size<Pixels>, | 1090 | window_size: Size<Pixels>, |
| 1091 | + window: &mut Window, | ||
| 1080 | cx: &mut Context<Player>, | 1092 | cx: &mut Context<Player>, |
| 1081 | ) -> impl IntoElement { | 1093 | ) -> impl IntoElement { |
| 1094 | + let focused = player.focus_inspector.is_focused(window); | ||
| 1082 | // The room actually given here, not the window's: `eq_card_w`/ | 1095 | // The room actually given here, not the window's: `eq_card_w`/ |
| 1083 | // `card_max_w` are asked "how wide may I draw" and answered with the | 1096 | // `card_max_w` are asked "how wide may I draw" and answered with the |
| 1084 | // *whole viewport's* width when handed `window_size` verbatim -- but this | 1097 | // *whole viewport's* width when handed `window_size` verbatim -- but this |
| @@ -1099,6 +1112,11 @@ fn clip_tab( | |||
| 1099 | && !player.subtitle_style_open; | 1112 | && !player.subtitle_style_open; |
| 1100 | div() | 1113 | div() |
| 1101 | .id("dock-clip") | 1114 | .id("dock-clip") |
| 1115 | + .track_focus(&player.focus_inspector) | ||
| 1116 | + .on_key_down(cx.listener(move |this, event: &KeyDownEvent, window, cx| { | ||
| 1117 | + cycle_on_key_down(Surface::Inspector)(this, event, window, cx) | ||
| 1118 | + })) | ||
| 1119 | + .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS()))) | ||
| 1102 | .flex_1() | 1120 | .flex_1() |
| 1103 | .min_h(px(0.)) | 1121 | .min_h(px(0.)) |
| 1104 | .flex() | 1122 | .flex() |
| @@ -1257,6 +1275,7 @@ pub(crate) fn render( | |||
| 1257 | player: &Player, | 1275 | player: &Player, |
| 1258 | width: f32, | 1276 | width: f32, |
| 1259 | window_size: Size<Pixels>, | 1277 | window_size: Size<Pixels>, |
| 1278 | + window: &mut Window, | ||
| 1260 | cx: &mut Context<Player>, | 1279 | cx: &mut Context<Player>, |
| 1261 | ) -> impl IntoElement { | 1280 | ) -> impl IntoElement { |
| 1262 | let src_active = player.dock_src_active; | 1281 | let src_active = player.dock_src_active; |
| @@ -1279,7 +1298,33 @@ pub(crate) fn render( | |||
| 1279 | .child(dock_tab("dock-tab-clip", "CLIP", !src_active, cx)), | 1298 | .child(dock_tab("dock-tab-clip", "CLIP", !src_active, cx)), |
| 1280 | ) | 1299 | ) |
| 1281 | .child(match src_active { | 1300 | .child(match src_active { |
| 1282 | - true => sources_tab(player, cx).into_any_element(), | 1301 | + true => sources_tab(player, window, cx).into_any_element(), |
| 1283 | - false => clip_tab(player, width, window_size, cx).into_any_element(), | 1302 | + false => clip_tab(player, width, window_size, window, cx).into_any_element(), |
| 1284 | }) | 1303 | }) |
| 1285 | } | 1304 | } |
| 1305 | + | ||
| 1306 | +/// The Tab/Shift-Tab handler shared by the dock's two tabs (`sources_tab`'s | ||
| 1307 | +/// "dock/library" and `clip_tab`'s "inspector") -- only [`is_focus_cycle_key`] | ||
| 1308 | +/// is ever answered here; every other key is left un-stopped so it bubbles | ||
| 1309 | +/// to the room's root handler (`ui::stance::render`'s `on_key_down`), which | ||
| 1310 | +/// is the one every other keybind, Tab included when nothing in the ring | ||
| 1311 | +/// has focus yet, still hangs off. | ||
| 1312 | +fn cycle_on_key_down( | ||
| 1313 | + surface: Surface, | ||
| 1314 | +) -> impl Fn(&mut Player, &KeyDownEvent, &mut Window, &mut Context<Player>) + 'static { | ||
| 1315 | + move |this, event, window, cx| { | ||
| 1316 | + let key = event.keystroke.key.as_str(); | ||
| 1317 | + if is_focus_cycle_key(key) { | ||
| 1318 | + let next = next_surface(surface, event.keystroke.modifiers.shift); | ||
| 1319 | + this.focus_surface(next, window, cx); | ||
| 1320 | + cx.stop_propagation(); | ||
| 1321 | + } else if is_focus_exit_key(key) { | ||
| 1322 | + // Same exit as `stance.rs`'s bench handler: leaves the ring for | ||
| 1323 | + // the root handle rather than letting escape bubble to whatever | ||
| 1324 | + // the root does with it. | ||
| 1325 | + window.focus(&this.focus); | ||
| 1326 | + cx.stop_propagation(); | ||
| 1327 | + cx.notify(); | ||
| 1328 | + } | ||
| 1329 | + } | ||
| 1330 | +} | ||
crates/app/src/ui/stance.rsmodified+132 -4
| @@ -17,6 +17,103 @@ use crate::ui::timeband_stance; | |||
| 17 | use crate::ui::type_scale::{self, Typeset}; | 17 | use crate::ui::type_scale::{self, Typeset}; |
| 18 | use crate::*; | 18 | use crate::*; |
| 19 | 19 | ||
| 20 | +/// Keyboard focus v1: the three regions Tab/Shift-Tab cycle a painted ring | ||
| 21 | +/// through -- the bench, the dock's Sources tab (library) and the dock's | ||
| 22 | +/// Clip tab (inspector), the darkroom's own stand-ins for "timeline", | ||
| 23 | +/// "library" and "inspector" (there is no separate inspector *region* in | ||
| 24 | +/// this tree -- MOCK-SPEC's Clip tab, `dock_stance::clip_tab`, is it). | ||
| 25 | +/// `Player::focus` (the root handle every keybind hangs off) is not a | ||
| 26 | +/// member: Tab already means "select the clip under the playhead" | ||
| 27 | +/// (`ActionId::Select`, `keymap.rs`) at the root, unchanged here, and only | ||
| 28 | +/// starts meaning "enter the ring" once one of these three already holds | ||
| 29 | +/// focus. | ||
| 30 | +#[derive(Clone, Copy, PartialEq, Eq, Debug)] | ||
| 31 | +pub(crate) enum Surface { | ||
| 32 | + Dock, | ||
| 33 | + Bench, | ||
| 34 | + Inspector, | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +/// Fixed cycle order: dock, bench, inspector. | ||
| 38 | +const SURFACE_CYCLE: [Surface; 3] = [Surface::Dock, Surface::Bench, Surface::Inspector]; | ||
| 39 | + | ||
| 40 | +/// Tab (`backward` false) or Shift-Tab (`backward` true) from `current`, | ||
| 41 | +/// wrapping at either end of [`SURFACE_CYCLE`]. | ||
| 42 | +pub(crate) fn next_surface(current: Surface, backward: bool) -> Surface { | ||
| 43 | + let i = SURFACE_CYCLE.iter().position(|&s| s == current).unwrap(); | ||
| 44 | + let n = SURFACE_CYCLE.len(); | ||
| 45 | + SURFACE_CYCLE[if backward { (i + n - 1) % n } else { (i + 1) % n }] | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +/// The one key a surface's own `on_key_down` answers. Everything else is | ||
| 49 | +/// left alone on purpose, unhandled and un-stopped, so it bubbles to the | ||
| 50 | +/// root's fallback handler exactly as an unfocused key already does | ||
| 51 | +/// (`window.rs`'s key dispatch walks the focused node's ancestors in | ||
| 52 | +/// `Bubble` phase and stops only at `cx.stop_propagation()` -- the three | ||
| 53 | +/// surface handlers call that solely from this branch, gpui-0.2.2 | ||
| 54 | +/// `window.rs:3897-3906`). | ||
| 55 | +pub(crate) fn is_focus_cycle_key(key: &str) -> bool { | ||
| 56 | + key == "tab" | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +/// The other key a surface's own `on_key_down` answers: leaves the ring for | ||
| 60 | +/// the root handle (`Player::focus`) rather than letting the stroke bubble | ||
| 61 | +/// there itself -- same one-door reason as [`is_focus_cycle_key`], so the | ||
| 62 | +/// bench and both dock tabs cannot answer "what closes the ring" two | ||
| 63 | +/// different ways. | ||
| 64 | +pub(crate) fn is_focus_exit_key(key: &str) -> bool { | ||
| 65 | + key == "escape" | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +/// The dock mounts only one of its two tabs at a time | ||
| 69 | +/// (`dock_stance::render`'s `match src_active`), so `focus_dock` only has a | ||
| 70 | +/// tree node under Sources and `focus_inspector` only under Clip -- focusing | ||
| 71 | +/// the unmounted one leaves gpui with a focused handle no node answers to, | ||
| 72 | +/// and every key dies until the next mouse click. Answers "does entering | ||
| 73 | +/// `surface` require flipping the dock tab first", pure so it's testable | ||
| 74 | +/// without a `Window`: `Some(true)`/`Some(false)` is the `dock_src_active` | ||
| 75 | +/// the surface needs mounted, `None` (bench) means leave the tab alone. | ||
| 76 | +pub(crate) fn surface_wants_src_active(surface: Surface) -> Option<bool> { | ||
| 77 | + match surface { | ||
| 78 | + Surface::Dock => Some(true), | ||
| 79 | + Surface::Inspector => Some(false), | ||
| 80 | + Surface::Bench => None, | ||
| 81 | + } | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +impl Player { | ||
| 85 | + /// The `FocusHandle` a [`Surface`] paints its ring on and Tab/Shift-Tab | ||
| 86 | + /// moves to next -- one door, so `next_surface`'s answer and the handle | ||
| 87 | + /// `window.focus` is given cannot name two different surfaces. | ||
| 88 | + pub(crate) fn focus_handle(&self, surface: Surface) -> &FocusHandle { | ||
| 89 | + match surface { | ||
| 90 | + Surface::Dock => &self.focus_dock, | ||
| 91 | + Surface::Bench => &self.focus_bench, | ||
| 92 | + Surface::Inspector => &self.focus_inspector, | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + /// One door onto every ring move: flips the dock tab first | ||
| 97 | + /// ([`surface_wants_src_active`]) so `surface`'s handle is always | ||
| 98 | + /// mounted before `window.focus` lands on it, then persists the flip | ||
| 99 | + /// exactly as the tab's own click does (`dock_stance::dock_tab`'s | ||
| 100 | + /// `on_click`), so the ring and a mouse click can't disagree about | ||
| 101 | + /// which tab was last chosen. | ||
| 102 | + pub(crate) fn focus_surface( | ||
| 103 | + &mut self, | ||
| 104 | + surface: Surface, | ||
| 105 | + window: &mut Window, | ||
| 106 | + cx: &mut Context<Self>, | ||
| 107 | + ) { | ||
| 108 | + if let Some(src_active) = surface_wants_src_active(surface) { | ||
| 109 | + self.dock_src_active = src_active; | ||
| 110 | + crate::ui::dock_stance::save(src_active); | ||
| 111 | + } | ||
| 112 | + window.focus(self.focus_handle(surface)); | ||
| 113 | + cx.notify(); | ||
| 114 | + } | ||
| 115 | +} | ||
| 116 | + | ||
| 20 | /// Left rail, full height (DESIGN §5). | 117 | /// Left rail, full height (DESIGN §5). |
| 21 | pub(crate) const SPINE_W: f32 = 56.; | 118 | pub(crate) const SPINE_W: f32 = 56.; |
| 22 | /// Fixed strip under the screen: timecode, transport, cut readout, contact | 119 | /// Fixed strip under the screen: timecode, transport, cut readout, contact |
| @@ -533,9 +630,33 @@ fn time_band(player: &mut Player, position: f64, cx: &mut Context<Player>) -> im | |||
| 533 | /// Height comes from [`Player::split_px`] now, not the fixed [`BENCH_H`]: | 630 | /// Height comes from [`Player::split_px`] now, not the fixed [`BENCH_H`]: |
| 534 | /// the seam [`crate::ui::stance::render`] mounts above this region is what | 631 | /// the seam [`crate::ui::stance::render`] mounts above this region is what |
| 535 | /// answers "ui fields are not stretchable" for the bench. | 632 | /// answers "ui fields are not stretchable" for the bench. |
| 536 | -fn bench(player: &mut Player, bench_h: f32, cx: &mut Context<Player>) -> impl IntoElement { | 633 | +fn bench( |
| 634 | + player: &mut Player, | ||
| 635 | + bench_h: f32, | ||
| 636 | + window: &mut Window, | ||
| 637 | + cx: &mut Context<Player>, | ||
| 638 | +) -> impl IntoElement { | ||
| 639 | + let focused = player.focus_bench.is_focused(window); | ||
| 537 | div() | 640 | div() |
| 538 | .id("stance-bench") | 641 | .id("stance-bench") |
| 642 | + .track_focus(&player.focus_bench) | ||
| 643 | + .on_key_down(cx.listener(|this, event: &KeyDownEvent, window, cx| { | ||
| 644 | + let key = event.keystroke.key.as_str(); | ||
| 645 | + if is_focus_cycle_key(key) { | ||
| 646 | + let next = next_surface(Surface::Bench, event.keystroke.modifiers.shift); | ||
| 647 | + this.focus_surface(next, window, cx); | ||
| 648 | + cx.stop_propagation(); | ||
| 649 | + } else if is_focus_exit_key(key) { | ||
| 650 | + // Leaves the ring rather than deleting it: the root handle | ||
| 651 | + // gets focus back, and a second escape there is what does | ||
| 652 | + // whatever escape means at the root (nothing, today) -- | ||
| 653 | + // this must not itself bubble, or the root's own handler | ||
| 654 | + // never sees a stroke that stayed a ring exit. | ||
| 655 | + window.focus(&this.focus); | ||
| 656 | + cx.stop_propagation(); | ||
| 657 | + cx.notify(); | ||
| 658 | + } | ||
| 659 | + })) | ||
| 539 | .flex_none() | 660 | .flex_none() |
| 540 | .h(px(bench_h)) | 661 | .h(px(bench_h)) |
| 541 | // §4: lanes take 0 radius. | 662 | // §4: lanes take 0 radius. |
| @@ -543,6 +664,12 @@ fn bench(player: &mut Player, bench_h: f32, cx: &mut Context<Player>) -> impl In | |||
| 543 | .bg(rgb(DARK_CANVAS())) | 664 | .bg(rgb(DARK_CANVAS())) |
| 544 | .border_t_1() | 665 | .border_t_1() |
| 545 | .border_color(rgba(DARK_SEAM())) | 666 | .border_color(rgba(DARK_SEAM())) |
| 667 | + // The ring (DESIGN §4's "1px, lamp-adjacent" convention -- the same | ||
| 668 | + // `.border_1().border_color(...)` a picked bench clip already uses): | ||
| 669 | + // painted on this outer frame, never on a row, and only while this | ||
| 670 | + // surface itself -- not a picked clip inside it -- holds the focus | ||
| 671 | + // ring Tab/Shift-Tab moves ([`next_surface`]). | ||
| 672 | + .when(focused, |d| d.border_1().border_color(rgb(STROKE_FOCUS()))) | ||
| 546 | .flex() | 673 | .flex() |
| 547 | .flex_col() | 674 | .flex_col() |
| 548 | .px(px(12.)) | 675 | .px(px(12.)) |
| @@ -739,6 +866,7 @@ fn dock( | |||
| 739 | player: &Player, | 866 | player: &Player, |
| 740 | dock_w: f32, | 867 | dock_w: f32, |
| 741 | window_size: Size<Pixels>, | 868 | window_size: Size<Pixels>, |
| 869 | + window: &mut Window, | ||
| 742 | cx: &mut Context<Player>, | 870 | cx: &mut Context<Player>, |
| 743 | ) -> impl IntoElement { | 871 | ) -> impl IntoElement { |
| 744 | div() | 872 | div() |
| @@ -751,7 +879,7 @@ fn dock( | |||
| 751 | .border_color(rgba(DARK_SEAM())) | 879 | .border_color(rgba(DARK_SEAM())) |
| 752 | .flex() | 880 | .flex() |
| 753 | .flex_col() | 881 | .flex_col() |
| 754 | - .child(dock_stance::render(player, dock_w, window_size, cx)) | 882 | + .child(dock_stance::render(player, dock_w, window_size, window, cx)) |
| 755 | } | 883 | } |
| 756 | 884 | ||
| 757 | /// A zero-size element whose only job is `window.on_mouse_event`'s door: | 885 | /// A zero-size element whose only job is `window.on_mouse_event`'s door: |
| @@ -982,7 +1110,7 @@ pub(crate) fn render( | |||
| 982 | .child(screen(player, position, window, cx)) | 1110 | .child(screen(player, position, window, cx)) |
| 983 | .child(time_band(player, position, cx)) | 1111 | .child(time_band(player, position, cx)) |
| 984 | .child(divider(Split::Bench, cx)) | 1112 | .child(divider(Split::Bench, cx)) |
| 985 | - .child(bench(player, bench_h, cx)) | 1113 | + .child(bench(player, bench_h, window, cx)) |
| 986 | .child(ledger(player, position)) | 1114 | .child(ledger(player, position)) |
| 987 | .when_some(player.notices.back().cloned(), |el, n| { | 1115 | .when_some(player.notices.back().cloned(), |el, n| { |
| 988 | el.child(notice_plate(n, bench_h)) | 1116 | el.child(notice_plate(n, bench_h)) |
| @@ -1033,7 +1161,7 @@ pub(crate) fn render( | |||
| 1033 | }), | 1161 | }), |
| 1034 | ) | 1162 | ) |
| 1035 | .child(divider(Split::Dock, cx)) | 1163 | .child(divider(Split::Dock, cx)) |
| 1036 | - .child(dock(player, dock_w, window_size, cx)) | 1164 | + .child(dock(player, dock_w, window_size, window, cx)) |
| 1037 | // The library row menu mounts on the ROOT, not inside | 1165 | // The library row menu mounts on the ROOT, not inside |
| 1038 | // `stance-centre` like the clip menu beside it: it is opened from a | 1166 | // `stance-centre` like the clip menu beside it: it is opened from a |
| 1039 | // dock row, so its anchor is a window x past the centre column's own | 1167 | // dock row, so its anchor is a window x past the centre column's own |
crates/app/src/ui/theme.rsmodified+14 -0
| @@ -105,6 +105,7 @@ palette! { | |||
| 105 | SCRIM: u32, | 105 | SCRIM: u32, |
| 106 | SCRIM_LIGHT: u32, | 106 | SCRIM_LIGHT: u32, |
| 107 | STROKE_DIVIDER: u32, | 107 | STROKE_DIVIDER: u32, |
| 108 | + STROKE_FOCUS: u32, | ||
| 108 | STROKE_SELECTED: u32, | 109 | STROKE_SELECTED: u32, |
| 109 | FG_PRIMARY: u32, | 110 | FG_PRIMARY: u32, |
| 110 | FG_SECONDARY: u32, | 111 | FG_SECONDARY: u32, |
| @@ -348,6 +349,7 @@ pub mod cool { | |||
| 348 | 349 | ||
| 349 | // -- strokes ---------------------------------------------------------------- | 350 | // -- strokes ---------------------------------------------------------------- |
| 350 | pub const STROKE_DIVIDER: u32 = 0x2a3442; | 351 | pub const STROKE_DIVIDER: u32 = 0x2a3442; |
| 352 | + pub const STROKE_FOCUS: u32 = 0xffd166; | ||
| 351 | pub const STROKE_SELECTED: u32 = 0x22d3ee; | 353 | pub const STROKE_SELECTED: u32 = 0x22d3ee; |
| 352 | 354 | ||
| 353 | // -- text ------------------------------------------------------------------- | 355 | // -- text ------------------------------------------------------------------- |
| @@ -439,6 +441,7 @@ pub mod warm { | |||
| 439 | 441 | ||
| 440 | // -- strokes ---------------------------------------------------------------- | 442 | // -- strokes ---------------------------------------------------------------- |
| 441 | pub const STROKE_DIVIDER: u32 = 0x3a322e; | 443 | pub const STROKE_DIVIDER: u32 = 0x3a322e; |
| 444 | + pub const STROKE_FOCUS: u32 = 0xffc38a; | ||
| 442 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 445 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 443 | 446 | ||
| 444 | // -- text ------------------------------------------------------------------- | 447 | // -- text ------------------------------------------------------------------- |
| @@ -523,6 +526,7 @@ pub mod forest { | |||
| 523 | 526 | ||
| 524 | // -- strokes ---------------------------------------------------------------- | 527 | // -- strokes ---------------------------------------------------------------- |
| 525 | pub const STROKE_DIVIDER: u32 = 0x25362c; | 528 | pub const STROKE_DIVIDER: u32 = 0x25362c; |
| 529 | + pub const STROKE_FOCUS: u32 = 0xffd166; | ||
| 526 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 530 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 527 | 531 | ||
| 528 | // -- text ------------------------------------------------------------------- | 532 | // -- text ------------------------------------------------------------------- |
| @@ -606,6 +610,7 @@ pub mod violet { | |||
| 606 | 610 | ||
| 607 | // -- strokes ---------------------------------------------------------------- | 611 | // -- strokes ---------------------------------------------------------------- |
| 608 | pub const STROKE_DIVIDER: u32 = 0x2e3150; | 612 | pub const STROKE_DIVIDER: u32 = 0x2e3150; |
| 613 | + pub const STROKE_FOCUS: u32 = 0xfde68a; | ||
| 609 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 614 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 610 | 615 | ||
| 611 | // -- text ------------------------------------------------------------------- | 616 | // -- text ------------------------------------------------------------------- |
| @@ -684,6 +689,7 @@ pub mod rose { | |||
| 684 | 689 | ||
| 685 | // -- strokes ---------------------------------------------------------------- | 690 | // -- strokes ---------------------------------------------------------------- |
| 686 | pub const STROKE_DIVIDER: u32 = 0x332f33; | 691 | pub const STROKE_DIVIDER: u32 = 0x332f33; |
| 692 | + pub const STROKE_FOCUS: u32 = 0xfcd34d; | ||
| 687 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 693 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 688 | 694 | ||
| 689 | // -- text ------------------------------------------------------------------- | 695 | // -- text ------------------------------------------------------------------- |
| @@ -764,6 +770,7 @@ pub mod amber { | |||
| 764 | 770 | ||
| 765 | // -- strokes ---------------------------------------------------------------- | 771 | // -- strokes ---------------------------------------------------------------- |
| 766 | pub const STROKE_DIVIDER: u32 = 0x35352f; | 772 | pub const STROKE_DIVIDER: u32 = 0x35352f; |
| 773 | + pub const STROKE_FOCUS: u32 = 0x7dd3fc; | ||
| 767 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 774 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 768 | 775 | ||
| 769 | // -- text ------------------------------------------------------------------- | 776 | // -- text ------------------------------------------------------------------- |
| @@ -842,6 +849,7 @@ pub mod ocean { | |||
| 842 | 849 | ||
| 843 | // -- strokes ---------------------------------------------------------------- | 850 | // -- strokes ---------------------------------------------------------------- |
| 844 | pub const STROKE_DIVIDER: u32 = 0x1e2d42; | 851 | pub const STROKE_DIVIDER: u32 = 0x1e2d42; |
| 852 | + pub const STROKE_FOCUS: u32 = 0xffd166; | ||
| 845 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 853 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 846 | 854 | ||
| 847 | // -- text ------------------------------------------------------------------- | 855 | // -- text ------------------------------------------------------------------- |
| @@ -921,6 +929,7 @@ pub mod ice { | |||
| 921 | 929 | ||
| 922 | // -- strokes ---------------------------------------------------------------- | 930 | // -- strokes ---------------------------------------------------------------- |
| 923 | pub const STROKE_DIVIDER: u32 = 0x223140; | 931 | pub const STROKE_DIVIDER: u32 = 0x223140; |
| 932 | + pub const STROKE_FOCUS: u32 = 0xfcd34d; | ||
| 924 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 933 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 925 | 934 | ||
| 926 | // -- text ------------------------------------------------------------------- | 935 | // -- text ------------------------------------------------------------------- |
| @@ -998,6 +1007,7 @@ pub mod orchid { | |||
| 998 | 1007 | ||
| 999 | // -- strokes ---------------------------------------------------------------- | 1008 | // -- strokes ---------------------------------------------------------------- |
| 1000 | pub const STROKE_DIVIDER: u32 = 0x33203f; | 1009 | pub const STROKE_DIVIDER: u32 = 0x33203f; |
| 1010 | + pub const STROKE_FOCUS: u32 = 0x7dd3fc; | ||
| 1001 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 1011 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 1002 | 1012 | ||
| 1003 | // -- text ------------------------------------------------------------------- | 1013 | // -- text ------------------------------------------------------------------- |
| @@ -1084,6 +1094,7 @@ pub mod nord { | |||
| 1084 | 1094 | ||
| 1085 | // -- strokes ---------------------------------------------------------------- | 1095 | // -- strokes ---------------------------------------------------------------- |
| 1086 | pub const STROKE_DIVIDER: u32 = 0x434c5e; | 1096 | pub const STROKE_DIVIDER: u32 = 0x434c5e; |
| 1097 | + pub const STROKE_FOCUS: u32 = 0xd08770; | ||
| 1087 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 1098 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 1088 | 1099 | ||
| 1089 | // -- text ------------------------------------------------------------------- | 1100 | // -- text ------------------------------------------------------------------- |
| @@ -1173,6 +1184,7 @@ pub mod gruvbox { | |||
| 1173 | 1184 | ||
| 1174 | // -- strokes ---------------------------------------------------------------- | 1185 | // -- strokes ---------------------------------------------------------------- |
| 1175 | pub const STROKE_DIVIDER: u32 = 0x504945; | 1186 | pub const STROKE_DIVIDER: u32 = 0x504945; |
| 1187 | + pub const STROKE_FOCUS: u32 = 0x83a598; | ||
| 1176 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 1188 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 1177 | 1189 | ||
| 1178 | // -- text ------------------------------------------------------------------- | 1190 | // -- text ------------------------------------------------------------------- |
| @@ -1253,6 +1265,7 @@ pub mod dracula { | |||
| 1253 | 1265 | ||
| 1254 | // -- strokes ---------------------------------------------------------------- | 1266 | // -- strokes ---------------------------------------------------------------- |
| 1255 | pub const STROKE_DIVIDER: u32 = 0x44475a; | 1267 | pub const STROKE_DIVIDER: u32 = 0x44475a; |
| 1268 | + pub const STROKE_FOCUS: u32 = 0x8be9fd; | ||
| 1256 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; | 1269 | pub const STROKE_SELECTED: u32 = ACCENT_PRIMARY; |
| 1257 | 1270 | ||
| 1258 | // -- text ------------------------------------------------------------------- | 1271 | // -- text ------------------------------------------------------------------- |
| @@ -1348,6 +1361,7 @@ pub mod darkroom { | |||
| 1348 | 1361 | ||
| 1349 | // -- strokes -------------------------------------------------------------- | 1362 | // -- strokes -------------------------------------------------------------- |
| 1350 | pub const STROKE_DIVIDER: u32 = 0x22262b; | 1363 | pub const STROKE_DIVIDER: u32 = 0x22262b; |
| 1364 | + pub const STROKE_FOCUS: u32 = INK1; | ||
| 1351 | /// "Focus/selection ring = 1px ink1 (lamp-adjacent, not coloured)." | 1365 | /// "Focus/selection ring = 1px ink1 (lamp-adjacent, not coloured)." |
| 1352 | pub const STROKE_SELECTED: u32 = INK1; | 1366 | pub const STROKE_SELECTED: u32 = INK1; |
| 1353 | 1367 | ||