File: ext-workspace.h

package info (click to toggle)
labwc 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,980 kB
  • sloc: ansic: 34,416; perl: 5,836; xml: 875; sh: 162; python: 131; makefile: 12
file content (109 lines) | stat: -rw-r--r-- 3,021 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* 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 */