mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-29 13:14:48 -04:00
opt: optmize structruing\
This commit is contained in:
parent
afd7135fa6
commit
b8ca3a3c34
11 changed files with 234 additions and 239 deletions
|
|
@ -57,14 +57,14 @@ void client_tile_resize(Client *c, struct wlr_box geo, int32_t interact) {
|
|||
if (!ISFAKETILED(c))
|
||||
return;
|
||||
|
||||
if (c->isfullscreen && c->tab_bar_node) {
|
||||
wlr_scene_node_set_enabled(&c->tab_bar_node->scene_buffer->node, false);
|
||||
if (c->isfullscreen && c->group_bar) {
|
||||
wlr_scene_node_set_enabled(&c->group_bar->scene_buffer->node, false);
|
||||
}
|
||||
|
||||
if (!c->mon->isoverview && c->tab_bar_node && !c->isfullscreen &&
|
||||
if (!c->mon->isoverview && c->group_bar && !c->isfullscreen &&
|
||||
(c->group_next || c->group_prev)) {
|
||||
geo.y = geo.y + config.tab_bar_height;
|
||||
geo.height -= config.tab_bar_height;
|
||||
geo.y = geo.y + config.group_bar_height;
|
||||
geo.height -= config.group_bar_height;
|
||||
}
|
||||
|
||||
if ((!c->isfullscreen && !c->ismaximizescreen) ||
|
||||
|
|
@ -115,27 +115,22 @@ void client_add_jump_label_node(Client *c) {
|
|||
wlr_scene_node_set_enabled(&c->jump_label_node->scene_buffer->node, false);
|
||||
}
|
||||
|
||||
void client_add_tab_bar_node(Client *c) {
|
||||
void client_add_group_bar(Client *c) {
|
||||
|
||||
if (config.tab_bar_height <= 0) {
|
||||
if (config.group_bar_height <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
MangoCustomDecorate *MangoCustomDecorate =
|
||||
ecalloc(1, sizeof(MangoCustomDecorate));
|
||||
MangoCustomDecorate->node_data = c;
|
||||
MangoCustomDecorate->node_type = MANGO_TITLE_NODE;
|
||||
MangoCustomDecorate->type = CustomDecorate;
|
||||
uint32_t layer = c->isoverlay ? LyrOverlay
|
||||
: c->isfloating || c->isfullscreen ? LyrTop
|
||||
: c->ismaximizescreen ? LyrMaximize
|
||||
: LyrTile;
|
||||
|
||||
c->tab_bar_node = mango_tab_bar_node_create(
|
||||
MangoCustomDecorate, layers[layer], config.tabdata, 0, 0);
|
||||
wlr_scene_node_lower_to_bottom(&c->tab_bar_node->scene_buffer->node);
|
||||
wlr_scene_node_set_enabled(&c->tab_bar_node->scene_buffer->node, false);
|
||||
mango_tab_bar_node_update(c->tab_bar_node, client_get_title(c), 1.0);
|
||||
c->group_bar = mango_group_bar_create(c, GroupBar, layers[layer],
|
||||
config.tabdata, 0, 0);
|
||||
wlr_scene_node_lower_to_bottom(&c->group_bar->scene_buffer->node);
|
||||
wlr_scene_node_set_enabled(&c->group_bar->scene_buffer->node, false);
|
||||
mango_group_bar_update(c->group_bar, client_get_title(c), 1.0);
|
||||
}
|
||||
|
||||
void client_focus_group_member(Client *c) {
|
||||
|
|
@ -165,11 +160,11 @@ void client_focus_group_member(Client *c) {
|
|||
cur_focusing->isgroupfocusing = false;
|
||||
c->mon = cur_focusing->mon;
|
||||
client_replace(c, cur_focusing, true);
|
||||
mango_tab_bar_node_set_focus(cur_focusing->tab_bar_node, false);
|
||||
mango_group_bar_set_focus(cur_focusing->group_bar, false);
|
||||
}
|
||||
|
||||
c->isgroupfocusing = true;
|
||||
mango_tab_bar_node_set_focus(c->tab_bar_node, true);
|
||||
mango_group_bar_set_focus(c->group_bar, true);
|
||||
|
||||
client_reparent_group(c);
|
||||
|
||||
|
|
@ -189,14 +184,14 @@ void client_check_tab_node_visible(Client *c) {
|
|||
|
||||
Client *cur = head;
|
||||
while (cur) {
|
||||
if (!c->mon->isoverview && cur->tab_bar_node &&
|
||||
if (!c->mon->isoverview && cur->group_bar &&
|
||||
(cur->group_next || cur->group_prev) && VISIBLEON(c, c->mon) &&
|
||||
ISNORMAL(c) && !c->isfullscreen &&
|
||||
(!is_monocle_layout(c->mon) || c == c->mon->sel)) {
|
||||
wlr_scene_node_set_enabled(&cur->tab_bar_node->scene_buffer->node,
|
||||
wlr_scene_node_set_enabled(&cur->group_bar->scene_buffer->node,
|
||||
true);
|
||||
} else {
|
||||
wlr_scene_node_set_enabled(&cur->tab_bar_node->scene_buffer->node,
|
||||
wlr_scene_node_set_enabled(&cur->group_bar->scene_buffer->node,
|
||||
false);
|
||||
}
|
||||
cur = cur->group_next;
|
||||
|
|
@ -216,8 +211,8 @@ void client_raise_group(Client *c) {
|
|||
|
||||
Client *cur = head;
|
||||
while (cur) {
|
||||
if (cur->tab_bar_node) {
|
||||
wlr_scene_node_raise_to_top(&cur->tab_bar_node->scene_buffer->node);
|
||||
if (cur->group_bar) {
|
||||
wlr_scene_node_raise_to_top(&cur->group_bar->scene_buffer->node);
|
||||
wlr_scene_node_raise_to_top(&cur->scene->node);
|
||||
}
|
||||
cur = cur->group_next;
|
||||
|
|
@ -225,7 +220,7 @@ void client_raise_group(Client *c) {
|
|||
}
|
||||
|
||||
void client_reparent_group(Client *c) {
|
||||
if (!c || !c->tab_bar_node)
|
||||
if (!c || !c->group_bar)
|
||||
return;
|
||||
|
||||
if (!c->group_prev && !c->group_next)
|
||||
|
|
@ -242,8 +237,8 @@ void client_reparent_group(Client *c) {
|
|||
|
||||
Client *cur = head;
|
||||
while (cur) {
|
||||
if (cur->tab_bar_node) {
|
||||
wlr_scene_node_reparent(&cur->tab_bar_node->scene_buffer->node,
|
||||
if (cur->group_bar) {
|
||||
wlr_scene_node_reparent(&cur->group_bar->scene_buffer->node,
|
||||
layers[layer]);
|
||||
wlr_scene_node_reparent(&cur->scene->node, layers[layer]);
|
||||
}
|
||||
|
|
@ -251,13 +246,13 @@ void client_reparent_group(Client *c) {
|
|||
}
|
||||
}
|
||||
|
||||
void client_handle_decorate_click(MangoCustomDecorate *md) {
|
||||
void client_handle_decorate_click(MangoGroupBar *gb) {
|
||||
|
||||
if (!md)
|
||||
if (!gb)
|
||||
return;
|
||||
|
||||
if (md->node_type == MANGO_TITLE_NODE) {
|
||||
Client *c = md->node_data;
|
||||
if (gb->node_data) {
|
||||
Client *c = gb->node_data;
|
||||
client_focus_group_member(c);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue