Double-click a window's title bar to maximize or restore it
CI / test (push) Failing after 16s

Two left presses on the same title bar within 400ms and 4px of each other
toggle maximize, like the title-bar button. A press that turned into a drag
never starts a double-click. A tiled window now floats only once the pointer
actually moves, so clicking or double-clicking its title bar leaves it in
(and restores it to) its tile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hjF2tD2UuaXLzFzrvV
This commit is contained in:
Claude committed 2026-11-25 19:00:40 +00:00
1 parent 4fc4a963b4
commit 3454619162
3 files changed
+271 -5

No files matched your search

+11 -5
View File
@@ -49,6 +49,8 @@ pub(all) struct ChandraCompositor {
mut ptr_win : UInt64?
/// Divider being dragged between tiled windows.
mut split_drag : @wm.SplitHandle?
/// The last left press on a title bar (titleclick.mbt): drag to move, double-click to maximize.
mut title_press : TitlePress?
/// True while a button press was forwarded to a client (so its release is too).
mut press_fwd : Bool
mut kbd_win : UInt64?
@@ -126,6 +128,7 @@ pub fn ChandraCompositor::new(
popups: [],
ptr_win: None,
split_drag: None,
title_press: None,
press_fwd: false,
kbd_win: None,
mods: 0U,
@@ -1098,6 +1101,9 @@ pub fn ChandraCompositor::handle_input(
self.shell.set_hover(id, xi, yi)
return
}
if self.title_bar_motion(xi, yi) {
return
}
if self.wm.drag is Some(_) {
match self.wm.update_drag(xi, yi) {
Some(a) => self.apply_actions([a])
@@ -1208,6 +1214,9 @@ pub fn ChandraCompositor::handle_input(
}
return
}
if !pressed && button == 272U {
self.title_bar_release()
}
if !pressed && self.shell.pointer_up() {
self.run_shell_actions()
return
@@ -1248,11 +1257,8 @@ pub fn ChandraCompositor::handle_input(
return
}
if button == 272U && self.resize_at(xi, yi) is None {
// Drag the window by its title bar; a tiled window becomes floating first.
self.leave_pointer()
self.activate_window(wid)
self.apply_actions(self.wm.float_window(wid, self.work_area))
ignore(self.wm.start_drag(wid, @wm.DragMode::Move, xi, yi))
// Drag the window by its title bar, or double-click it to maximize / restore.
self.title_bar_press(wid, xi, yi, time_ms)
return
}
}