Drop cosmic-workspace and use wlroots impl of ext-workspace-v1

This commit is contained in:
tokyo4j 2025-07-18 18:47:39 +09:00
parent 918c3290fc
commit 2802ca7264
21 changed files with 46 additions and 2697 deletions

View file

@ -247,13 +247,14 @@ struct server {
struct wl_list all; /* struct workspace.link */
struct workspace *current;
struct workspace *last;
struct lab_cosmic_workspace_manager *cosmic_manager;
struct lab_cosmic_workspace_group *cosmic_group;
struct lab_ext_workspace_manager *ext_manager;
struct lab_ext_workspace_group *ext_group;
struct wlr_ext_workspace_manager_v1 *ext_manager;
struct wlr_ext_workspace_group_handle_v1 *ext_group;
struct {
struct wl_listener layout_output_added;
} on;
struct {
struct wl_listener commit;
} on_ext_manager;
} workspaces;
struct wl_list outputs;

View file

@ -1,24 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_PROTOCOLS_COSMIC_WORKSPACES_INTERNAL_H
#define LABWC_PROTOCOLS_COSMIC_WORKSPACES_INTERNAL_H
struct lab_cosmic_workspace;
struct lab_cosmic_workspace_group;
struct lab_cosmic_workspace_manager;
enum pending_change {
/* group events */
CW_PENDING_WS_CREATE = 1 << 0,
/* ws events*/
CW_PENDING_WS_ACTIVATE = 1 << 1,
CW_PENDING_WS_DEACTIVATE = 1 << 2,
CW_PENDING_WS_REMOVE = 1 << 3,
};
void cosmic_group_output_send_initial_state(struct lab_cosmic_workspace_group *group,
struct wl_resource *group_resource);
void cosmic_manager_schedule_done_event(struct lab_cosmic_workspace_manager *manager);
#endif /* LABWC_PROTOCOLS_COSMIC_WORKSPACES_INTERNAL_H */

View file

@ -1,94 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_PROTOCOLS_COSMIC_WORKSPACES_H
#define LABWC_PROTOCOLS_COSMIC_WORKSPACES_H
#include <stdbool.h>
#include <wayland-server-core.h>
struct wlr_output;
struct lab_cosmic_workspace_manager {
struct wl_global *global;
struct wl_list groups;
uint32_t caps;
struct wl_event_source *idle_source;
struct wl_event_loop *event_loop;
struct {
struct wl_listener display_destroy;
} on;
struct wl_list resources;
};
struct lab_cosmic_workspace_group {
struct lab_cosmic_workspace_manager *manager;
struct wl_list workspaces;
struct wl_array capabilities;
struct {
struct wl_signal create_workspace;
struct wl_signal destroy;
} events;
struct wl_list link;
struct wl_list outputs;
struct wl_list resources;
};
struct lab_cosmic_workspace {
struct lab_cosmic_workspace_group *group;
char *name;
struct wl_array coordinates;
struct wl_array capabilities;
uint32_t state; /* enum lab_cosmic_workspace_state */
uint32_t state_pending; /* enum lab_cosmic_workspace_state */
struct {
struct wl_signal activate;
struct wl_signal deactivate;
struct wl_signal remove;
struct wl_signal destroy;
} events;
struct wl_list link;
struct wl_list resources;
};
enum lab_cosmic_workspace_caps {
CW_CAP_NONE = 0,
CW_CAP_GRP_ALL = 0x000000ff,
CW_CAP_WS_ALL = 0x0000ff00,
/* group caps */
CW_CAP_GRP_WS_CREATE = 1 << 0,
/* workspace caps */
CW_CAP_WS_ACTIVATE = 1 << 8,
CW_CAP_WS_DEACTIVATE = 1 << 9,
CW_CAP_WS_REMOVE = 1 << 10,
};
struct lab_cosmic_workspace_manager *lab_cosmic_workspace_manager_create(
struct wl_display *display, uint32_t caps, uint32_t version);
struct lab_cosmic_workspace_group *lab_cosmic_workspace_group_create(
struct lab_cosmic_workspace_manager *manager);
void lab_cosmic_workspace_group_output_enter(
struct lab_cosmic_workspace_group *group, struct wlr_output *output);
void lab_cosmic_workspace_group_output_leave(
struct lab_cosmic_workspace_group *group, struct wlr_output *output);
void lab_cosmic_workspace_group_destroy(struct lab_cosmic_workspace_group *group);
struct lab_cosmic_workspace *lab_cosmic_workspace_create(struct lab_cosmic_workspace_group *group);
void lab_cosmic_workspace_set_name(struct lab_cosmic_workspace *workspace, const char *name);
void lab_cosmic_workspace_set_active(struct lab_cosmic_workspace *workspace, bool enabled);
void lab_cosmic_workspace_set_urgent(struct lab_cosmic_workspace *workspace, bool enabled);
void lab_cosmic_workspace_set_hidden(struct lab_cosmic_workspace *workspace, bool enabled);
void lab_cosmic_workspace_set_coordinates(struct lab_cosmic_workspace *workspace,
struct wl_array *coordinates);
void lab_cosmic_workspace_destroy(struct lab_cosmic_workspace *workspace);
#endif /* LABWC_PROTOCOLS_COSMIC_WORKSPACES_H */

