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>
33 #include "common/atoms.h"
34 #include "common/xutil.h"
37 luaA_client_checkudata(lua_State
*L
, int ud
)
39 client_t
*c
= luaA_checkudata(L
, ud
, &client_class
);
41 luaL_error(L
, "client is invalid\n");
46 * \param L The Lua VM state.
47 * \return The number of element pushed on stack.
50 luaA_client_gc(lua_State
*L
)
52 client_t
*c
= luaA_checkudata(L
, 1, &client_class
);
53 button_array_wipe(&c
->buttons
);
54 key_array_wipe(&c
->keys
);
55 xcb_get_wm_protocols_reply_wipe(&c
->protocols
);
57 p_delete(&c
->instance
);
58 p_delete(&c
->icon_name
);
59 p_delete(&c
->alt_icon_name
);
61 p_delete(&c
->alt_name
);
62 return luaA_object_gc(L
);
65 /** Change the client opacity.
66 * \param L The Lua VM state.
67 * \param cidx The client index.
68 * \param opacity The opacity.
71 client_set_opacity(lua_State
*L
, int cidx
, double opacity
)
73 client_t
*c
= luaA_client_checkudata(L
, cidx
);
75 if(c
->opacity
!= opacity
)
78 window_opacity_set(c
->window
, opacity
);
79 luaA_object_emit_signal(L
, cidx
, "property::opacity", 0);
83 /** Change the clients urgency flag.
84 * \param L The Lua VM state.
85 * \param cidx The client index on the stack.
86 * \param urgent The new flag state.
89 client_set_urgent(lua_State
*L
, int cidx
, bool urgent
)
91 client_t
*c
= luaA_client_checkudata(L
, cidx
);
93 if(c
->urgent
!= urgent
)
95 xcb_get_property_cookie_t hints
=
96 xcb_get_wm_hints_unchecked(globalconf
.connection
, c
->window
);
99 ewmh_client_update_hints(c
);
101 /* update ICCCM hints */
103 xcb_get_wm_hints_reply(globalconf
.connection
, hints
, &wmh
, NULL
);
106 wmh
.flags
|= XCB_WM_HINT_X_URGENCY
;
108 wmh
.flags
&= ~XCB_WM_HINT_X_URGENCY
;
110 xcb_set_wm_hints(globalconf
.connection
, c
->window
, &wmh
);
112 hook_property(c
, "urgent");
113 luaA_object_emit_signal(L
, cidx
, "property::urgent", 0);
118 client_set_group_window(lua_State
*L
, int cidx
, xcb_window_t window
)
120 client_t
*c
= luaA_client_checkudata(L
, cidx
);
122 if(c
->group_window
!= window
)
124 c
->group_window
= window
;
125 luaA_object_emit_signal(L
, cidx
, "property::group_window", 0);
130 client_set_type(lua_State
*L
, int cidx
, window_type_t type
)
132 client_t
*c
= luaA_client_checkudata(L
, cidx
);
137 luaA_object_emit_signal(L
, cidx
, "property::type", 0);
142 client_set_pid(lua_State
*L
, int cidx
, uint32_t pid
)
144 client_t
*c
= luaA_client_checkudata(L
, cidx
);
149 luaA_object_emit_signal(L
, cidx
, "property::pid", 0);
154 client_set_icon_name(lua_State
*L
, int cidx
, char *icon_name
)
156 client_t
*c
= luaA_client_checkudata(L
, cidx
);
157 p_delete(&c
->icon_name
);
158 c
->icon_name
= icon_name
;
159 luaA_object_emit_signal(L
, cidx
, "property::icon_name", 0);
160 hook_property(c
, "icon_name");
164 client_set_alt_icon_name(lua_State
*L
, int cidx
, char *icon_name
)
166 client_t
*c
= luaA_client_checkudata(L
, cidx
);
167 p_delete(&c
->alt_icon_name
);
168 c
->alt_icon_name
= icon_name
;
169 luaA_object_emit_signal(L
, cidx
, "property::icon_name", 0);
170 hook_property(c
, "icon_name");
174 client_set_role(lua_State
*L
, int cidx
, char *role
)
176 client_t
*c
= luaA_client_checkudata(L
, cidx
);
179 luaA_object_emit_signal(L
, cidx
, "property::role", 0);
183 client_set_machine(lua_State
*L
, int cidx
, char *machine
)
185 client_t
*c
= luaA_client_checkudata(L
, cidx
);
186 p_delete(&c
->machine
);
187 c
->machine
= machine
;
188 luaA_object_emit_signal(L
, cidx
, "property::machine", 0);
192 client_set_class_instance(lua_State
*L
, int cidx
, const char *class, const char *instance
)
194 client_t
*c
= luaA_client_checkudata(L
, cidx
);
196 p_delete(&c
->instance
);
197 c
->class = a_strdup(class);
198 c
->instance
= a_strdup(instance
);
199 luaA_object_emit_signal(L
, cidx
, "property::class", 0);
200 luaA_object_emit_signal(L
, cidx
, "property::instance", 0);
204 client_set_transient_for(lua_State
*L
, int cidx
, client_t
*transient_for
)
206 client_t
*c
= luaA_client_checkudata(L
, cidx
);
208 if(c
->transient_for
!= transient_for
)
210 c
->transient_for
= transient_for
;
211 luaA_object_emit_signal(L
, cidx
, "property::transient_for", 0);
216 client_set_name(lua_State
*L
, int cidx
, char *name
)
218 client_t
*c
= luaA_client_checkudata(L
, cidx
);
221 hook_property(c
, "name");
222 luaA_object_emit_signal(L
, cidx
, "property::name", 0);
226 client_set_alt_name(lua_State
*L
, int cidx
, char *name
)
228 client_t
*c
= luaA_client_checkudata(L
, cidx
);
229 p_delete(&c
->alt_name
);
231 hook_property(c
, "name");
232 luaA_object_emit_signal(L
, cidx
, "property::name", 0);
235 /** Returns true if a client is tagged
236 * with one of the tags of the specified screen.
237 * \param c The client to check.
238 * \param screen Virtual screen.
239 * \return true if the client is visible, false otherwise.
242 client_maybevisible(client_t
*c
, screen_t
*screen
)
244 if(screen
&& c
->screen
== screen
)
246 if(c
->sticky
|| c
->type
== WINDOW_TYPE_DESKTOP
)
249 foreach(tag
, screen
->tags
)
250 if(tag_get_selected(*tag
) && is_client_tagged(c
, *tag
))
256 /** Get a client by its window.
257 * \param w The client window to find.
258 * \return A client pointer if found, NULL otherwise.
261 client_getbywin(xcb_window_t w
)
263 foreach(c
, globalconf
.clients
)
264 if((*c
)->window
== w
)
270 /** Record that a client lost focus.
271 * \param c Client being unfocused
274 client_unfocus_update(client_t
*c
)
276 globalconf
.screens
.tab
[c
->phys_screen
].client_focus
= NULL
;
277 ewmh_update_net_active_window(c
->phys_screen
);
280 if(globalconf
.hooks
.unfocus
!= LUA_REFNIL
)
282 luaA_object_push(globalconf
.L
, c
);
283 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.unfocus
, 1, 0);
286 luaA_object_push(globalconf
.L
, c
);
287 luaA_class_emit_signal(globalconf
.L
, &client_class
, "unfocus", 1);
290 /** Unfocus a client.
291 * \param c The client.
294 client_unfocus(client_t
*c
)
297 xcb_window_t root_win
= xutil_screen_get(globalconf
.connection
, c
->phys_screen
)->root
;
298 /* Set focus on root window, so no events leak to the current window.
299 * This kind of inlines client_set_focus(), but a root window will never have
300 * the WM_TAKE_FOCUS protocol.
302 xcb_set_input_focus(globalconf
.connection
, XCB_INPUT_FOCUS_PARENT
,
303 root_win
, XCB_CURRENT_TIME
);
305 client_unfocus_update(c
);
308 /** Check if client supports atom a protocol in WM_PROTOCOL.
309 * \param c The client.
310 * \param atom The protocol atom to check for.
311 * \return True if client has the atom in protocol, false otherwise.
314 client_hasproto(client_t
*c
, xcb_atom_t atom
)
316 for(uint32_t i
= 0; i
< c
->protocols
.atoms_len
; i
++)
317 if(c
->protocols
.atoms
[i
] == atom
)
322 /** Sets focus on window - using xcb_set_input_focus or WM_TAKE_FOCUS
323 * \param c Client that should get focus
324 * \param set_input_focus Should we call xcb_set_input_focus
327 client_set_focus(client_t
*c
, bool set_input_focus
)
329 bool takefocus
= client_hasproto(c
, WM_TAKE_FOCUS
);
331 xcb_set_input_focus(globalconf
.connection
, XCB_INPUT_FOCUS_PARENT
,
332 c
->window
, XCB_CURRENT_TIME
);
334 window_takefocus(c
->window
);
337 /** Ban client and move it out of the viewport.
338 * \param c The client.
341 client_ban(client_t
*c
)
345 xcb_unmap_window(globalconf
.connection
, c
->window
);
349 if(globalconf
.screens
.tab
[c
->phys_screen
].prev_client_focus
== c
)
350 globalconf
.screens
.tab
[c
->phys_screen
].prev_client_focus
= NULL
;
352 /* Wait until the last moment to take away the focus from the window. */
353 if(globalconf
.screens
.tab
[c
->phys_screen
].client_focus
== c
)
358 /** This is part of The Bob Marley Algorithm: we ignore enter and leave window
359 * in certain cases, like map/unmap or move, so we don't get spurious events.
362 client_ignore_enterleave_events(void)
364 foreach(c
, globalconf
.clients
)
365 xcb_change_window_attributes(globalconf
.connection
,
368 (const uint32_t []) { CLIENT_SELECT_INPUT_EVENT_MASK
& ~(XCB_EVENT_MASK_ENTER_WINDOW
| XCB_EVENT_MASK_LEAVE_WINDOW
) });
372 client_restore_enterleave_events(void)
374 foreach(c
, globalconf
.clients
)
375 xcb_change_window_attributes(globalconf
.connection
,
378 (const uint32_t []) { CLIENT_SELECT_INPUT_EVENT_MASK
});
381 /** Record that a client got focus.
382 * \param c The client.
385 client_focus_update(client_t
*c
)
387 if(!client_maybevisible(c
, c
->screen
))
389 /* Focus previously focused client */
390 client_focus(globalconf
.screen_focus
->prev_client_focus
);
394 if(globalconf
.screen_focus
395 && globalconf
.screen_focus
->client_focus
)
397 if (globalconf
.screen_focus
->client_focus
!= c
)
398 client_unfocus_update(globalconf
.screen_focus
->client_focus
);
400 /* Already focused */
403 luaA_object_push(globalconf
.L
, c
);
404 client_set_minimized(globalconf
.L
, -1, false);
406 /* unban the client before focusing for consistency */
409 globalconf
.screen_focus
= &globalconf
.screens
.tab
[c
->phys_screen
];
410 globalconf
.screen_focus
->prev_client_focus
= c
;
411 globalconf
.screen_focus
->client_focus
= c
;
413 /* according to EWMH, we have to remove the urgent state from a client */
414 client_set_urgent(globalconf
.L
, -1, false);
416 ewmh_update_net_active_window(c
->phys_screen
);
419 if(globalconf
.hooks
.focus
!= LUA_REFNIL
)
421 luaA_object_push(globalconf
.L
, c
);
422 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.focus
, 1, 0);
425 luaA_object_push(globalconf
.L
, c
);
426 luaA_class_emit_signal(globalconf
.L
, &client_class
, "focus", 1);
429 /** Give focus to client, or to first client if client is NULL.
430 * \param c The client.
433 client_focus(client_t
*c
)
435 /* We have to set focus on first client */
436 if(!c
&& globalconf
.clients
.len
&& !(c
= globalconf
.clients
.tab
[0]))
439 if(!client_maybevisible(c
, c
->screen
))
443 client_focus_update(c
);
445 client_set_focus(c
, !c
->nofocus
);
448 /** Stack a window below.
449 * \param c The client.
450 * \param previous The previous window on the stack.
451 * \return The next-previous!
454 client_stack_above(client_t
*c
, xcb_window_t previous
)
456 uint32_t config_win_vals
[2];
458 config_win_vals
[0] = previous
;
459 config_win_vals
[1] = XCB_STACK_MODE_ABOVE
;
461 xcb_configure_window(globalconf
.connection
, c
->window
,
462 XCB_CONFIG_WINDOW_SIBLING
| XCB_CONFIG_WINDOW_STACK_MODE
,
465 config_win_vals
[0] = c
->window
;
469 xcb_configure_window(globalconf
.connection
,
471 XCB_CONFIG_WINDOW_SIBLING
| XCB_CONFIG_WINDOW_STACK_MODE
,
473 previous
= c
->titlebar
->window
;
476 previous
= c
->window
;
478 /* stack transient window on top of their parents */
479 foreach(node
, globalconf
.stack
)
480 if((*node
)->transient_for
== c
)
481 previous
= client_stack_above(*node
, previous
);
486 /** Stacking layout layers */
489 /** This one is a special layer */
497 /** This one only used for counting and is not a real layer */
501 /** Get the real layer of a client according to its attribute (fullscreen, …)
502 * \param c The client.
503 * \return The real layer.
506 client_layer_translator(client_t
*c
)
508 /* first deal with user set attributes */
511 else if(c
->fullscreen
)
512 return LAYER_FULLSCREEN
;
518 /* check for transient attr */
522 /* then deal with windows type */
525 case WINDOW_TYPE_DESKTOP
:
526 return LAYER_DESKTOP
;
535 * \todo It might be worth stopping to restack everyone and only stack `c'
536 * relatively to the first matching in the list.
539 client_stack_refresh()
541 uint32_t config_win_vals
[2];
544 if (!globalconf
.client_need_stack_refresh
)
546 globalconf
.client_need_stack_refresh
= false;
548 config_win_vals
[0] = XCB_NONE
;
549 config_win_vals
[1] = XCB_STACK_MODE_ABOVE
;
551 /* stack desktop windows */
552 for(layer
= LAYER_DESKTOP
; layer
< LAYER_BELOW
; layer
++)
553 foreach(node
, globalconf
.stack
)
554 if(client_layer_translator(*node
) == layer
)
555 config_win_vals
[0] = client_stack_above(*node
,
558 /* first stack not ontop wibox window */
559 foreach(_sb
, globalconf
.wiboxes
)
564 xcb_configure_window(globalconf
.connection
,
566 XCB_CONFIG_WINDOW_SIBLING
| XCB_CONFIG_WINDOW_STACK_MODE
,
568 config_win_vals
[0] = sb
->window
;
572 /* then stack clients */
573 for(layer
= LAYER_BELOW
; layer
< LAYER_COUNT
; layer
++)
574 foreach(node
, globalconf
.stack
)
575 if(client_layer_translator(*node
) == layer
)
576 config_win_vals
[0] = client_stack_above(*node
,
579 /* then stack ontop wibox window */
580 foreach(_sb
, globalconf
.wiboxes
)
585 xcb_configure_window(globalconf
.connection
,
587 XCB_CONFIG_WINDOW_SIBLING
| XCB_CONFIG_WINDOW_STACK_MODE
,
589 config_win_vals
[0] = sb
->window
;
594 /** Manage a new client.
595 * \param w The window.
596 * \param wgeom Window geometry.
597 * \param phys_screen Physical screen number.
598 * \param startup True if we are managing at startup time.
601 client_manage(xcb_window_t w
, xcb_get_geometry_reply_t
*wgeom
, int phys_screen
, bool startup
)
604 const uint32_t select_input_val
[] = { CLIENT_SELECT_INPUT_EVENT_MASK
};
606 if(systray_iskdedockapp(w
))
608 systray_request_handle(w
, phys_screen
, NULL
);
612 /* If this is a new client that just has been launched, then request its
614 xcb_get_property_cookie_t startup_id_q
= { 0 };
616 startup_id_q
= xcb_get_any_property(globalconf
.connection
,
617 false, w
, _NET_STARTUP_ID
, UINT_MAX
);
619 xcb_change_window_attributes(globalconf
.connection
, w
, XCB_CW_EVENT_MASK
, select_input_val
);
621 client_t
*c
= client_new(globalconf
.L
);
622 /* Push client in client list */
623 client_array_push(&globalconf
.clients
, luaA_object_ref(globalconf
.L
, -1));
626 screen
= c
->screen
= screen_getbycoord(&globalconf
.screens
.tab
[phys_screen
],
629 c
->phys_screen
= phys_screen
;
631 /* consider the window banned */
636 c
->geometry
.x
= wgeom
->x
;
637 c
->geometry
.y
= wgeom
->y
;
638 /* Border will be added later. */
639 c
->geometry
.width
= wgeom
->width
;
640 c
->geometry
.height
= wgeom
->height
;
641 /* Also set internal geometry (client_ban() needs it). */
642 c
->geometries
.internal
.x
= wgeom
->x
;
643 c
->geometries
.internal
.y
= wgeom
->y
;
644 c
->geometries
.internal
.width
= wgeom
->width
;
645 c
->geometries
.internal
.height
= wgeom
->height
;
648 luaA_object_push(globalconf
.L
, c
);
649 client_set_border_width(globalconf
.L
, -1, wgeom
->border_width
);
650 lua_pop(globalconf
.L
, 1);
652 /* we honor size hints by default */
653 c
->size_hints_honor
= true;
656 property_update_wm_normal_hints(c
, NULL
);
657 property_update_wm_hints(c
, NULL
);
658 property_update_wm_transient_for(c
, NULL
);
659 property_update_wm_client_leader(c
, NULL
);
660 property_update_wm_client_machine(c
, NULL
);
661 property_update_wm_window_role(c
, NULL
);
662 property_update_net_wm_pid(c
, NULL
);
663 property_update_net_wm_icon(c
, NULL
);
666 c
->opacity
= window_opacity_get(c
->window
);
668 /* Then check clients hints */
669 ewmh_client_check_hints(c
);
671 screen_client_moveto(c
, screen
, true);
673 /* Push client in stack */
676 /* update window title */
677 property_update_wm_name(c
, NULL
);
678 property_update_net_wm_name(c
, NULL
);
679 property_update_wm_icon_name(c
, NULL
);
680 property_update_net_wm_icon_name(c
, NULL
);
681 property_update_wm_class(c
, NULL
);
682 property_update_wm_protocols(c
, NULL
);
685 ewmh_process_client_strut(c
, NULL
);
687 ewmh_update_net_client_list(c
->phys_screen
);
689 /* Always stay in NORMAL_STATE. Even though iconified seems more
690 * appropriate sometimes. The only possible loss is that clients not using
691 * visibility events may continue to process data (when banned).
692 * Without any exposes or other events the cost should be fairly limited though.
694 * Some clients may expect the window to be unmapped when STATE_ICONIFIED.
695 * Two conflicting parts of the ICCCM v2.0 (section 4.1.4):
697 * "Normal -> Iconic - The client should send a ClientMessage event as described later in this section."
698 * (note no explicit mention of unmapping, while Normal->Widthdrawn does mention that)
700 * "Once a client's window has left the Withdrawn state, the window will be mapped
701 * if it is in the Normal state and the window will be unmapped if it is in the Iconic state."
703 * At this stage it's just safer to keep it in normal state and avoid confusion.
705 window_state_set(c
->window
, XCB_WM_STATE_NORMAL
);
709 /* Request our response */
710 xcb_get_property_reply_t
*reply
=
711 xcb_get_property_reply(globalconf
.connection
, startup_id_q
, NULL
);
712 /* Say spawn that a client has been started, with startup id as argument */
713 char *startup_id
= xutil_get_text_property_from_reply(reply
);
715 spawn_start_notify(c
, startup_id
);
716 p_delete(&startup_id
);
719 /* Call hook to notify list change */
720 if(globalconf
.hooks
.clients
!= LUA_REFNIL
)
721 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.clients
, 0, 0);
723 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
726 if(globalconf
.hooks
.manage
!= LUA_REFNIL
)
728 luaA_object_push(globalconf
.L
, c
);
729 lua_pushboolean(globalconf
.L
, startup
);
730 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.manage
, 2, 0);
733 luaA_object_push(globalconf
.L
, c
);
734 lua_pushboolean(globalconf
.L
, startup
);
735 luaA_class_emit_signal(globalconf
.L
, &client_class
, "manage", 2);
738 /** Compute client geometry with respect to its geometry hints.
739 * \param c The client.
740 * \param geometry The geometry that the client might receive.
741 * \return The geometry the client must take respecting its hints.
744 client_geometry_hints(client_t
*c
, area_t geometry
)
746 int32_t basew
, baseh
, minw
, minh
;
748 /* base size is substituted with min size if not specified */
749 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_SIZE
)
751 basew
= c
->size_hints
.base_width
;
752 baseh
= c
->size_hints
.base_height
;
754 else if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_MIN_SIZE
)
756 basew
= c
->size_hints
.min_width
;
757 baseh
= c
->size_hints
.min_height
;
762 /* min size is substituted with base size if not specified */
763 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_MIN_SIZE
)
765 minw
= c
->size_hints
.min_width
;
766 minh
= c
->size_hints
.min_height
;
768 else if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_SIZE
)
770 minw
= c
->size_hints
.base_width
;
771 minh
= c
->size_hints
.base_height
;
776 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_ASPECT
777 && c
->size_hints
.min_aspect_num
> 0
778 && c
->size_hints
.min_aspect_den
> 0
779 && geometry
.height
- baseh
> 0
780 && geometry
.width
- basew
> 0)
782 double dx
= (double) (geometry
.width
- basew
);
783 double dy
= (double) (geometry
.height
- baseh
);
784 double min
= (double) c
->size_hints
.min_aspect_num
/ (double) c
->size_hints
.min_aspect_den
;
785 double max
= (double) c
->size_hints
.max_aspect_num
/ (double) c
->size_hints
.min_aspect_den
;
786 double ratio
= dx
/ dy
;
787 if(max
> 0 && min
> 0 && ratio
> 0)
791 dy
= (dx
* min
+ dy
) / (min
* min
+ 1);
793 geometry
.width
= (int) dx
+ basew
;
794 geometry
.height
= (int) dy
+ baseh
;
798 dy
= (dx
* min
+ dy
) / (max
* max
+ 1);
800 geometry
.width
= (int) dx
+ basew
;
801 geometry
.height
= (int) dy
+ baseh
;
807 geometry
.width
= MAX(geometry
.width
, minw
);
809 geometry
.height
= MAX(geometry
.height
, minh
);
811 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_MAX_SIZE
)
813 if(c
->size_hints
.max_width
)
814 geometry
.width
= MIN(geometry
.width
, c
->size_hints
.max_width
);
815 if(c
->size_hints
.max_height
)
816 geometry
.height
= MIN(geometry
.height
, c
->size_hints
.max_height
);
819 if(c
->size_hints
.flags
& (XCB_SIZE_HINT_P_RESIZE_INC
| XCB_SIZE_HINT_BASE_SIZE
)
820 && c
->size_hints
.width_inc
&& c
->size_hints
.height_inc
)
822 uint16_t t1
= geometry
.width
, t2
= geometry
.height
;
823 unsigned_subtract(t1
, basew
);
824 unsigned_subtract(t2
, baseh
);
825 geometry
.width
-= t1
% c
->size_hints
.width_inc
;
826 geometry
.height
-= t2
% c
->size_hints
.height_inc
;
832 /** Resize client window.
833 * The sizes given as parameters are with titlebar and borders!
834 * \param c Client to resize.
835 * \param geometry New window geometry.
836 * \param hints Use size hints.
837 * \return true if an actual resize occurred.
840 client_resize(client_t
*c
, area_t geometry
, bool hints
)
842 area_t geometry_internal
;
845 /* offscreen appearance fixes */
846 area
= display_area_get(c
->phys_screen
);
848 if(geometry
.x
> area
.width
)
849 geometry
.x
= area
.width
- geometry
.width
;
850 if(geometry
.y
> area
.height
)
851 geometry
.y
= area
.height
- geometry
.height
;
852 if(geometry
.x
+ geometry
.width
< 0)
854 if(geometry
.y
+ geometry
.height
< 0)
857 /* Real client geometry, please keep it contained to C code at the very least. */
858 geometry_internal
= titlebar_geometry_remove(c
->titlebar
, c
->border_width
, geometry
);
861 geometry_internal
= client_geometry_hints(c
, geometry_internal
);
863 if(geometry_internal
.width
== 0 || geometry_internal
.height
== 0)
866 /* Also let client hints propagate to the "official" geometry. */
867 geometry
= titlebar_geometry_add(c
->titlebar
, c
->border_width
, geometry_internal
);
869 if(c
->geometries
.internal
.x
!= geometry_internal
.x
870 || c
->geometries
.internal
.y
!= geometry_internal
.y
871 || c
->geometries
.internal
.width
!= geometry_internal
.width
872 || c
->geometries
.internal
.height
!= geometry_internal
.height
)
874 screen_t
*new_screen
= screen_getbycoord(c
->screen
,
875 geometry_internal
.x
, geometry_internal
.y
);
877 /* Values to configure a window is an array where values are
878 * stored according to 'value_mask' */
881 c
->geometries
.internal
.x
= values
[0] = geometry_internal
.x
;
882 c
->geometries
.internal
.y
= values
[1] = geometry_internal
.y
;
883 c
->geometries
.internal
.width
= values
[2] = geometry_internal
.width
;
884 c
->geometries
.internal
.height
= values
[3] = geometry_internal
.height
;
886 /* Also store geometry including border and titlebar. */
887 c
->geometry
= geometry
;
889 titlebar_update_geometry(c
);
891 /* Ignore all spurious enter/leave notify events */
892 client_ignore_enterleave_events();
894 xcb_configure_window(globalconf
.connection
, c
->window
,
895 XCB_CONFIG_WINDOW_X
| XCB_CONFIG_WINDOW_Y
896 | XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT
,
899 client_restore_enterleave_events();
901 screen_client_moveto(c
, new_screen
, false);
904 hook_property(c
, "geometry");
912 /** Set a client minimized, or not.
913 * \param L The Lua VM state.
914 * \param cidx The client index.
915 * \param s Set or not the client minimized.
918 client_set_minimized(lua_State
*L
, int cidx
, bool s
)
920 client_t
*c
= luaA_client_checkudata(L
, cidx
);
922 if(c
->minimized
!= s
)
924 client_need_reban(c
);
926 client_need_reban(c
);
928 window_state_set(c
->window
, XCB_WM_STATE_ICONIC
);
930 window_state_set(c
->window
, XCB_WM_STATE_NORMAL
);
931 ewmh_client_update_hints(c
);
932 if(strut_has_value(&c
->strut
))
933 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
935 hook_property(c
, "minimized");
936 luaA_object_emit_signal(L
, cidx
, "property::minimized", 0);
940 /** Set a client sticky, or not.
941 * \param L The Lua VM state.
942 * \param cidx The client index.
943 * \param s Set or not the client sticky.
946 client_set_sticky(lua_State
*L
, int cidx
, bool s
)
948 client_t
*c
= luaA_client_checkudata(L
, cidx
);
952 client_need_reban(c
);
954 client_need_reban(c
);
955 ewmh_client_update_hints(c
);
956 hook_property(c
, "sticky");
957 luaA_object_emit_signal(L
, cidx
, "property::sticky", 0);
961 /** Set a client fullscreen, or not.
962 * \param L The Lua VM state.
963 * \param cidx The client index.
964 * \param s Set or not the client fullscreen.
967 client_set_fullscreen(lua_State
*L
, int cidx
, bool s
)
969 client_t
*c
= luaA_client_checkudata(L
, cidx
);
971 if(c
->fullscreen
!= s
)
975 /* become fullscreen! */
978 /* Make sure the current geometry is stored without titlebar. */
979 titlebar_ban(c
->titlebar
);
980 /* remove any max state */
981 client_set_maximized_horizontal(L
, cidx
, false);
982 client_set_maximized_vertical(L
, cidx
, false);
983 /* You can only be part of one of the special layers. */
984 client_set_below(L
, cidx
, false);
985 client_set_above(L
, cidx
, false);
986 client_set_ontop(L
, cidx
, false);
988 geometry
= screen_area_get(c
->screen
, false);
989 c
->geometries
.fullscreen
= c
->geometry
;
990 c
->border_width_fs
= c
->border_width
;
991 client_set_border_width(L
, cidx
, 0);
992 c
->fullscreen
= true;
996 geometry
= c
->geometries
.fullscreen
;
997 c
->fullscreen
= false;
998 client_set_border_width(L
, cidx
, c
->border_width_fs
);
1000 client_resize(c
, geometry
, false);
1002 ewmh_client_update_hints(c
);
1003 hook_property(c
, "fullscreen");
1004 luaA_object_emit_signal(L
, cidx
, "property::fullscreen", 0);
1008 /** Set a client horizontally maximized.
1009 * \param L The Lua VM state.
1010 * \param cidx The client index.
1011 * \param s The maximized status.
1014 client_set_maximized_horizontal(lua_State
*L
, int cidx
, bool s
)
1016 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1018 if(c
->maximized_horizontal
!= s
)
1022 if((c
->maximized_horizontal
= s
))
1024 /* remove fullscreen mode */
1025 client_set_fullscreen(L
, cidx
, false);
1027 geometry
= screen_area_get(c
->screen
, true);
1028 geometry
.y
= c
->geometry
.y
;
1029 geometry
.height
= c
->geometry
.height
;
1030 c
->geometries
.max
.x
= c
->geometry
.x
;
1031 c
->geometries
.max
.width
= c
->geometry
.width
;
1035 geometry
= c
->geometry
;
1036 geometry
.x
= c
->geometries
.max
.x
;
1037 geometry
.width
= c
->geometries
.max
.width
;
1040 client_resize(c
, geometry
, c
->size_hints_honor
);
1042 ewmh_client_update_hints(c
);
1043 hook_property(c
, "maximized_horizontal");
1044 luaA_object_emit_signal(L
, cidx
, "property::maximized_horizontal", 0);
1048 /** Set a client vertically maximized.
1049 * \param L The Lua VM state.
1050 * \param cidx The client index.
1051 * \param s The maximized status.
1054 client_set_maximized_vertical(lua_State
*L
, int cidx
, bool s
)
1056 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1058 if(c
->maximized_vertical
!= s
)
1062 if((c
->maximized_vertical
= s
))
1064 /* remove fullscreen mode */
1065 client_set_fullscreen(L
, cidx
, false);
1067 geometry
= screen_area_get(c
->screen
, true);
1068 geometry
.x
= c
->geometry
.x
;
1069 geometry
.width
= c
->geometry
.width
;
1070 c
->geometries
.max
.y
= c
->geometry
.y
;
1071 c
->geometries
.max
.height
= c
->geometry
.height
;
1075 geometry
= c
->geometry
;
1076 geometry
.y
= c
->geometries
.max
.y
;
1077 geometry
.height
= c
->geometries
.max
.height
;
1080 client_resize(c
, geometry
, c
->size_hints_honor
);
1082 ewmh_client_update_hints(c
);
1083 hook_property(c
, "maximized_vertical");
1084 luaA_object_emit_signal(L
, cidx
, "property::maximized_vertical", 0);
1088 /** Set a client above, or not.
1089 * \param L The Lua VM state.
1090 * \param cidx The client index.
1091 * \param s Set or not the client above.
1094 client_set_above(lua_State
*L
, int cidx
, bool s
)
1096 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1100 /* You can only be part of one of the special layers. */
1103 client_set_below(L
, cidx
, false);
1104 client_set_ontop(L
, cidx
, false);
1105 client_set_fullscreen(L
, cidx
, false);
1109 ewmh_client_update_hints(c
);
1111 hook_property(c
, "above");
1112 luaA_object_emit_signal(L
, cidx
, "property::above", 0);
1116 /** Set a client below, or not.
1117 * \param L The Lua VM state.
1118 * \param cidx The client index.
1119 * \param s Set or not the client below.
1122 client_set_below(lua_State
*L
, int cidx
, bool s
)
1124 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1128 /* You can only be part of one of the special layers. */
1131 client_set_above(L
, cidx
, false);
1132 client_set_ontop(L
, cidx
, false);
1133 client_set_fullscreen(L
, cidx
, false);
1137 ewmh_client_update_hints(c
);
1139 hook_property(c
, "below");
1140 luaA_object_emit_signal(L
, cidx
, "property::below", 0);
1144 /** Set a client modal, or not.
1145 * \param L The Lua VM state.
1146 * \param cidx The client index.
1147 * \param s Set or not the client modal attribute.
1150 client_set_modal(lua_State
*L
, int cidx
, bool s
)
1152 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1158 ewmh_client_update_hints(c
);
1160 hook_property(c
, "modal");
1161 luaA_object_emit_signal(L
, cidx
, "property::modal", 0);
1165 /** Set a client ontop, or not.
1166 * \param L The Lua VM state.
1167 * \param cidx The client index.
1168 * \param s Set or not the client ontop attribute.
1171 client_set_ontop(lua_State
*L
, int cidx
, bool s
)
1173 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1177 /* You can only be part of one of the special layers. */
1180 client_set_above(L
, cidx
, false);
1181 client_set_below(L
, cidx
, false);
1182 client_set_fullscreen(L
, cidx
, false);
1187 hook_property(c
, "ontop");
1188 luaA_object_emit_signal(L
, cidx
, "property::ontop", 0);
1192 /** Set a client skip taskbar attribute.
1193 * \param L Tha Lua VM state.
1194 * \param cidx The client index.
1195 * \param s Set or not the client skip taskbar attribute.
1198 client_set_skip_taskbar(lua_State
*L
, int cidx
, bool s
)
1200 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1202 if(c
->skip_taskbar
!= s
)
1204 c
->skip_taskbar
= s
;
1205 ewmh_client_update_hints(c
);
1206 luaA_object_emit_signal(L
, cidx
, "property::skip_taskbar", 0);
1210 /** Unban a client and move it back into the viewport.
1211 * \param c The client.
1214 client_unban(client_t
*c
)
1218 xcb_map_window(globalconf
.connection
, c
->window
);
1220 c
->isbanned
= false;
1224 /** Unmanage a client.
1225 * \param c The client.
1228 client_unmanage(client_t
*c
)
1230 tag_array_t
*tags
= &c
->screen
->tags
;
1232 /* Reset transient_for attributes of widows that maybe referring to us */
1233 foreach(_tc
, globalconf
.clients
)
1235 client_t
*tc
= *_tc
;
1236 if(tc
->transient_for
== c
)
1237 tc
->transient_for
= NULL
;
1240 if(globalconf
.screens
.tab
[c
->phys_screen
].prev_client_focus
== c
)
1241 globalconf
.screens
.tab
[c
->phys_screen
].prev_client_focus
= NULL
;
1243 if(globalconf
.screens
.tab
[c
->phys_screen
].client_focus
== c
)
1246 /* remove client from global list and everywhere else */
1247 foreach(elem
, globalconf
.clients
)
1250 client_array_remove(&globalconf
.clients
, elem
);
1253 stack_client_remove(c
);
1254 for(int i
= 0; i
< tags
->len
; i
++)
1255 untag_client(c
, tags
->tab
[i
]);
1258 if(globalconf
.hooks
.unmanage
!= LUA_REFNIL
)
1260 luaA_object_push(globalconf
.L
, c
);
1261 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.unmanage
, 1, 0);
1264 luaA_object_push(globalconf
.L
, c
);
1265 luaA_class_emit_signal(globalconf
.L
, &client_class
, "unmanage", 1);
1267 /* Call hook to notify list change */
1268 if(globalconf
.hooks
.clients
!= LUA_REFNIL
)
1269 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.clients
, 0, 0);
1271 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
1273 if(strut_has_value(&c
->strut
))
1274 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
1276 window_state_set(c
->window
, XCB_WM_STATE_WITHDRAWN
);
1278 titlebar_client_detach(c
);
1280 ewmh_update_net_client_list(c
->phys_screen
);
1282 /* set client as invalid */
1285 luaA_object_unref(globalconf
.L
, c
);
1288 /** Kill a client via a WM_DELETE_WINDOW request or KillClient if not
1290 * \param c The client to kill.
1293 client_kill(client_t
*c
)
1295 if(client_hasproto(c
, WM_DELETE_WINDOW
))
1297 xcb_client_message_event_t ev
;
1299 /* Initialize all of event's fields first */
1302 ev
.response_type
= XCB_CLIENT_MESSAGE
;
1303 ev
.window
= c
->window
;
1305 ev
.data
.data32
[1] = XCB_CURRENT_TIME
;
1306 ev
.type
= WM_PROTOCOLS
;
1307 ev
.data
.data32
[0] = WM_DELETE_WINDOW
;
1309 xcb_send_event(globalconf
.connection
, false, c
->window
,
1310 XCB_EVENT_MASK_NO_EVENT
, (char *) &ev
);
1313 xcb_kill_client(globalconf
.connection
, c
->window
);
1316 /** Get all clients into a table.
1317 * \param L The Lua VM state.
1318 * \return The number of elements pushed on stack.
1320 * \lparam An optional screen number.
1321 * \lreturn A table with all clients.
1324 luaA_client_get(lua_State
*L
)
1328 screen
= luaL_optnumber(L
, 1, 0) - 1;
1333 foreach(c
, globalconf
.clients
)
1335 luaA_object_push(L
, *c
);
1336 lua_rawseti(L
, -2, i
++);
1340 luaA_checkscreen(screen
);
1341 foreach(c
, globalconf
.clients
)
1342 if((*c
)->screen
== &globalconf
.screens
.tab
[screen
])
1344 luaA_object_push(L
, *c
);
1345 lua_rawseti(L
, -2, i
++);
1352 /** Check if a client is visible on its screen.
1353 * \param L The Lua VM state.
1354 * \return The number of elements pushed on stack.
1357 * \lreturn A boolean value, true if the client is visible, false otherwise.
1360 luaA_client_isvisible(lua_State
*L
)
1362 client_t
*c
= luaA_client_checkudata(L
, 1);
1363 lua_pushboolean(L
, client_isvisible(c
, c
->screen
));
1367 /** Set client border width.
1368 * \param L The Lua VM state.
1369 * \param cidx The client index.
1370 * \param width The border width.
1373 client_set_border_width(lua_State
*L
, int cidx
, int width
)
1375 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1378 if(width
> 0 && (c
->type
== WINDOW_TYPE_DOCK
1379 || c
->type
== WINDOW_TYPE_SPLASH
1380 || c
->type
== WINDOW_TYPE_DESKTOP
1384 if(width
== c
->border_width
|| width
< 0)
1387 /* disallow change of border width if the client is fullscreen */
1391 /* Update geometry with the new border. */
1392 c
->geometry
.width
-= 2 * c
->border_width
;
1393 c
->geometry
.height
-= 2 * c
->border_width
;
1395 c
->border_width
= width
;
1396 xcb_configure_window(globalconf
.connection
, c
->window
,
1397 XCB_CONFIG_WINDOW_BORDER_WIDTH
, &w
);
1399 c
->geometry
.width
+= 2 * c
->border_width
;
1400 c
->geometry
.height
+= 2 * c
->border_width
;
1402 /* Changing border size also affects the size of the titlebar. */
1403 titlebar_update_geometry(c
);
1405 hook_property(c
, "border_width");
1406 luaA_object_emit_signal(L
, cidx
, "property::border_width", 0);
1409 /** Set a client icon.
1410 * \param L The Lua VM state.
1411 * \param cidx The client index on the stack.
1412 * \param iidx The image index on the stack.
1415 client_set_icon(lua_State
*L
, int cidx
, int iidx
)
1417 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1418 /* convert index to absolute */
1419 cidx
= luaA_absindex(L
, cidx
);
1420 iidx
= luaA_absindex(L
, iidx
);
1421 luaA_checkudata(L
, iidx
, &image_class
);
1422 luaA_object_unref_item(L
, cidx
, c
->icon
);
1423 c
->icon
= luaA_object_ref_item(L
, cidx
, iidx
);
1424 luaA_object_emit_signal(L
, cidx
< iidx
? cidx
: cidx
- 1, "property::icon", 0);
1426 hook_property(c
, "icon");
1430 * \param L The Lua VM state.
1436 luaA_client_kill(lua_State
*L
)
1438 client_t
*c
= luaA_client_checkudata(L
, 1);
1443 /** Swap a client with another one.
1444 * \param L The Lua VM state.
1447 * \lparam A client to swap with.
1450 luaA_client_swap(lua_State
*L
)
1452 client_t
*c
= luaA_client_checkudata(L
, 1);
1453 client_t
*swap
= luaA_client_checkudata(L
, 2);
1457 client_t
**ref_c
= NULL
, **ref_swap
= NULL
;
1458 foreach(item
, globalconf
.clients
)
1462 else if(*item
== swap
)
1464 if(ref_c
&& ref_swap
)
1471 /* Call hook to notify list change */
1472 if(globalconf
.hooks
.clients
!= LUA_REFNIL
)
1473 luaA_dofunction_from_registry(L
, globalconf
.hooks
.clients
, 0, 0);
1475 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
1481 /** Access or set the client tags.
1482 * \param L The Lua VM state.
1483 * \return The number of elements pushed on stack.
1484 * \lparam A table with tags to set, or none to get the current tags table.
1485 * \return The clients tag.
1488 luaA_client_tags(lua_State
*L
)
1490 client_t
*c
= luaA_client_checkudata(L
, 1);
1491 tag_array_t
*tags
= &c
->screen
->tags
;
1494 if(lua_gettop(L
) == 2)
1496 luaA_checktable(L
, 2);
1497 for(int i
= 0; i
< tags
->len
; i
++)
1498 untag_client(c
, tags
->tab
[i
]);
1500 while(lua_next(L
, 2))
1507 if(is_client_tagged(c
, *tag
))
1509 luaA_object_push(L
, *tag
);
1510 lua_rawseti(L
, -2, ++j
);
1516 /** Raise a client on top of others which are on the same layer.
1517 * \param L The Lua VM state.
1522 luaA_client_raise(lua_State
*L
)
1524 client_t
*c
= luaA_client_checkudata(L
, 1);
1529 /** Lower a client on bottom of others which are on the same layer.
1530 * \param L The Lua VM state.
1535 luaA_client_lower(lua_State
*L
)
1537 client_t
*c
= luaA_client_checkudata(L
, 1);
1539 stack_client_push(c
);
1541 /* Traverse all transient layers. */
1542 for(client_t
*tc
= c
->transient_for
; tc
; tc
= tc
->transient_for
)
1543 stack_client_push(tc
);
1550 /** Redraw a client by unmapping and mapping it quickly.
1551 * \param L The Lua VM state.
1557 luaA_client_redraw(lua_State
*L
)
1559 client_t
*c
= luaA_client_checkudata(L
, 1);
1561 xcb_unmap_window(globalconf
.connection
, c
->window
);
1562 xcb_map_window(globalconf
.connection
, c
->window
);
1564 /* Set the focus on the current window if the redraw has been
1565 performed on the window where the pointer is currently on
1566 because after the unmapping/mapping, the focus is lost */
1567 if(globalconf
.screen_focus
->client_focus
== c
)
1576 /** Stop managing a client.
1577 * \param L The Lua VM state.
1578 * \return The number of elements pushed on stack.
1583 luaA_client_unmanage(lua_State
*L
)
1585 client_t
*c
= luaA_client_checkudata(L
, 1);
1590 /** Return client geometry.
1591 * \param L The Lua VM state.
1592 * \return The number of elements pushed on stack.
1594 * \lparam A table with new coordinates, or none.
1595 * \lreturn A table with client coordinates.
1598 luaA_client_geometry(lua_State
*L
)
1600 client_t
*c
= luaA_client_checkudata(L
, 1);
1602 if(lua_gettop(L
) == 2)
1606 luaA_checktable(L
, 2);
1607 geometry
.x
= luaA_getopt_number(L
, 2, "x", c
->geometry
.x
);
1608 geometry
.y
= luaA_getopt_number(L
, 2, "y", c
->geometry
.y
);
1609 if(client_isfixed(c
))
1611 geometry
.width
= c
->geometry
.width
;
1612 geometry
.height
= c
->geometry
.height
;
1616 geometry
.width
= luaA_getopt_number(L
, 2, "width", c
->geometry
.width
);
1617 geometry
.height
= luaA_getopt_number(L
, 2, "height", c
->geometry
.height
);
1620 client_resize(c
, geometry
, c
->size_hints_honor
);
1623 return luaA_pusharea(L
, c
->geometry
);
1626 /** Return client struts (reserved space at the edge of the screen).
1627 * \param L The Lua VM state.
1628 * \return The number of elements pushed on stack.
1630 * \lparam A table with new strut values, or none.
1631 * \lreturn A table with strut values.
1634 luaA_client_struts(lua_State
*L
)
1636 client_t
*c
= luaA_client_checkudata(L
, 1);
1638 if(lua_gettop(L
) == 2)
1640 luaA_tostrut(L
, 2, &c
->strut
);
1641 ewmh_update_strut(c
->window
, &c
->strut
);
1642 hook_property(c
, "struts");
1643 luaA_object_emit_signal(L
, 1, "property::struts", 0);
1644 screen_emit_signal(L
, c
->screen
, "property::workarea", 0);
1647 return luaA_pushstrut(L
, c
->strut
);
1651 luaA_client_set_screen(lua_State
*L
, client_t
*c
)
1653 if(globalconf
.xinerama_is_active
)
1655 int screen
= luaL_checknumber(L
, -1) - 1;
1656 luaA_checkscreen(screen
);
1657 screen_client_moveto(c
, &globalconf
.screens
.tab
[screen
], true);
1663 luaA_client_set_hidden(lua_State
*L
, client_t
*c
)
1665 bool b
= luaA_checkboolean(L
, -1);
1668 client_need_reban(c
);
1670 client_need_reban(c
);
1671 hook_property(c
, "hidden");
1672 if(strut_has_value(&c
->strut
))
1673 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
1674 luaA_object_emit_signal(L
, -3, "property::hidden", 0);
1680 luaA_client_set_minimized(lua_State
*L
, client_t
*c
)
1682 client_set_minimized(L
, -3, luaA_checkboolean(L
, -1));
1687 luaA_client_set_fullscreen(lua_State
*L
, client_t
*c
)
1689 client_set_fullscreen(L
, -3, luaA_checkboolean(L
, -1));
1694 luaA_client_set_modal(lua_State
*L
, client_t
*c
)
1696 client_set_modal(L
, -3, luaA_checkboolean(L
, -1));
1701 luaA_client_set_maximized_horizontal(lua_State
*L
, client_t
*c
)
1703 client_set_maximized_horizontal(L
, -3, luaA_checkboolean(L
, -1));
1708 luaA_client_set_maximized_vertical(lua_State
*L
, client_t
*c
)
1710 client_set_maximized_vertical(L
, -3, luaA_checkboolean(L
, -1));
1715 luaA_client_set_icon(lua_State
*L
, client_t
*c
)
1717 client_set_icon(L
, -3, -1);
1722 luaA_client_set_opacity(lua_State
*L
, client_t
*c
)
1724 if(lua_isnil(L
, -1))
1725 client_set_opacity(L
, -3, -1);
1727 client_set_opacity(L
, -3, luaL_checknumber(L
, -1));
1732 luaA_client_set_sticky(lua_State
*L
, client_t
*c
)
1734 client_set_sticky(L
, -3, luaA_checkboolean(L
, -1));
1739 luaA_client_set_size_hints_honor(lua_State
*L
, client_t
*c
)
1741 c
->size_hints_honor
= luaA_checkboolean(L
, -1);
1742 hook_property(c
, "size_hints_honor");
1743 luaA_object_emit_signal(L
, -3, "property::size_hints_honor", 0);
1748 luaA_client_set_border_width(lua_State
*L
, client_t
*c
)
1750 client_set_border_width(L
, -3, luaL_checknumber(L
, -1));
1755 luaA_client_set_ontop(lua_State
*L
, client_t
*c
)
1757 client_set_ontop(L
, -3, luaA_checkboolean(L
, -1));
1762 luaA_client_set_below(lua_State
*L
, client_t
*c
)
1764 client_set_below(L
, -3, luaA_checkboolean(L
, -1));
1769 luaA_client_set_above(lua_State
*L
, client_t
*c
)
1771 client_set_above(L
, -3, luaA_checkboolean(L
, -1));
1776 luaA_client_set_urgent(lua_State
*L
, client_t
*c
)
1778 client_set_urgent(L
, -3, luaA_checkboolean(L
, -1));
1783 luaA_client_set_border_color(lua_State
*L
, client_t
*c
)
1787 if((buf
= luaL_checklstring(L
, -1, &len
))
1788 && xcolor_init_reply(xcolor_init_unchecked(&c
->border_color
, buf
, len
)))
1790 xcb_change_window_attributes(globalconf
.connection
, c
->window
,
1791 XCB_CW_BORDER_PIXEL
, &c
->border_color
.pixel
);
1792 luaA_object_emit_signal(L
, -3, "property::border_color", 0);
1798 luaA_client_set_titlebar(lua_State
*L
, client_t
*c
)
1800 if(lua_isnil(L
, -1))
1801 titlebar_client_detach(c
);
1803 titlebar_client_attach(c
);
1808 luaA_client_set_skip_taskbar(lua_State
*L
, client_t
*c
)
1810 client_set_skip_taskbar(L
, -3, luaA_checkboolean(L
, -1));
1815 luaA_client_get_name(lua_State
*L
, client_t
*c
)
1817 lua_pushstring(L
, c
->name
? c
->name
: c
->alt_name
);
1822 luaA_client_get_icon_name(lua_State
*L
, client_t
*c
)
1824 lua_pushstring(L
, c
->icon_name
? c
->icon_name
: c
->alt_icon_name
);
1828 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, class, lua_pushstring
)
1829 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, instance
, lua_pushstring
)
1830 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, machine
, lua_pushstring
)
1831 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, role
, lua_pushstring
)
1832 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, transient_for
, luaA_object_push
)
1833 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, skip_taskbar
, lua_pushboolean
)
1834 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, window
, lua_pushnumber
)
1835 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, leader_window
, lua_pushnumber
)
1836 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, group_window
, lua_pushnumber
)
1837 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, pid
, lua_pushnumber
)
1838 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, hidden
, lua_pushboolean
)
1839 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, minimized
, lua_pushboolean
)
1840 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, fullscreen
, lua_pushboolean
)
1841 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, modal
, lua_pushboolean
)
1842 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, ontop
, lua_pushboolean
)
1843 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, urgent
, lua_pushboolean
)
1844 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, above
, lua_pushboolean
)
1845 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, below
, lua_pushboolean
)
1846 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, sticky
, lua_pushboolean
)
1847 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, size_hints_honor
, lua_pushboolean
)
1848 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, maximized_horizontal
, lua_pushboolean
)
1849 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, maximized_vertical
, lua_pushboolean
)
1850 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, opacity
, lua_pushnumber
)
1851 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, border_width
, lua_pushnumber
)
1852 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, border_color
, luaA_pushxcolor
)
1855 luaA_client_get_content(lua_State
*L
, client_t
*c
)
1857 xcb_image_t
*ximage
= xcb_image_get(globalconf
.connection
,
1860 c
->geometries
.internal
.width
,
1861 c
->geometries
.internal
.height
,
1862 ~0, XCB_IMAGE_FORMAT_Z_PIXMAP
);
1867 if(ximage
->bpp
>= 24)
1869 uint32_t *data
= p_alloca(uint32_t, ximage
->width
* ximage
->height
);
1871 for(int y
= 0; y
< ximage
->height
; y
++)
1872 for(int x
= 0; x
< ximage
->width
; x
++)
1874 data
[y
* ximage
->width
+ x
] = xcb_image_get_pixel(ximage
, x
, y
);
1875 data
[y
* ximage
->width
+ x
] |= 0xff000000; /* set alpha to 0xff */
1878 retval
= image_new_from_argb32(ximage
->width
, ximage
->height
, data
);
1880 xcb_image_destroy(ximage
);
1887 luaA_client_get_type(lua_State
*L
, client_t
*c
)
1891 case WINDOW_TYPE_DESKTOP
:
1892 lua_pushliteral(L
, "desktop");
1894 case WINDOW_TYPE_DOCK
:
1895 lua_pushliteral(L
, "dock");
1897 case WINDOW_TYPE_SPLASH
:
1898 lua_pushliteral(L
, "splash");
1900 case WINDOW_TYPE_DIALOG
:
1901 lua_pushliteral(L
, "dialog");
1903 case WINDOW_TYPE_MENU
:
1904 lua_pushliteral(L
, "menu");
1906 case WINDOW_TYPE_TOOLBAR
:
1907 lua_pushliteral(L
, "toolbar");
1909 case WINDOW_TYPE_UTILITY
:
1910 lua_pushliteral(L
, "utility");
1912 case WINDOW_TYPE_DROPDOWN_MENU
:
1913 lua_pushliteral(L
, "dropdown_menu");
1915 case WINDOW_TYPE_POPUP_MENU
:
1916 lua_pushliteral(L
, "popup_menu");
1918 case WINDOW_TYPE_TOOLTIP
:
1919 lua_pushliteral(L
, "tooltip");
1921 case WINDOW_TYPE_NOTIFICATION
:
1922 lua_pushliteral(L
, "notification");
1924 case WINDOW_TYPE_COMBO
:
1925 lua_pushliteral(L
, "combo");
1927 case WINDOW_TYPE_DND
:
1928 lua_pushliteral(L
, "dnd");
1930 case WINDOW_TYPE_NORMAL
:
1931 lua_pushliteral(L
, "normal");
1938 luaA_client_get_screen(lua_State
*L
, client_t
*c
)
1942 lua_pushnumber(L
, 1 + screen_array_indexof(&globalconf
.screens
, c
->screen
));
1947 luaA_client_get_icon(lua_State
*L
, client_t
*c
)
1949 return luaA_object_push_item(L
, -2, c
->icon
);
1953 luaA_client_get_titlebar(lua_State
*L
, client_t
*c
)
1955 return luaA_object_push(L
, c
->titlebar
);
1959 luaA_client_get_size_hints(lua_State
*L
, client_t
*c
)
1961 const char *u_or_p
= NULL
;
1963 lua_createtable(L
, 0, 1);
1965 if(c
->size_hints
.flags
& XCB_SIZE_HINT_US_POSITION
)
1966 u_or_p
= "user_position";
1967 else if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_POSITION
)
1968 u_or_p
= "program_position";
1972 lua_createtable(L
, 0, 2);
1973 lua_pushnumber(L
, c
->size_hints
.x
);
1974 lua_setfield(L
, -2, "x");
1975 lua_pushnumber(L
, c
->size_hints
.y
);
1976 lua_setfield(L
, -2, "y");
1977 lua_setfield(L
, -2, u_or_p
);
1981 if(c
->size_hints
.flags
& XCB_SIZE_HINT_US_SIZE
)
1982 u_or_p
= "user_size";
1983 else if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_SIZE
)
1984 u_or_p
= "program_size";
1988 lua_createtable(L
, 0, 2);
1989 lua_pushnumber(L
, c
->size_hints
.width
);
1990 lua_setfield(L
, -2, "width");
1991 lua_pushnumber(L
, c
->size_hints
.height
);
1992 lua_setfield(L
, -2, "height");
1993 lua_setfield(L
, -2, u_or_p
);
1996 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_MIN_SIZE
)
1998 lua_pushnumber(L
, c
->size_hints
.min_width
);
1999 lua_setfield(L
, -2, "min_width");
2000 lua_pushnumber(L
, c
->size_hints
.min_height
);
2001 lua_setfield(L
, -2, "min_height");
2004 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_MAX_SIZE
)
2006 lua_pushnumber(L
, c
->size_hints
.max_width
);
2007 lua_setfield(L
, -2, "max_width");
2008 lua_pushnumber(L
, c
->size_hints
.max_height
);
2009 lua_setfield(L
, -2, "max_height");
2012 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_RESIZE_INC
)
2014 lua_pushnumber(L
, c
->size_hints
.width_inc
);
2015 lua_setfield(L
, -2, "width_inc");
2016 lua_pushnumber(L
, c
->size_hints
.height_inc
);
2017 lua_setfield(L
, -2, "height_inc");
2020 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_ASPECT
)
2022 lua_pushnumber(L
, c
->size_hints
.min_aspect_num
);
2023 lua_setfield(L
, -2, "min_aspect_num");
2024 lua_pushnumber(L
, c
->size_hints
.min_aspect_den
);
2025 lua_setfield(L
, -2, "min_aspect_den");
2026 lua_pushnumber(L
, c
->size_hints
.max_aspect_num
);
2027 lua_setfield(L
, -2, "max_aspect_num");
2028 lua_pushnumber(L
, c
->size_hints
.max_aspect_den
);
2029 lua_setfield(L
, -2, "max_aspect_den");
2032 if(c
->size_hints
.flags
& XCB_SIZE_HINT_BASE_SIZE
)
2034 lua_pushnumber(L
, c
->size_hints
.base_width
);
2035 lua_setfield(L
, -2, "base_width");
2036 lua_pushnumber(L
, c
->size_hints
.base_height
);
2037 lua_setfield(L
, -2, "base_height");
2040 if(c
->size_hints
.flags
& XCB_SIZE_HINT_P_WIN_GRAVITY
)
2042 switch(c
->size_hints
.win_gravity
)
2045 lua_pushliteral(L
, "north_west");
2047 case XCB_GRAVITY_NORTH
:
2048 lua_pushliteral(L
, "north");
2050 case XCB_GRAVITY_NORTH_EAST
:
2051 lua_pushliteral(L
, "north_east");
2053 case XCB_GRAVITY_WEST
:
2054 lua_pushliteral(L
, "west");
2056 case XCB_GRAVITY_CENTER
:
2057 lua_pushliteral(L
, "center");
2059 case XCB_GRAVITY_EAST
:
2060 lua_pushliteral(L
, "east");
2062 case XCB_GRAVITY_SOUTH_WEST
:
2063 lua_pushliteral(L
, "south_west");
2065 case XCB_GRAVITY_SOUTH
:
2066 lua_pushliteral(L
, "south");
2068 case XCB_GRAVITY_SOUTH_EAST
:
2069 lua_pushliteral(L
, "south_east");
2071 case XCB_GRAVITY_STATIC
:
2072 lua_pushliteral(L
, "static");
2075 lua_setfield(L
, -2, "win_gravity");
2081 /** Get or set mouse buttons bindings for a client.
2082 * \param L The Lua VM state.
2083 * \return The number of element pushed on stack.
2086 * \lparam An array of mouse button bindings objects, or nothing.
2087 * \return The array of mouse button bindings objects of this client.
2090 luaA_client_buttons(lua_State
*L
)
2092 client_t
*client
= luaA_client_checkudata(L
, 1);
2093 button_array_t
*buttons
= &client
->buttons
;
2095 if(lua_gettop(L
) == 2)
2097 luaA_button_array_set(L
, 1, 2, buttons
);
2098 luaA_object_emit_signal(L
, 1, "property::buttons", 0);
2099 window_buttons_grab(client
->window
, &client
->buttons
);
2102 return luaA_button_array_get(L
, 1, buttons
);
2105 /** Get or set keys bindings for a client.
2106 * \param L The Lua VM state.
2107 * \return The number of element pushed on stack.
2110 * \lparam An array of key bindings objects, or nothing.
2111 * \return The array of key bindings objects of this client.
2114 luaA_client_keys(lua_State
*L
)
2116 client_t
*c
= luaA_client_checkudata(L
, 1);
2117 key_array_t
*keys
= &c
->keys
;
2119 if(lua_gettop(L
) == 2)
2121 luaA_key_array_set(L
, 1, 2, keys
);
2122 luaA_object_emit_signal(L
, 1, "property::keys", 0);
2123 xcb_ungrab_key(globalconf
.connection
, XCB_GRAB_ANY
, c
->window
, XCB_BUTTON_MASK_ANY
);
2124 window_grabkeys(c
->window
, keys
);
2127 return luaA_key_array_get(L
, 1, keys
);
2131 * \param L The Lua VM state.
2132 * \return The number of pushed elements.
2135 luaA_client_module_index(lua_State
*L
)
2138 const char *buf
= luaL_checklstring(L
, 2, &len
);
2140 switch(a_tokenize(buf
, len
))
2143 return luaA_object_push(globalconf
.L
, globalconf
.screen_focus
->client_focus
);
2150 /* Client module new index.
2151 * \param L The Lua VM state.
2152 * \return The number of pushed elements.
2155 luaA_client_module_newindex(lua_State
*L
)
2158 const char *buf
= luaL_checklstring(L
, 2, &len
);
2161 switch(a_tokenize(buf
, len
))
2164 c
= luaA_client_checkudata(L
, 3);
2175 client_class_setup(lua_State
*L
)
2177 static const struct luaL_reg client_methods
[] =
2179 LUA_CLASS_METHODS(client
)
2180 { "get", luaA_client_get
},
2181 { "__index", luaA_client_module_index
},
2182 { "__newindex", luaA_client_module_newindex
},
2186 static const struct luaL_reg client_meta
[] =
2188 LUA_OBJECT_META(client
)
2190 { "buttons", luaA_client_buttons
},
2191 { "keys", luaA_client_keys
},
2192 { "isvisible", luaA_client_isvisible
},
2193 { "geometry", luaA_client_geometry
},
2194 { "struts", luaA_client_struts
},
2195 { "tags", luaA_client_tags
},
2196 { "kill", luaA_client_kill
},
2197 { "swap", luaA_client_swap
},
2198 { "raise", luaA_client_raise
},
2199 { "lower", luaA_client_lower
},
2200 { "redraw", luaA_client_redraw
},
2201 { "unmanage", luaA_client_unmanage
},
2202 { "__gc", luaA_client_gc
},
2206 luaA_class_setup(L
, &client_class
, "client", (lua_class_allocator_t
) client_new
,
2207 luaA_class_index_miss_property
, luaA_class_newindex_miss_property
,
2208 client_methods
, client_meta
);
2209 luaA_class_add_property(&client_class
, A_TK_NAME
,
2211 (lua_class_propfunc_t
) luaA_client_get_name
,
2213 luaA_class_add_property(&client_class
, A_TK_TRANSIENT_FOR
,
2215 (lua_class_propfunc_t
) luaA_client_get_transient_for
,
2217 luaA_class_add_property(&client_class
, A_TK_SKIP_TASKBAR
,
2218 (lua_class_propfunc_t
) luaA_client_set_skip_taskbar
,
2219 (lua_class_propfunc_t
) luaA_client_get_skip_taskbar
,
2220 (lua_class_propfunc_t
) luaA_client_set_skip_taskbar
);
2221 luaA_class_add_property(&client_class
, A_TK_CONTENT
,
2223 (lua_class_propfunc_t
) luaA_client_get_content
,
2225 luaA_class_add_property(&client_class
, A_TK_TYPE
,
2227 (lua_class_propfunc_t
) luaA_client_get_type
,
2229 luaA_class_add_property(&client_class
, A_TK_CLASS
,
2231 (lua_class_propfunc_t
) luaA_client_get_class
,
2233 luaA_class_add_property(&client_class
, A_TK_INSTANCE
,
2235 (lua_class_propfunc_t
) luaA_client_get_instance
,
2237 luaA_class_add_property(&client_class
, A_TK_ROLE
,
2239 (lua_class_propfunc_t
) luaA_client_get_role
,
2241 luaA_class_add_property(&client_class
, A_TK_PID
,
2243 (lua_class_propfunc_t
) luaA_client_get_pid
,
2245 luaA_class_add_property(&client_class
, A_TK_WINDOW
,
2247 (lua_class_propfunc_t
) luaA_client_get_window
,
2249 luaA_class_add_property(&client_class
, A_TK_LEADER_WINDOW
,
2251 (lua_class_propfunc_t
) luaA_client_get_leader_window
,
2253 luaA_class_add_property(&client_class
, A_TK_MACHINE
,
2255 (lua_class_propfunc_t
) luaA_client_get_machine
,
2257 luaA_class_add_property(&client_class
, A_TK_ICON_NAME
,
2259 (lua_class_propfunc_t
) luaA_client_get_icon_name
,
2261 luaA_class_add_property(&client_class
, A_TK_SCREEN
,
2263 (lua_class_propfunc_t
) luaA_client_get_screen
,
2264 (lua_class_propfunc_t
) luaA_client_set_screen
);
2265 luaA_class_add_property(&client_class
, A_TK_HIDDEN
,
2266 (lua_class_propfunc_t
) luaA_client_set_hidden
,
2267 (lua_class_propfunc_t
) luaA_client_get_hidden
,
2268 (lua_class_propfunc_t
) luaA_client_set_hidden
);
2269 luaA_class_add_property(&client_class
, A_TK_MINIMIZED
,
2270 (lua_class_propfunc_t
) luaA_client_set_minimized
,
2271 (lua_class_propfunc_t
) luaA_client_get_minimized
,
2272 (lua_class_propfunc_t
) luaA_client_set_minimized
);
2273 luaA_class_add_property(&client_class
, A_TK_FULLSCREEN
,
2274 (lua_class_propfunc_t
) luaA_client_set_fullscreen
,
2275 (lua_class_propfunc_t
) luaA_client_get_fullscreen
,
2276 (lua_class_propfunc_t
) luaA_client_set_fullscreen
);
2277 luaA_class_add_property(&client_class
, A_TK_MODAL
,
2278 (lua_class_propfunc_t
) luaA_client_set_modal
,
2279 (lua_class_propfunc_t
) luaA_client_get_modal
,
2280 (lua_class_propfunc_t
) luaA_client_set_modal
);
2281 luaA_class_add_property(&client_class
, A_TK_GROUP_WINDOW
,
2283 (lua_class_propfunc_t
) luaA_client_get_group_window
,
2285 luaA_class_add_property(&client_class
, A_TK_MAXIMIZED_HORIZONTAL
,
2286 (lua_class_propfunc_t
) luaA_client_set_maximized_horizontal
,
2287 (lua_class_propfunc_t
) luaA_client_get_maximized_horizontal
,
2288 (lua_class_propfunc_t
) luaA_client_set_maximized_horizontal
);
2289 luaA_class_add_property(&client_class
, A_TK_MAXIMIZED_VERTICAL
,
2290 (lua_class_propfunc_t
) luaA_client_set_maximized_vertical
,
2291 (lua_class_propfunc_t
) luaA_client_get_maximized_vertical
,
2292 (lua_class_propfunc_t
) luaA_client_set_maximized_vertical
);
2293 luaA_class_add_property(&client_class
, A_TK_ICON
,
2294 (lua_class_propfunc_t
) luaA_client_set_icon
,
2295 (lua_class_propfunc_t
) luaA_client_get_icon
,
2296 (lua_class_propfunc_t
) luaA_client_set_icon
);
2297 luaA_class_add_property(&client_class
, A_TK_OPACITY
,
2298 (lua_class_propfunc_t
) luaA_client_set_opacity
,
2299 (lua_class_propfunc_t
) luaA_client_get_opacity
,
2300 (lua_class_propfunc_t
) luaA_client_set_opacity
);
2301 luaA_class_add_property(&client_class
, A_TK_ONTOP
,
2302 (lua_class_propfunc_t
) luaA_client_set_ontop
,
2303 (lua_class_propfunc_t
) luaA_client_get_ontop
,
2304 (lua_class_propfunc_t
) luaA_client_set_ontop
);
2305 luaA_class_add_property(&client_class
, A_TK_ABOVE
,
2306 (lua_class_propfunc_t
) luaA_client_set_above
,
2307 (lua_class_propfunc_t
) luaA_client_get_above
,
2308 (lua_class_propfunc_t
) luaA_client_set_above
);
2309 luaA_class_add_property(&client_class
, A_TK_BELOW
,
2310 (lua_class_propfunc_t
) luaA_client_set_below
,
2311 (lua_class_propfunc_t
) luaA_client_get_below
,
2312 (lua_class_propfunc_t
) luaA_client_set_below
);
2313 luaA_class_add_property(&client_class
, A_TK_STICKY
,
2314 (lua_class_propfunc_t
) luaA_client_set_sticky
,
2315 (lua_class_propfunc_t
) luaA_client_get_sticky
,
2316 (lua_class_propfunc_t
) luaA_client_set_sticky
);
2317 luaA_class_add_property(&client_class
, A_TK_SIZE_HINTS_HONOR
,
2318 (lua_class_propfunc_t
) luaA_client_set_size_hints_honor
,
2319 (lua_class_propfunc_t
) luaA_client_get_size_hints_honor
,
2320 (lua_class_propfunc_t
) luaA_client_set_size_hints_honor
);
2321 luaA_class_add_property(&client_class
, A_TK_BORDER_WIDTH
,
2322 (lua_class_propfunc_t
) luaA_client_set_border_width
,
2323 (lua_class_propfunc_t
) luaA_client_get_border_width
,
2324 (lua_class_propfunc_t
) luaA_client_set_border_width
);
2325 luaA_class_add_property(&client_class
, A_TK_BORDER_COLOR
,
2326 (lua_class_propfunc_t
) luaA_client_set_border_color
,
2327 (lua_class_propfunc_t
) luaA_client_get_border_color
,
2328 (lua_class_propfunc_t
) luaA_client_set_border_color
);
2329 luaA_class_add_property(&client_class
, A_TK_TITLEBAR
,
2330 (lua_class_propfunc_t
) luaA_client_set_titlebar
,
2331 (lua_class_propfunc_t
) luaA_client_get_titlebar
,
2332 (lua_class_propfunc_t
) luaA_client_set_titlebar
);
2333 luaA_class_add_property(&client_class
, A_TK_URGENT
,
2334 (lua_class_propfunc_t
) luaA_client_set_urgent
,
2335 (lua_class_propfunc_t
) luaA_client_get_urgent
,
2336 (lua_class_propfunc_t
) luaA_client_set_urgent
);
2337 luaA_class_add_property(&client_class
, A_TK_SIZE_HINTS
,
2339 (lua_class_propfunc_t
) luaA_client_get_size_hints
,
2343 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80