opt: optimize ws module

This commit is contained in:
DreamMaoMao 2025-12-13 09:50:36 +08:00
parent d696b763e8
commit 06dd3423a1
4 changed files with 285 additions and 256 deletions

View file

@ -2,32 +2,11 @@
// TODO: remove this file
// refer: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5115
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_EXT_WORKSPACE_V1_H
#define WLR_TYPES_WLR_EXT_WORKSPACE_V1_H
#include <wayland-protocols/ext-workspace-v1-enum.h>
#include <wayland-server-core.h>
struct wlr_output;
enum wlr_ext_workspace_group_handle_v1_cap {
WLR_EXT_WORKSPACE_GROUP_HANDLE_V1_CAP_CREATE_WORKSPACE = 1 << 0,
};
enum wlr_ext_workspace_handle_v1_cap {
WLR_EXT_WORKSPACE_HANDLE_V1_CAP_ACTIVATE = 1 << 0,
WLR_EXT_WORKSPACE_HANDLE_V1_CAP_DEACTIVATE = 1 << 1,
WLR_EXT_WORKSPACE_HANDLE_V1_CAP_REMOVE = 1 << 2,
WLR_EXT_WORKSPACE_HANDLE_V1_CAP_ASSIGN = 1 << 3,
};
struct wlr_ext_workspace_manager_v1 {
struct wl_global *global;
struct wl_list groups; // wlr_ext_workspace_group_handle_v1.link
@ -37,24 +16,33 @@ struct wlr_ext_workspace_manager_v1 {
struct wl_signal destroy;
} events;
struct wl_list clients; // wlr_ext_workspace_manager_client_v1.link
struct wl_event_source *idle_source;
struct wl_event_loop *event_loop;
struct wl_listener display_destroy;
struct {
struct wl_list resources; // wlr_ext_workspace_manager_v1_resource.link
struct wl_event_source *idle_source;
struct wl_event_loop *event_loop;
struct wl_listener display_destroy;
};
};
struct wlr_ext_workspace_group_handle_v1_create_workspace_event {
const char *name;
};
struct wlr_ext_workspace_group_handle_v1 {
struct wlr_ext_workspace_manager_v1 *manager;
uint32_t caps; // wlr_ext_workspace_group_handle_v1_cap
uint32_t caps; // ext_workspace_group_handle_v1_group_capabilities
struct {
struct wl_signal create_workspace; // const char *
struct wl_signal
create_workspace; // wlr_ext_workspace_group_handle_v1_create_workspace_event
struct wl_signal destroy;
} events;
struct wl_list link; // wlr_ext_workspace_manager_v1.groups
struct wl_list outputs; // wlr_ext_workspace_v1_group_output.link
struct wl_list clients; // wlr_ext_workspace_manager_client_v1.link
struct {
struct wl_list outputs; // wlr_ext_workspace_v1_group_output.link
struct wl_list resources; // wlr_ext_workspace_manager_v1_resource.link
};
};
struct wlr_ext_workspace_handle_v1 {
@ -63,7 +51,7 @@ struct wlr_ext_workspace_handle_v1 {
char *id;
char *name;
struct wl_array coordinates;
uint32_t caps; // wlr_ext_workspace_handle_v1_cap
uint32_t caps; // ext_workspace_handle_v1_workspace_capabilities
uint32_t state; // ext_workspace_handle_v1_state
struct {
@ -74,9 +62,11 @@ struct wlr_ext_workspace_handle_v1 {
struct wl_signal destroy;
} events;
struct wl_list link; // wlr_ext_workspace_manager_v1.workspaces;
struct wl_list link; // wlr_ext_workspace_manager_v1.workspaces
struct wl_list clients;
struct {
struct wl_list resources; // wlr_ext_workspace_v1_resource.link
};
};
struct wlr_ext_workspace_manager_v1 *
@ -114,5 +104,3 @@ void wlr_ext_workspace_handle_v1_set_urgent(
struct wlr_ext_workspace_handle_v1 *workspace, bool enabled);
void wlr_ext_workspace_handle_v1_set_hidden(
struct wlr_ext_workspace_handle_v1 *workspace, bool enabled);
#endif