View file

@ -1,25 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_PROTOCOLS_EXT_WORKSPACES_INTERNAL_H
#define LABWC_PROTOCOLS_EXT_WORKSPACES_INTERNAL_H
struct wl_resource;
struct lab_ext_workspace_group;
struct lab_ext_workspace_manager;
enum pending_ext_workspaces_change {
/* group events */
WS_PENDING_WS_CREATE = 1 << 0,
/* ws events*/
WS_PENDING_WS_ACTIVATE = 1 << 1,
WS_PENDING_WS_DEACTIVATE = 1 << 2,
WS_PENDING_WS_REMOVE = 1 << 3,
WS_PENDING_WS_ASSIGN = 1 << 4,
};
void ext_group_output_send_initial_state(struct lab_ext_workspace_group *group,
struct wl_resource *group_resource);
void ext_manager_schedule_done_event(struct lab_ext_workspace_manager *manager);
#endif /* LABWC_PROTOCOLS_EXT_WORKSPACES_INTERNAL_H */

View file

@ -1,109 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_PROTOCOLS_EXT_WORKSPACES_H
#define LABWC_PROTOCOLS_EXT_WORKSPACES_H
#include <stdbool.h>
#include <wayland-server-core.h>
struct wlr_output;
struct lab_ext_workspace_manager {
struct wl_global *global;
struct wl_list groups;
struct wl_list workspaces;
uint32_t caps;
struct wl_event_source *idle_source;
struct wl_event_loop *event_loop;
struct {
struct wl_listener display_destroy;
} on;
struct wl_list resources;
};
struct lab_ext_workspace_group {
struct lab_ext_workspace_manager *manager;
uint32_t capabilities;
struct {
struct wl_signal create_workspace;
struct wl_signal destroy;
} events;
struct wl_list link;
struct wl_list outputs;
struct wl_list resources;
};
struct lab_ext_workspace {
struct lab_ext_workspace_manager *manager;
struct lab_ext_workspace_group *group;
char *id;
char *name;
struct wl_array coordinates;
uint32_t capabilities;
uint32_t state; /* enum lab_ext_workspace_state */
uint32_t state_pending; /* enum lab_ext_workspace_state */
struct {
struct wl_signal activate;
struct wl_signal deactivate;
struct wl_signal remove;
struct wl_signal assign;
struct wl_signal destroy;
} events;
struct wl_list link;
struct wl_list resources;
};
enum lab_ext_workspace_caps {
WS_CAP_NONE = 0,
WS_CAP_GRP_ALL = 0x0000ffff,
WS_CAP_WS_ALL = 0xffff0000,
/* group caps */
WS_CAP_GRP_WS_CREATE = 1 << 0,
/* workspace caps */
WS_CAP_WS_ACTIVATE = 1 << 16,
WS_CAP_WS_DEACTIVATE = 1 << 17,
WS_CAP_WS_REMOVE = 1 << 18,
WS_CAP_WS_ASSIGN = 1 << 19,
};
struct lab_ext_workspace_manager *lab_ext_workspace_manager_create(
struct wl_display *display, uint32_t caps, uint32_t version);
struct lab_ext_workspace_group *lab_ext_workspace_group_create(
struct lab_ext_workspace_manager *manager);
void lab_ext_workspace_group_output_enter(
struct lab_ext_workspace_group *group, struct wlr_output *output);
void lab_ext_workspace_group_output_leave(
struct lab_ext_workspace_group *group, struct wlr_output *output);
void lab_ext_workspace_group_destroy(struct lab_ext_workspace_group *group);
/* Create a new workspace, id may be NULL */
struct lab_ext_workspace *lab_ext_workspace_create(
struct lab_ext_workspace_manager *manager, const char *id);
void lab_ext_workspace_assign_to_group(struct lab_ext_workspace *workspace,
struct lab_ext_workspace_group *group);
void lab_ext_workspace_set_name(struct lab_ext_workspace *workspace, const char *name);
void lab_ext_workspace_set_active(struct lab_ext_workspace *workspace, bool enabled);
void lab_ext_workspace_set_urgent(struct lab_ext_workspace *workspace, bool enabled);
void lab_ext_workspace_set_hidden(struct lab_ext_workspace *workspace, bool enabled);
void lab_ext_workspace_set_coordinates(struct lab_ext_workspace *workspace,
struct wl_array *coordinates);
void lab_ext_workspace_destroy(struct lab_ext_workspace *workspace);
#endif /* LABWC_PROTOCOLS_EXT_WORKSPACES_H */

