2 * client.c - client management
4 * Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <xcb/xcb_atom.h>
23 #include <xcb/xcb_image.h>
24 #include <xcb/shape.h>
25 #include <cairo-xcb.h>
27 #include "objects/tag.h"
35 #include "common/atoms.h"
36 #include "common/xutil.h"
38 static area_t
titlebar_get_area(client_t
*c
, client_titlebar_t bar
);
39 static drawable_t
*titlebar_get_drawable(lua_State
*L
, client_t
*c
, int cl_idx
, client_titlebar_t bar
);
42 * \param L The Lua VM state.
43 * \return The number of element pushed on stack.
46 client_wipe(client_t
*c
)
48 key_array_wipe(&c
->keys
);
49 xcb_icccm_get_wm_protocols_reply_wipe(&c
->protocols
);
50 p_delete(&c
->machine
);
52 p_delete(&c
->instance
);
53 p_delete(&c
->icon_name
);
54 p_delete(&c
->alt_icon_name
);
56 p_delete(&c
->alt_name
);
58 cairo_surface_destroy(c
->icon
);
61 /** Change the clients urgency flag.
62 * \param L The Lua VM state.
63 * \param cidx The client index on the stack.
64 * \param urgent The new flag state.
67 client_set_urgent(lua_State
*L
, int cidx
, bool urgent
)
69 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
71 if(c
->urgent
!= urgent
)
73 xcb_get_property_cookie_t hints
=
74 xcb_icccm_get_wm_hints_unchecked(globalconf
.connection
, c
->window
);
78 /* update ICCCM hints */
79 xcb_icccm_wm_hints_t wmh
;
80 xcb_icccm_get_wm_hints_reply(globalconf
.connection
, hints
, &wmh
, NULL
);
83 wmh
.flags
|= XCB_ICCCM_WM_HINT_X_URGENCY
;
85 wmh
.flags
&= ~XCB_ICCCM_WM_HINT_X_URGENCY
;
87 xcb_icccm_set_wm_hints(globalconf
.connection
, c
->window
, &wmh
);
89 luaA_object_emit_signal(L
, cidx
, "property::urgent", 0);
93 #define DO_CLIENT_SET_PROPERTY(prop) \
95 client_set_##prop(lua_State *L, int cidx, fieldtypeof(client_t, prop) value) \
97 client_t *c = luaA_checkudata(L, cidx, &client_class); \
98 if(c->prop != value) \
101 luaA_object_emit_signal(L, cidx, "property::" #prop, 0); \
104 DO_CLIENT_SET_PROPERTY(group_window
)
105 DO_CLIENT_SET_PROPERTY(type
)
106 DO_CLIENT_SET_PROPERTY(transient_for
)
107 DO_CLIENT_SET_PROPERTY(pid
)
108 DO_CLIENT_SET_PROPERTY(skip_taskbar
)
109 #undef DO_CLIENT_SET_PROPERTY
111 #define DO_CLIENT_SET_STRING_PROPERTY2(prop, signal) \
113 client_set_##prop(lua_State *L, int cidx, char *value) \
115 client_t *c = luaA_checkudata(L, cidx, &client_class); \
116 p_delete(&c->prop); \
118 luaA_object_emit_signal(L, cidx, "property::" #signal, 0); \
120 #define DO_CLIENT_SET_STRING_PROPERTY(prop) \
121 DO_CLIENT_SET_STRING_PROPERTY2(prop, prop)
122 DO_CLIENT_SET_STRING_PROPERTY(name
)
123 DO_CLIENT_SET_STRING_PROPERTY2(alt_name
, name
)
124 DO_CLIENT_SET_STRING_PROPERTY(icon_name
)
125 DO_CLIENT_SET_STRING_PROPERTY2(alt_icon_name
, icon_name
)
126 DO_CLIENT_SET_STRING_PROPERTY(role
)
127 DO_CLIENT_SET_STRING_PROPERTY(machine
)
128 #undef DO_CLIENT_SET_STRING_PROPERTY
131 client_set_class_instance(lua_State
*L
, int cidx
, const char *class, const char *instance
)
133 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
135 p_delete(&c
->instance
);
136 c
->class = a_strdup(class);
137 luaA_object_emit_signal(L
, cidx
, "property::class", 0);
138 c
->instance
= a_strdup(instance
);
139 luaA_object_emit_signal(L
, cidx
, "property::instance", 0);
142 /** Returns true if a client is tagged
143 * with one of the tags of the specified screen.
144 * \param c The client to check.
145 * \param screen Virtual screen.
146 * \return true if the client is visible, false otherwise.
149 client_maybevisible(client_t
*c
)
154 foreach(tag
, globalconf
.tags
)
155 if(tag_get_selected(*tag
) && is_client_tagged(c
, *tag
))
161 /** Get a client by its window.
162 * \param w The client window to find.
163 * \return A client pointer if found, NULL otherwise.
166 client_getbywin(xcb_window_t w
)
168 foreach(c
, globalconf
.clients
)
169 if((*c
)->window
== w
)
175 /** Get a client by its frame window.
176 * \param w The client window to find.
177 * \return A client pointer if found, NULL otherwise.
180 client_getbyframewin(xcb_window_t w
)
182 foreach(c
, globalconf
.clients
)
183 if((*c
)->frame_window
== w
)
189 /** Unfocus a client (internal).
190 * \param c The client.
193 client_unfocus_internal(client_t
*c
)
195 globalconf
.focus
.client
= NULL
;
197 luaA_object_push(globalconf
.L
, c
);
198 luaA_object_emit_signal(globalconf
.L
, -1, "unfocus", 0);
199 lua_pop(globalconf
.L
, 1);
202 /** Unfocus a client.
203 * \param c The client.
206 client_unfocus(client_t
*c
)
208 client_unfocus_internal(c
);
209 globalconf
.focus
.need_update
= true;
212 /** Check if client supports atom a protocol in WM_PROTOCOL.
213 * \param c The client.
214 * \param atom The protocol atom to check for.
215 * \return True if client has the atom in protocol, false otherwise.
218 client_hasproto(client_t
*c
, xcb_atom_t atom
)
220 for(uint32_t i
= 0; i
< c
->protocols
.atoms_len
; i
++)
221 if(c
->protocols
.atoms
[i
] == atom
)
226 /** Prepare banning a client by running all needed lua events.
227 * \param c The client.
229 void client_ban_unfocus(client_t
*c
)
231 /* Wait until the last moment to take away the focus from the window. */
232 if(globalconf
.focus
.client
== c
)
236 /** Ban client and move it out of the viewport.
237 * \param c The client.
240 client_ban(client_t
*c
)
244 xcb_unmap_window(globalconf
.connection
, c
->frame_window
);
248 client_ban_unfocus(c
);
252 /** This is part of The Bob Marley Algorithm: we ignore enter and leave window
253 * in certain cases, like map/unmap or move, so we don't get spurious events.
256 client_ignore_enterleave_events(void)
258 foreach(c
, globalconf
.clients
)
260 xcb_change_window_attributes(globalconf
.connection
,
263 (const uint32_t []) { CLIENT_SELECT_INPUT_EVENT_MASK
& ~(XCB_EVENT_MASK_ENTER_WINDOW
| XCB_EVENT_MASK_LEAVE_WINDOW
) });
264 xcb_change_window_attributes(globalconf
.connection
,
267 (const uint32_t []) { FRAME_SELECT_INPUT_EVENT_MASK
& ~(XCB_EVENT_MASK_ENTER_WINDOW
| XCB_EVENT_MASK_LEAVE_WINDOW
) });
272 client_restore_enterleave_events(void)
274 foreach(c
, globalconf
.clients
)
276 xcb_change_window_attributes(globalconf
.connection
,
279 (const uint32_t []) { CLIENT_SELECT_INPUT_EVENT_MASK
});
280 xcb_change_window_attributes(globalconf
.connection
,
283 (const uint32_t []) { FRAME_SELECT_INPUT_EVENT_MASK
});
287 /** Record that a client got focus.
288 * \param c The client.
291 client_focus_update(client_t
*c
)
293 if(!client_maybevisible(c
))
296 if(globalconf
.focus
.client
)
298 if (globalconf
.focus
.client
== c
)
299 /* Already focused */
302 /* When we are called due to a FocusIn event (=old focused client
303 * already unfocused), we don't want to cause a SetInputFocus,
304 * because the client which has focus now could be using globally
305 * active input model (or 'no input').
307 client_unfocus_internal(globalconf
.focus
.client
);
310 globalconf
.focus
.client
= c
;
312 /* according to EWMH, we have to remove the urgent state from a client */
313 luaA_object_push(globalconf
.L
, c
);
314 client_set_urgent(globalconf
.L
, -1, false);
316 luaA_object_emit_signal(globalconf
.L
, -1, "focus", 0);
317 lua_pop(globalconf
.L
, 1);
320 /** Give focus to client, or to first client if client is NULL.
321 * \param c The client.
324 client_focus(client_t
*c
)
326 /* We have to set focus on first client */
327 if(!c
&& globalconf
.clients
.len
&& !(c
= globalconf
.clients
.tab
[0]))
330 if(!client_maybevisible(c
) || c
== globalconf
.focus
.client
)
333 client_focus_update(c
);
334 globalconf
.focus
.need_update
= true;
338 client_focus_refresh(void)
340 client_t
*c
= globalconf
.focus
.client
;
341 xcb_window_t win
= globalconf
.screen
->root
;
343 if(!globalconf
.focus
.need_update
)
345 globalconf
.focus
.need_update
= false;
349 /* Make sure this window is unbanned and e.g. not minimized */
351 /* Sets focus on window - using xcb_set_input_focus or WM_TAKE_FOCUS */
355 /* Focus the root window to make sure the previously focused client
356 * doesn't get any input in case WM_TAKE_FOCUS gets ignored.
358 win
= globalconf
.screen
->root
;
360 if(client_hasproto(c
, WM_TAKE_FOCUS
))
361 xwindow_takefocus(c
->window
);
364 /* If nothing has the focused or the currently focused client doesn't want
365 * us to focus it, this sets the focus to the root window. This makes sure
366 * the previously focused client actually gets unfocused. Alternatively, the
367 * new client gets the input focus.
369 xcb_set_input_focus(globalconf
.connection
, XCB_INPUT_FOCUS_PARENT
,
370 win
, globalconf
.timestamp
);
374 client_update_properties(client_t
*c
)
377 xcb_get_property_cookie_t wm_normal_hints
= property_get_wm_normal_hints(c
);
378 xcb_get_property_cookie_t wm_hints
= property_get_wm_hints(c
);
379 xcb_get_property_cookie_t wm_transient_for
= property_get_wm_transient_for(c
);
380 xcb_get_property_cookie_t wm_client_leader
= property_get_wm_client_leader(c
);
381 xcb_get_property_cookie_t wm_client_machine
= property_get_wm_client_machine(c
);
382 xcb_get_property_cookie_t wm_window_role
= property_get_wm_window_role(c
);
383 xcb_get_property_cookie_t net_wm_pid
= property_get_net_wm_pid(c
);
384 xcb_get_property_cookie_t net_wm_icon
= property_get_net_wm_icon(c
);
385 xcb_get_property_cookie_t wm_name
= property_get_wm_name(c
);
386 xcb_get_property_cookie_t net_wm_name
= property_get_net_wm_name(c
);
387 xcb_get_property_cookie_t wm_icon_name
= property_get_wm_icon_name(c
);
388 xcb_get_property_cookie_t net_wm_icon_name
= property_get_net_wm_icon_name(c
);
389 xcb_get_property_cookie_t wm_class
= property_get_wm_class(c
);
390 xcb_get_property_cookie_t wm_protocols
= property_get_wm_protocols(c
);
391 xcb_get_property_cookie_t opacity
= xwindow_get_opacity_unchecked(c
->window
);
394 ewmh_process_client_strut(c
);
396 /* Now process all replies */
397 property_update_wm_normal_hints(c
, wm_normal_hints
);
398 property_update_wm_hints(c
, wm_hints
);
399 property_update_wm_transient_for(c
, wm_transient_for
);
400 property_update_wm_client_leader(c
, wm_client_leader
);
401 property_update_wm_client_machine(c
, wm_client_machine
);
402 property_update_wm_window_role(c
, wm_window_role
);
403 property_update_net_wm_pid(c
, net_wm_pid
);
404 property_update_net_wm_icon(c
, net_wm_icon
);
405 property_update_wm_name(c
, wm_name
);
406 property_update_net_wm_name(c
, net_wm_name
);
407 property_update_wm_icon_name(c
, wm_icon_name
);
408 property_update_net_wm_icon_name(c
, net_wm_icon_name
);
409 property_update_wm_class(c
, wm_class
);
410 property_update_wm_protocols(c
, wm_protocols
);
411 window_set_opacity(globalconf
.L
, -1, xwindow_get_opacity_from_cookie(opacity
));
414 /** Manage a new client.
415 * \param w The window.
416 * \param wgeom Window geometry.
417 * \param startup True if we are managing at startup time.
420 client_manage(xcb_window_t w
, xcb_get_geometry_reply_t
*wgeom
, bool startup
)
422 const uint32_t select_input_val
[] = { CLIENT_SELECT_INPUT_EVENT_MASK
};
424 if(systray_iskdedockapp(w
))
426 systray_request_handle(w
, NULL
);
430 /* If this is a new client that just has been launched, then request its
432 xcb_get_property_cookie_t startup_id_q
= { 0 };
434 startup_id_q
= xcb_get_property(globalconf
.connection
, false, w
,
435 _NET_STARTUP_ID
, XCB_GET_PROPERTY_TYPE_ANY
, 0, UINT_MAX
);
437 /* Make sure the window is automatically mapped if awesome exits or dies. */
438 xcb_change_save_set(globalconf
.connection
, XCB_SET_MODE_INSERT
, w
);
440 client_t
*c
= client_new(globalconf
.L
);
441 xcb_screen_t
*s
= globalconf
.screen
;
443 /* consider the window banned */
447 c
->frame_window
= xcb_generate_id(globalconf
.connection
);
448 xcb_create_window(globalconf
.connection
, globalconf
.default_depth
, c
->frame_window
, s
->root
,
449 wgeom
->x
, wgeom
->y
, wgeom
->width
, wgeom
->height
,
450 wgeom
->border_width
, XCB_COPY_FROM_PARENT
, globalconf
.visual
->visual_id
,
451 XCB_CW_BACK_PIXEL
| XCB_CW_BORDER_PIXEL
| XCB_CW_BIT_GRAVITY
452 | XCB_CW_WIN_GRAVITY
| XCB_CW_OVERRIDE_REDIRECT
| XCB_CW_EVENT_MASK
456 globalconf
.screen
->black_pixel
,
457 globalconf
.screen
->black_pixel
,
458 XCB_GRAVITY_NORTH_WEST
,
459 XCB_GRAVITY_NORTH_WEST
,
461 FRAME_SELECT_INPUT_EVENT_MASK
,
462 globalconf
.default_cmap
467 /* The client is already mapped, thus we must be sure that we don't send
468 * ourselves an UnmapNotify due to the xcb_reparent_window().
470 * Grab the server to make sure we don't lose any events.
472 uint32_t no_event
[] = { 0 };
473 xcb_grab_server(globalconf
.connection
);
475 xcb_change_window_attributes(globalconf
.connection
,
476 globalconf
.screen
->root
,
481 xcb_reparent_window(globalconf
.connection
, w
, c
->frame_window
, 0, 0);
482 xcb_map_window(globalconf
.connection
, w
);
486 xcb_change_window_attributes(globalconf
.connection
,
487 globalconf
.screen
->root
,
489 ROOT_WINDOW_EVENT_MASK
);
490 xcb_ungrab_server(globalconf
.connection
);
493 /* Do this now so that we don't get any events for the above
494 * (Else, reparent could cause an UnmapNotify) */
495 xcb_change_window_attributes(globalconf
.connection
, w
, XCB_CW_EVENT_MASK
, select_input_val
);
497 luaA_object_emit_signal(globalconf
.L
, -1, "property::window", 0);
499 /* The frame window gets the border, not the real client window */
500 xcb_configure_window(globalconf
.connection
, w
,
501 XCB_CONFIG_WINDOW_BORDER_WIDTH
,
504 /* Move this window to the bottom of the stack. Without this we would force
505 * other windows which will be above this one to redraw themselves because
506 * this window occludes them for a tiny moment. The next stack_refresh()
507 * will fix this up and move the window to its correct place. */
508 xcb_configure_window(globalconf
.connection
, c
->frame_window
,
509 XCB_CONFIG_WINDOW_STACK_MODE
,
510 (uint32_t[]) { XCB_STACK_MODE_BELOW
});
512 /* Duplicate client and push it in client list */
513 lua_pushvalue(globalconf
.L
, -1);
514 client_array_push(&globalconf
.clients
, luaA_object_ref(globalconf
.L
, -1));
516 /* Set the right screen */
517 screen_client_moveto(c
, screen_getbycoord(wgeom
->x
, wgeom
->y
), false);
519 /* Store initial geometry and emits signals so we inform that geometry have
521 #define HANDLE_GEOM(attr) \
522 c->geometry.attr = wgeom->attr; \
523 luaA_object_emit_signal(globalconf.L, -1, "property::" #attr, 0);
530 luaA_object_emit_signal(globalconf
.L
, -1, "property::geometry", 0);
532 /* Set border width */
533 window_set_border_width(globalconf
.L
, -1, wgeom
->border_width
);
535 /* we honor size hints by default */
536 c
->size_hints_honor
= true;
537 luaA_object_emit_signal(globalconf
.L
, -1, "property::size_hints_honor", 0);
539 /* update all properties */
540 client_update_properties(c
);
542 /* Then check clients hints */
543 ewmh_client_check_hints(c
);
545 /* Push client in stack */
548 /* Always stay in NORMAL_STATE. Even though iconified seems more
549 * appropriate sometimes. The only possible loss is that clients not using
550 * visibility events may continue to process data (when banned).
551 * Without any exposes or other events the cost should be fairly limited though.
553 * Some clients may expect the window to be unmapped when STATE_ICONIFIED.
554 * Two conflicting parts of the ICCCM v2.0 (section 4.1.4):
556 * "Normal -> Iconic - The client should send a ClientMessage event as described later in this section."
557 * (note no explicit mention of unmapping, while Normal->Widthdrawn does mention that)
559 * "Once a client's window has left the Withdrawn state, the window will be mapped
560 * if it is in the Normal state and the window will be unmapped if it is in the Iconic state."
562 * At this stage it's just safer to keep it in normal state and avoid confusion.
564 xwindow_set_state(c
->window
, XCB_ICCCM_WM_STATE_NORMAL
);
568 /* Request our response */
569 xcb_get_property_reply_t
*reply
=
570 xcb_get_property_reply(globalconf
.connection
, startup_id_q
, NULL
);
571 /* Say spawn that a client has been started, with startup id as argument */
572 char *startup_id
= xutil_get_text_property_from_reply(reply
);
574 spawn_start_notify(c
, startup_id
);
575 p_delete(&startup_id
);
578 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
580 /* client is still on top of the stack; push startup value,
581 * and emit signals with one arg */
582 lua_pushboolean(globalconf
.L
, startup
);
583 luaA_object_emit_signal(globalconf
.L
, -2, "manage", 1);
585 lua_pop(globalconf
.L
, 1);
588 /** Send a synthetic configure event to a window.
591 client_send_configure(client_t
*c
)
593 area_t geometry
= c
->geometry
;
594 geometry
.x
+= c
->titlebar
[CLIENT_TITLEBAR_LEFT
].size
;
595 geometry
.y
+= c
->titlebar
[CLIENT_TITLEBAR_TOP
].size
;
596 geometry
.width
-= c
->titlebar
[CLIENT_TITLEBAR_LEFT
].size
;
597 geometry
.width
-= c
->titlebar
[CLIENT_TITLEBAR_RIGHT
].size
;
598 geometry
.height
-= c
->titlebar
[CLIENT_TITLEBAR_TOP
].size
;
599 geometry
.height
-= c
->titlebar
[CLIENT_TITLEBAR_BOTTOM
].size
;
601 xwindow_configure(c
->window
, geometry
, c
->border_width
);
605 client_resize_do(client_t
*c
, area_t geometry
, bool force_notice
)
607 bool send_notice
= force_notice
;
608 bool hide_titlebars
= c
->fullscreen
;
609 screen_t
*new_screen
= screen_getbycoord(geometry
.x
, geometry
.y
);
611 if(c
->geometry
.width
== geometry
.width
612 && c
->geometry
.height
== geometry
.height
)
615 /* Also store geometry including border */
616 area_t old_geometry
= c
->geometry
;
617 c
->geometry
= geometry
;
619 /* Ignore all spurious enter/leave notify events */
620 client_ignore_enterleave_events();
622 /* Configure the client for its new size */
623 area_t real_geometry
= geometry
;
626 real_geometry
.x
= c
->titlebar
[CLIENT_TITLEBAR_LEFT
].size
;
627 real_geometry
.y
= c
->titlebar
[CLIENT_TITLEBAR_TOP
].size
;
628 real_geometry
.width
-= c
->titlebar
[CLIENT_TITLEBAR_LEFT
].size
;
629 real_geometry
.width
-= c
->titlebar
[CLIENT_TITLEBAR_RIGHT
].size
;
630 real_geometry
.height
-= c
->titlebar
[CLIENT_TITLEBAR_TOP
].size
;
631 real_geometry
.height
-= c
->titlebar
[CLIENT_TITLEBAR_BOTTOM
].size
;
637 xcb_configure_window(globalconf
.connection
, c
->frame_window
,
638 XCB_CONFIG_WINDOW_X
| XCB_CONFIG_WINDOW_Y
| XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT
,
639 (uint32_t[]) { geometry
.x
, geometry
.y
, geometry
.width
, geometry
.height
});
640 xcb_configure_window(globalconf
.connection
, c
->window
,
641 XCB_CONFIG_WINDOW_X
| XCB_CONFIG_WINDOW_Y
| XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT
,
642 (uint32_t[]) { real_geometry
.x
, real_geometry
.y
, real_geometry
.width
, real_geometry
.height
});
645 /* We are moving without changing the size, see ICCCM 4.2.3 */
646 client_send_configure(c
);
648 client_restore_enterleave_events();
650 screen_client_moveto(c
, new_screen
, false);
652 luaA_object_push(globalconf
.L
, c
);
653 luaA_object_emit_signal(globalconf
.L
, -1, "property::geometry", 0);
654 if (old_geometry
.x
!= geometry
.x
)
655 luaA_object_emit_signal(globalconf
.L
, -1, "property::x", 0);
656 if (old_geometry
.y
!= geometry
.y
)
657 luaA_object_emit_signal(globalconf
.L
, -1, "property::y", 0);
658 if (old_geometry
.width
!= geometry
.width
)
659 luaA_object_emit_signal(globalconf
.L
, -1, "property::width", 0);
660 if (old_geometry
.height
!= geometry
.height
)
661 luaA_object_emit_signal(globalconf
.L
, -1, "property::height", 0);
662 lua_pop(globalconf
.L
, 1);
664 /* Update all titlebars */
665 for (client_titlebar_t bar
= CLIENT_TITLEBAR_TOP
; bar
< CLIENT_TITLEBAR_COUNT
; bar
++) {
666 if (c
->titlebar
[bar
].drawable
== NULL
&& c
->titlebar
[bar
].size
== 0)
669 luaA_object_push(globalconf
.L
, c
);
670 drawable_t
*drawable
= titlebar_get_drawable(globalconf
.L
, c
, -1, bar
);
671 luaA_object_push_item(globalconf
.L
, -1, drawable
);
673 area_t area
= titlebar_get_area(c
, bar
);
675 /* Convert to global coordinates */
676 area
.x
+= geometry
.x
;
677 area
.y
+= geometry
.y
;
679 area
.width
= area
.height
= 0;
681 if (old_geometry
.width
!= geometry
.width
|| old_geometry
.height
!= geometry
.height
||
682 drawable
->geometry
.width
== 0 || drawable
->geometry
.height
== 0) {
683 /* Get rid of the old state */
684 drawable_unset_surface(drawable
);
685 if (c
->titlebar
[bar
].pixmap
!= XCB_NONE
)
686 xcb_free_pixmap(globalconf
.connection
, c
->titlebar
[bar
].pixmap
);
687 c
->titlebar
[bar
].pixmap
= XCB_NONE
;
689 /* And get us some new state */
690 if (c
->titlebar
[bar
].size
!= 0 && !hide_titlebars
)
692 c
->titlebar
[bar
].pixmap
= xcb_generate_id(globalconf
.connection
);
693 xcb_create_pixmap(globalconf
.connection
, globalconf
.default_depth
, c
->titlebar
[bar
].pixmap
,
694 globalconf
.screen
->root
, area
.width
, area
.height
);
695 cairo_surface_t
*surface
= cairo_xcb_surface_create(globalconf
.connection
,
696 c
->titlebar
[bar
].pixmap
, globalconf
.visual
,
697 area
.width
, area
.height
);
698 drawable_set_surface(drawable
, -1, surface
, area
);
700 drawable_set_geometry(drawable
, -1, area
);
702 drawable_set_geometry(drawable
, -1, area
);
704 /* Pop the client and the drawable */
705 lua_pop(globalconf
.L
, 2);
709 /** Resize client window.
710 * The sizes given as parameters are with borders!
711 * \param c Client to resize.
712 * \param geometry New window geometry.
713 * \param hints Use size hints.
714 * \return true if an actual resize occurred.
717 client_resize(client_t
*c
, area_t geometry
)
721 /* offscreen appearance fixes */
722 area
= display_area_get();
724 if(geometry
.x
> area
.width
)
725 geometry
.x
= area
.width
- geometry
.width
;
726 if(geometry
.y
> area
.height
)
727 geometry
.y
= area
.height
- geometry
.height
;
728 if(geometry
.x
+ geometry
.width
< 0)
730 if(geometry
.y
+ geometry
.height
< 0)
733 if(geometry
.width
< c
->titlebar
[CLIENT_TITLEBAR_LEFT
].size
+ c
->titlebar
[CLIENT_TITLEBAR_RIGHT
].size
)
735 if(geometry
.height
< c
->titlebar
[CLIENT_TITLEBAR_TOP
].size
+ c
->titlebar
[CLIENT_TITLEBAR_BOTTOM
].size
)
738 if(geometry
.width
== 0 || geometry
.height
== 0)
741 if(c
->geometry
.x
!= geometry
.x
742 || c
->geometry
.y
!= geometry
.y
743 || c
->geometry
.width
!= geometry
.width
744 || c
->geometry
.height
!= geometry
.height
)
746 client_resize_do(c
, geometry
, false);
754 /** Set a client minimized, or not.
755 * \param L The Lua VM state.
756 * \param cidx The client index.
757 * \param s Set or not the client minimized.
760 client_set_minimized(lua_State
*L
, int cidx
, bool s
)
762 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
764 if(c
->minimized
!= s
)
767 banning_need_update();
769 xwindow_set_state(c
->window
, XCB_ICCCM_WM_STATE_ICONIC
);
771 xwindow_set_state(c
->window
, XCB_ICCCM_WM_STATE_NORMAL
);
772 if(strut_has_value(&c
->strut
))
773 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
774 luaA_object_emit_signal(L
, cidx
, "property::minimized", 0);
778 /** Set a client hidden, or not.
779 * \param L The Lua VM state.
780 * \param cidx The client index.
781 * \param s Set or not the client hidden.
784 client_set_hidden(lua_State
*L
, int cidx
, bool s
)
786 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
791 banning_need_update();
792 if(strut_has_value(&c
->strut
))
793 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
794 luaA_object_emit_signal(L
, cidx
, "property::hidden", 0);
798 /** Set a client sticky, or not.
799 * \param L The Lua VM state.
800 * \param cidx The client index.
801 * \param s Set or not the client sticky.
804 client_set_sticky(lua_State
*L
, int cidx
, bool s
)
806 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
811 banning_need_update();
812 luaA_object_emit_signal(L
, cidx
, "property::sticky", 0);
816 /** Set a client fullscreen, or not.
817 * \param L The Lua VM state.
818 * \param cidx The client index.
819 * \param s Set or not the client fullscreen.
822 client_set_fullscreen(lua_State
*L
, int cidx
, bool s
)
824 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
826 if(c
->fullscreen
!= s
)
828 /* become fullscreen! */
831 /* remove any max state */
832 client_set_maximized_horizontal(L
, cidx
, false);
833 client_set_maximized_vertical(L
, cidx
, false);
834 /* You can only be part of one of the special layers. */
835 client_set_below(L
, cidx
, false);
836 client_set_above(L
, cidx
, false);
837 client_set_ontop(L
, cidx
, false);
839 int abs_cidx
= luaA_absindex(L
, cidx
); \
840 lua_pushboolean(L
, s
);
842 luaA_object_emit_signal(L
, abs_cidx
, "request::fullscreen", 1);
843 luaA_object_emit_signal(L
, abs_cidx
, "property::fullscreen", 0);
844 /* Force a client resize, so that titlebars get shown/hidden */
845 client_resize_do(c
, c
->geometry
, true);
850 /** Set a client horizontally|vertically maximized.
851 * \param L The Lua VM state.
852 * \param cidx The client index.
853 * \param s The maximized status.
855 #define DO_FUNCTION_CLIENT_MAXIMIZED(type) \
857 client_set_maximized_##type(lua_State *L, int cidx, bool s) \
859 client_t *c = luaA_checkudata(L, cidx, &client_class); \
860 if(c->maximized_##type != s) \
862 int abs_cidx = luaA_absindex(L, cidx); \
864 client_set_fullscreen(L, abs_cidx, false); \
865 lua_pushboolean(L, s); \
866 c->maximized_##type = s; \
867 luaA_object_emit_signal(L, abs_cidx, "request::maximized_" #type, 1); \
868 luaA_object_emit_signal(L, abs_cidx, "property::maximized_" #type, 0); \
872 DO_FUNCTION_CLIENT_MAXIMIZED(vertical
)
873 DO_FUNCTION_CLIENT_MAXIMIZED(horizontal
)
874 #undef DO_FUNCTION_CLIENT_MAXIMIZED
876 /** Set a client above, or not.
877 * \param L The Lua VM state.
878 * \param cidx The client index.
879 * \param s Set or not the client above.
882 client_set_above(lua_State
*L
, int cidx
, bool s
)
884 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
888 /* You can only be part of one of the special layers. */
891 client_set_below(L
, cidx
, false);
892 client_set_ontop(L
, cidx
, false);
893 client_set_fullscreen(L
, cidx
, false);
897 luaA_object_emit_signal(L
, cidx
, "property::above", 0);
901 /** Set a client below, or not.
902 * \param L The Lua VM state.
903 * \param cidx The client index.
904 * \param s Set or not the client below.
907 client_set_below(lua_State
*L
, int cidx
, bool s
)
909 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
913 /* You can only be part of one of the special layers. */
916 client_set_above(L
, cidx
, false);
917 client_set_ontop(L
, cidx
, false);
918 client_set_fullscreen(L
, cidx
, false);
922 luaA_object_emit_signal(L
, cidx
, "property::below", 0);
926 /** Set a client modal, or not.
927 * \param L The Lua VM state.
928 * \param cidx The client index.
929 * \param s Set or not the client modal attribute.
932 client_set_modal(lua_State
*L
, int cidx
, bool s
)
934 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
940 luaA_object_emit_signal(L
, cidx
, "property::modal", 0);
944 /** Set a client ontop, or not.
945 * \param L The Lua VM state.
946 * \param cidx The client index.
947 * \param s Set or not the client ontop attribute.
950 client_set_ontop(lua_State
*L
, int cidx
, bool s
)
952 client_t
*c
= luaA_checkudata(L
, cidx
, &client_class
);
956 /* You can only be part of one of the special layers. */
959 client_set_above(L
, cidx
, false);
960 client_set_below(L
, cidx
, false);
961 client_set_fullscreen(L
, cidx
, false);
965 luaA_object_emit_signal(L
, cidx
, "property::ontop", 0);
969 /** Unban a client and move it back into the viewport.
970 * \param c The client.
973 client_unban(client_t
*c
)
977 xcb_map_window(globalconf
.connection
, c
->frame_window
);
981 /* An unbanned client shouldn't be minimized or hidden */
982 luaA_object_push(globalconf
.L
, c
);
983 client_set_minimized(globalconf
.L
, -1, false);
984 client_set_hidden(globalconf
.L
, -1, false);
985 lua_pop(globalconf
.L
, 1);
989 /** Unmanage a client.
990 * \param c The client.
991 * \param window_valid Is the client's window still valid?
994 client_unmanage(client_t
*c
, bool window_valid
)
996 /* Reset transient_for attributes of widows that maybe referring to us */
997 foreach(_tc
, globalconf
.clients
)
1000 if(tc
->transient_for
== c
)
1001 tc
->transient_for
= NULL
;
1004 if(globalconf
.focus
.client
== c
)
1007 /* remove client from global list and everywhere else */
1008 foreach(elem
, globalconf
.clients
)
1011 client_array_remove(&globalconf
.clients
, elem
);
1014 stack_client_remove(c
);
1015 for(int i
= 0; i
< globalconf
.tags
.len
; i
++)
1016 untag_client(c
, globalconf
.tags
.tab
[i
]);
1018 luaA_object_push(globalconf
.L
, c
);
1019 luaA_object_emit_signal(globalconf
.L
, -1, "unmanage", 0);
1020 lua_pop(globalconf
.L
, 1);
1022 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
1024 if(strut_has_value(&c
->strut
))
1025 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
1027 /* Get rid of all titlebars */
1028 for (client_titlebar_t bar
= CLIENT_TITLEBAR_TOP
; bar
< CLIENT_TITLEBAR_COUNT
; bar
++) {
1029 if (c
->titlebar
[bar
].drawable
== NULL
)
1032 luaA_object_push(globalconf
.L
, c
);
1033 luaA_object_push_item(globalconf
.L
, -1, c
->titlebar
[bar
].drawable
);
1035 /* Make the drawable unusable */
1036 drawable_unset_surface(c
->titlebar
[bar
].drawable
);
1037 if (c
->titlebar
[bar
].pixmap
!= XCB_NONE
)
1038 xcb_free_pixmap(globalconf
.connection
, c
->titlebar
[bar
].pixmap
);
1040 /* And forget about it */
1041 luaA_object_unref_item(globalconf
.L
, -2, c
->titlebar
[bar
].drawable
);
1042 c
->titlebar
[bar
].drawable
= NULL
;
1043 lua_pop(globalconf
.L
, 2);
1046 /* Clear our event mask so that we don't receive any events from now on,
1047 * especially not for the following requests. */
1049 xcb_change_window_attributes(globalconf
.connection
,
1052 (const uint32_t []) { 0 });
1053 xcb_change_window_attributes(globalconf
.connection
,
1056 (const uint32_t []) { 0 });
1060 xcb_unmap_window(globalconf
.connection
, c
->window
);
1061 xcb_reparent_window(globalconf
.connection
, c
->window
, globalconf
.screen
->root
,
1062 c
->geometry
.x
, c
->geometry
.y
);
1064 xcb_destroy_window(globalconf
.connection
, c
->frame_window
);
1068 /* Remove this window from the save set since this shouldn't be made visible
1069 * after a restart anymore. */
1070 xcb_change_save_set(globalconf
.connection
, XCB_SET_MODE_DELETE
, c
->window
);
1072 /* Do this last to avoid races with clients. According to ICCCM, clients
1073 * arent allowed to re-use the window until after this. */
1074 xwindow_set_state(c
->window
, XCB_ICCCM_WM_STATE_WITHDRAWN
);
1077 /* set client as invalid */
1078 c
->window
= XCB_NONE
;
1080 luaA_object_unref(globalconf
.L
, c
);
1083 /** Kill a client via a WM_DELETE_WINDOW request or KillClient if not
1085 * \param c The client to kill.
1088 client_kill(client_t
*c
)
1090 if(client_hasproto(c
, WM_DELETE_WINDOW
))
1092 xcb_client_message_event_t ev
;
1094 /* Initialize all of event's fields first */
1097 ev
.response_type
= XCB_CLIENT_MESSAGE
;
1098 ev
.window
= c
->window
;
1100 ev
.data
.data32
[1] = globalconf
.timestamp
;
1101 ev
.type
= WM_PROTOCOLS
;
1102 ev
.data
.data32
[0] = WM_DELETE_WINDOW
;
1104 xcb_send_event(globalconf
.connection
, false, c
->window
,
1105 XCB_EVENT_MASK_NO_EVENT
, (char *) &ev
);
1108 xcb_kill_client(globalconf
.connection
, c
->window
);
1111 /** Get all clients into a table.
1112 * \param L The Lua VM state.
1113 * \return The number of elements pushed on stack.
1115 * \lparam An optional screen number.
1116 * \lreturn A table with all clients.
1119 luaA_client_get(lua_State
*L
)
1123 screen
= luaL_optnumber(L
, 1, 0) - 1;
1128 foreach(c
, globalconf
.clients
)
1130 luaA_object_push(L
, *c
);
1131 lua_rawseti(L
, -2, i
++);
1135 luaA_checkscreen(screen
);
1136 foreach(c
, globalconf
.clients
)
1137 if((*c
)->screen
== &globalconf
.screens
.tab
[screen
])
1139 luaA_object_push(L
, *c
);
1140 lua_rawseti(L
, -2, i
++);
1147 /** Check if a client is visible on its screen.
1148 * \param L The Lua VM state.
1149 * \return The number of elements pushed on stack.
1152 * \lreturn A boolean value, true if the client is visible, false otherwise.
1155 luaA_client_isvisible(lua_State
*L
)
1157 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1158 lua_pushboolean(L
, client_isvisible(c
));
1162 /** Set a client icon.
1163 * \param L The Lua VM state.
1164 * \param cidx The client index on the stack.
1165 * \param iidx The image index on the stack.
1168 client_set_icon(client_t
*c
, cairo_surface_t
*s
)
1171 s
= draw_dup_image_surface(s
);
1173 cairo_surface_destroy(c
->icon
);
1176 luaA_object_push(globalconf
.L
, c
);
1177 luaA_object_emit_signal(globalconf
.L
, -1, "property::icon", 0);
1178 lua_pop(globalconf
.L
, 1);
1182 * \param L The Lua VM state.
1188 luaA_client_kill(lua_State
*L
)
1190 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1195 /** Swap a client with another one.
1196 * \param L The Lua VM state.
1199 * \lparam A client to swap with.
1202 luaA_client_swap(lua_State
*L
)
1204 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1205 client_t
*swap
= luaA_checkudata(L
, 2, &client_class
);
1209 client_t
**ref_c
= NULL
, **ref_swap
= NULL
;
1210 foreach(item
, globalconf
.clients
)
1214 else if(*item
== swap
)
1216 if(ref_c
&& ref_swap
)
1223 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
1229 /** Access or set the client tags.
1230 * \param L The Lua VM state.
1231 * \return The number of elements pushed on stack.
1232 * \lparam A table with tags to set, or none to get the current tags table.
1233 * \return The clients tag.
1236 luaA_client_tags(lua_State
*L
)
1238 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1241 if(lua_gettop(L
) == 2)
1243 luaA_checktable(L
, 2);
1244 for(int i
= 0; i
< globalconf
.tags
.len
; i
++)
1246 /* Only untag if we aren't going to add this tag again */
1249 while(lua_next(L
, 2))
1251 tag_t
*t
= lua_touserdata(L
, -1);
1252 /* Pop the value from lua_next */
1254 if (t
!= globalconf
.tags
.tab
[i
])
1257 /* Pop the key from lua_next */
1263 untag_client(c
, globalconf
.tags
.tab
[i
]);
1266 while(lua_next(L
, 2))
1272 foreach(tag
, globalconf
.tags
)
1273 if(is_client_tagged(c
, *tag
))
1275 luaA_object_push(L
, *tag
);
1276 lua_rawseti(L
, -2, ++j
);
1282 /** Raise a client on top of others which are on the same layer.
1283 * \param L The Lua VM state.
1288 luaA_client_raise(lua_State
*L
)
1290 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1295 /** Lower a client on bottom of others which are on the same layer.
1296 * \param L The Lua VM state.
1301 luaA_client_lower(lua_State
*L
)
1303 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1305 stack_client_push(c
);
1307 /* Traverse all transient layers. */
1308 for(client_t
*tc
= c
->transient_for
; tc
; tc
= tc
->transient_for
)
1309 stack_client_push(tc
);
1314 /** Stop managing a client.
1315 * \param L The Lua VM state.
1316 * \return The number of elements pushed on stack.
1321 luaA_client_unmanage(lua_State
*L
)
1323 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1324 client_unmanage(c
, true);
1329 titlebar_get_area(client_t
*c
, client_titlebar_t bar
)
1331 area_t result
= c
->geometry
;
1332 result
.x
= result
.y
= 0;
1334 // Let's try some ascii art:
1335 // ---------------------------
1337 // |-------------------------|
1343 // |-------------------------|
1345 // ---------------------------
1348 case CLIENT_TITLEBAR_BOTTOM
:
1349 result
.y
= c
->geometry
.height
- c
->titlebar
[bar
].size
;
1351 case CLIENT_TITLEBAR_TOP
:
1352 result
.height
= c
->titlebar
[bar
].size
;
1354 case CLIENT_TITLEBAR_RIGHT
:
1355 result
.x
= c
->geometry
.width
- c
->titlebar
[bar
].size
;
1357 case CLIENT_TITLEBAR_LEFT
:
1358 result
.y
= c
->titlebar
[CLIENT_TITLEBAR_TOP
].size
;
1359 result
.width
= c
->titlebar
[bar
].size
;
1360 result
.height
-= c
->titlebar
[CLIENT_TITLEBAR_TOP
].size
;
1361 result
.height
-= c
->titlebar
[CLIENT_TITLEBAR_BOTTOM
].size
;
1364 fatal("Unknown titlebar kind %d\n", (int) bar
);
1371 client_get_drawable_offset(client_t
*c
, int *x
, int *y
)
1373 for (client_titlebar_t bar
= CLIENT_TITLEBAR_TOP
; bar
< CLIENT_TITLEBAR_COUNT
; bar
++) {
1374 area_t area
= titlebar_get_area(c
, bar
);
1375 if (AREA_LEFT(area
) > *x
|| AREA_RIGHT(area
) <= *x
)
1377 if (AREA_TOP(area
) > *y
|| AREA_BOTTOM(area
) <= *y
)
1382 return c
->titlebar
[bar
].drawable
;
1389 client_get_drawable(client_t
*c
, int x
, int y
)
1391 return client_get_drawable_offset(c
, &x
, &y
);
1395 client_refresh(client_t
*c
)
1397 for (client_titlebar_t bar
= CLIENT_TITLEBAR_TOP
; bar
< CLIENT_TITLEBAR_COUNT
; bar
++) {
1398 if (c
->titlebar
[bar
].drawable
== NULL
|| c
->titlebar
[bar
].drawable
->surface
== NULL
)
1401 area_t area
= titlebar_get_area(c
, bar
);
1402 cairo_surface_flush(c
->titlebar
[bar
].drawable
->surface
);
1403 xcb_copy_area(globalconf
.connection
, c
->titlebar
[bar
].pixmap
, c
->frame_window
,
1404 globalconf
.gc
, 0, 0, area
.x
, area
.y
, area
.width
, area
.height
);
1409 titlebar_get_drawable(lua_State
*L
, client_t
*c
, int cl_idx
, client_titlebar_t bar
)
1411 if (c
->titlebar
[bar
].drawable
== NULL
)
1413 cl_idx
= luaA_absindex(L
, cl_idx
);
1414 drawable_allocator(L
, (drawable_refresh_callback
*) client_refresh
, c
);
1415 c
->titlebar
[bar
].drawable
= luaA_object_ref_item(L
, cl_idx
, -1);
1418 return c
->titlebar
[bar
].drawable
;
1422 titlebar_resize(client_t
*c
, client_titlebar_t bar
, int size
)
1427 if (size
== c
->titlebar
[bar
].size
)
1430 /* Now resize the client (and titlebars!) suitably (the client without
1431 * titlebars should keep its current size!) */
1432 area_t geometry
= c
->geometry
;
1433 int change
= size
- c
->titlebar
[bar
].size
;
1435 case CLIENT_TITLEBAR_TOP
:
1436 case CLIENT_TITLEBAR_BOTTOM
:
1437 geometry
.height
+= change
;
1439 case CLIENT_TITLEBAR_RIGHT
:
1440 case CLIENT_TITLEBAR_LEFT
:
1441 geometry
.width
+= change
;
1444 fatal("Unknown titlebar kind %d\n", (int) bar
);
1447 c
->titlebar
[bar
].size
= size
;
1448 client_resize_do(c
, geometry
, true);
1451 #define HANDLE_TITLEBAR(name, index) \
1453 luaA_client_titlebar_ ## name(lua_State *L) \
1455 client_t *c = luaA_checkudata(L, 1, &client_class); \
1457 if (lua_gettop(L) == 2) \
1459 if (lua_isnil(L, 2)) \
1460 titlebar_resize(c, index, 0); \
1462 titlebar_resize(c, index, luaL_checknumber(L, 2)); \
1465 luaA_object_push_item(L, 1, titlebar_get_drawable(L, c, 1, index)); \
1466 lua_pushnumber(L, c->titlebar[index].size); \
1469 HANDLE_TITLEBAR(top
, CLIENT_TITLEBAR_TOP
)
1470 HANDLE_TITLEBAR(right
, CLIENT_TITLEBAR_RIGHT
)
1471 HANDLE_TITLEBAR(bottom
, CLIENT_TITLEBAR_BOTTOM
)
1472 HANDLE_TITLEBAR(left
, CLIENT_TITLEBAR_LEFT
)
1474 /** Return client geometry.
1475 * \param L The Lua VM state.
1476 * \return The number of elements pushed on stack.
1478 * \lparam A table with new coordinates, or none.
1479 * \lreturn A table with client coordinates.
1482 luaA_client_geometry(lua_State
*L
)
1484 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1486 if(lua_gettop(L
) == 2 && !lua_isnil(L
, 2))
1490 luaA_checktable(L
, 2);
1491 geometry
.x
= luaA_getopt_number(L
, 2, "x", c
->geometry
.x
);
1492 geometry
.y
= luaA_getopt_number(L
, 2, "y", c
->geometry
.y
);
1493 if(client_isfixed(c
))
1495 geometry
.width
= c
->geometry
.width
;
1496 geometry
.height
= c
->geometry
.height
;
1500 geometry
.width
= luaA_getopt_number(L
, 2, "width", c
->geometry
.width
);
1501 geometry
.height
= luaA_getopt_number(L
, 2, "height", c
->geometry
.height
);
1504 client_resize(c
, geometry
);
1507 return luaA_pusharea(L
, c
->geometry
);
1511 luaA_client_set_screen(lua_State
*L
, client_t
*c
)
1513 int screen
= luaL_checknumber(L
, -1) - 1;
1514 luaA_checkscreen(screen
);
1515 screen_client_moveto(c
, &globalconf
.screens
.tab
[screen
], true);
1521 luaA_client_set_hidden(lua_State
*L
, client_t
*c
)
1523 client_set_hidden(L
, -3, luaA_checkboolean(L
, -1));
1528 luaA_client_set_minimized(lua_State
*L
, client_t
*c
)
1530 client_set_minimized(L
, -3, luaA_checkboolean(L
, -1));
1535 luaA_client_set_fullscreen(lua_State
*L
, client_t
*c
)
1537 client_set_fullscreen(L
, -3, luaA_checkboolean(L
, -1));
1542 luaA_client_set_modal(lua_State
*L
, client_t
*c
)
1544 client_set_modal(L
, -3, luaA_checkboolean(L
, -1));
1549 luaA_client_set_maximized_horizontal(lua_State
*L
, client_t
*c
)
1551 client_set_maximized_horizontal(L
, -3, luaA_checkboolean(L
, -1));
1556 luaA_client_set_maximized_vertical(lua_State
*L
, client_t
*c
)
1558 client_set_maximized_vertical(L
, -3, luaA_checkboolean(L
, -1));
1563 luaA_client_set_icon(lua_State
*L
, client_t
*c
)
1565 cairo_surface_t
*surf
= NULL
;
1566 if(!lua_isnil(L
, -1))
1567 surf
= (cairo_surface_t
*)lua_touserdata(L
, -1);
1568 client_set_icon(c
, surf
);
1573 luaA_client_set_sticky(lua_State
*L
, client_t
*c
)
1575 client_set_sticky(L
, -3, luaA_checkboolean(L
, -1));
1580 luaA_client_set_size_hints_honor(lua_State
*L
, client_t
*c
)
1582 c
->size_hints_honor
= luaA_checkboolean(L
, -1);
1583 luaA_object_emit_signal(L
, -3, "property::size_hints_honor", 0);
1588 luaA_client_set_ontop(lua_State
*L
, client_t
*c
)
1590 client_set_ontop(L
, -3, luaA_checkboolean(L
, -1));
1595 luaA_client_set_below(lua_State
*L
, client_t
*c
)
1597 client_set_below(L
, -3, luaA_checkboolean(L
, -1));
1602 luaA_client_set_above(lua_State
*L
, client_t
*c
)
1604 client_set_above(L
, -3, luaA_checkboolean(L
, -1));
1609 luaA_client_set_urgent(lua_State
*L
, client_t
*c
)
1611 client_set_urgent(L
, -3, luaA_checkboolean(L
, -1));
1616 luaA_client_set_skip_taskbar(lua_State
*L
, client_t
*c
)
1618 client_set_skip_taskbar(L
, -3, luaA_checkboolean(L
, -1));
1623 luaA_client_get_name(lua_State
*L
, client_t
*c
)
1625 lua_pushstring(L
, c
->name
? c
->name
: c
->alt_name
);
1630 luaA_client_get_icon_name(lua_State
*L
, client_t
*c
)
1632 lua_pushstring(L
, c
->icon_name
? c
->icon_name
: c
->alt_icon_name
);
1636 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, class, lua_pushstring
)
1637 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, instance
, lua_pushstring
)
1638 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, machine
, lua_pushstring
)
1639 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, role
, lua_pushstring
)
1640 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, transient_for
, luaA_object_push
)
1641 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, skip_taskbar
, lua_pushboolean
)
1642 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, leader_window
, lua_pushnumber
)
1643 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, group_window
, lua_pushnumber
)
1644 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, pid
, lua_pushnumber
)
1645 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, hidden
, lua_pushboolean
)
1646 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, minimized
, lua_pushboolean
)
1647 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, fullscreen
, lua_pushboolean
)
1648 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, modal
, lua_pushboolean
)
1649 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, ontop
, lua_pushboolean
)
1650 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, urgent
, lua_pushboolean
)
1651 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, above
, lua_pushboolean
)
1652 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, below
, lua_pushboolean
)
1653 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, sticky
, lua_pushboolean
)
1654 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, size_hints_honor
, lua_pushboolean
)
1655 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, maximized_horizontal
, lua_pushboolean
)
1656 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, maximized_vertical
, lua_pushboolean
)
1659 luaA_client_get_content(lua_State
*L
, client_t
*c
)
1661 xcb_image_t
*ximage
= xcb_image_get(globalconf
.connection
,
1666 ~0, XCB_IMAGE_FORMAT_Z_PIXMAP
);
1667 cairo_surface_t
*surface
= NULL
;
1671 if(ximage
->bpp
>= 24)
1673 uint32_t *data
= p_new(uint32_t, ximage
->width
* ximage
->height
);
1675 for(int y
= 0; y
< ximage
->height
; y
++)
1676 for(int x
= 0; x
< ximage
->width
; x
++)
1678 data
[y
* ximage
->width
+ x
] = xcb_image_get_pixel(ximage
, x
, y
);
1679 data
[y
* ximage
->width
+ x
] |= 0xff000000; /* set alpha to 0xff */
1682 surface
= draw_surface_from_data(ximage
->width
, ximage
->height
, data
);
1685 xcb_image_destroy(ximage
);
1691 /* lua has to make sure to free the ref or we have a leak */
1692 lua_pushlightuserdata(L
, surface
);
1697 luaA_client_get_screen(lua_State
*L
, client_t
*c
)
1701 lua_pushnumber(L
, 1 + screen_array_indexof(&globalconf
.screens
, c
->screen
));
1706 luaA_client_get_icon(lua_State
*L
, client_t
*c
)
1710 /* lua gets its own reference which it will have to destroy */
1711 lua_pushlightuserdata(L
, cairo_surface_reference(c
->icon
));
1716 luaA_client_get_focusable(lua_State
*L
, client_t
*c
)
1720 /* A client can be focused if it doesnt have the "nofocus" hint...*/
1724 /* ...or if it knows the WM_TAKE_FOCUS protocol */
1725 ret
= client_hasproto(c
, WM_TAKE_FOCUS
);
1727 lua_pushboolean(L
, ret
);
1732 luaA_client_get_size_hints(lua_State
*L
, client_t
*c
)
1734 const char *u_or_p
= NULL
;
1736 lua_createtable(L
, 0, 1);
1738 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_US_POSITION
)
1739 u_or_p
= "user_position";
1740 else if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_POSITION
)
1741 u_or_p
= "program_position";
1745 lua_createtable(L
, 0, 2);
1746 lua_pushnumber(L
, c
->size_hints
.x
);
1747 lua_setfield(L
, -2, "x");
1748 lua_pushnumber(L
, c
->size_hints
.y
);
1749 lua_setfield(L
, -2, "y");
1750 lua_setfield(L
, -2, u_or_p
);
1754 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_US_SIZE
)
1755 u_or_p
= "user_size";
1756 else if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_SIZE
)
1757 u_or_p
= "program_size";
1761 lua_createtable(L
, 0, 2);
1762 lua_pushnumber(L
, c
->size_hints
.width
);
1763 lua_setfield(L
, -2, "width");
1764 lua_pushnumber(L
, c
->size_hints
.height
);
1765 lua_setfield(L
, -2, "height");
1766 lua_setfield(L
, -2, u_or_p
);
1769 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_MIN_SIZE
)
1771 lua_pushnumber(L
, c
->size_hints
.min_width
);
1772 lua_setfield(L
, -2, "min_width");
1773 lua_pushnumber(L
, c
->size_hints
.min_height
);
1774 lua_setfield(L
, -2, "min_height");
1777 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_MAX_SIZE
)
1779 lua_pushnumber(L
, c
->size_hints
.max_width
);
1780 lua_setfield(L
, -2, "max_width");
1781 lua_pushnumber(L
, c
->size_hints
.max_height
);
1782 lua_setfield(L
, -2, "max_height");
1785 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_RESIZE_INC
)
1787 lua_pushnumber(L
, c
->size_hints
.width_inc
);
1788 lua_setfield(L
, -2, "width_inc");
1789 lua_pushnumber(L
, c
->size_hints
.height_inc
);
1790 lua_setfield(L
, -2, "height_inc");
1793 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_ASPECT
)
1795 lua_pushnumber(L
, c
->size_hints
.min_aspect_num
);
1796 lua_setfield(L
, -2, "min_aspect_num");
1797 lua_pushnumber(L
, c
->size_hints
.min_aspect_den
);
1798 lua_setfield(L
, -2, "min_aspect_den");
1799 lua_pushnumber(L
, c
->size_hints
.max_aspect_num
);
1800 lua_setfield(L
, -2, "max_aspect_num");
1801 lua_pushnumber(L
, c
->size_hints
.max_aspect_den
);
1802 lua_setfield(L
, -2, "max_aspect_den");
1805 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_BASE_SIZE
)
1807 lua_pushnumber(L
, c
->size_hints
.base_width
);
1808 lua_setfield(L
, -2, "base_width");
1809 lua_pushnumber(L
, c
->size_hints
.base_height
);
1810 lua_setfield(L
, -2, "base_height");
1813 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY
)
1815 switch(c
->size_hints
.win_gravity
)
1818 lua_pushliteral(L
, "north_west");
1820 case XCB_GRAVITY_NORTH
:
1821 lua_pushliteral(L
, "north");
1823 case XCB_GRAVITY_NORTH_EAST
:
1824 lua_pushliteral(L
, "north_east");
1826 case XCB_GRAVITY_WEST
:
1827 lua_pushliteral(L
, "west");
1829 case XCB_GRAVITY_CENTER
:
1830 lua_pushliteral(L
, "center");
1832 case XCB_GRAVITY_EAST
:
1833 lua_pushliteral(L
, "east");
1835 case XCB_GRAVITY_SOUTH_WEST
:
1836 lua_pushliteral(L
, "south_west");
1838 case XCB_GRAVITY_SOUTH
:
1839 lua_pushliteral(L
, "south");
1841 case XCB_GRAVITY_SOUTH_EAST
:
1842 lua_pushliteral(L
, "south_east");
1844 case XCB_GRAVITY_STATIC
:
1845 lua_pushliteral(L
, "static");
1848 lua_setfield(L
, -2, "win_gravity");
1854 /** Set the client's bounding shape.
1855 * \param L The Lua VM state.
1856 * \param client The client object.
1857 * \return The number of elements pushed on stack.
1860 luaA_client_set_shape_bounding(lua_State
*L
, client_t
*c
)
1862 cairo_surface_t
*surf
= NULL
;
1863 if(!lua_isnil(L
, -1))
1864 surf
= (cairo_surface_t
*)lua_touserdata(L
, -1);
1865 xwindow_set_shape(c
->frame_window
,
1866 c
->geometry
.width
+ (c
->border_width
* 2),
1867 c
->geometry
.height
+ (c
->border_width
* 2),
1868 XCB_SHAPE_SK_BOUNDING
, surf
, -c
->border_width
);
1872 /** Set the client's clip shape.
1873 * \param L The Lua VM state.
1874 * \param client The client object.
1875 * \return The number of elements pushed on stack.
1878 luaA_client_set_shape_clip(lua_State
*L
, client_t
*c
)
1880 cairo_surface_t
*surf
= NULL
;
1881 if(!lua_isnil(L
, -1))
1882 surf
= (cairo_surface_t
*)lua_touserdata(L
, -1);
1883 xwindow_set_shape(c
->frame_window
, c
->geometry
.width
, c
->geometry
.height
,
1884 XCB_SHAPE_SK_CLIP
, surf
, 0);
1888 /** Get or set keys bindings for a client.
1889 * \param L The Lua VM state.
1890 * \return The number of element pushed on stack.
1893 * \lparam An array of key bindings objects, or nothing.
1894 * \return The array of key bindings objects of this client.
1897 luaA_client_keys(lua_State
*L
)
1899 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
1900 key_array_t
*keys
= &c
->keys
;
1902 if(lua_gettop(L
) == 2)
1904 luaA_key_array_set(L
, 1, 2, keys
);
1905 luaA_object_emit_signal(L
, 1, "property::keys", 0);
1906 xcb_ungrab_key(globalconf
.connection
, XCB_GRAB_ANY
, c
->frame_window
, XCB_BUTTON_MASK_ANY
);
1907 xwindow_grabkeys(c
->frame_window
, keys
);
1910 return luaA_key_array_get(L
, 1, keys
);
1914 * \param L The Lua VM state.
1915 * \return The number of pushed elements.
1918 luaA_client_module_index(lua_State
*L
)
1920 const char *buf
= luaL_checkstring(L
, 2);
1922 if (A_STREQ(buf
, "focus"))
1923 return luaA_object_push(globalconf
.L
, globalconf
.focus
.client
);
1927 /* Client module new index.
1928 * \param L The Lua VM state.
1929 * \return The number of pushed elements.
1932 luaA_client_module_newindex(lua_State
*L
)
1934 const char *buf
= luaL_checkstring(L
, 2);
1937 if (A_STREQ(buf
, "focus"))
1939 c
= luaA_checkudata(L
, 3, &client_class
);
1947 client_checker(client_t
*c
)
1949 return c
->window
!= XCB_NONE
;
1953 client_class_setup(lua_State
*L
)
1955 static const struct luaL_Reg client_methods
[] =
1957 LUA_CLASS_METHODS(client
)
1958 { "get", luaA_client_get
},
1959 { "__index", luaA_client_module_index
},
1960 { "__newindex", luaA_client_module_newindex
},
1964 static const struct luaL_Reg client_meta
[] =
1966 LUA_OBJECT_META(client
)
1968 { "keys", luaA_client_keys
},
1969 { "isvisible", luaA_client_isvisible
},
1970 { "geometry", luaA_client_geometry
},
1971 { "tags", luaA_client_tags
},
1972 { "kill", luaA_client_kill
},
1973 { "swap", luaA_client_swap
},
1974 { "raise", luaA_client_raise
},
1975 { "lower", luaA_client_lower
},
1976 { "unmanage", luaA_client_unmanage
},
1977 { "titlebar_top", luaA_client_titlebar_top
},
1978 { "titlebar_right", luaA_client_titlebar_right
},
1979 { "titlebar_bottom", luaA_client_titlebar_bottom
},
1980 { "titlebar_left", luaA_client_titlebar_left
},
1984 luaA_class_setup(L
, &client_class
, "client", &window_class
,
1985 (lua_class_allocator_t
) client_new
,
1986 (lua_class_collector_t
) client_wipe
,
1987 (lua_class_checker_t
) client_checker
,
1988 luaA_class_index_miss_property
, luaA_class_newindex_miss_property
,
1989 client_methods
, client_meta
);
1990 luaA_class_add_property(&client_class
, "name",
1992 (lua_class_propfunc_t
) luaA_client_get_name
,
1994 luaA_class_add_property(&client_class
, "transient_for",
1996 (lua_class_propfunc_t
) luaA_client_get_transient_for
,
1998 luaA_class_add_property(&client_class
, "skip_taskbar",
1999 (lua_class_propfunc_t
) luaA_client_set_skip_taskbar
,
2000 (lua_class_propfunc_t
) luaA_client_get_skip_taskbar
,
2001 (lua_class_propfunc_t
) luaA_client_set_skip_taskbar
);
2002 luaA_class_add_property(&client_class
, "content",
2004 (lua_class_propfunc_t
) luaA_client_get_content
,
2006 luaA_class_add_property(&client_class
, "type",
2008 (lua_class_propfunc_t
) luaA_window_get_type
,
2010 luaA_class_add_property(&client_class
, "class",
2012 (lua_class_propfunc_t
) luaA_client_get_class
,
2014 luaA_class_add_property(&client_class
, "instance",
2016 (lua_class_propfunc_t
) luaA_client_get_instance
,
2018 luaA_class_add_property(&client_class
, "role",
2020 (lua_class_propfunc_t
) luaA_client_get_role
,
2022 luaA_class_add_property(&client_class
, "pid",
2024 (lua_class_propfunc_t
) luaA_client_get_pid
,
2026 luaA_class_add_property(&client_class
, "leader_window",
2028 (lua_class_propfunc_t
) luaA_client_get_leader_window
,
2030 luaA_class_add_property(&client_class
, "machine",
2032 (lua_class_propfunc_t
) luaA_client_get_machine
,
2034 luaA_class_add_property(&client_class
, "icon_name",
2036 (lua_class_propfunc_t
) luaA_client_get_icon_name
,
2038 luaA_class_add_property(&client_class
, "screen",
2040 (lua_class_propfunc_t
) luaA_client_get_screen
,
2041 (lua_class_propfunc_t
) luaA_client_set_screen
);
2042 luaA_class_add_property(&client_class
, "hidden",
2043 (lua_class_propfunc_t
) luaA_client_set_hidden
,
2044 (lua_class_propfunc_t
) luaA_client_get_hidden
,
2045 (lua_class_propfunc_t
) luaA_client_set_hidden
);
2046 luaA_class_add_property(&client_class
, "minimized",
2047 (lua_class_propfunc_t
) luaA_client_set_minimized
,
2048 (lua_class_propfunc_t
) luaA_client_get_minimized
,
2049 (lua_class_propfunc_t
) luaA_client_set_minimized
);
2050 luaA_class_add_property(&client_class
, "fullscreen",
2051 (lua_class_propfunc_t
) luaA_client_set_fullscreen
,
2052 (lua_class_propfunc_t
) luaA_client_get_fullscreen
,
2053 (lua_class_propfunc_t
) luaA_client_set_fullscreen
);
2054 luaA_class_add_property(&client_class
, "modal",
2055 (lua_class_propfunc_t
) luaA_client_set_modal
,
2056 (lua_class_propfunc_t
) luaA_client_get_modal
,
2057 (lua_class_propfunc_t
) luaA_client_set_modal
);
2058 luaA_class_add_property(&client_class
, "group_window",
2060 (lua_class_propfunc_t
) luaA_client_get_group_window
,
2062 luaA_class_add_property(&client_class
, "maximized_horizontal",
2063 (lua_class_propfunc_t
) luaA_client_set_maximized_horizontal
,
2064 (lua_class_propfunc_t
) luaA_client_get_maximized_horizontal
,
2065 (lua_class_propfunc_t
) luaA_client_set_maximized_horizontal
);
2066 luaA_class_add_property(&client_class
, "maximized_vertical",
2067 (lua_class_propfunc_t
) luaA_client_set_maximized_vertical
,
2068 (lua_class_propfunc_t
) luaA_client_get_maximized_vertical
,
2069 (lua_class_propfunc_t
) luaA_client_set_maximized_vertical
);
2070 luaA_class_add_property(&client_class
, "icon",
2071 (lua_class_propfunc_t
) luaA_client_set_icon
,
2072 (lua_class_propfunc_t
) luaA_client_get_icon
,
2073 (lua_class_propfunc_t
) luaA_client_set_icon
);
2074 luaA_class_add_property(&client_class
, "ontop",
2075 (lua_class_propfunc_t
) luaA_client_set_ontop
,
2076 (lua_class_propfunc_t
) luaA_client_get_ontop
,
2077 (lua_class_propfunc_t
) luaA_client_set_ontop
);
2078 luaA_class_add_property(&client_class
, "above",
2079 (lua_class_propfunc_t
) luaA_client_set_above
,
2080 (lua_class_propfunc_t
) luaA_client_get_above
,
2081 (lua_class_propfunc_t
) luaA_client_set_above
);
2082 luaA_class_add_property(&client_class
, "below",
2083 (lua_class_propfunc_t
) luaA_client_set_below
,
2084 (lua_class_propfunc_t
) luaA_client_get_below
,
2085 (lua_class_propfunc_t
) luaA_client_set_below
);
2086 luaA_class_add_property(&client_class
, "sticky",
2087 (lua_class_propfunc_t
) luaA_client_set_sticky
,
2088 (lua_class_propfunc_t
) luaA_client_get_sticky
,
2089 (lua_class_propfunc_t
) luaA_client_set_sticky
);
2090 luaA_class_add_property(&client_class
, "size_hints_honor",
2091 (lua_class_propfunc_t
) luaA_client_set_size_hints_honor
,
2092 (lua_class_propfunc_t
) luaA_client_get_size_hints_honor
,
2093 (lua_class_propfunc_t
) luaA_client_set_size_hints_honor
);
2094 luaA_class_add_property(&client_class
, "urgent",
2095 (lua_class_propfunc_t
) luaA_client_set_urgent
,
2096 (lua_class_propfunc_t
) luaA_client_get_urgent
,
2097 (lua_class_propfunc_t
) luaA_client_set_urgent
);
2098 luaA_class_add_property(&client_class
, "size_hints",
2100 (lua_class_propfunc_t
) luaA_client_get_size_hints
,
2102 luaA_class_add_property(&client_class
, "focusable",
2104 (lua_class_propfunc_t
) luaA_client_get_focusable
,
2106 luaA_class_add_property(&client_class
, "shape_bounding",
2107 (lua_class_propfunc_t
) luaA_client_set_shape_bounding
,
2109 (lua_class_propfunc_t
) luaA_client_set_shape_bounding
);
2110 luaA_class_add_property(&client_class
, "shape_clip",
2111 (lua_class_propfunc_t
) luaA_client_set_shape_clip
,
2113 (lua_class_propfunc_t
) luaA_client_set_shape_clip
);
2115 signal_add(&client_class
.signals
, "focus");
2116 signal_add(&client_class
.signals
, "list");
2117 signal_add(&client_class
.signals
, "manage");
2118 signal_add(&client_class
.signals
, "button::press");
2119 signal_add(&client_class
.signals
, "button::release");
2120 signal_add(&client_class
.signals
, "mouse::enter");
2121 signal_add(&client_class
.signals
, "mouse::leave");
2122 signal_add(&client_class
.signals
, "mouse::move");
2123 signal_add(&client_class
.signals
, "property::above");
2124 signal_add(&client_class
.signals
, "property::below");
2125 signal_add(&client_class
.signals
, "property::class");
2126 signal_add(&client_class
.signals
, "property::fullscreen");
2127 signal_add(&client_class
.signals
, "property::geometry");
2128 signal_add(&client_class
.signals
, "property::group_window");
2129 signal_add(&client_class
.signals
, "property::height");
2130 signal_add(&client_class
.signals
, "property::hidden");
2131 signal_add(&client_class
.signals
, "property::icon");
2132 signal_add(&client_class
.signals
, "property::icon_name");
2133 signal_add(&client_class
.signals
, "property::instance");
2134 signal_add(&client_class
.signals
, "property::keys");
2135 signal_add(&client_class
.signals
, "property::machine");
2136 signal_add(&client_class
.signals
, "property::maximized_horizontal");
2137 signal_add(&client_class
.signals
, "property::maximized_vertical");
2138 signal_add(&client_class
.signals
, "property::minimized");
2139 signal_add(&client_class
.signals
, "property::modal");
2140 signal_add(&client_class
.signals
, "property::name");
2141 signal_add(&client_class
.signals
, "property::ontop");
2142 signal_add(&client_class
.signals
, "property::pid");
2143 signal_add(&client_class
.signals
, "property::role");
2144 signal_add(&client_class
.signals
, "property::screen");
2145 signal_add(&client_class
.signals
, "property::size_hints_honor");
2146 signal_add(&client_class
.signals
, "property::skip_taskbar");
2147 signal_add(&client_class
.signals
, "property::sticky");
2148 signal_add(&client_class
.signals
, "property::struts");
2149 signal_add(&client_class
.signals
, "property::transient_for");
2150 signal_add(&client_class
.signals
, "property::type");
2151 signal_add(&client_class
.signals
, "property::urgent");
2152 signal_add(&client_class
.signals
, "property::width");
2153 signal_add(&client_class
.signals
, "property::window");
2154 signal_add(&client_class
.signals
, "property::x");
2155 signal_add(&client_class
.signals
, "property::y");
2156 signal_add(&client_class
.signals
, "request::fullscreen");
2157 signal_add(&client_class
.signals
, "request::maximized_horizontal");
2158 signal_add(&client_class
.signals
, "request::maximized_vertical");
2159 signal_add(&client_class
.signals
, "tagged");
2160 signal_add(&client_class
.signals
, "unfocus");
2161 signal_add(&client_class
.signals
, "unmanage");
2162 signal_add(&client_class
.signals
, "untagged");
2165 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80