[go: up one dir, main page]

File: libdecor-plugin.h

package info (click to toggle)
libdecor-0 0.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 492 kB
  • sloc: ansic: 8,377; cpp: 288; sh: 89; makefile: 23
file content (183 lines) | stat: -rw-r--r-- 5,587 bytes parent folder | download | duplicates (4)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
 * Copyright © 2017-2018 Red Hat Inc.
 * Copyright © 2018 Jonas Ådahl
 * Copyright © 2019 Christian Rauch
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#ifndef LIBDECOR_PLUGIN_H
#define LIBDECOR_PLUGIN_H

#include "libdecor.h"

struct libdecor_frame_private;

struct libdecor_frame {
	struct libdecor_frame_private *priv;
	struct wl_list link;
};

struct libdecor_plugin_private;

struct libdecor_plugin {
	struct libdecor_plugin_private *priv;
};

typedef struct libdecor_plugin * (* libdecor_plugin_constructor)(struct libdecor *context);

#define LIBDECOR_PLUGIN_PRIORITY_HIGH 1000
#define LIBDECOR_PLUGIN_PRIORITY_MEDIUM 100
#define LIBDECOR_PLUGIN_PRIORITY_LOW 0

struct libdecor_plugin_priority {
	const char *desktop;
	int priority;
};

enum libdecor_plugin_capabilities {
	LIBDECOR_PLUGIN_CAPABILITY_BASE = 1 << 0,
};

struct libdecor_plugin_description {
	/* API version the plugin is compatible with. */
	int api_version;

	/* Human readable string describing the plugin. */
	char *description;

	/* A plugin has a bitmask of capabilities. The plugin loader can use this
	 * to load a plugin with the right capabilities. */
	enum libdecor_plugin_capabilities capabilities;

	/*
	 * The priorities field points to a list of per desktop priorities.
	 * properties[i].desktop is matched against XDG_CURRENT_DESKTOP when
	 * determining what plugin to use. The last entry in the list MUST have
	 * the priorities[i].desktop pointer set to NULL as a default
	 * priority.
	 */
	const struct libdecor_plugin_priority *priorities;

	/* Vfunc used for constructing a plugin instance. */
	libdecor_plugin_constructor constructor;

	/* NULL terminated list of incompatible symbols. */
	char *conflicting_symbols[1024];
};

struct libdecor_plugin_interface {
	void (* destroy)(struct libdecor_plugin *plugin);

	int (* get_fd)(struct libdecor_plugin *plugin);
	int (* dispatch)(struct libdecor_plugin *plugin,
			 int timeout);

	struct libdecor_frame * (* frame_new)(struct libdecor_plugin *plugin);
	void (* frame_free)(struct libdecor_plugin *plugin,
			    struct libdecor_frame *frame);
	void (* frame_commit)(struct libdecor_plugin *plugin,
			      struct libdecor_frame *frame,
			      struct libdecor_state *state,
			      struct libdecor_configuration *configuration);
	void (*frame_property_changed)(struct libdecor_plugin *plugin,
				       struct libdecor_frame *frame);
	void (* frame_popup_grab)(struct libdecor_plugin *plugin,
				  struct libdecor_frame *frame,
				  const char *seat_name);
	void (* frame_popup_ungrab)(struct libdecor_plugin *plugin,
				    struct libdecor_frame *frame,
				    const char *seat_name);

	bool (* frame_get_border_size)(struct libdecor_plugin *plugin,
				       struct libdecor_frame *frame,
				       struct libdecor_configuration *configuration,
				       int *left,
				       int *right,
				       int *top,
				       int *bottom);

	/* Reserved */
	void (* reserved0)(void);
	void (* reserved1)(void);
	void (* reserved2)(void);
	void (* reserved3)(void);
	void (* reserved4)(void);
	void (* reserved5)(void);
	void (* reserved6)(void);
	void (* reserved7)(void);
	void (* reserved8)(void);
	void (* reserved9)(void);
};

struct wl_surface *
libdecor_frame_get_wl_surface(struct libdecor_frame *frame);

int
libdecor_frame_get_content_width(struct libdecor_frame *frame);

int
libdecor_frame_get_content_height(struct libdecor_frame *frame);

enum libdecor_window_state
libdecor_frame_get_window_state(struct libdecor_frame *frame);

enum libdecor_capabilities
libdecor_frame_get_capabilities(const struct libdecor_frame *frame);

void
libdecor_frame_dismiss_popup(struct libdecor_frame *frame,
			     const char *seat_name);

void
libdecor_frame_toplevel_commit(struct libdecor_frame *frame);

struct wl_display *
libdecor_get_wl_display(struct libdecor *context);

void
libdecor_notify_plugin_ready(struct libdecor *context);

void
libdecor_notify_plugin_error(struct libdecor *context,
			     enum libdecor_error error,
			     const char *__restrict fmt,
			     ...);

int
libdecor_state_get_content_width(struct libdecor_state *state);

int
libdecor_state_get_content_height(struct libdecor_state *state);

enum libdecor_window_state
libdecor_state_get_window_state(struct libdecor_state *state);

int
libdecor_plugin_init(struct libdecor_plugin *plugin,
		     struct libdecor *context,
		     struct libdecor_plugin_interface *iface);

void
libdecor_plugin_release(struct libdecor_plugin *plugin);

#endif /* LIBDECOR_PLUGIN_H */