View file

@ -1,84 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_PROTOCOLS_TRANSACTION_ADDON_H
#define LABWC_PROTOCOLS_TRANSACTION_ADDON_H
#include <wayland-server-core.h>
struct lab_transaction_op {
uint32_t change;
void *src;
void *data;
struct {
struct wl_signal destroy;
} events;
// Private
struct wl_list link;
};
struct lab_transaction_session_context {
int ref_count;
struct wl_list transaction_ops;
};
struct lab_wl_resource_addon {
struct lab_transaction_session_context *ctx;
void *data;
};
/*
* Creates a new addon which can be attached to a wl_resource via
* wl_resource_set_user_data() and retrieved via wl_resource_get_user_data().
*
* Usually the ctx argument should be addon->ctx of the parent wl_resource.
* If it is NULL it will be created automatically which can be used for top
* level wl_resources (when a client binds a wl_global from the registry).
*
* The context refcount is increased by one after this call.
*/
struct lab_wl_resource_addon *lab_resource_addon_create(
struct lab_transaction_session_context *ctx);
/*
* A generic transaction operation attached to
* a session context transaction operation list.
*
* All arguments other than the context are user defined.
* Use of an enum for pending_change is suggested.
*
* The client is responsible for eventually freeing the data
* passed in the void *src and *data arguments by listening
* to the events.destroy signal. The transaction operations can be
* looped through by using lab_transaction_for_each(trans_op, ctx).
*/
struct lab_transaction_op *lab_transaction_op_add(
struct lab_transaction_session_context *ctx,
uint32_t pending_change, void *src, void *data);
/*
* Removes the transaction operation from the ctx list and frees it.
*
* Does *not* free any passed in src or data arguments.
* Use the events.destroy signal for that if necessary.
*/
void lab_transaction_op_destroy(struct lab_transaction_op *transaction_op);
/*
* Destroys the addon.
*
* The context refcount is decreased by one. If it reaches
* zero the context will be free'd alongside the addon itself.
* If the context is destroyed all pending transaction operations
* are destroyed as well.
*/
void lab_resource_addon_destroy(struct lab_wl_resource_addon *addon);
/* Convenience wrappers for looping through the pending transaction ops of a ctx */
#define lab_transaction_for_each(transaction_op, ctx) \
wl_list_for_each(transaction_op, &(ctx)->transaction_ops, link)
#define lab_transaction_for_each_safe(trans_op, trans_op_tmp, ctx) \
wl_list_for_each_safe(trans_op, trans_op_tmp, &(ctx)->transaction_ops, link)
#endif /* LABWC_PROTOCOLS_TRANSACTIONS_ADDON_H */

View file

@ -21,20 +21,7 @@ struct workspace {
char *name;
struct wlr_scene_tree *tree;
struct lab_cosmic_workspace *cosmic_workspace;
struct {
struct wl_listener activate;
struct wl_listener deactivate;
struct wl_listener remove;
} on_cosmic;
struct lab_ext_workspace *ext_workspace;
struct {
struct wl_listener activate;
struct wl_listener deactivate;
struct wl_listener assign;
struct wl_listener remove;
} on_ext;
struct wlr_ext_workspace_handle_v1 *ext_workspace;
};
void workspaces_init(struct server *server);