11#include "libglace-private.h"
22
33static guint glace_client_signals [GLACE_CLIENT_N_SIGNALS ] = {0 };
4- static GParamSpec * glace_client_properties [GLACE_CLIENT_N_PROPERTIES ] = {NULL ,};
4+ static GParamSpec * glace_client_properties [GLACE_CLIENT_N_PROPERTIES ] = {
5+ NULL ,
6+ };
57
68static void glace_client_signal_changed_emit (GlaceClient * self ) {
79 g_signal_emit (
@@ -19,7 +21,6 @@ static void glace_client_signal_close_emit(GlaceClient* self) {
1921 );
2022}
2123
22-
2324static void glace_client_get_property (
2425 GObject * object ,
2526 guint prop_id ,
@@ -29,37 +30,36 @@ static void glace_client_get_property(
2930 GlaceClient * self = GLACE_CLIENT (object );
3031
3132 switch (prop_id ) {
32- case GLACE_CLIENT_PROPERTY_ID :
33- g_value_set_uint (value , (guint )self -> priv -> id );
34- break ;
35- case GLACE_CLIENT_PROPERTY_APP_ID :
36- g_value_set_string (value , CLIENT_GET_CURRENT_PROP (self , app_id ));
37- break ;
38- case GLACE_CLIENT_PROPERTY_TITLE :
39- g_value_set_string (value , CLIENT_GET_CURRENT_PROP (self , title ));
40- break ;
41- case GLACE_CLIENT_PROPERTY_MAXIMIZED :
42- g_value_set_boolean (value , CLIENT_GET_CURRENT_PROP (self , maximized ));
43- break ;
44- case GLACE_CLIENT_PROPERTY_MINIMIZED :
45- g_value_set_boolean (value , CLIENT_GET_CURRENT_PROP (self , minimized ));
46- break ;
47- case GLACE_CLIENT_PROPERTY_ACTIVATED :
48- g_value_set_boolean (value , CLIENT_GET_CURRENT_PROP (self , activated ));
49- break ;
50- case GLACE_CLIENT_PROPERTY_FULLSCREEN :
51- g_value_set_boolean (value , CLIENT_GET_CURRENT_PROP (self , fullscreen ));
52- break ;
53- case GLACE_CLIENT_PROPERTY_CLOSED :
54- g_value_set_boolean (value , self -> priv -> closed );
55- break ;
56- default :
57- G_OBJECT_WARN_INVALID_PROPERTY_ID (object , prop_id , pspec );
58- break ;
33+ case GLACE_CLIENT_PROPERTY_ID :
34+ g_value_set_uint (value , (guint )self -> priv -> id );
35+ break ;
36+ case GLACE_CLIENT_PROPERTY_APP_ID :
37+ g_value_set_string (value , CLIENT_GET_CURRENT_PROP (self , app_id ));
38+ break ;
39+ case GLACE_CLIENT_PROPERTY_TITLE :
40+ g_value_set_string (value , CLIENT_GET_CURRENT_PROP (self , title ));
41+ break ;
42+ case GLACE_CLIENT_PROPERTY_MAXIMIZED :
43+ g_value_set_boolean (value , CLIENT_GET_CURRENT_PROP (self , maximized ));
44+ break ;
45+ case GLACE_CLIENT_PROPERTY_MINIMIZED :
46+ g_value_set_boolean (value , CLIENT_GET_CURRENT_PROP (self , minimized ));
47+ break ;
48+ case GLACE_CLIENT_PROPERTY_ACTIVATED :
49+ g_value_set_boolean (value , CLIENT_GET_CURRENT_PROP (self , activated ));
50+ break ;
51+ case GLACE_CLIENT_PROPERTY_FULLSCREEN :
52+ g_value_set_boolean (value , CLIENT_GET_CURRENT_PROP (self , fullscreen ));
53+ break ;
54+ case GLACE_CLIENT_PROPERTY_CLOSED :
55+ g_value_set_boolean (value , self -> priv -> closed );
56+ break ;
57+ default :
58+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object , prop_id , pspec );
59+ break ;
5960 }
6061}
6162
62-
6363// client event handlers
6464static void on_toplevel_handle_title (
6565 void * data ,
@@ -71,7 +71,6 @@ static void on_toplevel_handle_title(
7171 CLIENT_SET_PENDING_PROP (self , title , (gchar * )(strdup (title )));
7272}
7373
74-
7574static void on_toplevel_handle_app_id (
7675 void * data ,
7776 struct zwlr_foreign_toplevel_handle_v1 * wlr_handle ,
@@ -89,14 +88,12 @@ static void on_toplevel_handle_output_enter(
8988 struct wl_output * output
9089) {}
9190
92-
9391static void on_toplevel_handle_output_leave (
9492 void * data ,
9593 struct zwlr_foreign_toplevel_handle_v1 * wlr_handle ,
9694 struct wl_output * output
9795) {}
9896
99-
10097static void on_toplevel_handle_state (
10198 void * data ,
10299 struct zwlr_foreign_toplevel_handle_v1 * wlr_handle ,
@@ -108,7 +105,7 @@ static void on_toplevel_handle_state(
108105
109106 enum zwlr_foreign_toplevel_handle_v1_state * state ;
110107 wl_array_for_each (state , states ) {
111- switch (* state ) {
108+ switch (* state ) {
112109 CLIENT_SET_STATE_FOR_CASE (self , state , MAXIMIZED , maximized );
113110 CLIENT_SET_STATE_FOR_CASE (self , state , MINIMIZED , minimized );
114111 CLIENT_SET_STATE_FOR_CASE (self , state , ACTIVATED , activated );
@@ -117,7 +114,6 @@ static void on_toplevel_handle_state(
117114 }
118115}
119116
120-
121117static void on_toplevel_handle_done (
122118 void * data ,
123119 struct zwlr_foreign_toplevel_handle_v1 * wlr_handle
@@ -136,7 +132,6 @@ static void on_toplevel_handle_done(
136132 free (CLIENT_GET_CURRENT_PROP (self , app_id ));
137133 }
138134
139-
140135 if (CLIENT_GET_PENDING_PROP (self , title )) {
141136 CLIENT_BRIDGE_PROPS (self , title , TITLE );
142137 CLIENT_SET_PENDING_PROP (self , title , NULL );
@@ -156,7 +151,6 @@ static void on_toplevel_handle_done(
156151 glace_client_signal_changed_emit (self );
157152}
158153
159-
160154static void on_toplevel_handle_closed (
161155 void * data ,
162156 struct zwlr_foreign_toplevel_handle_v1 * wlr_handle
@@ -168,14 +162,12 @@ static void on_toplevel_handle_closed(
168162 glace_client_signal_close_emit (self );
169163}
170164
171-
172165static void on_toplevel_handle_parent (
173166 void * data ,
174167 struct zwlr_foreign_toplevel_handle_v1 * wlr_handle ,
175168 struct zwlr_foreign_toplevel_handle_v1 * parent
176169) {}
177170
178-
179171static struct zwlr_foreign_toplevel_handle_v1_listener toplevel_handle_listener = {
180172 .title = & on_toplevel_handle_title ,
181173 .app_id = & on_toplevel_handle_app_id ,
@@ -187,7 +179,6 @@ static struct zwlr_foreign_toplevel_handle_v1_listener toplevel_handle_listener
187179 .parent = & on_toplevel_handle_parent
188180};
189181
190-
191182static void glace_client_class_init (GlaceClientClass * klass ) {
192183 GObjectClass * parent_class = G_OBJECT_CLASS (klass );
193184
@@ -231,9 +222,7 @@ static void glace_client_class_init(GlaceClientClass* klass) {
231222 0
232223 );
233224
234- glace_client_properties [
235- GLACE_CLIENT_PROPERTY_ID
236- ] = g_param_spec_uint (
225+ glace_client_properties [GLACE_CLIENT_PROPERTY_ID ] = g_param_spec_uint (
237226 "id" ,
238227 "id" ,
239228 "the id of the client" ,
@@ -243,19 +232,15 @@ static void glace_client_class_init(GlaceClientClass* klass) {
243232 G_PARAM_READABLE
244233 );
245234
246- glace_client_properties [
247- GLACE_CLIENT_PROPERTY_APP_ID
248- ] = g_param_spec_string (
235+ glace_client_properties [GLACE_CLIENT_PROPERTY_APP_ID ] = g_param_spec_string (
249236 "app-id" ,
250237 "class" ,
251238 "the application id of the client (class name under X11)" ,
252239 NULL ,
253240 G_PARAM_READABLE
254241 );
255242
256- glace_client_properties [
257- GLACE_CLIENT_PROPERTY_TITLE
258- ] = g_param_spec_string (
243+ glace_client_properties [GLACE_CLIENT_PROPERTY_TITLE ] = g_param_spec_string (
259244 "title" ,
260245 "title" ,
261246 "the current title of the client" ,
@@ -264,47 +249,35 @@ static void glace_client_class_init(GlaceClientClass* klass) {
264249 );
265250
266251 // state properties
267- glace_client_properties [
268- GLACE_CLIENT_PROPERTY_MAXIMIZED
269- ] = g_param_spec_boolean (
252+ glace_client_properties [GLACE_CLIENT_PROPERTY_MAXIMIZED ] = g_param_spec_boolean (
270253 "maximized" ,
271254 "maximized" ,
272255 "whether this client is currently maximized or not" ,
273256 false,
274257 G_PARAM_READABLE
275258 );
276259
277- glace_client_properties [
278- GLACE_CLIENT_PROPERTY_MINIMIZED
279- ] = g_param_spec_boolean (
260+ glace_client_properties [GLACE_CLIENT_PROPERTY_MINIMIZED ] = g_param_spec_boolean (
280261 "minimized" ,
281262 "minimized" ,
282263 "whether this client is currently minimized or not" ,
283264 false,
284265 G_PARAM_READABLE
285266 );
286267
287- glace_client_properties [
288- GLACE_CLIENT_PROPERTY_ACTIVATED
289- ] = g_param_spec_boolean (
268+ glace_client_properties [GLACE_CLIENT_PROPERTY_ACTIVATED ] = g_param_spec_boolean (
290269 "activated" ,
291270 "focused" ,
292271 "whether this client is currently activated (focused) or not" ,
293272 false,
294273 G_PARAM_READABLE
295274 );
296275
297- glace_client_properties [
298- GLACE_CLIENT_PROPERTY_FULLSCREEN
299- ] = g_param_spec_boolean (
300- "fullscreen" , "fullscreen" , "whether this client is currently in a fullscreen state or not" ,
301- false,
302- G_PARAM_READABLE
276+ glace_client_properties [GLACE_CLIENT_PROPERTY_FULLSCREEN ] = g_param_spec_boolean (
277+ "fullscreen" , "fullscreen" , "whether this client is currently in a fullscreen state or not" , false, G_PARAM_READABLE
303278 );
304279
305- glace_client_properties [
306- GLACE_CLIENT_PROPERTY_CLOSED
307- ] = g_param_spec_boolean (
280+ glace_client_properties [GLACE_CLIENT_PROPERTY_CLOSED ] = g_param_spec_boolean (
308281 "closed" ,
309282 "closed" ,
310283 "whether this client is closed (killed) or not, it's guaranteed that you won't receive events for this client after it gets closed" ,
@@ -319,7 +292,6 @@ static void glace_client_class_init(GlaceClientClass* klass) {
319292 );
320293}
321294
322-
323295static void glace_client_init (GlaceClient * self ) {
324296 self -> priv = G_TYPE_INSTANCE_GET_PRIVATE (
325297 self ,
@@ -336,7 +308,6 @@ static void glace_client_init(GlaceClient* self) {
336308 CLIENT_SET_CURRENT_PROP (self , fullscreen , false);
337309}
338310
339-
340311GlaceClient * glace_client_new (
341312 struct zwlr_foreign_toplevel_handle_v1 * wlr_handle ,
342313 GdkWaylandDisplay * gdk_display
@@ -353,5 +324,4 @@ GlaceClient* glace_client_new(
353324 return self ;
354325}
355326
356-
357327G_DEFINE_TYPE (GlaceClient , glace_client , G_TYPE_OBJECT );
0 commit comments