decompose wl_backend.c: extract wl_fakeleader.c
This commit is contained in:
parent
db0db065a1
commit
c60c20bf49
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
#include <wlr/interfaces/wlr_buffer.h>
|
||||
#include <pixman.h>
|
||||
#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; }
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue