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_icccm_get_wm_protocols_reply_wipe(&c
->protocols
);
56 p_delete(&c
->machine
);
58 p_delete(&c
->instance
);
59 p_delete(&c
->icon_name
);
60 p_delete(&c
->alt_icon_name
);
62 p_delete(&c
->alt_name
);
63 return luaA_object_gc(L
);
66 /** Change the client opacity.
67 * \param L The Lua VM state.
68 * \param cidx The client index.
69 * \param opacity The opacity.
72 client_set_opacity(lua_State
*L
, int cidx
, double opacity
)
74 client_t
*c
= luaA_client_checkudata(L
, cidx
);
76 if(c
->opacity
!= opacity
)
79 window_opacity_set(c
->window
, opacity
);
80 luaA_object_emit_signal(L
, cidx
, "property::opacity", 0);
84 /** Change the clients urgency flag.
85 * \param L The Lua VM state.
86 * \param cidx The client index on the stack.
87 * \param urgent The new flag state.
90 client_set_urgent(lua_State
*L
, int cidx
, bool urgent
)
92 client_t
*c
= luaA_client_checkudata(L
, cidx
);
94 if(c
->urgent
!= urgent
)
96 xcb_get_property_cookie_t hints
=
97 xcb_icccm_get_wm_hints_unchecked(globalconf
.connection
, c
->window
);
100 ewmh_client_update_hints(c
);
102 /* update ICCCM hints */
103 xcb_icccm_wm_hints_t wmh
;
104 xcb_icccm_get_wm_hints_reply(globalconf
.connection
, hints
, &wmh
, NULL
);
107 wmh
.flags
|= XCB_ICCCM_WM_HINT_X_URGENCY
;
109 wmh
.flags
&= ~XCB_ICCCM_WM_HINT_X_URGENCY
;
111 xcb_icccm_set_wm_hints(globalconf
.connection
, c
->window
, &wmh
);
113 hook_property(c
, "urgent");
114 luaA_object_emit_signal(L
, cidx
, "property::urgent", 0);
119 client_set_group_window(lua_State
*L
, int cidx
, xcb_window_t window
)
121 client_t
*c
= luaA_client_checkudata(L
, cidx
);
123 if(c
->group_window
!= window
)
125 c
->group_window
= window
;
126 luaA_object_emit_signal(L
, cidx
, "property::group_window", 0);
131 client_set_type(lua_State
*L
, int cidx
, window_type_t type
)
133 client_t
*c
= luaA_client_checkudata(L
, cidx
);
138 luaA_object_emit_signal(L
, cidx
, "property::type", 0);
143 client_set_pid(lua_State
*L
, int cidx
, uint32_t pid
)
145 client_t
*c
= luaA_client_checkudata(L
, cidx
);
150 luaA_object_emit_signal(L
, cidx
, "property::pid", 0);
155 client_set_icon_name(lua_State
*L
, int cidx
, char *icon_name
)
157 client_t
*c
= luaA_client_checkudata(L
, cidx
);
158 p_delete(&c
->icon_name
);
159 c
->icon_name
= icon_name
;
160 luaA_object_emit_signal(L
, cidx
, "property::icon_name", 0);
161 hook_property(c
, "icon_name");
165 client_set_alt_icon_name(lua_State
*L
, int cidx
, char *icon_name
)
167 client_t
*c
= luaA_client_checkudata(L
, cidx
);
168 p_delete(&c
->alt_icon_name
);
169 c
->alt_icon_name
= icon_name
;
170 luaA_object_emit_signal(L
, cidx
, "property::icon_name", 0);
171 hook_property(c
, "icon_name");
175 client_set_role(lua_State
*L
, int cidx
, char *role
)
177 client_t
*c
= luaA_client_checkudata(L
, cidx
);
180 luaA_object_emit_signal(L
, cidx
, "property::role", 0);
184 client_set_machine(lua_State
*L
, int cidx
, char *machine
)
186 client_t
*c
= luaA_client_checkudata(L
, cidx
);
187 p_delete(&c
->machine
);
188 c
->machine
= machine
;
189 luaA_object_emit_signal(L
, cidx
, "property::machine", 0);
193 client_set_class_instance(lua_State
*L
, int cidx
, const char *class, const char *instance
)
195 client_t
*c
= luaA_client_checkudata(L
, cidx
);
197 p_delete(&c
->instance
);
198 c
->class = a_strdup(class);
199 c
->instance
= a_strdup(instance
);
200 luaA_object_emit_signal(L
, cidx
, "property::class", 0);
201 luaA_object_emit_signal(L
, cidx
, "property::instance", 0);
205 client_set_transient_for(lua_State
*L
, int cidx
, client_t
*transient_for
)
207 client_t
*c
= luaA_client_checkudata(L
, cidx
);
209 if(c
->transient_for
!= transient_for
)
211 c
->transient_for
= transient_for
;
212 luaA_object_emit_signal(L
, cidx
, "property::transient_for", 0);
217 client_set_name(lua_State
*L
, int cidx
, char *name
)
219 client_t
*c
= luaA_client_checkudata(L
, cidx
);
222 hook_property(c
, "name");
223 luaA_object_emit_signal(L
, cidx
, "property::name", 0);
227 client_set_alt_name(lua_State
*L
, int cidx
, char *name
)
229 client_t
*c
= luaA_client_checkudata(L
, cidx
);
230 p_delete(&c
->alt_name
);
232 hook_property(c
, "name");
233 luaA_object_emit_signal(L
, cidx
, "property::name", 0);
236 /** Returns true if a client is tagged
237 * with one of the tags of the specified screen.
238 * \param c The client to check.
239 * \param screen Virtual screen.
240 * \return true if the client is visible, false otherwise.
243 client_maybevisible(client_t
*c
, screen_t
*screen
)
245 if(screen
&& c
->screen
== screen
)
250 foreach(tag
, screen
->tags
)
251 if(tag_get_selected(*tag
) && is_client_tagged(c
, *tag
))
257 /** Get a client by its window.
258 * \param w The client window to find.
259 * \return A client pointer if found, NULL otherwise.
262 client_getbywin(xcb_window_t w
)
264 foreach(c
, globalconf
.clients
)
265 if((*c
)->window
== w
)
271 /** Record that a client lost focus.
272 * \param c Client being unfocused
275 client_unfocus_update(client_t
*c
)
277 globalconf
.screens
.tab
[c
->phys_screen
].client_focus
= NULL
;
278 ewmh_update_net_active_window(c
->phys_screen
);
281 if(globalconf
.hooks
.unfocus
!= LUA_REFNIL
)
283 luaA_object_push(globalconf
.L
, c
);
284 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.unfocus
, 1, 0);
287 luaA_object_push(globalconf
.L
, c
);
288 luaA_class_emit_signal(globalconf
.L
, &client_class
, "unfocus", 1);
291 /** Unfocus a client.
292 * \param c The client.
295 client_unfocus(client_t
*c
)
298 xcb_window_t root_win
= xutil_screen_get(globalconf
.connection
, c
->phys_screen
)->root
;
299 /* Set focus on root window, so no events leak to the current window.
300 * This kind of inlines client_set_focus(), but a root window will never have
301 * the WM_TAKE_FOCUS protocol.
303 xcb_set_input_focus(globalconf
.connection
, XCB_INPUT_FOCUS_PARENT
,
304 root_win
, globalconf
.timestamp
);
306 client_unfocus_update(c
);
309 /** Check if client supports atom a protocol in WM_PROTOCOL.
310 * \param c The client.
311 * \param atom The protocol atom to check for.
312 * \return True if client has the atom in protocol, false otherwise.
315 client_hasproto(client_t
*c
, xcb_atom_t atom
)
317 for(uint32_t i
= 0; i
< c
->protocols
.atoms_len
; i
++)
318 if(c
->protocols
.atoms
[i
] == atom
)
323 /** Sets focus on window - using xcb_set_input_focus or WM_TAKE_FOCUS
324 * \param c Client that should get focus
325 * \param set_input_focus Should we call xcb_set_input_focus
328 client_set_focus(client_t
*c
, bool set_input_focus
)
330 bool takefocus
= client_hasproto(c
, WM_TAKE_FOCUS
);
332 xcb_set_input_focus(globalconf
.connection
, XCB_INPUT_FOCUS_PARENT
,
333 c
->window
, globalconf
.timestamp
);
335 window_takefocus(c
->window
);
338 /** Prepare banning a client by running all needed lua events.
339 * \param c The client.
341 void client_ban_unfocus(client_t
*c
)
343 if(globalconf
.screens
.tab
[c
->phys_screen
].prev_client_focus
== c
)
344 globalconf
.screens
.tab
[c
->phys_screen
].prev_client_focus
= NULL
;
346 /* Wait until the last moment to take away the focus from the window. */
347 if(globalconf
.screens
.tab
[c
->phys_screen
].client_focus
== c
)
351 /** Ban client and move it out of the viewport.
352 * \param c The client.
355 client_ban(client_t
*c
)
359 xcb_unmap_window(globalconf
.connection
, c
->window
);
363 client_ban_unfocus(c
);
367 /** This is part of The Bob Marley Algorithm: we ignore enter and leave window
368 * in certain cases, like map/unmap or move, so we don't get spurious events.
371 client_ignore_enterleave_events(void)
373 foreach(c
, globalconf
.clients
)
374 xcb_change_window_attributes(globalconf
.connection
,
377 (const uint32_t []) { CLIENT_SELECT_INPUT_EVENT_MASK
& ~(XCB_EVENT_MASK_ENTER_WINDOW
| XCB_EVENT_MASK_LEAVE_WINDOW
) });
381 client_restore_enterleave_events(void)
383 foreach(c
, globalconf
.clients
)
384 xcb_change_window_attributes(globalconf
.connection
,
387 (const uint32_t []) { CLIENT_SELECT_INPUT_EVENT_MASK
});
390 /** Record that a client got focus.
391 * \param c The client.
394 client_focus_update(client_t
*c
)
396 if(!client_maybevisible(c
, c
->screen
))
398 /* Focus previously focused client */
399 client_focus(globalconf
.screen_focus
->prev_client_focus
);
403 if(globalconf
.screen_focus
404 && globalconf
.screen_focus
->client_focus
)
406 if (globalconf
.screen_focus
->client_focus
!= c
)
407 client_unfocus_update(globalconf
.screen_focus
->client_focus
);
409 /* Already focused */
413 globalconf
.screen_focus
= &globalconf
.screens
.tab
[c
->phys_screen
];
414 globalconf
.screen_focus
->prev_client_focus
= c
;
415 globalconf
.screen_focus
->client_focus
= c
;
417 /* according to EWMH, we have to remove the urgent state from a client */
418 luaA_object_push(globalconf
.L
, c
);
419 client_set_urgent(globalconf
.L
, -1, false);
421 ewmh_update_net_active_window(c
->phys_screen
);
424 if(globalconf
.hooks
.focus
!= LUA_REFNIL
)
426 luaA_object_push(globalconf
.L
, c
);
427 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.focus
, 1, 0);
430 luaA_class_emit_signal(globalconf
.L
, &client_class
, "focus", 1);
433 /** Give focus to client, or to first client if client is NULL.
434 * \param c The client.
437 client_focus(client_t
*c
)
439 /* We have to set focus on first client */
440 if(!c
&& globalconf
.clients
.len
&& !(c
= globalconf
.clients
.tab
[0]))
443 if(!client_maybevisible(c
, c
->screen
))
446 /* X11 doesn't let you focus a window that isn't viewable */
450 client_focus_update(c
);
452 client_set_focus(c
, !c
->nofocus
);
455 /** Stack a window below.
456 * \param c The client.
457 * \param previous The previous window on the stack.
458 * \return The next-previous!
461 client_stack_above(client_t
*c
, xcb_window_t previous
)
463 uint32_t config_win_vals
[2];
465 config_win_vals
[0] = previous
;
466 config_win_vals
[1] = XCB_STACK_MODE_ABOVE
;
468 xcb_configure_window(globalconf
.connection
, c
->window
,
469 XCB_CONFIG_WINDOW_SIBLING
| XCB_CONFIG_WINDOW_STACK_MODE
,
472 config_win_vals
[0] = c
->window
;
476 xcb_configure_window(globalconf
.connection
,
478 XCB_CONFIG_WINDOW_SIBLING
| XCB_CONFIG_WINDOW_STACK_MODE
,
480 previous
= c
->titlebar
->window
;
483 previous
= c
->window
;
485 /* stack transient window on top of their parents */
486 foreach(node
, globalconf
.stack
)
487 if((*node
)->transient_for
== c
)
488 previous
= client_stack_above(*node
, previous
);
493 /** Stacking layout layers */
496 /** This one is a special layer */
504 /** This one only used for counting and is not a real layer */
508 /** Get the real layer of a client according to its attribute (fullscreen, …)
509 * \param c The client.
510 * \return The real layer.
513 client_layer_translator(client_t
*c
)
515 /* first deal with user set attributes */
518 else if(c
->fullscreen
&& globalconf
.screen_focus
->client_focus
== c
)
519 return LAYER_FULLSCREEN
;
525 /* check for transient attr */
529 /* then deal with windows type */
532 case WINDOW_TYPE_DESKTOP
:
533 return LAYER_DESKTOP
;
542 * \todo It might be worth stopping to restack everyone and only stack `c'
543 * relatively to the first matching in the list.
546 client_stack_refresh_screen(int screen
)
548 uint32_t config_win_vals
[2];
551 config_win_vals
[0] = XCB_NONE
;
552 config_win_vals
[1] = XCB_STACK_MODE_ABOVE
;
554 /* stack desktop windows */
555 for(layer
= LAYER_DESKTOP
; layer
< LAYER_BELOW
; layer
++)
556 foreach(node
, globalconf
.stack
)
557 if((*node
)->phys_screen
== screen
&& client_layer_translator(*node
) == layer
)
558 config_win_vals
[0] = client_stack_above(*node
,
561 /* first stack not ontop wibox window */
562 foreach(_sb
, globalconf
.wiboxes
)
565 if(sb
->ctx
.phys_screen
== screen
&& !sb
->ontop
)
567 xcb_configure_window(globalconf
.connection
,
569 XCB_CONFIG_WINDOW_SIBLING
| XCB_CONFIG_WINDOW_STACK_MODE
,
571 config_win_vals
[0] = sb
->window
;
575 /* then stack clients */
576 for(layer
= LAYER_BELOW
; layer
< LAYER_COUNT
; layer
++)
577 foreach(node
, globalconf
.stack
)
578 if((*node
)->phys_screen
== screen
&& client_layer_translator(*node
) == layer
)
579 config_win_vals
[0] = client_stack_above(*node
,
582 /* then stack ontop wibox window */
583 foreach(_sb
, globalconf
.wiboxes
)
586 if(sb
->ctx
.phys_screen
== screen
&& sb
->ontop
)
588 xcb_configure_window(globalconf
.connection
,
590 XCB_CONFIG_WINDOW_SIBLING
| XCB_CONFIG_WINDOW_STACK_MODE
,
592 config_win_vals
[0] = sb
->window
;
598 client_stack_refresh()
600 if (!globalconf
.client_need_stack_refresh
)
602 globalconf
.client_need_stack_refresh
= false;
605 screen
< xcb_setup_roots_length(xcb_get_setup(globalconf
.connection
));
607 client_stack_refresh_screen(screen
);
610 /** Manage a new client.
611 * \param w The window.
612 * \param wgeom Window geometry.
613 * \param phys_screen Physical screen number.
614 * \param startup True if we are managing at startup time.
617 client_manage(xcb_window_t w
, xcb_get_geometry_reply_t
*wgeom
, int phys_screen
, bool startup
)
619 const uint32_t select_input_val
[] = { CLIENT_SELECT_INPUT_EVENT_MASK
};
621 if(systray_iskdedockapp(w
))
623 systray_request_handle(w
, phys_screen
, NULL
);
627 /* If this is a new client that just has been launched, then request its
629 xcb_get_property_cookie_t startup_id_q
= { 0 };
631 startup_id_q
= xcb_get_property(globalconf
.connection
, false, w
,
632 _NET_STARTUP_ID
, XCB_GET_PROPERTY_TYPE_ANY
, 0, UINT_MAX
);
634 xcb_change_window_attributes(globalconf
.connection
, w
, XCB_CW_EVENT_MASK
, select_input_val
);
636 /* Make sure the window is automatically mapped if awesome exits or dies. */
637 xcb_change_save_set(globalconf
.connection
, XCB_SET_MODE_INSERT
, w
);
639 /* Move this window to the bottom of the stack. Without this we would force
640 * other windows which will be above this one to redraw themselves because
641 * this window occludes them for a tiny moment. The next stack_refresh()
642 * will fix this up and move the window to its correct place. */
643 xcb_configure_window(globalconf
.connection
, w
,
644 XCB_CONFIG_WINDOW_STACK_MODE
,
645 (uint32_t[]) { XCB_STACK_MODE_BELOW
});
647 client_t
*c
= client_new(globalconf
.L
);
649 /* This cannot change, ever. */
650 c
->phys_screen
= phys_screen
;
651 /* consider the window banned */
655 luaA_object_emit_signal(globalconf
.L
, -1, "property::window", 0);
657 /* Duplicate client and push it in client list */
658 lua_pushvalue(globalconf
.L
, -1);
659 client_array_push(&globalconf
.clients
, luaA_object_ref(globalconf
.L
, -1));
661 /* Set the right screen */
662 screen_client_moveto(c
, screen_getbycoord(&globalconf
.screens
.tab
[phys_screen
], wgeom
->x
, wgeom
->y
), false);
664 /* Store initial geometry and emits signals so we inform that geometry have
666 #define HANDLE_GEOM(attr) \
667 c->geometry.attr = wgeom->attr; \
668 c->geometries.internal.attr = wgeom->attr; \
669 luaA_object_emit_signal(globalconf.L, -1, "property::" #attr, 0);
676 luaA_object_emit_signal(globalconf
.L
, -1, "property::geometry", 0);
679 client_set_border_width(globalconf
.L
, -1, wgeom
->border_width
);
681 /* we honor size hints by default */
682 c
->size_hints_honor
= true;
683 luaA_object_emit_signal(globalconf
.L
, -1, "property::size_hints_honor", 0);
686 property_update_wm_normal_hints(c
, NULL
);
687 property_update_wm_hints(c
, NULL
);
688 property_update_wm_transient_for(c
, NULL
);
689 property_update_wm_client_leader(c
, NULL
);
690 property_update_wm_client_machine(c
, NULL
);
691 property_update_wm_window_role(c
, NULL
);
692 property_update_net_wm_pid(c
, NULL
);
693 property_update_net_wm_icon(c
, NULL
);
696 client_set_opacity(globalconf
.L
, -1, window_opacity_get(c
->window
));
698 /* Then check clients hints */
699 ewmh_client_check_hints(c
);
701 /* Push client in stack */
704 /* update window title */
705 property_update_wm_name(c
, NULL
);
706 property_update_net_wm_name(c
, NULL
);
707 property_update_wm_icon_name(c
, NULL
);
708 property_update_net_wm_icon_name(c
, NULL
);
709 property_update_wm_class(c
, NULL
);
710 property_update_wm_protocols(c
, NULL
);
713 ewmh_process_client_strut(c
, NULL
);
715 ewmh_update_net_client_list(c
->phys_screen
);
717 /* Always stay in NORMAL_STATE. Even though iconified seems more
718 * appropriate sometimes. The only possible loss is that clients not using
719 * visibility events may continue to process data (when banned).
720 * Without any exposes or other events the cost should be fairly limited though.
722 * Some clients may expect the window to be unmapped when STATE_ICONIFIED.
723 * Two conflicting parts of the ICCCM v2.0 (section 4.1.4):
725 * "Normal -> Iconic - The client should send a ClientMessage event as described later in this section."
726 * (note no explicit mention of unmapping, while Normal->Widthdrawn does mention that)
728 * "Once a client's window has left the Withdrawn state, the window will be mapped
729 * if it is in the Normal state and the window will be unmapped if it is in the Iconic state."
731 * At this stage it's just safer to keep it in normal state and avoid confusion.
733 window_state_set(c
->window
, XCB_ICCCM_WM_STATE_NORMAL
);
737 /* Request our response */
738 xcb_get_property_reply_t
*reply
=
739 xcb_get_property_reply(globalconf
.connection
, startup_id_q
, NULL
);
740 /* Say spawn that a client has been started, with startup id as argument */
741 char *startup_id
= xutil_get_text_property_from_reply(reply
);
743 spawn_start_notify(c
, startup_id
);
744 p_delete(&startup_id
);
747 /* Call hook to notify list change */
748 if(globalconf
.hooks
.clients
!= LUA_REFNIL
)
749 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.clients
, 0, 0);
751 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
754 if(globalconf
.hooks
.manage
!= LUA_REFNIL
)
756 luaA_object_push(globalconf
.L
, c
);
757 lua_pushboolean(globalconf
.L
, startup
);
758 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.manage
, 2, 0);
761 /* client is still on top of the stack; push startup value,
762 * and emit signals with 2 args */
763 lua_pushboolean(globalconf
.L
, startup
);
764 luaA_class_emit_signal(globalconf
.L
, &client_class
, "manage", 2);
767 /** Compute client geometry with respect to its geometry hints.
768 * \param c The client.
769 * \param geometry The geometry that the client might receive.
770 * \return The geometry the client must take respecting its hints.
773 client_geometry_hints(client_t
*c
, area_t geometry
)
775 int32_t basew
, baseh
, minw
, minh
;
776 int32_t real_basew
= 0, real_baseh
= 0;
778 /* base size is substituted with min size if not specified */
779 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_SIZE
)
781 basew
= c
->size_hints
.base_width
;
782 baseh
= c
->size_hints
.base_height
;
786 else if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_MIN_SIZE
)
788 basew
= c
->size_hints
.min_width
;
789 baseh
= c
->size_hints
.min_height
;
794 /* min size is substituted with base size if not specified */
795 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_MIN_SIZE
)
797 minw
= c
->size_hints
.min_width
;
798 minh
= c
->size_hints
.min_height
;
800 else if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_SIZE
)
802 minw
= c
->size_hints
.base_width
;
803 minh
= c
->size_hints
.base_height
;
808 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_ASPECT
809 && c
->size_hints
.min_aspect_den
> 0
810 && c
->size_hints
.max_aspect_den
> 0
811 && geometry
.height
- real_baseh
> 0
812 && geometry
.width
- real_basew
> 0)
815 * If a base size is provided along with the aspect ratio fields, the
816 * base size should be subtracted from the window size prior to checking
817 * that the aspect ratio falls in range. If a base size is not provided,
818 * nothing should be subtracted from the window size. (The minimum size
819 * is not to be used in place of the base size for this purpose.) */
820 double dx
= (double) (geometry
.width
- real_basew
);
821 double dy
= (double) (geometry
.height
- real_baseh
);
822 double min
= (double) c
->size_hints
.min_aspect_num
/ (double) c
->size_hints
.min_aspect_den
;
823 double max
= (double) c
->size_hints
.max_aspect_num
/ (double) c
->size_hints
.max_aspect_den
;
824 double ratio
= dx
/ dy
;
825 if(max
> 0 && min
> 0 && ratio
> 0)
829 /* dx is lower than allowed, make dy lower to compensate this
830 * (+ 0.5 to force proper rounding). */
832 geometry
.width
= (int) dx
+ real_basew
;
833 geometry
.height
= (int) dy
+ real_baseh
;
837 /* dx is too high, lower it (+0.5 for proper rounding) */
839 geometry
.width
= (int) dx
+ real_basew
;
840 geometry
.height
= (int) dy
+ real_baseh
;
846 geometry
.width
= MAX(geometry
.width
, minw
);
848 geometry
.height
= MAX(geometry
.height
, minh
);
850 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_MAX_SIZE
)
852 if(c
->size_hints
.max_width
)
853 geometry
.width
= MIN(geometry
.width
, c
->size_hints
.max_width
);
854 if(c
->size_hints
.max_height
)
855 geometry
.height
= MIN(geometry
.height
, c
->size_hints
.max_height
);
858 if(c
->size_hints
.flags
& (XCB_ICCCM_SIZE_HINT_P_RESIZE_INC
| XCB_ICCCM_SIZE_HINT_BASE_SIZE
)
859 && c
->size_hints
.width_inc
&& c
->size_hints
.height_inc
)
861 uint16_t t1
= geometry
.width
, t2
= geometry
.height
;
862 unsigned_subtract(t1
, basew
);
863 unsigned_subtract(t2
, baseh
);
864 geometry
.width
-= t1
% c
->size_hints
.width_inc
;
865 geometry
.height
-= t2
% c
->size_hints
.height_inc
;
871 /** Resize client window.
872 * The sizes given as parameters are with titlebar and borders!
873 * \param c Client to resize.
874 * \param geometry New window geometry.
875 * \param hints Use size hints.
876 * \return true if an actual resize occurred.
879 client_resize(client_t
*c
, area_t geometry
, bool hints
)
881 area_t geometry_internal
;
884 /* offscreen appearance fixes */
885 area
= display_area_get(c
->phys_screen
);
887 if(geometry
.x
> area
.width
)
888 geometry
.x
= area
.width
- geometry
.width
;
889 if(geometry
.y
> area
.height
)
890 geometry
.y
= area
.height
- geometry
.height
;
891 if(geometry
.x
+ geometry
.width
< 0)
893 if(geometry
.y
+ geometry
.height
< 0)
896 /* Real client geometry, please keep it contained to C code at the very least. */
898 geometry_internal
= titlebar_geometry_remove(c
->titlebar
, c
->border_width
, geometry
);
900 geometry_internal
= geometry
;
902 if(hints
&& !c
->fullscreen
)
903 geometry_internal
= client_geometry_hints(c
, geometry_internal
);
905 if(geometry_internal
.width
== 0 || geometry_internal
.height
== 0)
908 /* Also let client hints propagate to the "official" geometry. */
910 geometry
= titlebar_geometry_add(c
->titlebar
, c
->border_width
, geometry_internal
);
912 geometry
= geometry_internal
;
914 if(c
->geometries
.internal
.x
!= geometry_internal
.x
915 || c
->geometries
.internal
.y
!= geometry_internal
.y
916 || c
->geometries
.internal
.width
!= geometry_internal
.width
917 || c
->geometries
.internal
.height
!= geometry_internal
.height
)
919 screen_t
*new_screen
= screen_getbycoord(c
->screen
,
920 geometry_internal
.x
, geometry_internal
.y
);
922 /* Values to configure a window is an array where values are
923 * stored according to 'value_mask' */
926 c
->geometries
.internal
.x
= values
[0] = geometry_internal
.x
;
927 c
->geometries
.internal
.y
= values
[1] = geometry_internal
.y
;
928 c
->geometries
.internal
.width
= values
[2] = geometry_internal
.width
;
929 c
->geometries
.internal
.height
= values
[3] = geometry_internal
.height
;
931 /* Also store geometry including border and titlebar. */
932 c
->geometry
= geometry
;
934 titlebar_update_geometry(c
);
936 /* Ignore all spurious enter/leave notify events */
937 client_ignore_enterleave_events();
939 xcb_configure_window(globalconf
.connection
, c
->window
,
940 XCB_CONFIG_WINDOW_X
| XCB_CONFIG_WINDOW_Y
941 | XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT
,
944 client_restore_enterleave_events();
946 screen_client_moveto(c
, new_screen
, false);
949 hook_property(c
, "geometry");
951 luaA_object_push(globalconf
.L
, c
);
952 luaA_object_emit_signal(globalconf
.L
, -1, "property::geometry", 0);
953 /** \todo This need to be VERIFIED before it is emitted! */
954 luaA_object_emit_signal(globalconf
.L
, -1, "property::x", 0);
955 luaA_object_emit_signal(globalconf
.L
, -1, "property::y", 0);
956 luaA_object_emit_signal(globalconf
.L
, -1, "property::width", 0);
957 luaA_object_emit_signal(globalconf
.L
, -1, "property::height", 0);
958 lua_pop(globalconf
.L
, 1);
966 /** Set a client minimized, or not.
967 * \param L The Lua VM state.
968 * \param cidx The client index.
969 * \param s Set or not the client minimized.
972 client_set_minimized(lua_State
*L
, int cidx
, bool s
)
974 client_t
*c
= luaA_client_checkudata(L
, cidx
);
976 if(c
->minimized
!= s
)
979 banning_need_update((c
)->screen
);
981 window_state_set(c
->window
, XCB_ICCCM_WM_STATE_ICONIC
);
983 window_state_set(c
->window
, XCB_ICCCM_WM_STATE_NORMAL
);
984 ewmh_client_update_hints(c
);
985 if(strut_has_value(&c
->strut
))
986 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
988 hook_property(c
, "minimized");
989 luaA_object_emit_signal(L
, cidx
, "property::minimized", 0);
993 /** Set a client sticky, or not.
994 * \param L The Lua VM state.
995 * \param cidx The client index.
996 * \param s Set or not the client sticky.
999 client_set_sticky(lua_State
*L
, int cidx
, bool s
)
1001 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1006 banning_need_update((c
)->screen
);
1007 ewmh_client_update_hints(c
);
1008 hook_property(c
, "sticky");
1009 luaA_object_emit_signal(L
, cidx
, "property::sticky", 0);
1013 /** Set a client fullscreen, or not.
1014 * \param L The Lua VM state.
1015 * \param cidx The client index.
1016 * \param s Set or not the client fullscreen.
1019 client_set_fullscreen(lua_State
*L
, int cidx
, bool s
)
1021 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1023 if(c
->fullscreen
!= s
)
1027 /* become fullscreen! */
1030 /* Make sure the current geometry is stored without titlebar. */
1031 titlebar_ban(c
->titlebar
);
1032 /* remove any max state */
1033 client_set_maximized_horizontal(L
, cidx
, false);
1034 client_set_maximized_vertical(L
, cidx
, false);
1035 /* You can only be part of one of the special layers. */
1036 client_set_below(L
, cidx
, false);
1037 client_set_above(L
, cidx
, false);
1038 client_set_ontop(L
, cidx
, false);
1040 geometry
= screen_area_get(c
->screen
, false);
1041 c
->geometries
.fullscreen
= c
->geometry
;
1042 c
->border_width_fs
= c
->border_width
;
1043 client_set_border_width(L
, cidx
, 0);
1044 c
->fullscreen
= true;
1048 /* The titlebar was banned, unban! */
1049 titlebar_unban(c
->titlebar
);
1050 geometry
= titlebar_geometry_add(c
->titlebar
, 0, c
->geometries
.fullscreen
);
1051 c
->fullscreen
= false;
1052 client_set_border_width(L
, cidx
, c
->border_width_fs
);
1054 client_resize(c
, geometry
, false);
1056 ewmh_client_update_hints(c
);
1057 hook_property(c
, "fullscreen");
1058 luaA_object_emit_signal(L
, cidx
, "property::fullscreen", 0);
1062 /** Set a client horizontally maximized.
1063 * \param L The Lua VM state.
1064 * \param cidx The client index.
1065 * \param s The maximized status.
1068 client_set_maximized_horizontal(lua_State
*L
, int cidx
, bool s
)
1070 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1072 if(c
->maximized_horizontal
!= s
)
1076 if((c
->maximized_horizontal
= s
))
1078 /* remove fullscreen mode */
1079 client_set_fullscreen(L
, cidx
, false);
1081 geometry
= screen_area_get(c
->screen
, true);
1082 geometry
.y
= c
->geometry
.y
;
1083 geometry
.height
= c
->geometry
.height
;
1084 c
->geometries
.max
.x
= c
->geometry
.x
;
1085 c
->geometries
.max
.width
= c
->geometry
.width
;
1089 geometry
= c
->geometry
;
1090 geometry
.x
= c
->geometries
.max
.x
;
1091 geometry
.width
= c
->geometries
.max
.width
;
1094 client_resize(c
, geometry
, c
->size_hints_honor
);
1096 ewmh_client_update_hints(c
);
1097 hook_property(c
, "maximized_horizontal");
1098 luaA_object_emit_signal(L
, cidx
, "property::maximized_horizontal", 0);
1102 /** Set a client vertically maximized.
1103 * \param L The Lua VM state.
1104 * \param cidx The client index.
1105 * \param s The maximized status.
1108 client_set_maximized_vertical(lua_State
*L
, int cidx
, bool s
)
1110 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1112 if(c
->maximized_vertical
!= s
)
1116 if((c
->maximized_vertical
= s
))
1118 /* remove fullscreen mode */
1119 client_set_fullscreen(L
, cidx
, false);
1121 geometry
= screen_area_get(c
->screen
, true);
1122 geometry
.x
= c
->geometry
.x
;
1123 geometry
.width
= c
->geometry
.width
;
1124 c
->geometries
.max
.y
= c
->geometry
.y
;
1125 c
->geometries
.max
.height
= c
->geometry
.height
;
1129 geometry
= c
->geometry
;
1130 geometry
.y
= c
->geometries
.max
.y
;
1131 geometry
.height
= c
->geometries
.max
.height
;
1134 client_resize(c
, geometry
, c
->size_hints_honor
);
1136 ewmh_client_update_hints(c
);
1137 hook_property(c
, "maximized_vertical");
1138 luaA_object_emit_signal(L
, cidx
, "property::maximized_vertical", 0);
1142 /** Set a client above, or not.
1143 * \param L The Lua VM state.
1144 * \param cidx The client index.
1145 * \param s Set or not the client above.
1148 client_set_above(lua_State
*L
, int cidx
, bool s
)
1150 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1154 /* You can only be part of one of the special layers. */
1157 client_set_below(L
, cidx
, false);
1158 client_set_ontop(L
, cidx
, false);
1159 client_set_fullscreen(L
, cidx
, false);
1163 ewmh_client_update_hints(c
);
1165 hook_property(c
, "above");
1166 luaA_object_emit_signal(L
, cidx
, "property::above", 0);
1170 /** Set a client below, or not.
1171 * \param L The Lua VM state.
1172 * \param cidx The client index.
1173 * \param s Set or not the client below.
1176 client_set_below(lua_State
*L
, int cidx
, bool s
)
1178 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1182 /* You can only be part of one of the special layers. */
1185 client_set_above(L
, cidx
, false);
1186 client_set_ontop(L
, cidx
, false);
1187 client_set_fullscreen(L
, cidx
, false);
1191 ewmh_client_update_hints(c
);
1193 hook_property(c
, "below");
1194 luaA_object_emit_signal(L
, cidx
, "property::below", 0);
1198 /** Set a client modal, or not.
1199 * \param L The Lua VM state.
1200 * \param cidx The client index.
1201 * \param s Set or not the client modal attribute.
1204 client_set_modal(lua_State
*L
, int cidx
, bool s
)
1206 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1212 ewmh_client_update_hints(c
);
1214 hook_property(c
, "modal");
1215 luaA_object_emit_signal(L
, cidx
, "property::modal", 0);
1219 /** Set a client ontop, or not.
1220 * \param L The Lua VM state.
1221 * \param cidx The client index.
1222 * \param s Set or not the client ontop attribute.
1225 client_set_ontop(lua_State
*L
, int cidx
, bool s
)
1227 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1231 /* You can only be part of one of the special layers. */
1234 client_set_above(L
, cidx
, false);
1235 client_set_below(L
, cidx
, false);
1236 client_set_fullscreen(L
, cidx
, false);
1241 hook_property(c
, "ontop");
1242 luaA_object_emit_signal(L
, cidx
, "property::ontop", 0);
1246 /** Set a client skip taskbar attribute.
1247 * \param L Tha Lua VM state.
1248 * \param cidx The client index.
1249 * \param s Set or not the client skip taskbar attribute.
1252 client_set_skip_taskbar(lua_State
*L
, int cidx
, bool s
)
1254 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1256 if(c
->skip_taskbar
!= s
)
1258 c
->skip_taskbar
= s
;
1259 ewmh_client_update_hints(c
);
1260 luaA_object_emit_signal(L
, cidx
, "property::skip_taskbar", 0);
1264 /** Unban a client and move it back into the viewport.
1265 * \param c The client.
1268 client_unban(client_t
*c
)
1272 xcb_map_window(globalconf
.connection
, c
->window
);
1274 c
->isbanned
= false;
1276 /* An unbanned clients shouldn't be minimized */
1277 luaA_object_push(globalconf
.L
, c
);
1278 client_set_minimized(globalconf
.L
, -1, false);
1279 lua_pop(globalconf
.L
, 1);
1283 /** Unmanage a client.
1284 * \param c The client.
1287 client_unmanage(client_t
*c
)
1289 tag_array_t
*tags
= &c
->screen
->tags
;
1291 /* Reset transient_for attributes of widows that maybe referring to us */
1292 foreach(_tc
, globalconf
.clients
)
1294 client_t
*tc
= *_tc
;
1295 if(tc
->transient_for
== c
)
1296 tc
->transient_for
= NULL
;
1299 if(globalconf
.screens
.tab
[c
->phys_screen
].prev_client_focus
== c
)
1300 globalconf
.screens
.tab
[c
->phys_screen
].prev_client_focus
= NULL
;
1302 if(globalconf
.screens
.tab
[c
->phys_screen
].client_focus
== c
)
1305 /* remove client from global list and everywhere else */
1306 foreach(elem
, globalconf
.clients
)
1309 client_array_remove(&globalconf
.clients
, elem
);
1312 stack_client_remove(c
);
1313 for(int i
= 0; i
< tags
->len
; i
++)
1314 untag_client(c
, tags
->tab
[i
]);
1317 if(globalconf
.hooks
.unmanage
!= LUA_REFNIL
)
1319 luaA_object_push(globalconf
.L
, c
);
1320 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.unmanage
, 1, 0);
1323 luaA_object_push(globalconf
.L
, c
);
1324 luaA_class_emit_signal(globalconf
.L
, &client_class
, "unmanage", 1);
1326 /* Call hook to notify list change */
1327 if(globalconf
.hooks
.clients
!= LUA_REFNIL
)
1328 luaA_dofunction_from_registry(globalconf
.L
, globalconf
.hooks
.clients
, 0, 0);
1330 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
1332 if(strut_has_value(&c
->strut
))
1333 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
1335 titlebar_client_detach(c
);
1337 ewmh_update_net_client_list(c
->phys_screen
);
1339 /* Remove this window from the save set since this shouldn't be made visible
1340 * after a restart anymore. */
1341 xcb_change_save_set(globalconf
.connection
, XCB_SET_MODE_DELETE
, c
->window
);
1343 /* Do this last to avoid races with clients. According to ICCCM, clients
1344 * arent allowed to re-use the window until after this. */
1345 window_state_set(c
->window
, XCB_ICCCM_WM_STATE_WITHDRAWN
);
1347 /* set client as invalid */
1350 luaA_object_unref(globalconf
.L
, c
);
1353 /** Kill a client via a WM_DELETE_WINDOW request or KillClient if not
1355 * \param c The client to kill.
1358 client_kill(client_t
*c
)
1360 if(client_hasproto(c
, WM_DELETE_WINDOW
))
1362 xcb_client_message_event_t ev
;
1364 /* Initialize all of event's fields first */
1367 ev
.response_type
= XCB_CLIENT_MESSAGE
;
1368 ev
.window
= c
->window
;
1370 ev
.data
.data32
[1] = globalconf
.timestamp
;
1371 ev
.type
= WM_PROTOCOLS
;
1372 ev
.data
.data32
[0] = WM_DELETE_WINDOW
;
1374 xcb_send_event(globalconf
.connection
, false, c
->window
,
1375 XCB_EVENT_MASK_NO_EVENT
, (char *) &ev
);
1378 xcb_kill_client(globalconf
.connection
, c
->window
);
1381 /** Get all clients into a table.
1382 * \param L The Lua VM state.
1383 * \return The number of elements pushed on stack.
1385 * \lparam An optional screen number.
1386 * \lreturn A table with all clients.
1389 luaA_client_get(lua_State
*L
)
1393 screen
= luaL_optnumber(L
, 1, 0) - 1;
1398 foreach(c
, globalconf
.clients
)
1400 luaA_object_push(L
, *c
);
1401 lua_rawseti(L
, -2, i
++);
1405 luaA_checkscreen(screen
);
1406 foreach(c
, globalconf
.clients
)
1407 if((*c
)->screen
== &globalconf
.screens
.tab
[screen
])
1409 luaA_object_push(L
, *c
);
1410 lua_rawseti(L
, -2, i
++);
1417 /** Check if a client is visible on its screen.
1418 * \param L The Lua VM state.
1419 * \return The number of elements pushed on stack.
1422 * \lreturn A boolean value, true if the client is visible, false otherwise.
1425 luaA_client_isvisible(lua_State
*L
)
1427 client_t
*c
= luaA_client_checkudata(L
, 1);
1428 lua_pushboolean(L
, client_isvisible(c
, c
->screen
));
1432 /** Set client border width.
1433 * \param L The Lua VM state.
1434 * \param cidx The client index.
1435 * \param width The border width.
1438 client_set_border_width(lua_State
*L
, int cidx
, int width
)
1440 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1443 if(width
> 0 && (c
->type
== WINDOW_TYPE_DOCK
1444 || c
->type
== WINDOW_TYPE_SPLASH
1445 || c
->type
== WINDOW_TYPE_DESKTOP
1449 if(width
== c
->border_width
|| width
< 0)
1452 /* disallow change of border width if the client is fullscreen */
1456 /* Update geometry with the new border. */
1457 c
->geometry
.width
-= 2 * c
->border_width
;
1458 c
->geometry
.height
-= 2 * c
->border_width
;
1460 c
->border_width
= width
;
1461 xcb_configure_window(globalconf
.connection
, c
->window
,
1462 XCB_CONFIG_WINDOW_BORDER_WIDTH
, &w
);
1464 c
->geometry
.width
+= 2 * c
->border_width
;
1465 c
->geometry
.height
+= 2 * c
->border_width
;
1467 /* Changing border size also affects the size of the titlebar. */
1468 titlebar_update_geometry(c
);
1470 hook_property(c
, "border_width");
1471 luaA_object_emit_signal(L
, cidx
, "property::border_width", 0);
1474 /** Set a client icon.
1475 * \param L The Lua VM state.
1476 * \param cidx The client index on the stack.
1477 * \param iidx The image index on the stack.
1480 client_set_icon(lua_State
*L
, int cidx
, int iidx
)
1482 client_t
*c
= luaA_client_checkudata(L
, cidx
);
1483 /* convert index to absolute */
1484 cidx
= luaA_absindex(L
, cidx
);
1485 iidx
= luaA_absindex(L
, iidx
);
1486 luaA_checkudata(L
, iidx
, &image_class
);
1487 luaA_object_unref_item(L
, cidx
, c
->icon
);
1488 c
->icon
= luaA_object_ref_item(L
, cidx
, iidx
);
1489 luaA_object_emit_signal(L
, cidx
< iidx
? cidx
: cidx
- 1, "property::icon", 0);
1491 hook_property(c
, "icon");
1495 * \param L The Lua VM state.
1501 luaA_client_kill(lua_State
*L
)
1503 client_t
*c
= luaA_client_checkudata(L
, 1);
1508 /** Swap a client with another one.
1509 * \param L The Lua VM state.
1512 * \lparam A client to swap with.
1515 luaA_client_swap(lua_State
*L
)
1517 client_t
*c
= luaA_client_checkudata(L
, 1);
1518 client_t
*swap
= luaA_client_checkudata(L
, 2);
1522 client_t
**ref_c
= NULL
, **ref_swap
= NULL
;
1523 foreach(item
, globalconf
.clients
)
1527 else if(*item
== swap
)
1529 if(ref_c
&& ref_swap
)
1536 /* Call hook to notify list change */
1537 if(globalconf
.hooks
.clients
!= LUA_REFNIL
)
1538 luaA_dofunction_from_registry(L
, globalconf
.hooks
.clients
, 0, 0);
1540 luaA_class_emit_signal(globalconf
.L
, &client_class
, "list", 0);
1546 /** Access or set the client tags.
1547 * \param L The Lua VM state.
1548 * \return The number of elements pushed on stack.
1549 * \lparam A table with tags to set, or none to get the current tags table.
1550 * \return The clients tag.
1553 luaA_client_tags(lua_State
*L
)
1555 client_t
*c
= luaA_client_checkudata(L
, 1);
1556 tag_array_t
*tags
= &c
->screen
->tags
;
1559 if(lua_gettop(L
) == 2)
1561 luaA_checktable(L
, 2);
1562 for(int i
= 0; i
< tags
->len
; i
++)
1564 /* Only untag if we aren't going to add this tag again */
1567 while(lua_next(L
, 2))
1569 tag_t
*t
= lua_touserdata(L
, -1);
1570 /* Pop the value from lua_next */
1572 if (t
!= tags
->tab
[i
])
1575 /* Pop the key from lua_next */
1581 untag_client(c
, tags
->tab
[i
]);
1584 while(lua_next(L
, 2))
1591 if(is_client_tagged(c
, *tag
))
1593 luaA_object_push(L
, *tag
);
1594 lua_rawseti(L
, -2, ++j
);
1600 /** Raise a client on top of others which are on the same layer.
1601 * \param L The Lua VM state.
1606 luaA_client_raise(lua_State
*L
)
1608 client_t
*c
= luaA_client_checkudata(L
, 1);
1613 /** Lower a client on bottom of others which are on the same layer.
1614 * \param L The Lua VM state.
1619 luaA_client_lower(lua_State
*L
)
1621 client_t
*c
= luaA_client_checkudata(L
, 1);
1623 stack_client_push(c
);
1625 /* Traverse all transient layers. */
1626 for(client_t
*tc
= c
->transient_for
; tc
; tc
= tc
->transient_for
)
1627 stack_client_push(tc
);
1634 /** Redraw a client by unmapping and mapping it quickly.
1635 * \param L The Lua VM state.
1641 luaA_client_redraw(lua_State
*L
)
1643 client_t
*c
= luaA_client_checkudata(L
, 1);
1645 xcb_unmap_window(globalconf
.connection
, c
->window
);
1646 xcb_map_window(globalconf
.connection
, c
->window
);
1648 /* Set the focus on the current window if the redraw has been
1649 performed on the window where the pointer is currently on
1650 because after the unmapping/mapping, the focus is lost */
1651 if(globalconf
.screen_focus
->client_focus
== c
)
1660 /** Stop managing a client.
1661 * \param L The Lua VM state.
1662 * \return The number of elements pushed on stack.
1667 luaA_client_unmanage(lua_State
*L
)
1669 client_t
*c
= luaA_client_checkudata(L
, 1);
1674 /** Return client geometry.
1675 * \param L The Lua VM state.
1676 * \return The number of elements pushed on stack.
1678 * \lparam A table with new coordinates, or none.
1679 * \lreturn A table with client coordinates.
1682 luaA_client_geometry(lua_State
*L
)
1684 client_t
*c
= luaA_client_checkudata(L
, 1);
1686 if(lua_gettop(L
) == 2 && !lua_isnil(L
, 2))
1690 luaA_checktable(L
, 2);
1691 geometry
.x
= luaA_getopt_number(L
, 2, "x", c
->geometry
.x
);
1692 geometry
.y
= luaA_getopt_number(L
, 2, "y", c
->geometry
.y
);
1693 if(client_isfixed(c
))
1695 geometry
.width
= c
->geometry
.width
;
1696 geometry
.height
= c
->geometry
.height
;
1700 geometry
.width
= luaA_getopt_number(L
, 2, "width", c
->geometry
.width
);
1701 geometry
.height
= luaA_getopt_number(L
, 2, "height", c
->geometry
.height
);
1704 client_resize(c
, geometry
, c
->size_hints_honor
);
1707 return luaA_pusharea(L
, c
->geometry
);
1710 /** Return client struts (reserved space at the edge of the screen).
1711 * \param L The Lua VM state.
1712 * \return The number of elements pushed on stack.
1714 * \lparam A table with new strut values, or none.
1715 * \lreturn A table with strut values.
1718 luaA_client_struts(lua_State
*L
)
1720 client_t
*c
= luaA_client_checkudata(L
, 1);
1722 if(lua_gettop(L
) == 2)
1724 luaA_tostrut(L
, 2, &c
->strut
);
1725 ewmh_update_strut(c
->window
, &c
->strut
);
1726 hook_property(c
, "struts");
1727 luaA_object_emit_signal(L
, 1, "property::struts", 0);
1728 screen_emit_signal(L
, c
->screen
, "property::workarea", 0);
1731 return luaA_pushstrut(L
, c
->strut
);
1735 luaA_client_set_screen(lua_State
*L
, client_t
*c
)
1737 if(globalconf
.xinerama_is_active
)
1739 int screen
= luaL_checknumber(L
, -1) - 1;
1740 luaA_checkscreen(screen
);
1741 screen_client_moveto(c
, &globalconf
.screens
.tab
[screen
], true);
1747 luaA_client_set_hidden(lua_State
*L
, client_t
*c
)
1749 bool b
= luaA_checkboolean(L
, -1);
1753 banning_need_update((c
)->screen
);
1754 hook_property(c
, "hidden");
1755 if(strut_has_value(&c
->strut
))
1756 screen_emit_signal(globalconf
.L
, c
->screen
, "property::workarea", 0);
1757 luaA_object_emit_signal(L
, -3, "property::hidden", 0);
1763 luaA_client_set_minimized(lua_State
*L
, client_t
*c
)
1765 client_set_minimized(L
, -3, luaA_checkboolean(L
, -1));
1770 luaA_client_set_fullscreen(lua_State
*L
, client_t
*c
)
1772 client_set_fullscreen(L
, -3, luaA_checkboolean(L
, -1));
1777 luaA_client_set_modal(lua_State
*L
, client_t
*c
)
1779 client_set_modal(L
, -3, luaA_checkboolean(L
, -1));
1784 luaA_client_set_maximized_horizontal(lua_State
*L
, client_t
*c
)
1786 client_set_maximized_horizontal(L
, -3, luaA_checkboolean(L
, -1));
1791 luaA_client_set_maximized_vertical(lua_State
*L
, client_t
*c
)
1793 client_set_maximized_vertical(L
, -3, luaA_checkboolean(L
, -1));
1798 luaA_client_set_icon(lua_State
*L
, client_t
*c
)
1800 client_set_icon(L
, -3, -1);
1805 luaA_client_set_opacity(lua_State
*L
, client_t
*c
)
1807 if(lua_isnil(L
, -1))
1808 client_set_opacity(L
, -3, -1);
1810 client_set_opacity(L
, -3, luaL_checknumber(L
, -1));
1815 luaA_client_set_sticky(lua_State
*L
, client_t
*c
)
1817 client_set_sticky(L
, -3, luaA_checkboolean(L
, -1));
1822 luaA_client_set_size_hints_honor(lua_State
*L
, client_t
*c
)
1824 c
->size_hints_honor
= luaA_checkboolean(L
, -1);
1825 hook_property(c
, "size_hints_honor");
1826 luaA_object_emit_signal(L
, -3, "property::size_hints_honor", 0);
1831 luaA_client_set_border_width(lua_State
*L
, client_t
*c
)
1833 client_set_border_width(L
, -3, luaL_checknumber(L
, -1));
1838 luaA_client_set_ontop(lua_State
*L
, client_t
*c
)
1840 client_set_ontop(L
, -3, luaA_checkboolean(L
, -1));
1845 luaA_client_set_below(lua_State
*L
, client_t
*c
)
1847 client_set_below(L
, -3, luaA_checkboolean(L
, -1));
1852 luaA_client_set_above(lua_State
*L
, client_t
*c
)
1854 client_set_above(L
, -3, luaA_checkboolean(L
, -1));
1859 luaA_client_set_urgent(lua_State
*L
, client_t
*c
)
1861 client_set_urgent(L
, -3, luaA_checkboolean(L
, -1));
1866 luaA_client_set_border_color(lua_State
*L
, client_t
*c
)
1870 if((buf
= luaL_checklstring(L
, -1, &len
))
1871 && xcolor_init_reply(xcolor_init_unchecked(&c
->border_color
, buf
, len
)))
1873 xcb_change_window_attributes(globalconf
.connection
, c
->window
,
1874 XCB_CW_BORDER_PIXEL
, &c
->border_color
.pixel
);
1875 luaA_object_emit_signal(L
, -3, "property::border_color", 0);
1881 luaA_client_set_titlebar(lua_State
*L
, client_t
*c
)
1883 if(lua_isnil(L
, -1))
1884 titlebar_client_detach(c
);
1886 titlebar_client_attach(c
);
1891 luaA_client_set_skip_taskbar(lua_State
*L
, client_t
*c
)
1893 client_set_skip_taskbar(L
, -3, luaA_checkboolean(L
, -1));
1898 luaA_client_get_name(lua_State
*L
, client_t
*c
)
1900 lua_pushstring(L
, c
->name
? c
->name
: c
->alt_name
);
1905 luaA_client_get_icon_name(lua_State
*L
, client_t
*c
)
1907 lua_pushstring(L
, c
->icon_name
? c
->icon_name
: c
->alt_icon_name
);
1911 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, class, lua_pushstring
)
1912 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, instance
, lua_pushstring
)
1913 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, machine
, lua_pushstring
)
1914 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, role
, lua_pushstring
)
1915 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, transient_for
, luaA_object_push
)
1916 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, skip_taskbar
, lua_pushboolean
)
1917 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, window
, lua_pushnumber
)
1918 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, leader_window
, lua_pushnumber
)
1919 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, group_window
, lua_pushnumber
)
1920 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, pid
, lua_pushnumber
)
1921 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, hidden
, lua_pushboolean
)
1922 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, minimized
, lua_pushboolean
)
1923 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, fullscreen
, lua_pushboolean
)
1924 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, modal
, lua_pushboolean
)
1925 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, ontop
, lua_pushboolean
)
1926 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, urgent
, lua_pushboolean
)
1927 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, above
, lua_pushboolean
)
1928 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, below
, lua_pushboolean
)
1929 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, sticky
, lua_pushboolean
)
1930 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, size_hints_honor
, lua_pushboolean
)
1931 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, maximized_horizontal
, lua_pushboolean
)
1932 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, maximized_vertical
, lua_pushboolean
)
1933 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, opacity
, lua_pushnumber
)
1934 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, border_width
, lua_pushnumber
)
1935 LUA_OBJECT_EXPORT_PROPERTY(client
, client_t
, border_color
, luaA_pushxcolor
)
1938 luaA_client_get_content(lua_State
*L
, client_t
*c
)
1940 xcb_image_t
*ximage
= xcb_image_get(globalconf
.connection
,
1943 c
->geometries
.internal
.width
,
1944 c
->geometries
.internal
.height
,
1945 ~0, XCB_IMAGE_FORMAT_Z_PIXMAP
);
1950 if(ximage
->bpp
>= 24)
1952 uint32_t *data
= p_alloca(uint32_t, ximage
->width
* ximage
->height
);
1954 for(int y
= 0; y
< ximage
->height
; y
++)
1955 for(int x
= 0; x
< ximage
->width
; x
++)
1957 data
[y
* ximage
->width
+ x
] = xcb_image_get_pixel(ximage
, x
, y
);
1958 data
[y
* ximage
->width
+ x
] |= 0xff000000; /* set alpha to 0xff */
1961 retval
= image_new_from_argb32(ximage
->width
, ximage
->height
, data
);
1963 xcb_image_destroy(ximage
);
1970 luaA_client_get_type(lua_State
*L
, client_t
*c
)
1974 case WINDOW_TYPE_DESKTOP
:
1975 lua_pushliteral(L
, "desktop");
1977 case WINDOW_TYPE_DOCK
:
1978 lua_pushliteral(L
, "dock");
1980 case WINDOW_TYPE_SPLASH
:
1981 lua_pushliteral(L
, "splash");
1983 case WINDOW_TYPE_DIALOG
:
1984 lua_pushliteral(L
, "dialog");
1986 case WINDOW_TYPE_MENU
:
1987 lua_pushliteral(L
, "menu");
1989 case WINDOW_TYPE_TOOLBAR
:
1990 lua_pushliteral(L
, "toolbar");
1992 case WINDOW_TYPE_UTILITY
:
1993 lua_pushliteral(L
, "utility");
1995 case WINDOW_TYPE_DROPDOWN_MENU
:
1996 lua_pushliteral(L
, "dropdown_menu");
1998 case WINDOW_TYPE_POPUP_MENU
:
1999 lua_pushliteral(L
, "popup_menu");
2001 case WINDOW_TYPE_TOOLTIP
:
2002 lua_pushliteral(L
, "tooltip");
2004 case WINDOW_TYPE_NOTIFICATION
:
2005 lua_pushliteral(L
, "notification");
2007 case WINDOW_TYPE_COMBO
:
2008 lua_pushliteral(L
, "combo");
2010 case WINDOW_TYPE_DND
:
2011 lua_pushliteral(L
, "dnd");
2013 case WINDOW_TYPE_NORMAL
:
2014 lua_pushliteral(L
, "normal");
2021 luaA_client_get_screen(lua_State
*L
, client_t
*c
)
2025 lua_pushnumber(L
, 1 + screen_array_indexof(&globalconf
.screens
, c
->screen
));
2030 luaA_client_get_icon(lua_State
*L
, client_t
*c
)
2032 return luaA_object_push_item(L
, -2, c
->icon
);
2036 luaA_client_get_titlebar(lua_State
*L
, client_t
*c
)
2038 return luaA_object_push(L
, c
->titlebar
);
2042 luaA_client_get_focusable(lua_State
*L
, client_t
*c
)
2046 /* A client can be focused if it doesnt have the "nofocus" hint...*/
2050 /* ...or if it knows the WM_TAKE_FOCUS protocol */
2051 ret
= client_hasproto(c
, WM_TAKE_FOCUS
);
2053 lua_pushboolean(L
, ret
);
2058 luaA_client_get_size_hints(lua_State
*L
, client_t
*c
)
2060 const char *u_or_p
= NULL
;
2062 lua_createtable(L
, 0, 1);
2064 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_US_POSITION
)
2065 u_or_p
= "user_position";
2066 else if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_POSITION
)
2067 u_or_p
= "program_position";
2071 lua_createtable(L
, 0, 2);
2072 lua_pushnumber(L
, c
->size_hints
.x
);
2073 lua_setfield(L
, -2, "x");
2074 lua_pushnumber(L
, c
->size_hints
.y
);
2075 lua_setfield(L
, -2, "y");
2076 lua_setfield(L
, -2, u_or_p
);
2080 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_US_SIZE
)
2081 u_or_p
= "user_size";
2082 else if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_SIZE
)
2083 u_or_p
= "program_size";
2087 lua_createtable(L
, 0, 2);
2088 lua_pushnumber(L
, c
->size_hints
.width
);
2089 lua_setfield(L
, -2, "width");
2090 lua_pushnumber(L
, c
->size_hints
.height
);
2091 lua_setfield(L
, -2, "height");
2092 lua_setfield(L
, -2, u_or_p
);
2095 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_MIN_SIZE
)
2097 lua_pushnumber(L
, c
->size_hints
.min_width
);
2098 lua_setfield(L
, -2, "min_width");
2099 lua_pushnumber(L
, c
->size_hints
.min_height
);
2100 lua_setfield(L
, -2, "min_height");
2103 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_MAX_SIZE
)
2105 lua_pushnumber(L
, c
->size_hints
.max_width
);
2106 lua_setfield(L
, -2, "max_width");
2107 lua_pushnumber(L
, c
->size_hints
.max_height
);
2108 lua_setfield(L
, -2, "max_height");
2111 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_RESIZE_INC
)
2113 lua_pushnumber(L
, c
->size_hints
.width_inc
);
2114 lua_setfield(L
, -2, "width_inc");
2115 lua_pushnumber(L
, c
->size_hints
.height_inc
);
2116 lua_setfield(L
, -2, "height_inc");
2119 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_ASPECT
)
2121 lua_pushnumber(L
, c
->size_hints
.min_aspect_num
);
2122 lua_setfield(L
, -2, "min_aspect_num");
2123 lua_pushnumber(L
, c
->size_hints
.min_aspect_den
);
2124 lua_setfield(L
, -2, "min_aspect_den");
2125 lua_pushnumber(L
, c
->size_hints
.max_aspect_num
);
2126 lua_setfield(L
, -2, "max_aspect_num");
2127 lua_pushnumber(L
, c
->size_hints
.max_aspect_den
);
2128 lua_setfield(L
, -2, "max_aspect_den");
2131 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_BASE_SIZE
)
2133 lua_pushnumber(L
, c
->size_hints
.base_width
);
2134 lua_setfield(L
, -2, "base_width");
2135 lua_pushnumber(L
, c
->size_hints
.base_height
);
2136 lua_setfield(L
, -2, "base_height");
2139 if(c
->size_hints
.flags
& XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY
)
2141 switch(c
->size_hints
.win_gravity
)
2144 lua_pushliteral(L
, "north_west");
2146 case XCB_GRAVITY_NORTH
:
2147 lua_pushliteral(L
, "north");
2149 case XCB_GRAVITY_NORTH_EAST
:
2150 lua_pushliteral(L
, "north_east");
2152 case XCB_GRAVITY_WEST
:
2153 lua_pushliteral(L
, "west");
2155 case XCB_GRAVITY_CENTER
:
2156 lua_pushliteral(L
, "center");
2158 case XCB_GRAVITY_EAST
:
2159 lua_pushliteral(L
, "east");
2161 case XCB_GRAVITY_SOUTH_WEST
:
2162 lua_pushliteral(L
, "south_west");
2164 case XCB_GRAVITY_SOUTH
:
2165 lua_pushliteral(L
, "south");
2167 case XCB_GRAVITY_SOUTH_EAST
:
2168 lua_pushliteral(L
, "south_east");
2170 case XCB_GRAVITY_STATIC
:
2171 lua_pushliteral(L
, "static");
2174 lua_setfield(L
, -2, "win_gravity");
2180 /** Get or set mouse buttons bindings for a client.
2181 * \param L The Lua VM state.
2182 * \return The number of element pushed on stack.
2185 * \lparam An array of mouse button bindings objects, or nothing.
2186 * \return The array of mouse button bindings objects of this client.
2189 luaA_client_buttons(lua_State
*L
)
2191 client_t
*client
= luaA_client_checkudata(L
, 1);
2192 button_array_t
*buttons
= &client
->buttons
;
2194 if(lua_gettop(L
) == 2)
2196 luaA_button_array_set(L
, 1, 2, buttons
);
2197 luaA_object_emit_signal(L
, 1, "property::buttons", 0);
2198 window_buttons_grab(client
->window
, &client
->buttons
);
2201 return luaA_button_array_get(L
, 1, buttons
);
2204 /** Get or set keys bindings for a client.
2205 * \param L The Lua VM state.
2206 * \return The number of element pushed on stack.
2209 * \lparam An array of key bindings objects, or nothing.
2210 * \return The array of key bindings objects of this client.
2213 luaA_client_keys(lua_State
*L
)
2215 client_t
*c
= luaA_client_checkudata(L
, 1);
2216 key_array_t
*keys
= &c
->keys
;
2218 if(lua_gettop(L
) == 2)
2220 luaA_key_array_set(L
, 1, 2, keys
);
2221 luaA_object_emit_signal(L
, 1, "property::keys", 0);
2222 xcb_ungrab_key(globalconf
.connection
, XCB_GRAB_ANY
, c
->window
, XCB_BUTTON_MASK_ANY
);
2223 window_grabkeys(c
->window
, keys
);
2226 return luaA_key_array_get(L
, 1, keys
);
2230 * \param L The Lua VM state.
2231 * \return The number of pushed elements.
2234 luaA_client_module_index(lua_State
*L
)
2237 const char *buf
= luaL_checklstring(L
, 2, &len
);
2239 switch(a_tokenize(buf
, len
))
2242 return luaA_object_push(globalconf
.L
, globalconf
.screen_focus
->client_focus
);
2249 /* Client module new index.
2250 * \param L The Lua VM state.
2251 * \return The number of pushed elements.
2254 luaA_client_module_newindex(lua_State
*L
)
2257 const char *buf
= luaL_checklstring(L
, 2, &len
);
2260 switch(a_tokenize(buf
, len
))
2263 c
= luaA_client_checkudata(L
, 3);
2274 client_class_setup(lua_State
*L
)
2276 static const struct luaL_reg client_methods
[] =
2278 LUA_CLASS_METHODS(client
)
2279 { "get", luaA_client_get
},
2280 { "__index", luaA_client_module_index
},
2281 { "__newindex", luaA_client_module_newindex
},
2285 static const struct luaL_reg client_meta
[] =
2287 LUA_OBJECT_META(client
)
2289 { "buttons", luaA_client_buttons
},
2290 { "keys", luaA_client_keys
},
2291 { "isvisible", luaA_client_isvisible
},
2292 { "geometry", luaA_client_geometry
},
2293 { "struts", luaA_client_struts
},
2294 { "tags", luaA_client_tags
},
2295 { "kill", luaA_client_kill
},
2296 { "swap", luaA_client_swap
},
2297 { "raise", luaA_client_raise
},
2298 { "lower", luaA_client_lower
},
2299 { "redraw", luaA_client_redraw
},
2300 { "unmanage", luaA_client_unmanage
},
2301 { "__gc", luaA_client_gc
},
2305 luaA_class_setup(L
, &client_class
, "client", (lua_class_allocator_t
) client_new
,
2306 luaA_class_index_miss_property
, luaA_class_newindex_miss_property
,
2307 client_methods
, client_meta
);
2308 luaA_class_add_property(&client_class
, A_TK_NAME
,
2310 (lua_class_propfunc_t
) luaA_client_get_name
,
2312 luaA_class_add_property(&client_class
, A_TK_TRANSIENT_FOR
,
2314 (lua_class_propfunc_t
) luaA_client_get_transient_for
,
2316 luaA_class_add_property(&client_class
, A_TK_SKIP_TASKBAR
,
2317 (lua_class_propfunc_t
) luaA_client_set_skip_taskbar
,
2318 (lua_class_propfunc_t
) luaA_client_get_skip_taskbar
,
2319 (lua_class_propfunc_t
) luaA_client_set_skip_taskbar
);
2320 luaA_class_add_property(&client_class
, A_TK_CONTENT
,
2322 (lua_class_propfunc_t
) luaA_client_get_content
,
2324 luaA_class_add_property(&client_class
, A_TK_TYPE
,
2326 (lua_class_propfunc_t
) luaA_client_get_type
,
2328 luaA_class_add_property(&client_class
, A_TK_CLASS
,
2330 (lua_class_propfunc_t
) luaA_client_get_class
,
2332 luaA_class_add_property(&client_class
, A_TK_INSTANCE
,
2334 (lua_class_propfunc_t
) luaA_client_get_instance
,
2336 luaA_class_add_property(&client_class
, A_TK_ROLE
,
2338 (lua_class_propfunc_t
) luaA_client_get_role
,
2340 luaA_class_add_property(&client_class
, A_TK_PID
,
2342 (lua_class_propfunc_t
) luaA_client_get_pid
,
2344 luaA_class_add_property(&client_class
, A_TK_WINDOW
,
2346 (lua_class_propfunc_t
) luaA_client_get_window
,
2348 luaA_class_add_property(&client_class
, A_TK_LEADER_WINDOW
,
2350 (lua_class_propfunc_t
) luaA_client_get_leader_window
,
2352 luaA_class_add_property(&client_class
, A_TK_MACHINE
,
2354 (lua_class_propfunc_t
) luaA_client_get_machine
,
2356 luaA_class_add_property(&client_class
, A_TK_ICON_NAME
,
2358 (lua_class_propfunc_t
) luaA_client_get_icon_name
,
2360 luaA_class_add_property(&client_class
, A_TK_SCREEN
,
2362 (lua_class_propfunc_t
) luaA_client_get_screen
,
2363 (lua_class_propfunc_t
) luaA_client_set_screen
);
2364 luaA_class_add_property(&client_class
, A_TK_HIDDEN
,
2365 (lua_class_propfunc_t
) luaA_client_set_hidden
,
2366 (lua_class_propfunc_t
) luaA_client_get_hidden
,
2367 (lua_class_propfunc_t
) luaA_client_set_hidden
);
2368 luaA_class_add_property(&client_class
, A_TK_MINIMIZED
,
2369 (lua_class_propfunc_t
) luaA_client_set_minimized
,
2370 (lua_class_propfunc_t
) luaA_client_get_minimized
,
2371 (lua_class_propfunc_t
) luaA_client_set_minimized
);
2372 luaA_class_add_property(&client_class
, A_TK_FULLSCREEN
,
2373 (lua_class_propfunc_t
) luaA_client_set_fullscreen
,
2374 (lua_class_propfunc_t
) luaA_client_get_fullscreen
,
2375 (lua_class_propfunc_t
) luaA_client_set_fullscreen
);
2376 luaA_class_add_property(&client_class
, A_TK_MODAL
,
2377 (lua_class_propfunc_t
) luaA_client_set_modal
,
2378 (lua_class_propfunc_t
) luaA_client_get_modal
,
2379 (lua_class_propfunc_t
) luaA_client_set_modal
);
2380 luaA_class_add_property(&client_class
, A_TK_GROUP_WINDOW
,
2382 (lua_class_propfunc_t
) luaA_client_get_group_window
,
2384 luaA_class_add_property(&client_class
, A_TK_MAXIMIZED_HORIZONTAL
,
2385 (lua_class_propfunc_t
) luaA_client_set_maximized_horizontal
,
2386 (lua_class_propfunc_t
) luaA_client_get_maximized_horizontal
,
2387 (lua_class_propfunc_t
) luaA_client_set_maximized_horizontal
);
2388 luaA_class_add_property(&client_class
, A_TK_MAXIMIZED_VERTICAL
,
2389 (lua_class_propfunc_t
) luaA_client_set_maximized_vertical
,
2390 (lua_class_propfunc_t
) luaA_client_get_maximized_vertical
,
2391 (lua_class_propfunc_t
) luaA_client_set_maximized_vertical
);
2392 luaA_class_add_property(&client_class
, A_TK_ICON
,
2393 (lua_class_propfunc_t
) luaA_client_set_icon
,
2394 (lua_class_propfunc_t
) luaA_client_get_icon
,
2395 (lua_class_propfunc_t
) luaA_client_set_icon
);
2396 luaA_class_add_property(&client_class
, A_TK_OPACITY
,
2397 (lua_class_propfunc_t
) luaA_client_set_opacity
,
2398 (lua_class_propfunc_t
) luaA_client_get_opacity
,
2399 (lua_class_propfunc_t
) luaA_client_set_opacity
);
2400 luaA_class_add_property(&client_class
, A_TK_ONTOP
,
2401 (lua_class_propfunc_t
) luaA_client_set_ontop
,
2402 (lua_class_propfunc_t
) luaA_client_get_ontop
,
2403 (lua_class_propfunc_t
) luaA_client_set_ontop
);
2404 luaA_class_add_property(&client_class
, A_TK_ABOVE
,
2405 (lua_class_propfunc_t
) luaA_client_set_above
,
2406 (lua_class_propfunc_t
) luaA_client_get_above
,
2407 (lua_class_propfunc_t
) luaA_client_set_above
);
2408 luaA_class_add_property(&client_class
, A_TK_BELOW
,
2409 (lua_class_propfunc_t
) luaA_client_set_below
,
2410 (lua_class_propfunc_t
) luaA_client_get_below
,
2411 (lua_class_propfunc_t
) luaA_client_set_below
);
2412 luaA_class_add_property(&client_class
, A_TK_STICKY
,
2413 (lua_class_propfunc_t
) luaA_client_set_sticky
,
2414 (lua_class_propfunc_t
) luaA_client_get_sticky
,
2415 (lua_class_propfunc_t
) luaA_client_set_sticky
);
2416 luaA_class_add_property(&client_class
, A_TK_SIZE_HINTS_HONOR
,
2417 (lua_class_propfunc_t
) luaA_client_set_size_hints_honor
,
2418 (lua_class_propfunc_t
) luaA_client_get_size_hints_honor
,
2419 (lua_class_propfunc_t
) luaA_client_set_size_hints_honor
);
2420 luaA_class_add_property(&client_class
, A_TK_BORDER_WIDTH
,
2421 (lua_class_propfunc_t
) luaA_client_set_border_width
,
2422 (lua_class_propfunc_t
) luaA_client_get_border_width
,
2423 (lua_class_propfunc_t
) luaA_client_set_border_width
);
2424 luaA_class_add_property(&client_class
, A_TK_BORDER_COLOR
,
2425 (lua_class_propfunc_t
) luaA_client_set_border_color
,
2426 (lua_class_propfunc_t
) luaA_client_get_border_color
,
2427 (lua_class_propfunc_t
) luaA_client_set_border_color
);
2428 luaA_class_add_property(&client_class
, A_TK_TITLEBAR
,
2429 (lua_class_propfunc_t
) luaA_client_set_titlebar
,
2430 (lua_class_propfunc_t
) luaA_client_get_titlebar
,
2431 (lua_class_propfunc_t
) luaA_client_set_titlebar
);
2432 luaA_class_add_property(&client_class
, A_TK_URGENT
,
2433 (lua_class_propfunc_t
) luaA_client_set_urgent
,
2434 (lua_class_propfunc_t
) luaA_client_get_urgent
,
2435 (lua_class_propfunc_t
) luaA_client_set_urgent
);
2436 luaA_class_add_property(&client_class
, A_TK_SIZE_HINTS
,
2438 (lua_class_propfunc_t
) luaA_client_get_size_hints
,
2440 luaA_class_add_property(&client_class
, A_TK_FOCUSABLE
,
2442 (lua_class_propfunc_t
) luaA_client_get_focusable
,
2446 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80