mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
opt: destroy foreign_toplevel for swallowing window
This commit is contained in:
parent
4d6da14c13
commit
c23945ef49
1 changed files with 22 additions and 32 deletions
54
maomao.c
54
maomao.c
|
|
@ -475,6 +475,8 @@ static void motionnotify(uint32_t time, struct wlr_input_device *device,
|
||||||
static void motionrelative(struct wl_listener *listener, void *data);
|
static void motionrelative(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
static void reset_foreign_tolevel(Client *c);
|
static void reset_foreign_tolevel(Client *c);
|
||||||
|
static void remove_foreign_topleve(Client *c);
|
||||||
|
static void add_foreign_topleve(Client *c);
|
||||||
static void exchange_two_client(Client *c1, Client *c2);
|
static void exchange_two_client(Client *c1, Client *c2);
|
||||||
static void outputmgrapply(struct wl_listener *listener, void *data);
|
static void outputmgrapply(struct wl_listener *listener, void *data);
|
||||||
static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config,
|
static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config,
|
||||||
|
|
@ -1220,11 +1222,12 @@ void show_scratchpad(Client *c) {
|
||||||
setborder_color(c);
|
setborder_color(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_foreign_tolevel(Client *c) {
|
void remove_foreign_topleve(Client *c) {
|
||||||
wlr_foreign_toplevel_handle_v1_destroy(c->foreign_toplevel);
|
wlr_foreign_toplevel_handle_v1_destroy(c->foreign_toplevel);
|
||||||
c->foreign_toplevel = NULL;
|
c->foreign_toplevel = NULL;
|
||||||
// printstatus();
|
}
|
||||||
// 创建外部顶层窗口的句柄,每一个顶层窗口都有一个
|
|
||||||
|
void add_foreign_toplevel(Client *c) {
|
||||||
c->foreign_toplevel =
|
c->foreign_toplevel =
|
||||||
wlr_foreign_toplevel_handle_v1_create(foreign_toplevel_manager);
|
wlr_foreign_toplevel_handle_v1_create(foreign_toplevel_manager);
|
||||||
// 监听来自外部对于窗口的事件请求
|
// 监听来自外部对于窗口的事件请求
|
||||||
|
|
@ -1253,6 +1256,12 @@ void reset_foreign_tolevel(Client *c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset_foreign_tolevel(Client *c) {
|
||||||
|
remove_foreign_topleve(c);
|
||||||
|
add_foreign_toplevel(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
getparentprocess(pid_t p)
|
getparentprocess(pid_t p)
|
||||||
{
|
{
|
||||||
|
|
@ -1307,8 +1316,15 @@ swallow(Client *c, Client *w)
|
||||||
c->geom = w->geom;
|
c->geom = w->geom;
|
||||||
wl_list_insert(&w->link, &c->link);
|
wl_list_insert(&w->link, &c->link);
|
||||||
wl_list_insert(&w->flink, &c->flink);
|
wl_list_insert(&w->flink, &c->flink);
|
||||||
|
|
||||||
|
if(w->foreign_toplevel)
|
||||||
|
remove_foreign_topleve(w);
|
||||||
|
|
||||||
wlr_scene_node_set_enabled(&w->scene->node, 0);
|
wlr_scene_node_set_enabled(&w->scene->node, 0);
|
||||||
wlr_scene_node_set_enabled(&c->scene->node, 1);
|
wlr_scene_node_set_enabled(&c->scene->node, 1);
|
||||||
|
|
||||||
|
if(!c->foreign_toplevel && c->mon)
|
||||||
|
add_foreign_toplevel(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggle_scratchpad(const Arg *arg) {
|
void toggle_scratchpad(const Arg *arg) {
|
||||||
|
|
@ -3644,34 +3660,8 @@ mapnotify(struct wl_listener *listener, void *data) {
|
||||||
applyrules(c);
|
applyrules(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建外部顶层窗口的句柄,每一个顶层窗口都有一个
|
if(!c->foreign_toplevel && c->mon)
|
||||||
c->foreign_toplevel =
|
add_foreign_toplevel(c);
|
||||||
wlr_foreign_toplevel_handle_v1_create(foreign_toplevel_manager);
|
|
||||||
|
|
||||||
// 监听来自外部对于窗口的事件请求
|
|
||||||
if (c->foreign_toplevel) {
|
|
||||||
LISTEN(&(c->foreign_toplevel->events.request_activate),
|
|
||||||
&c->foreign_activate_request, handle_foreign_activate_request);
|
|
||||||
LISTEN(&(c->foreign_toplevel->events.request_fullscreen),
|
|
||||||
&c->foreign_fullscreen_request, handle_foreign_fullscreen_request);
|
|
||||||
LISTEN(&(c->foreign_toplevel->events.request_close),
|
|
||||||
&c->foreign_close_request, handle_foreign_close_request);
|
|
||||||
LISTEN(&(c->foreign_toplevel->events.destroy), &c->foreign_destroy,
|
|
||||||
handle_foreign_destroy);
|
|
||||||
// 设置外部顶层句柄的id为应用的id
|
|
||||||
const char *appid;
|
|
||||||
appid = client_get_appid(c);
|
|
||||||
if (appid)
|
|
||||||
wlr_foreign_toplevel_handle_v1_set_app_id(c->foreign_toplevel, appid);
|
|
||||||
// 设置外部顶层句柄的title为应用的title
|
|
||||||
const char *title;
|
|
||||||
title = client_get_title(c);
|
|
||||||
if (title)
|
|
||||||
wlr_foreign_toplevel_handle_v1_set_title(c->foreign_toplevel, title);
|
|
||||||
// 设置外部顶层句柄的显示监视器为当前监视器
|
|
||||||
wlr_foreign_toplevel_handle_v1_output_enter(c->foreign_toplevel,
|
|
||||||
selmon->wlr_output);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selmon->sel && selmon->sel->foreign_toplevel)
|
if (selmon->sel && selmon->sel->foreign_toplevel)
|
||||||
wlr_foreign_toplevel_handle_v1_set_activated(selmon->sel->foreign_toplevel,
|
wlr_foreign_toplevel_handle_v1_set_activated(selmon->sel->foreign_toplevel,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue