mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-30 13:14:45 -04:00
opt: Remove redundant code
This commit is contained in:
parent
38393873f3
commit
d0645e5c30
3 changed files with 6 additions and 47 deletions
|
|
@ -179,7 +179,7 @@ void client_focus_group_member(Client *c) {
|
||||||
|
|
||||||
void client_check_tab_node_visible(Client *c) {
|
void client_check_tab_node_visible(Client *c) {
|
||||||
|
|
||||||
if (!c || c->iskilling || !c->mon)
|
if (!c || !c->mon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Client *head = c;
|
Client *head = c;
|
||||||
|
|
@ -206,9 +206,6 @@ void client_raise_group(Client *c) {
|
||||||
if (!c || !c->mon)
|
if (!c || !c->mon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!c->group_prev && !c->group_next)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Client *head = c;
|
Client *head = c;
|
||||||
while (head->group_prev)
|
while (head->group_prev)
|
||||||
head = head->group_prev;
|
head = head->group_prev;
|
||||||
|
|
@ -217,17 +214,14 @@ void client_raise_group(Client *c) {
|
||||||
while (cur) {
|
while (cur) {
|
||||||
if (cur->group_bar) {
|
if (cur->group_bar) {
|
||||||
wlr_scene_node_raise_to_top(&cur->group_bar->scene_buffer->node);
|
wlr_scene_node_raise_to_top(&cur->group_bar->scene_buffer->node);
|
||||||
wlr_scene_node_raise_to_top(&cur->scene->node);
|
|
||||||
}
|
}
|
||||||
|
wlr_scene_node_raise_to_top(&cur->scene->node);
|
||||||
cur = cur->group_next;
|
cur = cur->group_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_reparent_group(Client *c) {
|
void client_reparent_group(Client *c) {
|
||||||
if (!c || !c->group_bar)
|
if (!c || !c->mon)
|
||||||
return;
|
|
||||||
|
|
||||||
if (!c->group_prev && !c->group_next)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int32_t layer = c->isoverlay ? LyrOverlay
|
int32_t layer = c->isoverlay ? LyrOverlay
|
||||||
|
|
@ -244,8 +238,8 @@ void client_reparent_group(Client *c) {
|
||||||
if (cur->group_bar) {
|
if (cur->group_bar) {
|
||||||
wlr_scene_node_reparent(&cur->group_bar->scene_buffer->node,
|
wlr_scene_node_reparent(&cur->group_bar->scene_buffer->node,
|
||||||
layers[layer]);
|
layers[layer]);
|
||||||
wlr_scene_node_reparent(&cur->scene->node, layers[layer]);
|
|
||||||
}
|
}
|
||||||
|
wlr_scene_node_reparent(&cur->scene->node, layers[layer]);
|
||||||
cur = cur->group_next;
|
cur = cur->group_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -268,7 +262,7 @@ void client_set_group_mon(Client *c, Monitor *m) {
|
||||||
|
|
||||||
Client *cur = head;
|
Client *cur = head;
|
||||||
while (cur) {
|
while (cur) {
|
||||||
cur->mon = m;
|
client_change_mon(cur, m);
|
||||||
cur = cur->group_next;
|
cur = cur->group_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1554,16 +1554,6 @@ int32_t toggleoverlay(const Arg *arg) {
|
||||||
|
|
||||||
c->isoverlay ^= 1;
|
c->isoverlay ^= 1;
|
||||||
|
|
||||||
if (c->isoverlay) {
|
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrOverlay]);
|
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
|
||||||
} else if (client_should_overtop(c) && c->isfloating) {
|
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrTop]);
|
|
||||||
} else {
|
|
||||||
wlr_scene_node_reparent(&c->scene->node,
|
|
||||||
layers[c->isfloating ? LyrTop : LyrTile]);
|
|
||||||
}
|
|
||||||
|
|
||||||
client_reparent_group(c);
|
client_reparent_group(c);
|
||||||
setborder_color(c);
|
setborder_color(c);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
27
src/mango.c
27
src/mango.c
|
|
@ -947,6 +947,7 @@ static void global_draw_group_bar(Client *c, int32_t x, int32_t y,
|
||||||
int32_t width, int32_t height);
|
int32_t width, int32_t height);
|
||||||
|
|
||||||
static void client_reparent_group(Client *c);
|
static void client_reparent_group(Client *c);
|
||||||
|
static void client_change_mon(Client *c, Monitor *m);
|
||||||
|
|
||||||
#include "data/static_keymap.h"
|
#include "data/static_keymap.h"
|
||||||
#include "dispatch/bind_declare.h"
|
#include "dispatch/bind_declare.h"
|
||||||
|
|
@ -2771,10 +2772,8 @@ void closemon(Monitor *m) {
|
||||||
c->foreign_toplevel = NULL;
|
c->foreign_toplevel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->mon = NULL;
|
|
||||||
client_set_group_mon(c, NULL);
|
client_set_group_mon(c, NULL);
|
||||||
} else {
|
} else {
|
||||||
client_change_mon(c, selmon);
|
|
||||||
client_set_group_mon(c, selmon);
|
client_set_group_mon(c, selmon);
|
||||||
}
|
}
|
||||||
// record the oldmonname which is used to restore
|
// record the oldmonname which is used to restore
|
||||||
|
|
@ -3955,7 +3954,6 @@ void focusclient(Client *c, int32_t lift) {
|
||||||
/* Raise client in stacking order if requested */
|
/* Raise client in stacking order if requested */
|
||||||
if (c && lift) {
|
if (c && lift) {
|
||||||
client_raise_group(c);
|
client_raise_group(c);
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c && client_surface(c) == old_keyboard_focus_surface && selmon &&
|
if (c && client_surface(c) == old_keyboard_focus_surface && selmon &&
|
||||||
|
|
@ -5677,15 +5675,6 @@ setfloating(Client *c, int32_t floating) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->isoverlay) {
|
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrOverlay]);
|
|
||||||
} else if (client_should_overtop(c) && c->isfloating) {
|
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrTop]);
|
|
||||||
} else {
|
|
||||||
wlr_scene_node_reparent(&c->scene->node,
|
|
||||||
layers[c->isfloating ? LyrTop : LyrTile]);
|
|
||||||
}
|
|
||||||
|
|
||||||
client_reparent_group(c);
|
client_reparent_group(c);
|
||||||
|
|
||||||
if (c->isfloating) {
|
if (c->isfloating) {
|
||||||
|
|
@ -5781,10 +5770,6 @@ void setmaximizescreen(Client *c, int32_t maximizescreen, bool rearrange) {
|
||||||
setfloating(c, 1);
|
setfloating(c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_scene_node_reparent(&c->scene->node,
|
|
||||||
layers[c->ismaximizescreen ? LyrMaximize
|
|
||||||
: c->isfloating ? LyrTop
|
|
||||||
: LyrTile]);
|
|
||||||
client_reparent_group(c);
|
client_reparent_group(c);
|
||||||
|
|
||||||
if (!c->force_fakemaximize && !c->ismaximizescreen) {
|
if (!c->force_fakemaximize && !c->ismaximizescreen) {
|
||||||
|
|
@ -5845,16 +5830,6 @@ void setfullscreen(Client *c, int32_t fullscreen,
|
||||||
setfloating(c, 1);
|
setfloating(c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->isoverlay) {
|
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrOverlay]);
|
|
||||||
} else if (client_should_overtop(c) && c->isfloating) {
|
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrTop]);
|
|
||||||
} else {
|
|
||||||
wlr_scene_node_reparent(
|
|
||||||
&c->scene->node,
|
|
||||||
layers[fullscreen || c->isfloating ? LyrTop : LyrTile]);
|
|
||||||
}
|
|
||||||
|
|
||||||
client_reparent_group(c);
|
client_reparent_group(c);
|
||||||
|
|
||||||
if (rearrange)
|
if (rearrange)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue