feat: 统一 current_monitor 切换并让光标跟随 current_monitor 变化
- 新增 wm_set_current_monitor ,切换前记录光标当前所在 monitor 的最后 位置 - 切换到目标 monitor 时按需恢复该 monitor 的光标位置 - 将 action/event/client 中直接赋值 wm.current_monitor 的逻辑改为统一 调用 wm_set_current_monitor - 优化 monitor_restore_cursor_point:首次未初始化时计算并设置位置 - 为 wm_get_monitor_by_area / wm_get_monitor_by_point 增加 returns_nonnull 约束,并让 by_point 复用 by_area
This commit is contained in:
@@ -34,7 +34,7 @@ static void button_press(xcb_button_press_event_t *ev) {
|
||||
|
||||
if (!monitor) return;
|
||||
|
||||
wm.current_monitor = monitor;
|
||||
wm_set_current_monitor(monitor);
|
||||
if (ev->event_x >= monitor->tag_extent.start &&
|
||||
ev->event_x <= monitor->tag_extent.end) {
|
||||
click_area = click_tag;
|
||||
@@ -188,7 +188,7 @@ static void client_message(xcb_client_message_event_t *ev) {
|
||||
|
||||
switch (ev->data.data32[0]) {
|
||||
case 2: /* 来自 pager */
|
||||
wm.current_monitor = c->monitor;
|
||||
wm_set_current_monitor(c->monitor);
|
||||
monitor_select_tag(c->monitor, t->mask);
|
||||
client_focus(c);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user