OSK: sit on top of the panel instead of covering it
CI / test (push) Failing after 49s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Opus 5.5 committed 2026-11-28 23:11:59 -08:00
1 parent 68912f6d64
commit 444d67ac79
7 files changed
+51 -16

No files matched your search

+1 -1
View File
@@ -443,7 +443,7 @@ fn ChandraCompositor::auth_ops(self : ChandraCompositor) -> Array[@scene.DrawOp]
// Place the card in the middle (shaking after a failure) with a soft shadow.
let h = y
let cx = (sw - w) / 2 + d.shake_offset(now)
let avail_h = if self.osk_visible { sh - self.osk_height() } else { sh }
let avail_h = sh - self.osk_bottom_inset()
let cyy = ((avail_h - h) / 2).max(8)
for k = 1; k <= 4; k = k + 1 {
ops.push(@scene.DrawOp::FillRect(@scene.Rect::new(cx - k * 2, cyy - k * 2 + 6, w + k * 4, h + k * 4), @scene.Rgba::new(0, 0, 0, 22), rad + 6 + k * 2))
+3 -3
View File
@@ -537,7 +537,7 @@ fn work_area_for(
///| 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 }
let bottom_extra = self.osk_bottom_inset()
self.work_area = work_area_for(
self.output_w,
self.output_h,
@@ -627,7 +627,7 @@ pub fn ChandraCompositor::resize(self : ChandraCompositor, w : Int, h : Int) ->
}
self.output_w = w
self.output_h = h
let bottom_extra = if self.osk_visible { self.osk_height() } else { 0 }
let bottom_extra = self.osk_bottom_inset()
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()
@@ -1912,7 +1912,7 @@ 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()
let bottom_extra = if self.osk_visible { self.osk_height() } else { 0 }
let bottom_extra = self.osk_bottom_inset()
self.work_area = work_area_for(
self.output_w,
self.output_h,
+2 -2
View File
@@ -182,7 +182,7 @@ fn ChandraCompositor::emoji_place(self : ChandraCompositor, ui : EmojiUi) -> Uni
x = ox + cx
y = oy + cy + ch + 6
let bottom_edge = if self.osk_visible {
self.output_h - self.osk_height()
self.osk_rect().y
} else {
sh - self.theme.panel_height
}
@@ -201,7 +201,7 @@ fn ChandraCompositor::emoji_place(self : ChandraCompositor, ui : EmojiUi) -> Uni
None => ()
}
x = x.min((sw - w - 8).max(8)).max(8)
let max_y = (if self.osk_visible { sh - self.osk_height() } else { sh }) - h - 8
let max_y = sh - self.osk_bottom_inset() - h - 8
y = y.min(max_y.max(8)).max(8)
ui.rect = @scene.Rect::new(x, y, w, h)
}
+2 -1
View File
@@ -177,7 +177,7 @@ fn ChandraCompositor::apply_kiosk_lock(self : ChandraCompositor) -> Unit {
self.switcher_on = false
}
}
let bottom_extra = if self.osk_visible { self.osk_height() } else { 0 }
let bottom_extra = self.osk_bottom_inset()
self.work_area = work_area_for(
self.output_w,
self.output_h,
@@ -185,6 +185,7 @@ fn ChandraCompositor::apply_kiosk_lock(self : ChandraCompositor) -> Unit {
kiosk=locked,
bottom_extra~,
)
self.shell.set_popup_bottom_inset(bottom_extra)
if !locked {
// Give the windows the kiosk made fullscreen back to the normal layout.
let ids : Array[UInt64] = []
+20 -7
View File
@@ -95,17 +95,30 @@ pub fn ChandraCompositor::osk_key_center(self : ChandraCompositor, label : Strin
None
}
///| Height of the on-screen keyboard when shown.
pub fn ChandraCompositor::osk_height(self : ChandraCompositor) -> Int {
let half = self.output_h / 2
let h = if 236 < half { 236 } else { half }
if h < 120 { (120).min(self.output_h) } else { h }
///| Room kept below the keyboard for the panel (none in a strict kiosk, which has no panel).
fn ChandraCompositor::osk_panel_room(self : ChandraCompositor) -> Int {
if self.kiosk_strict() { 0 } else { self.theme.panel_height }
}
///| Bounding rectangle of the visible on-screen keyboard.
///| Height of the on-screen keyboard when shown.
pub fn ChandraCompositor::osk_height(self : ChandraCompositor) -> Int {
let room = self.output_h - self.osk_panel_room()
let half = room / 2
let h = if 236 < half { 236 } else { half }
if h < 120 { (120).min(room) } else { h }
}
///| How much of the bottom of the output the open keyboard takes, the panel under it included
/// (0 while it is hidden).
fn ChandraCompositor::osk_bottom_inset(self : ChandraCompositor) -> Int {
if self.osk_visible { self.output_h - self.osk_rect().y } else { 0 }
}
///| Bounding rectangle of the visible on-screen keyboard: it sits on top of the panel, which
/// stays visible and usable.
pub fn ChandraCompositor::osk_rect(self : ChandraCompositor) -> @scene.Rect {
let h = self.osk_height()
@scene.Rect::new(0, self.output_h - h, self.output_w, h)
@scene.Rect::new(0, self.output_h - self.osk_panel_room() - h, self.output_w, h)
}
///| Compact "KB" pill above the bottom-right corner of the panel when the OSK is enabled but
+22 -1
View File
@@ -39,7 +39,7 @@ test "OSK auto-opens on zwp_text_input_v3 enable, shrinks work_area, and auto-hi
// Enabling text-input-v3 raises the OSK and shrinks the window work area cleanly above it.
text_input_state(comp, a, ti, true, 50, 50, 16)
assert_true(comp.osk_is_visible())
assert_eq(comp.work_area.h, full_wa_h - (comp.osk_height() - comp.theme.panel_height))
assert_eq(comp.work_area.h, full_wa_h - comp.osk_height())
// Disabling text-input-v3 hides the OSK and restores the full work area.
text_input_state(comp, a, ti, false, 0, 0, 0)
@@ -127,6 +127,10 @@ test "OSK auto-opens on launcher popup, lifts popup above OSK, and types into se
assert_true(comp.shell.popup_open())
assert_true(comp.osk_is_visible())
// The OSK sits on top of the panel, not over it.
let or = comp.osk_rect()
assert_eq(or.y + or.h, comp.output_h - comp.theme.panel_height)
// Launcher popup sits entirely above the OSK.
let pr = comp.shell.open_popup_rect().unwrap()
assert_true(pr.y + pr.h <= comp.osk_rect().y)
@@ -135,6 +139,23 @@ test "OSK auto-opens on launcher popup, lifts popup above OSK, and types into se
let (tx, ty) = comp.osk_key_center("t").unwrap()
click_at(comp, tx, ty, 20U)
assert_eq(comp.shell.launcher_state.query, "t")
// The panel still takes clicks under the open OSK: its launcher button closes the popup.
click_at(comp, lx.to_int(), ly.to_int(), 30U)
assert_false(comp.shell.popup_open())
assert_false(comp.osk_is_visible())
comp.close()
}
///|
test "OSK reaches the bottom edge in a strict kiosk, which has no panel" {
let comp = osk_comp("kiosk")
comp.start_kiosk("")
let r = comp.osk_rect()
assert_eq(r.y + r.h, comp.output_h)
assert_true(comp.set_kiosk_locked(false))
let r2 = comp.osk_rect()
assert_eq(r2.y + r2.h, comp.output_h - comp.theme.panel_height)
comp.close()
}
+1 -1
View File
@@ -15,7 +15,7 @@ Chandra includes KMS/libinput/compositor adaptations tailored for mainline Linux
## Touch Input & On-Screen Keyboard
- **Long-press right-click:** In [`compositor/kms/kms_stub.c`](../compositor/kms/kms_stub.c), a stationary touch held for `500 ms` converts to a synthetic right-click (`BTN_RIGHT`) via a `timerfd`, allowing context menus and secondary actions without a mouse.
- **Built-in OSK:** [`compositor/host/osk.mbt`](../compositor/host/osk.mbt) provides a 5-row virtual keyboard that opens automatically when Wayland text input (`zwp_text_input_v3`) gains focus and can also be toggled manually from the bottom-right **`KB`** pill.
- **Built-in OSK:** [`compositor/host/osk.mbt`](../compositor/host/osk.mbt) provides a 5-row virtual keyboard that opens automatically when Wayland text input (`zwp_text_input_v3`) gains focus and can also be toggled manually from the bottom-right **`KB`** pill. It sits directly above the panel, so the panel stays visible and usable while typing (a strict kiosk has no panel: there it reaches the bottom edge).
## Display Rotation, Flip, and Auto-Rotate