调整 send_client_to_next_monitor 函数实现
This commit is contained in:
14
src/action.c
14
src/action.c
@@ -36,20 +36,10 @@ void send_client_to_tag(const user_action_arg_t *arg) {
|
|||||||
void send_client_to_next_monitor(const user_action_arg_t *arg) {
|
void send_client_to_next_monitor(const user_action_arg_t *arg) {
|
||||||
if (!wm.client_focused) return;
|
if (!wm.client_focused) return;
|
||||||
|
|
||||||
monitor_t *current_monitor = wm.client_focused->monitor;
|
monitor_t *next_monitor = wm_get_next_monitor(wm.client_focused->monitor);
|
||||||
monitor_t *next_monitor = current_monitor->next;
|
if (wm.client_focused->monitor == next_monitor) return;
|
||||||
if (next_monitor == nullptr) {
|
|
||||||
next_monitor = wm.monitor_list;
|
|
||||||
} else {
|
|
||||||
for (monitor_t *m = wm.monitor_list; m && m->next != current_monitor;
|
|
||||||
m = m->next) {
|
|
||||||
next_monitor = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current_monitor != next_monitor) {
|
|
||||||
client_send_to_monitor(wm.client_focused, next_monitor);
|
client_send_to_monitor(wm.client_focused, next_monitor);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void spawn(const user_action_arg_t *arg) {
|
void spawn(const user_action_arg_t *arg) {
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ void client_send_to_monitor(client_t *client, monitor_t *monitor) {
|
|||||||
client->tags = monitor->selected_tag->mask;
|
client->tags = monitor->selected_tag->mask;
|
||||||
client_add_to_tag(client, monitor->selected_tag);
|
client_add_to_tag(client, monitor->selected_tag);
|
||||||
|
|
||||||
|
wm.current_monitor = monitor;
|
||||||
monitor_arrange(m);
|
monitor_arrange(m);
|
||||||
monitor_arrange(monitor);
|
monitor_arrange(monitor);
|
||||||
monitor_draw_bar(m);
|
monitor_draw_bar(m);
|
||||||
|
|||||||
6
src/wm.c
6
src/wm.c
@@ -419,6 +419,12 @@ monitor_t *wm_get_monitor_by_point(point_t point) {
|
|||||||
return wm.monitor_list;
|
return wm.monitor_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
monitor_t *wm_get_next_monitor(monitor_t *monitor) {
|
||||||
|
monitor_t *next_monitor = monitor->next;
|
||||||
|
if (next_monitor == nullptr) next_monitor = wm.monitor_list;
|
||||||
|
return next_monitor;
|
||||||
|
}
|
||||||
|
|
||||||
static void debug_show_monitor_list(void) {
|
static void debug_show_monitor_list(void) {
|
||||||
logger("\n========================== monitors ==========================\n");
|
logger("\n========================== monitors ==========================\n");
|
||||||
for (monitor_t *m = wm.monitor_list; m; m = m->next) {
|
for (monitor_t *m = wm.monitor_list; m; m = m->next) {
|
||||||
|
|||||||
1
src/wm.h
1
src/wm.h
@@ -54,3 +54,4 @@ void wm_restart(void);
|
|||||||
void wm_quit(void);
|
void wm_quit(void);
|
||||||
void wm_restack_clients(void);
|
void wm_restack_clients(void);
|
||||||
monitor_t *wm_get_monitor_by_point(point_t point);
|
monitor_t *wm_get_monitor_by_point(point_t point);
|
||||||
|
monitor_t *wm_get_next_monitor(monitor_t *monitor);
|
||||||
|
|||||||
Reference in New Issue
Block a user