chandra-ctl windows: how Chandra sees each window, and what the pointer is over
CI / test (push) Canceled after 7m7s
CI / test (push) Canceled after 7m7s
For "this window won't resize" reports (V's Gajim still not resizing on real hardware, while a libadwaita window built like Gajim's resizes headless on both hosts): one line per window with its frame kind (client-frame / chandra-frame), layout state (floating, tiled, maximized, fullscreen), box, buffer, the client's shadow per side, min/max size and title, then the pointer position and what it's over (a resize grip and which edge, a window, a title bar, a tiling divider, the panel, the desktop). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hiu4r7mEXBdKY6cgv6
This commit is contained in:
4 files changed
+123
-1
No files matched your search
@@ -210,6 +210,7 @@ pub fn ChandraCompositor::control_command(self : ChandraCompositor, line : Strin
|
|||||||
"reload load every panel module again from disk", "reload NAME only the modules whose name, slot or path is NAME",
|
"reload load every panel module again from disk", "reload NAME only the modules whose name, slot or path is NAME",
|
||||||
"shortcut ID do what shortcut ID does (launcher, overview, show-desktop, ...)",
|
"shortcut ID do what shortcut ID does (launcher, overview, show-desktop, ...)",
|
||||||
"kiosk [lock|unlock|status] kiosk mode (--kiosk): lock it down or unlock it for admin work",
|
"kiosk [lock|unlock|status] kiosk mode (--kiosk): lock it down or unlock it for admin work",
|
||||||
|
"windows each window: frame, layout, box, shadow, size limits; and what is under the pointer",
|
||||||
"ok",
|
"ok",
|
||||||
],
|
],
|
||||||
true,
|
true,
|
||||||
@@ -272,6 +273,109 @@ pub fn ChandraCompositor::control_command(self : ChandraCompositor, line : Strin
|
|||||||
_ => (["error usage: kiosk [lock|unlock|status]"], false)
|
_ => (["error usage: kiosk [lock|unlock|status]"], false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"windows" => {
|
||||||
|
let out = self.window_report()
|
||||||
|
out.push("ok " + self.windows.length().to_string() + " windows")
|
||||||
|
(out, true)
|
||||||
|
}
|
||||||
other => (["error unknown command '" + other + "' (try: help)"], false)
|
other => (["error unknown command '" + other + "' (try: help)"], false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///| `chandra-ctl windows`: how Chandra sees each window, for "this window won't resize/move"
|
||||||
|
/// reports. One line per window, top of the stack first, then what is under the pointer.
|
||||||
|
fn ChandraCompositor::window_report(self : ChandraCompositor) -> Array[String] {
|
||||||
|
let out : Array[String] = []
|
||||||
|
let order = self.wm.stacking_order()
|
||||||
|
let mut i = order.length() - 1
|
||||||
|
while i >= 0 {
|
||||||
|
let id = order[i]
|
||||||
|
i = i - 1
|
||||||
|
match self.windows.get(id) {
|
||||||
|
Some(w) => {
|
||||||
|
let r = w.client_rect()
|
||||||
|
let sb = StringBuilder()
|
||||||
|
sb.write_string(id.to_string() + " " + (if w.app_id == "" { "-" } else { w.app_id }))
|
||||||
|
sb.write_string(if w.csd { " client-frame" } else { " chandra-frame" })
|
||||||
|
match self.wm.windows.get(id) {
|
||||||
|
Some(rec) => {
|
||||||
|
sb.write_string(
|
||||||
|
if rec.fullscreen {
|
||||||
|
" fullscreen"
|
||||||
|
} else if rec.maximized {
|
||||||
|
" maximized"
|
||||||
|
} else if rec.is_floating {
|
||||||
|
" floating"
|
||||||
|
} else {
|
||||||
|
" tiled"
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if rec.minimized {
|
||||||
|
sb.write_string(" minimized")
|
||||||
|
}
|
||||||
|
sb.write_string(" min=" + rec.min_size.w.to_string() + "x" + rec.min_size.h.to_string())
|
||||||
|
match rec.max_size {
|
||||||
|
Some(m) => sb.write_string(" max=" + m.w.to_string() + "x" + m.h.to_string())
|
||||||
|
None => ()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => sb.write_string(" unmanaged")
|
||||||
|
}
|
||||||
|
sb.write_string(" box=" + r.x.to_string() + "," + r.y.to_string() + "+" + r.w.to_string() + "x" + r.h.to_string())
|
||||||
|
match w.surface {
|
||||||
|
Some(s) => {
|
||||||
|
sb.write_string(" buffer=" + s.width.to_string() + "x" + s.height.to_string())
|
||||||
|
if w.csd {
|
||||||
|
// The client's shadow on each side: left, top, right, bottom.
|
||||||
|
sb.write_string(
|
||||||
|
" shadow=" + w.geo_x.to_string() + "," + w.geo_y.to_string() + "," +
|
||||||
|
(s.width - w.geo_x - r.w).to_string() + "," + (s.height - w.geo_y - r.h).to_string(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => sb.write_string(" no-buffer")
|
||||||
|
}
|
||||||
|
if w.subs.length() > 0 {
|
||||||
|
sb.write_string(" subsurfaces=" + w.subs.length().to_string())
|
||||||
|
}
|
||||||
|
sb.write_string(" \"" + w.title + "\"")
|
||||||
|
out.push(sb.to_string())
|
||||||
|
}
|
||||||
|
None => ()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let x = self.ptr_x.to_int()
|
||||||
|
let y = self.ptr_y.to_int()
|
||||||
|
let under = if self.popup_at(x, y) is Some(_) {
|
||||||
|
"a popup menu"
|
||||||
|
} else if self.shell.hit(x, y) {
|
||||||
|
"the panel"
|
||||||
|
} else {
|
||||||
|
match self.resize_at(x, y) {
|
||||||
|
Some((wid, mode)) => "resize grip " + drag_mode_name(mode) + " of " + wid.to_string()
|
||||||
|
None =>
|
||||||
|
match self.window_at(x, y) {
|
||||||
|
Some((wid, true)) => "window " + wid.to_string()
|
||||||
|
Some((wid, false)) => "title bar of " + wid.to_string()
|
||||||
|
None => if self.handle_at(x, y) is Some(_) { "a tiling divider" } else { "the desktop" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.push("pointer " + x.to_string() + "," + y.to_string() + " over " + under)
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn drag_mode_name(m : @wm.DragMode) -> String {
|
||||||
|
match m {
|
||||||
|
ResizeN => "top"
|
||||||
|
ResizeS => "bottom"
|
||||||
|
ResizeW => "left"
|
||||||
|
ResizeE => "right"
|
||||||
|
ResizeNW => "top-left"
|
||||||
|
ResizeNE => "top-right"
|
||||||
|
ResizeSW => "bottom-left"
|
||||||
|
ResizeSE => "bottom-right"
|
||||||
|
_ => "move"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -396,3 +396,18 @@ test "a subsurface (Chrome's toolbar bubbles) is drawn over its window and gets
|
|||||||
assert_eq(comp.windows.get(1UL).unwrap().subs.length(), 0)
|
assert_eq(comp.windows.get(1UL).unwrap().subs.length(), 0)
|
||||||
assert_true(comp.compose_frame().pixel(ox + 110, oy + 60) != blue)
|
assert_true(comp.compose_frame().pixel(ox + 110, oy + 60) != blue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
test "chandra-ctl windows says how a GTK window is framed and what the pointer is over" {
|
||||||
|
let (comp, c, shm, surf, xdg, tl) = csd_setup("report")
|
||||||
|
ignore(gtk_frame(comp, c, shm, surf, xdg, tl))
|
||||||
|
ignore(gtk_frame(comp, c, shm, surf, xdg, tl))
|
||||||
|
let r = comp.windows.get(1UL).unwrap().client_rect()
|
||||||
|
comp.handle_input(@nested.InputEvent::PointerMove((r.x + r.w + 5).to_double(), (r.y + r.h / 2).to_double()), 60U)
|
||||||
|
let (lines, ok) = comp.control_command("windows")
|
||||||
|
assert_true(ok)
|
||||||
|
assert_true(lines[0].has_prefix("1 org.gnome.Nautilus client-frame floating "))
|
||||||
|
assert_true(lines[0].contains(" shadow=24,24,24,24 "))
|
||||||
|
assert_true(lines.contains("pointer " + (r.x + r.w + 5).to_string() + "," + (r.y + r.h / 2).to_string() + " over resize grip right of 1"))
|
||||||
|
assert_eq(lines[lines.length() - 1], "ok 1 windows")
|
||||||
|
}
|
||||||
@@ -33,6 +33,8 @@ chandra-ctl reload NAME # modules whose name (clock-digital), slot (w3)
|
|||||||
chandra-ctl list # loaded modules in panel order: slot, module, path
|
chandra-ctl list # loaded modules in panel order: slot, module, path
|
||||||
chandra-ctl ping # is the compositor answering?
|
chandra-ctl ping # is the compositor answering?
|
||||||
chandra-ctl shortcut overview # run a keyboard shortcut by its id (see Settings > Shortcuts)
|
chandra-ctl shortcut overview # run a keyboard shortcut by its id (see Settings > Shortcuts)
|
||||||
|
chandra-ctl windows # each window's frame, layout state, box, shadow and size limits,
|
||||||
|
# then what the pointer is over (a resize grip, a window, ...)
|
||||||
chandra-ctl help
|
chandra-ctl help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -7,6 +7,7 @@
|
|||||||
chandra-ctl ping check the compositor answers
|
chandra-ctl ping check the compositor answers
|
||||||
chandra-ctl shortcut ID do what a keyboard shortcut does (overview, launcher, show-desktop...)
|
chandra-ctl shortcut ID do what a keyboard shortcut does (overview, launcher, show-desktop...)
|
||||||
chandra-ctl kiosk [lock|unlock|status] kiosk mode (--kiosk, docs/kiosk.md)
|
chandra-ctl kiosk [lock|unlock|status] kiosk mode (--kiosk, docs/kiosk.md)
|
||||||
|
chandra-ctl windows how Chandra sees each window, and what is under the pointer
|
||||||
|
|
||||||
The socket is $XDG_RUNTIME_DIR/chandra/<wayland socket name>.sock (the session's is
|
The socket is $XDG_RUNTIME_DIR/chandra/<wayland socket name>.sock (the session's is
|
||||||
wayland-moon-0.sock). It is found in this order: --socket PATH, $CHANDRA_CONTROL, the one for
|
wayland-moon-0.sock). It is found in this order: --socket PATH, $CHANDRA_CONTROL, the one for
|
||||||
@@ -19,7 +20,7 @@ import os
|
|||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
USAGE = "usage: chandra-ctl [--socket PATH] [--quiet] {reload [NAME] | list | ping | shortcut ID | kiosk [lock|unlock|status] | help}"
|
USAGE = "usage: chandra-ctl [--socket PATH] [--quiet] {reload [NAME] | list | ping | shortcut ID | kiosk [lock|unlock|status] | windows | help}"
|
||||||
|
|
||||||
|
|
||||||
def runtime_dir():
|
def runtime_dir():
|
||||||
|
|||||||
Reference in new issue
Block a user