mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
cosmic-workspaces: protocol implementation
This commit is contained in:
parent
a9daaa05be
commit
31f4336ed6
10 changed files with 1445 additions and 0 deletions
61
include/protocols/cosmic-workspaces-internal.h
Normal file
61
include/protocols/cosmic-workspaces-internal.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/* 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,
|
||||
};
|
||||
|
||||
struct transaction {
|
||||
uint32_t change;
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
struct transaction_workspace {
|
||||
struct transaction base;
|
||||
struct lab_cosmic_workspace *workspace;
|
||||
};
|
||||
|
||||
struct transaction_group {
|
||||
struct transaction base;
|
||||
struct lab_cosmic_workspace_group *group;
|
||||
char *new_workspace_name;
|
||||
};
|
||||
|
||||
struct session_context {
|
||||
int ref_count;
|
||||
struct wl_list transactions;
|
||||
};
|
||||
|
||||
struct wl_resource_addon {
|
||||
struct session_context *ctx;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wl_resource_addon *resource_addon_create(struct session_context *ctx);
|
||||
|
||||
void transaction_add_workspace_ev(struct lab_cosmic_workspace *ws,
|
||||
struct wl_resource *resource, enum pending_change change);
|
||||
|
||||
void transaction_add_workspace_group_ev(struct lab_cosmic_workspace_group *group,
|
||||
struct wl_resource *resource, enum pending_change change,
|
||||
const char *new_workspace_name);
|
||||
|
||||
void resource_addon_destroy(struct wl_resource_addon *addon);
|
||||
|
||||
void group_output_send_initial_state(struct lab_cosmic_workspace_group *group,
|
||||
struct wl_resource *group_resource);
|
||||
|
||||
void manager_schedule_done_event(struct lab_cosmic_workspace_manager *manager);
|
||||
|
||||
#endif /* LABWC_PROTOCOLS_COSMIC_WORKSPACES_INTERNAL_H */
|
||||
94
include/protocols/cosmic-workspaces.h
Normal file
94
include/protocols/cosmic-workspaces.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/* 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 */
|
||||
Loading…
Add table
Add a link
Reference in a new issue