diff --git a/src/Makefile.am b/src/Makefile.am index 57ee77c..7823c1c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -170,7 +170,8 @@ wmaker_SOURCES += \ backend/wayland/wl_atom.c \ backend/wayland/wl_signalfd.c \ backend/wayland/wl_xkb.c \ - backend/wayland/wl_badge.c + backend/wayland/wl_badge.c \ + backend/wayland/wl_fakeleader.c endif if USE_NESTED_FUNC diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 0fb1b70..1687508 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -5489,49 +5489,6 @@ wl_coords_translate(WNativeWindow src, WNativeWindow dst, } -/* ------------------------------------------------------------------ */ -/* Fake leader */ -/* ------------------------------------------------------------------ */ - -static WNativeWindow wl_fake_leader_create(WScreen *scr) -{ - (void)scr; - /* Create a frame_buf with a tree to act as the dialog's content - * container. The tree is essential — content reparented into the - * fake_leader (e.g. WINGs panel views) becomes a child of the tree - * and follows it when the fake_leader itself is reparented into - * a WMaker frame. */ - struct wl_frame_buf *fb = wmalloc(sizeof(*fb)); - memset(fb, 0, sizeof(*fb)); - - fb->id = wl_state.next_synthetic_id++; - fb->parent_id = 0; - fb->width = 1; - fb->height = 1; - fb->image = pixman_image_create_bits(PIXMAN_a8r8g8b8, 1, 1, NULL, 0); - wlr_buffer_init(&fb->base, &frame_buf_impl, 1, 1); - - if (wl_state.scene) { - struct wlr_scene_tree *_pp = wl_state.level_trees[WL_LAYER_NORMAL] - ? wl_state.level_trees[WL_LAYER_NORMAL] : &wl_state.scene->tree; - fb->tree = wlr_scene_tree_create(_pp); - if (fb->tree) { - fb_attach_tree_listener(fb); - wlr_scene_node_set_position(&fb->tree->node, 0, 0); - fb->scene_buf = wlr_scene_buffer_create(fb->tree, &fb->base); - if (fb->scene_buf) { - fb_attach_scene_buf_listener(fb); - wlr_scene_node_set_position(&fb->scene_buf->node, 0, 0); - wlr_scene_node_set_enabled(&fb->scene_buf->node, false); - } - wlr_scene_node_set_enabled(&fb->tree->node, true); - } - } - - wl_list_insert(&wl_state.frame_list, &fb->link); - return fb->id; -} -static void wl_fake_leader_destroy(WNativeWindow win) { (void)win; } /* ------------------------------------------------------------------ */ /* Screen internals */ diff --git a/src/backend/wayland/wl_fakeleader.c b/src/backend/wayland/wl_fakeleader.c new file mode 100644 index 0000000..d1a0305 --- /dev/null +++ b/src/backend/wayland/wl_fakeleader.c @@ -0,0 +1,54 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include +#include +#include +#include +#include "../../screen.h" +#include "wl_types.h" + +/* ------------------------------------------------------------------ */ +/* Fake leader */ +/* ------------------------------------------------------------------ */ + +WNativeWindow wl_fake_leader_create(WScreen *scr) +{ + (void)scr; + /* Create a frame_buf with a tree to act as the dialog's content + * container. The tree is essential — content reparented into the + * fake_leader (e.g. WINGs panel views) becomes a child of the tree + * and follows it when the fake_leader itself is reparented into + * a WMaker frame. */ + struct wl_frame_buf *fb = wmalloc(sizeof(*fb)); + memset(fb, 0, sizeof(*fb)); + + fb->id = wl_state.next_synthetic_id++; + fb->parent_id = 0; + fb->width = 1; + fb->height = 1; + fb->image = pixman_image_create_bits(PIXMAN_a8r8g8b8, 1, 1, NULL, 0); + wlr_buffer_init(&fb->base, &frame_buf_impl, 1, 1); + + if (wl_state.scene) { + struct wlr_scene_tree *_pp = wl_state.level_trees[WL_LAYER_NORMAL] + ? wl_state.level_trees[WL_LAYER_NORMAL] : &wl_state.scene->tree; + fb->tree = wlr_scene_tree_create(_pp); + if (fb->tree) { + fb_attach_tree_listener(fb); + wlr_scene_node_set_position(&fb->tree->node, 0, 0); + fb->scene_buf = wlr_scene_buffer_create(fb->tree, &fb->base); + if (fb->scene_buf) { + fb_attach_scene_buf_listener(fb); + wlr_scene_node_set_position(&fb->scene_buf->node, 0, 0); + wlr_scene_node_set_enabled(&fb->scene_buf->node, false); + } + wlr_scene_node_set_enabled(&fb->tree->node, true); + } + } + + wl_list_insert(&wl_state.frame_list, &fb->link); + return fb->id; +} +void wl_fake_leader_destroy(WNativeWindow win) { (void)win; } diff --git a/src/backend/wayland/wl_types.h b/src/backend/wayland/wl_types.h index 6a18591..d276629 100644 --- a/src/backend/wayland/wl_types.h +++ b/src/backend/wayland/wl_types.h @@ -514,3 +514,7 @@ int wl_xkb_get_group(void); RImage *wl_workspace_badge_render(WScreen *scr, WNativeWindow badge_win, const char *name, int name_len, int width, int height); RImage *wl_workspace_badge_get_background(WScreen *scr, int x, int y, int width, int height); void wl_workspace_badge_update(WScreen *scr, WNativeWindow badge_win, RImage *img); + +/* Fake leader declarations (extracted to wl_fakeleader.c) */ +WNativeWindow wl_fake_leader_create(WScreen *scr); +void wl_fake_leader_destroy(WNativeWindow win);