mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-26 13:15:00 -04:00
opt: optimize layer cover of floating group bar
This commit is contained in:
parent
5a57198c1d
commit
060b0a0c7d
2 changed files with 63 additions and 13 deletions
|
|
@ -163,6 +163,9 @@ void client_focus_group_member(Client *c) {
|
|||
|
||||
c->isgroupfocusing = true;
|
||||
mango_tab_bar_node_set_focus(c->tab_bar_node, true);
|
||||
|
||||
client_reparent_group(c);
|
||||
|
||||
focusclient(c, 1);
|
||||
|
||||
arrange(c->mon, false, false);
|
||||
|
|
@ -193,7 +196,7 @@ void client_check_tab_node_visible(Client *c) {
|
|||
}
|
||||
}
|
||||
|
||||
void client_raise_group_tab_bar(Client *c) {
|
||||
void client_raise_group(Client *c) {
|
||||
if (!c || !c->mon)
|
||||
return;
|
||||
|
||||
|
|
@ -208,7 +211,54 @@ void client_raise_group_tab_bar(Client *c) {
|
|||
while (cur) {
|
||||
if (cur->tab_bar_node) {
|
||||
wlr_scene_node_raise_to_top(&cur->tab_bar_node->scene_buffer->node);
|
||||
wlr_scene_node_raise_to_top(&cur->scene->node);
|
||||
}
|
||||
cur = cur->group_next;
|
||||
}
|
||||
}
|
||||
|
||||
void client_reparent_group(Client *c) {
|
||||
if (!c || !c->tab_bar_node)
|
||||
return;
|
||||
|
||||
if (!c->group_prev && !c->group_next)
|
||||
return;
|
||||
|
||||
int32_t bar_layer = c->isfloating ? LyrDecorateTop : LyrDecorate;
|
||||
int32_t client_layer = c->isfloating || c->isfullscreen ? LyrTop
|
||||
: c->ismaximizescreen ? LyrMaximize
|
||||
: LyrTile;
|
||||
|
||||
Client *head = c;
|
||||
while (head->group_prev)
|
||||
head = head->group_prev;
|
||||
|
||||
Client *cur = head;
|
||||
while (cur) {
|
||||
if (cur->tab_bar_node) {
|
||||
wlr_scene_node_reparent(&cur->tab_bar_node->scene_buffer->node,
|
||||
layers[bar_layer]);
|
||||
wlr_scene_node_reparent(&cur->scene->node, layers[client_layer]);
|
||||
}
|
||||
cur = cur->group_next;
|
||||
}
|
||||
}
|
||||
|
||||
void client_handle_decorate_click(int32_t x, int32_t y) {
|
||||
struct wlr_scene_node *node =
|
||||
wlr_scene_node_at(&layers[LyrDecorateTop]->node, x, y, NULL, NULL);
|
||||
|
||||
if (!node || !node->data) {
|
||||
node = wlr_scene_node_at(&layers[LyrDecorate]->node, x, y, NULL, NULL);
|
||||
}
|
||||
|
||||
if (!node || !node->data) {
|
||||
return;
|
||||
}
|
||||
|
||||
MangoNodeData *mangonodedata = (MangoNodeData *)node->data;
|
||||
if (mangonodedata->type == MANGO_TITLE_NODE) {
|
||||
Client *c = mangonodedata->node_data;
|
||||
client_focus_group_member(c);
|
||||
}
|
||||
}
|
||||
24
src/mango.c
24
src/mango.c
|
|
@ -175,6 +175,7 @@ enum {
|
|||
LyrTile,
|
||||
LyrDecorate,
|
||||
LyrMaximize,
|
||||
LyrDecorateTop,
|
||||
LyrTop,
|
||||
LyrFadeOut,
|
||||
LyrOverlay,
|
||||
|
|
@ -944,6 +945,8 @@ static void begin_jump_mode(Monitor *m);
|
|||
static void global_draw_tab_bar(Client *c, int32_t x, int32_t y, int32_t width,
|
||||
int32_t height);
|
||||
|
||||
static void client_reparent_group(Client *c);
|
||||
|
||||
#include "data/static_keymap.h"
|
||||
#include "dispatch/bind_declare.h"
|
||||
#include "layout/layout.h"
|
||||
|
|
@ -2484,15 +2487,7 @@ bool handle_buttonpress(struct wlr_pointer_button_event *event) {
|
|||
}
|
||||
|
||||
// handle click on tile node
|
||||
struct wlr_scene_node *node = wlr_scene_node_at(
|
||||
&layers[LyrDecorate]->node, cursor->x, cursor->y, NULL, NULL);
|
||||
if (node && node->data) {
|
||||
MangoNodeData *mangonodedata = (MangoNodeData *)node->data;
|
||||
if (mangonodedata->type == MANGO_TITLE_NODE) {
|
||||
Client *c = mangonodedata->node_data;
|
||||
client_focus_group_member(c);
|
||||
}
|
||||
}
|
||||
client_handle_decorate_click(cursor->x, cursor->y);
|
||||
|
||||
// 当鼠标焦点在layer上的时候,不检测虚拟键盘的mod状态,
|
||||
// 避免layer虚拟键盘锁死mod按键状态
|
||||
|
|
@ -3952,8 +3947,10 @@ void focusclient(Client *c, int32_t lift) {
|
|||
return;
|
||||
|
||||
/* Raise client in stacking order if requested */
|
||||
if (c && lift)
|
||||
if (c && lift) {
|
||||
client_raise_group(c);
|
||||
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
||||
}
|
||||
|
||||
if (c && client_surface(c) == old_keyboard_focus_surface && selmon &&
|
||||
selmon->sel)
|
||||
|
|
@ -5683,9 +5680,10 @@ setfloating(Client *c, int32_t floating) {
|
|||
layers[c->isfloating ? LyrTop : LyrTile]);
|
||||
}
|
||||
|
||||
client_reparent_group(c);
|
||||
|
||||
if (c->isfloating) {
|
||||
set_size_per(c->mon, c);
|
||||
client_raise_group_tab_bar(c);
|
||||
}
|
||||
|
||||
if (!c->force_fakemaximize)
|
||||
|
|
@ -5769,7 +5767,6 @@ void setmaximizescreen(Client *c, int32_t maximizescreen, bool rearrange) {
|
|||
}
|
||||
|
||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||
client_raise_group_tab_bar(c);
|
||||
if (!is_scroller_layout(c->mon) || c->isfloating)
|
||||
resize(c, maximizescreen_box, 0);
|
||||
} else {
|
||||
|
|
@ -5782,6 +5779,7 @@ void setmaximizescreen(Client *c, int32_t maximizescreen, bool rearrange) {
|
|||
layers[c->ismaximizescreen ? LyrMaximize
|
||||
: c->isfloating ? LyrTop
|
||||
: LyrTile]);
|
||||
client_reparent_group(c);
|
||||
|
||||
if (!c->force_fakemaximize && !c->ismaximizescreen) {
|
||||
client_set_maximized(c, false);
|
||||
|
|
@ -5851,6 +5849,8 @@ void setfullscreen(Client *c, int32_t fullscreen,
|
|||
layers[fullscreen || c->isfloating ? LyrTop : LyrTile]);
|
||||
}
|
||||
|
||||
client_reparent_group(c);
|
||||
|
||||
if (rearrange)
|
||||
arrange(c->mon, false, false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue