mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-29 13:14:48 -04:00
opt: make groupbar same layer with its client
This commit is contained in:
parent
060b0a0c7d
commit
06eed8cd2e
7 changed files with 48 additions and 42 deletions
|
|
@ -121,12 +121,17 @@ void client_add_tab_bar_node(Client *c) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MangoNodeData *mangonodedata = ecalloc(1, sizeof(MangoNodeData));
|
MangoCustomDecorate *MangoCustomDecorate =
|
||||||
mangonodedata->node_data = c;
|
ecalloc(1, sizeof(MangoCustomDecorate));
|
||||||
mangonodedata->type = MANGO_TITLE_NODE;
|
MangoCustomDecorate->node_data = c;
|
||||||
|
MangoCustomDecorate->node_type = MANGO_TITLE_NODE;
|
||||||
|
MangoCustomDecorate->type = CustomDecorate;
|
||||||
|
uint32_t layer = c->isfloating || c->isfullscreen ? LyrTop
|
||||||
|
: c->ismaximizescreen ? LyrMaximize
|
||||||
|
: LyrTile;
|
||||||
|
|
||||||
c->tab_bar_node = mango_tab_bar_node_create(
|
c->tab_bar_node = mango_tab_bar_node_create(
|
||||||
mangonodedata, layers[LyrDecorate], config.tabdata, 0, 0);
|
MangoCustomDecorate, layers[layer], config.tabdata, 0, 0);
|
||||||
wlr_scene_node_lower_to_bottom(&c->tab_bar_node->scene_buffer->node);
|
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);
|
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);
|
mango_tab_bar_node_update(c->tab_bar_node, client_get_title(c), 1.0);
|
||||||
|
|
@ -224,10 +229,9 @@ void client_reparent_group(Client *c) {
|
||||||
if (!c->group_prev && !c->group_next)
|
if (!c->group_prev && !c->group_next)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int32_t bar_layer = c->isfloating ? LyrDecorateTop : LyrDecorate;
|
int32_t layer = c->isfloating || c->isfullscreen ? LyrTop
|
||||||
int32_t client_layer = c->isfloating || c->isfullscreen ? LyrTop
|
: c->ismaximizescreen ? LyrMaximize
|
||||||
: c->ismaximizescreen ? LyrMaximize
|
: LyrTile;
|
||||||
: LyrTile;
|
|
||||||
|
|
||||||
Client *head = c;
|
Client *head = c;
|
||||||
while (head->group_prev)
|
while (head->group_prev)
|
||||||
|
|
@ -237,28 +241,20 @@ void client_reparent_group(Client *c) {
|
||||||
while (cur) {
|
while (cur) {
|
||||||
if (cur->tab_bar_node) {
|
if (cur->tab_bar_node) {
|
||||||
wlr_scene_node_reparent(&cur->tab_bar_node->scene_buffer->node,
|
wlr_scene_node_reparent(&cur->tab_bar_node->scene_buffer->node,
|
||||||
layers[bar_layer]);
|
layers[layer]);
|
||||||
wlr_scene_node_reparent(&cur->scene->node, layers[client_layer]);
|
wlr_scene_node_reparent(&cur->scene->node, layers[layer]);
|
||||||
}
|
}
|
||||||
cur = cur->group_next;
|
cur = cur->group_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_handle_decorate_click(int32_t x, int32_t y) {
|
void client_handle_decorate_click(MangoCustomDecorate *md) {
|
||||||
struct wlr_scene_node *node =
|
|
||||||
wlr_scene_node_at(&layers[LyrDecorateTop]->node, x, y, NULL, NULL);
|
|
||||||
|
|
||||||
if (!node || !node->data) {
|
if (!md)
|
||||||
node = wlr_scene_node_at(&layers[LyrDecorate]->node, x, y, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!node || !node->data) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
MangoNodeData *mangonodedata = (MangoNodeData *)node->data;
|
if (md->node_type == MANGO_TITLE_NODE) {
|
||||||
if (mangonodedata->type == MANGO_TITLE_NODE) {
|
Client *c = md->node_data;
|
||||||
Client *c = mangonodedata->node_data;
|
|
||||||
client_focus_group_member(c);
|
client_focus_group_member(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -252,11 +252,13 @@ void scene_buffer_apply_overview_effect(struct wlr_scene_buffer *buffer,
|
||||||
bool is_subsurface = false;
|
bool is_subsurface = false;
|
||||||
|
|
||||||
struct wlr_scene_tree *parent_tree = buffer->node.parent;
|
struct wlr_scene_tree *parent_tree = buffer->node.parent;
|
||||||
if (parent_tree->node.data != NULL) {
|
SnapshotMetadata *meta = (SnapshotMetadata *)parent_tree->node.data;
|
||||||
SnapshotMetadata *meta = (SnapshotMetadata *)parent_tree->node.data;
|
if (parent_tree->node.data != NULL && meta->type == Snapshot) {
|
||||||
surface_width = meta->orig_width;
|
surface_width = meta->orig_width;
|
||||||
surface_height = meta->orig_height;
|
surface_height = meta->orig_height;
|
||||||
is_subsurface = meta->is_subsurface;
|
is_subsurface = meta->is_subsurface;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_height = surface_height * buffer_data->height_scale;
|
surface_height = surface_height * buffer_data->height_scale;
|
||||||
|
|
@ -1228,7 +1230,7 @@ void client_animation_next_tick(Client *c) {
|
||||||
c->animation.current = c->geom;
|
c->animation.current = c->geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
xytonode(cursor->x, cursor->y, NULL, &pointer_c, NULL, &sx, &sy);
|
xytonode(cursor->x, cursor->y, NULL, &pointer_c, NULL, NULL, &sx, &sy);
|
||||||
|
|
||||||
surface =
|
surface =
|
||||||
pointer_c && pointer_c == c ? client_surface(pointer_c) : NULL;
|
pointer_c && pointer_c == c ? client_surface(pointer_c) : NULL;
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,7 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int32_t lx,
|
||||||
}
|
}
|
||||||
meta->orig_width = scene_buffer->dst_width;
|
meta->orig_width = scene_buffer->dst_width;
|
||||||
meta->orig_height = scene_buffer->dst_height;
|
meta->orig_height = scene_buffer->dst_height;
|
||||||
|
meta->type = Snapshot;
|
||||||
|
|
||||||
struct wlr_scene_surface *scene_surface =
|
struct wlr_scene_surface *scene_surface =
|
||||||
wlr_scene_surface_try_from_buffer(scene_buffer);
|
wlr_scene_surface_try_from_buffer(scene_buffer);
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ int32_t moveresize(const Arg *arg) {
|
||||||
|
|
||||||
if (cursor_mode != CurNormal && cursor_mode != CurPressed)
|
if (cursor_mode != CurNormal && cursor_mode != CurPressed)
|
||||||
return 0;
|
return 0;
|
||||||
xytonode(cursor->x, cursor->y, NULL, &grabc, NULL, NULL, NULL);
|
xytonode(cursor->x, cursor->y, NULL, &grabc, NULL, NULL, NULL, NULL);
|
||||||
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen ||
|
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen ||
|
||||||
grabc->ismaximizescreen) {
|
grabc->ismaximizescreen) {
|
||||||
grabc = NULL;
|
grabc = NULL;
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ void tablettoolmotion(struct TabletTool *tool, bool change_x, bool change_y,
|
||||||
if (config.sloppyfocus)
|
if (config.sloppyfocus)
|
||||||
selmon = xytomon(cursor->x, cursor->y);
|
selmon = xytomon(cursor->x, cursor->y);
|
||||||
|
|
||||||
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
|
xytonode(cursor->x, cursor->y, &surface, &c, NULL, NULL, &sx, &sy);
|
||||||
if (cursor_mode == CurPressed && !seat->drag &&
|
if (cursor_mode == CurPressed && !seat->drag &&
|
||||||
surface != seat->pointer_state.focused_surface &&
|
surface != seat->pointer_state.focused_surface &&
|
||||||
toplevel_from_wlr_surface(seat->pointer_state.focused_surface, &w,
|
toplevel_from_wlr_surface(seat->pointer_state.focused_surface, &w,
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,13 @@ static bool layer_ignores_focus(LayerSurface *l) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
|
void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
|
||||||
LayerSurface **pl, double *nx, double *ny) {
|
LayerSurface **pl, MangoCustomDecorate **pd, double *nx,
|
||||||
|
double *ny) {
|
||||||
struct wlr_scene_node *node, *pnode;
|
struct wlr_scene_node *node, *pnode;
|
||||||
struct wlr_surface *surface = NULL;
|
struct wlr_surface *surface = NULL;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
LayerSurface *l = NULL;
|
LayerSurface *l = NULL;
|
||||||
|
MangoCustomDecorate *mangocustomdecorate = NULL;
|
||||||
int32_t layer;
|
int32_t layer;
|
||||||
Client *ovc = NULL;
|
Client *ovc = NULL;
|
||||||
|
|
||||||
|
|
@ -125,8 +127,6 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
|
||||||
wlr_scene_buffer_from_node(node));
|
wlr_scene_buffer_from_node(node));
|
||||||
if (scene_surface) {
|
if (scene_surface) {
|
||||||
surface = scene_surface->surface;
|
surface = scene_surface->surface;
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,6 +142,9 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
|
||||||
if (c && c->type == LayerShell) {
|
if (c && c->type == LayerShell) {
|
||||||
l = (LayerSurface *)c;
|
l = (LayerSurface *)c;
|
||||||
c = NULL;
|
c = NULL;
|
||||||
|
} else if (c && c->type == CustomDecorate) {
|
||||||
|
mangocustomdecorate = (MangoCustomDecorate *)c;
|
||||||
|
c = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,6 +162,8 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
|
||||||
*pc = c;
|
*pc = c;
|
||||||
if (pl)
|
if (pl)
|
||||||
*pl = l;
|
*pl = l;
|
||||||
|
if (pd)
|
||||||
|
*pd = mangocustomdecorate;
|
||||||
|
|
||||||
if (selmon && selmon->isoverview && config.ov_no_resize) {
|
if (selmon && selmon->isoverview && config.ov_no_resize) {
|
||||||
ovc = xytoclient(x, y);
|
ovc = xytoclient(x, y);
|
||||||
|
|
|
||||||
26
src/mango.c
26
src/mango.c
|
|
@ -165,17 +165,15 @@ enum { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT };
|
||||||
|
|
||||||
enum { VERTICAL, HORIZONTAL };
|
enum { VERTICAL, HORIZONTAL };
|
||||||
enum { SWIPE_UP, SWIPE_DOWN, SWIPE_LEFT, SWIPE_RIGHT };
|
enum { SWIPE_UP, SWIPE_DOWN, SWIPE_LEFT, SWIPE_RIGHT };
|
||||||
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
|
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
|
||||||
enum { XDGShell, LayerShell, X11 }; /* client types */
|
enum { XDGShell, LayerShell, X11, CustomDecorate, Snapshot }; /* client types */
|
||||||
enum { AxisUp, AxisDown, AxisLeft, AxisRight }; // 滚轮滚动的方向
|
enum { AxisUp, AxisDown, AxisLeft, AxisRight }; // 滚轮滚动的方向
|
||||||
enum {
|
enum {
|
||||||
LyrBg,
|
LyrBg,
|
||||||
LyrBlur,
|
LyrBlur,
|
||||||
LyrBottom,
|
LyrBottom,
|
||||||
LyrTile,
|
LyrTile,
|
||||||
LyrDecorate,
|
|
||||||
LyrMaximize,
|
LyrMaximize,
|
||||||
LyrDecorateTop,
|
|
||||||
LyrTop,
|
LyrTop,
|
||||||
LyrFadeOut,
|
LyrFadeOut,
|
||||||
LyrOverlay,
|
LyrOverlay,
|
||||||
|
|
@ -184,7 +182,7 @@ enum {
|
||||||
NUM_LAYERS
|
NUM_LAYERS
|
||||||
}; /* scene layers */
|
}; /* scene layers */
|
||||||
|
|
||||||
enum mango_node_type { MANGO_TITLE_NODE, MANGO_jump_label_node };
|
enum mango_node_type { MANGO_TITLE_NODE, MANGO_JUMP_NODE };
|
||||||
|
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -253,9 +251,10 @@ typedef struct {
|
||||||
} Arg;
|
} Arg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
enum mango_node_type type;
|
uint32_t type;
|
||||||
|
enum mango_node_type node_type;
|
||||||
void *node_data;
|
void *node_data;
|
||||||
} MangoNodeData;
|
} MangoCustomDecorate;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t mod;
|
uint32_t mod;
|
||||||
|
|
@ -652,6 +651,7 @@ struct TagScrollerState {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
uint32_t type;
|
||||||
int32_t orig_width;
|
int32_t orig_width;
|
||||||
int32_t orig_height;
|
int32_t orig_height;
|
||||||
bool is_subsurface;
|
bool is_subsurface;
|
||||||
|
|
@ -805,7 +805,8 @@ static Monitor *get_monitor_nearest_to(int32_t x, int32_t y);
|
||||||
static void handle_iamge_copy_capture_new_session(struct wl_listener *listener,
|
static void handle_iamge_copy_capture_new_session(struct wl_listener *listener,
|
||||||
void *data);
|
void *data);
|
||||||
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
||||||
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
Client **pc, LayerSurface **pl, MangoCustomDecorate **pd,
|
||||||
|
double *nx, double *ny);
|
||||||
static void clear_fullscreen_flag(Client *c);
|
static void clear_fullscreen_flag(Client *c);
|
||||||
static pid_t getparentprocess(pid_t p);
|
static pid_t getparentprocess(pid_t p);
|
||||||
static int32_t isdescprocess(pid_t p, pid_t c);
|
static int32_t isdescprocess(pid_t p, pid_t c);
|
||||||
|
|
@ -2435,6 +2436,7 @@ bool handle_buttonpress(struct wlr_pointer_button_event *event) {
|
||||||
uint32_t hard_mods, mods;
|
uint32_t hard_mods, mods;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
LayerSurface *l = NULL;
|
LayerSurface *l = NULL;
|
||||||
|
MangoCustomDecorate *md = NULL;
|
||||||
struct wlr_surface *surface;
|
struct wlr_surface *surface;
|
||||||
Client *tmpc = NULL;
|
Client *tmpc = NULL;
|
||||||
int32_t ji;
|
int32_t ji;
|
||||||
|
|
@ -2456,7 +2458,7 @@ bool handle_buttonpress(struct wlr_pointer_button_event *event) {
|
||||||
if (locked)
|
if (locked)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
xytonode(cursor->x, cursor->y, &surface, NULL, NULL, NULL, NULL);
|
xytonode(cursor->x, cursor->y, &surface, NULL, NULL, &md, NULL, NULL);
|
||||||
if (toplevel_from_wlr_surface(surface, &c, &l) >= 0) {
|
if (toplevel_from_wlr_surface(surface, &c, &l) >= 0) {
|
||||||
if (c && c->scene->node.enabled &&
|
if (c && c->scene->node.enabled &&
|
||||||
(!client_is_unmanaged(c) || client_wants_focus(c)))
|
(!client_is_unmanaged(c) || client_wants_focus(c)))
|
||||||
|
|
@ -2487,7 +2489,7 @@ bool handle_buttonpress(struct wlr_pointer_button_event *event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle click on tile node
|
// handle click on tile node
|
||||||
client_handle_decorate_click(cursor->x, cursor->y);
|
client_handle_decorate_click(md);
|
||||||
|
|
||||||
// 当鼠标焦点在layer上的时候,不检测虚拟键盘的mod状态,
|
// 当鼠标焦点在layer上的时候,不检测虚拟键盘的mod状态,
|
||||||
// 避免layer虚拟键盘锁死mod按键状态
|
// 避免layer虚拟键盘锁死mod按键状态
|
||||||
|
|
@ -4951,7 +4953,7 @@ void motionnotify(uint32_t time, struct wlr_input_device *device, double dx,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the client under the pointer and send the event along. */
|
/* Find the client under the pointer and send the event along. */
|
||||||
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
|
xytonode(cursor->x, cursor->y, &surface, &c, NULL, NULL, &sx, &sy);
|
||||||
|
|
||||||
if (cursor_mode == CurPressed && !seat->drag &&
|
if (cursor_mode == CurPressed && !seat->drag &&
|
||||||
surface != seat->pointer_state.focused_surface &&
|
surface != seat->pointer_state.focused_surface &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue