- Opens for text-input-v3 fields, terminals, launcher search, Network password, emoji picker and the password dialog; a KB pill summons it manually. - Enabled on CHASSIS=handset; CHANDRA_OSK=1|0 overrides, and it stays off under CHANDRA_TEST_CONFIG. - Work area and panel popups shrink above the keyboard so focused content stays visible. - Keys send evdev codes with Shift, Ctrl and Alt modifiers. - chandra-ctl: `screenshot [PATH]` saves a PNG without opening the editor. - Key names cover the full punctuation set and shifted symbols. - Launcher plasmoid min width drops from 60 to 36.
This commit is contained in:
1 parent
1205329abd
commit
905dab8725
21 files changed
+1335
-68
No files matched your search
+111
-13
@@ -312,6 +312,20 @@ pub(all) struct ChandraCompositor {
|
||||
/// External windows from the host X11 WM (`--x11`), bridged into the dock/panel only.
|
||||
mut ext_windows : Array[ExternalWindow]
|
||||
mut ext_handler : ExternalWindowHandler?
|
||||
/// Built-in on-screen keyboard (osk.mbt).
|
||||
mut osk_enabled : Bool
|
||||
mut osk_visible : Bool
|
||||
mut osk_shift : Bool
|
||||
mut osk_ctrl : Bool
|
||||
mut osk_alt : Bool
|
||||
mut osk_sym : Bool
|
||||
mut osk_manual_hide : Bool
|
||||
mut osk_manual_show : Bool
|
||||
mut osk_popup_typing : Bool
|
||||
mut osk_target : String
|
||||
mut osk_pressed : Int?
|
||||
mut osk_hover : Int?
|
||||
mut osk_pointer_grab : Bool
|
||||
}
|
||||
|
||||
///|
|
||||
@@ -448,6 +462,19 @@ pub fn ChandraCompositor::new(
|
||||
kiosk: None,
|
||||
ext_windows: [],
|
||||
ext_handler: None,
|
||||
osk_enabled: osk_default_enabled(),
|
||||
osk_visible: false,
|
||||
osk_shift: false,
|
||||
osk_ctrl: false,
|
||||
osk_alt: false,
|
||||
osk_sym: false,
|
||||
osk_manual_hide: false,
|
||||
osk_manual_show: false,
|
||||
osk_popup_typing: false,
|
||||
osk_target: "",
|
||||
osk_pressed: None,
|
||||
osk_hover: None,
|
||||
osk_pointer_grab: false,
|
||||
}
|
||||
// Client popups (menus) are placed to stay on screen: the server asks for the output's
|
||||
// rectangle relative to the parent's content origin when it applies constraint adjustment.
|
||||
@@ -459,18 +486,44 @@ pub fn ChandraCompositor::new(
|
||||
}
|
||||
|
||||
///| The part of a `w` x `h` output windows are laid out in.
|
||||
fn work_area_for(w : Int, h : Int, theme : @scene.ThemeTokens, kiosk~ : Bool = false) -> @wm.Rect {
|
||||
fn work_area_for(
|
||||
w : Int,
|
||||
h : Int,
|
||||
theme : @scene.ThemeTokens,
|
||||
kiosk~ : Bool = false,
|
||||
bottom_extra~ : Int = 0,
|
||||
) -> @wm.Rect {
|
||||
if kiosk {
|
||||
// A locked kiosk has no panel and its windows are fullscreen: the whole output.
|
||||
return { x: 0, y: 0, w, h }
|
||||
// A locked kiosk has no panel and its windows are fullscreen: the whole output (above OSK).
|
||||
let bh = h - bottom_extra
|
||||
return { x: 0, y: 0, w, h: if bh > 1 { bh } else { 1 } }
|
||||
}
|
||||
let excl_bottom = if bottom_extra > theme.panel_height { bottom_extra } else { theme.panel_height }
|
||||
@wm.compute_work_area(
|
||||
{ x: 0, y: 0, w, h },
|
||||
excl_top=frame_top(), // room for the server-side title bar drawn above each client
|
||||
excl_bottom=theme.panel_height,
|
||||
excl_bottom~,
|
||||
)
|
||||
}
|
||||
|
||||
///| Recompute the window work area and shell popup clearance (e.g. when OSK opens/closes).
|
||||
fn ChandraCompositor::recompute_work_area(self : ChandraCompositor) -> Unit {
|
||||
let bottom_extra = if self.osk_visible { self.osk_height() } else { 0 }
|
||||
self.work_area = work_area_for(
|
||||
self.output_w,
|
||||
self.output_h,
|
||||
self.theme,
|
||||
kiosk=self.kiosk_strict(),
|
||||
bottom_extra~,
|
||||
)
|
||||
self.shell.set_popup_bottom_inset(bottom_extra)
|
||||
self.apply_actions(self.wm.fit_work_area(self.work_area))
|
||||
self.last_frame = None
|
||||
self.last_sig = None
|
||||
self.frame_changed = true
|
||||
self.damage.mark_full()
|
||||
}
|
||||
|
||||
///| The output changed size (the nested window was resized, maximized or made fullscreen):
|
||||
/// lay the desktop out for the new size, so nothing is drawn past the edge and cropped away.
|
||||
pub fn ChandraCompositor::resize(self : ChandraCompositor, w : Int, h : Int) -> Unit {
|
||||
@@ -479,11 +532,13 @@ pub fn ChandraCompositor::resize(self : ChandraCompositor, w : Int, h : Int) ->
|
||||
}
|
||||
self.output_w = w
|
||||
self.output_h = h
|
||||
self.work_area = work_area_for(w, h, self.theme, kiosk=self.kiosk_strict())
|
||||
let bottom_extra = if self.osk_visible { self.osk_height() } else { 0 }
|
||||
self.work_area = work_area_for(w, h, self.theme, kiosk=self.kiosk_strict(), bottom_extra~)
|
||||
self.close_overlay() // its frozen frame is the old size
|
||||
self.stop_recording()
|
||||
self.server.set_output_size(w, h)
|
||||
self.shell.set_output(self.theme, w, h)
|
||||
self.shell.set_popup_bottom_inset(bottom_extra)
|
||||
self.apply_actions(self.wm.fit_work_area(self.work_area))
|
||||
self.last_frame = None
|
||||
self.last_sig = None
|
||||
@@ -901,6 +956,7 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
self.session_tick()
|
||||
self.screenshot_tick()
|
||||
self.recording_tick()
|
||||
self.osk_sync()
|
||||
}
|
||||
|
||||
///| True while something runs on a timer rather than on input or client messages (a recording,
|
||||
@@ -1143,6 +1199,7 @@ fn ChandraCompositor::build_scene(
|
||||
panel_ops.append(self.face_window_ops())
|
||||
panel_ops.append(self.auth_ops())
|
||||
panel_ops.append(self.auth_notice_ops())
|
||||
panel_ops.append(self.osk_ops())
|
||||
self.frames_built = self.frames_built + 1
|
||||
self.run_shell_actions()
|
||||
// The wallpaper (the first ops) is cached by the renderer; the desktop card after it changes.
|
||||
@@ -1749,7 +1806,14 @@ pub fn ChandraCompositor::sync_window_style(self : ChandraCompositor) -> Unit {
|
||||
window_style.val = style
|
||||
self.wm.titlebar_h = frame_top()
|
||||
self.wm.border_w = frame_side()
|
||||
self.work_area = work_area_for(self.output_w, self.output_h, self.theme, kiosk=self.kiosk_strict())
|
||||
let bottom_extra = if self.osk_visible { self.osk_height() } else { 0 }
|
||||
self.work_area = work_area_for(
|
||||
self.output_w,
|
||||
self.output_h,
|
||||
self.theme,
|
||||
kiosk=self.kiosk_strict(),
|
||||
bottom_extra~,
|
||||
)
|
||||
self.apply_actions(self.wm.fit_work_area(self.work_area))
|
||||
for _, win in self.windows {
|
||||
if win.csd {
|
||||
@@ -1875,7 +1939,6 @@ fn key_name(code : UInt, shift : Bool) -> String {
|
||||
(16U, "qwertyuiop"),
|
||||
(30U, "asdfghjkl"),
|
||||
(44U, "zxcvbnm"),
|
||||
(2U, "1234567890"),
|
||||
]
|
||||
for r in rows {
|
||||
let (first, chars) = r
|
||||
@@ -1888,30 +1951,53 @@ fn key_name(code : UInt, shift : Bool) -> String {
|
||||
}
|
||||
}
|
||||
}
|
||||
if code >= 2U && code <= 11U {
|
||||
let digits = "1234567890"
|
||||
let shifted = "!@#$%^&*()"
|
||||
let s = if shift { shifted } else { digits }
|
||||
let c = Int::unsafe_to_char(s[(code - 2U).reinterpret_as_int()].to_int())
|
||||
return c.to_string()
|
||||
}
|
||||
match code {
|
||||
1U => "Escape"
|
||||
14U => "Backspace"
|
||||
28U => "Enter"
|
||||
57U => " "
|
||||
12U => "-"
|
||||
12U => if shift { "_" } else { "-" }
|
||||
13U => if shift { "+" } else { "=" }
|
||||
15U => "Tab"
|
||||
26U => if shift { "{" } else { "[" }
|
||||
27U => if shift { "}" } else { "]" }
|
||||
39U => if shift { ":" } else { ";" }
|
||||
40U => if shift { "\"" } else { "'" }
|
||||
41U => if shift { "~" } else { "`" }
|
||||
43U => if shift { "|" } else { "\\" }
|
||||
51U => if shift { "<" } else { "," }
|
||||
52U => if shift { ">" } else { "." }
|
||||
53U => if shift { "?" } else { "/" }
|
||||
103U => "ArrowUp"
|
||||
108U => "ArrowDown"
|
||||
105U => "ArrowLeft"
|
||||
106U => "ArrowRight"
|
||||
52U => "."
|
||||
53U => "/"
|
||||
_ => ""
|
||||
}
|
||||
}
|
||||
|
||||
///| Route host input: shell (launcher) first, then the window under the pointer
|
||||
/// / the keyboard-focused window.
|
||||
///| Route host input: OSK first, then grabs, shell (launcher), and focused window.
|
||||
pub fn ChandraCompositor::handle_input(
|
||||
self : ChandraCompositor,
|
||||
ev : @nested.InputEvent,
|
||||
time_ms : UInt,
|
||||
) -> Unit {
|
||||
self.handle_input_inner(ev, time_ms)
|
||||
self.osk_sync()
|
||||
}
|
||||
|
||||
///|
|
||||
fn ChandraCompositor::handle_input_inner(
|
||||
self : ChandraCompositor,
|
||||
ev : @nested.InputEvent,
|
||||
time_ms : UInt,
|
||||
) -> Unit {
|
||||
self.note_activity(@sys.monotonic_ms())
|
||||
match ev {
|
||||
@@ -1925,6 +2011,9 @@ pub fn ChandraCompositor::handle_input(
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
if self.osk_input(ev, time_ms) {
|
||||
return
|
||||
}
|
||||
// The password dialog takes all input while it is up; else the Face unlock window does.
|
||||
if self.grab_input(ev) {
|
||||
return
|
||||
@@ -2199,6 +2288,9 @@ pub fn ChandraCompositor::handle_input(
|
||||
self.super_solo = false
|
||||
if button != 273U && self.shell.pointer_down(xi, yi) {
|
||||
self.run_shell_actions()
|
||||
if button == 272U {
|
||||
self.osk_on_shell_click(xi, yi)
|
||||
}
|
||||
return
|
||||
}
|
||||
match self.window_at(xi, yi) {
|
||||
@@ -2250,8 +2342,11 @@ pub fn ChandraCompositor::handle_input(
|
||||
return
|
||||
}
|
||||
match self.window_at(xi, yi) {
|
||||
Some((wid, _)) => {
|
||||
Some((wid, client)) => {
|
||||
self.activate_window(wid)
|
||||
if button == 272U && client {
|
||||
self.osk_on_window_click(wid)
|
||||
}
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
@@ -2334,6 +2429,9 @@ pub fn ChandraCompositor::handle_input(
|
||||
///| Cursor shape (wp_cursor_shape_v1 value) for the current pointer position: shell UI
|
||||
/// decides over the launcher; a client window decides inside its client area; otherwise default.
|
||||
pub fn ChandraCompositor::desired_cursor(self : ChandraCompositor) -> UInt {
|
||||
if self.osk_hit_any(self.ptr_x.to_int(), self.ptr_y.to_int()) {
|
||||
return 4U
|
||||
}
|
||||
match self.auth {
|
||||
Some(ui) => return self.auth_cursor(ui)
|
||||
None => ()
|
||||
|
||||
Reference in new issue
Block a user