2 * wibox.c - wibox functions
4 * Copyright © 2008-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/shape.h>
32 #include "common/xcursor.h"
33 #include "common/xutil.h"
35 LUA_OBJECT_FUNCS(wibox_class
, wibox_t
, wibox
)
37 /** Take care of garbage collecting a wibox.
38 * \param L The Lua VM state.
39 * \return The number of elements pushed on stack, 0!
42 luaA_wibox_gc(lua_State
*L
)
44 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
45 p_delete(&wibox
->cursor
);
47 button_array_wipe(&wibox
->buttons
);
48 widget_node_array_wipe(&wibox
->widgets
);
49 return luaA_object_gc(L
);
53 wibox_unref_simplified(wibox_t
**item
)
55 luaA_object_unref(globalconf
.L
, *item
);
59 wibox_need_update(wibox_t
*wibox
)
61 wibox
->need_update
= true;
62 wibox
->mouse_over
= NULL
;
68 const xcb_query_extension_reply_t
*reply
;
70 reply
= xcb_get_extension_data(globalconf
.connection
, &xcb_shape_id
);
71 if (!reply
|| !reply
->present
)
74 /* We don't need a specific version of SHAPE, no version check required */
79 shape_update(xcb_window_t win
, xcb_shape_kind_t kind
, image_t
*image
, int offset
)
84 shape
= image_to_1bit_pixmap(image
, win
);
89 xcb_shape_mask(globalconf
.connection
, XCB_SHAPE_SO_SET
, kind
,
90 win
, offset
, offset
, shape
);
92 if (shape
!= XCB_NONE
)
93 xcb_free_pixmap(globalconf
.connection
, shape
);
96 /** Update the window's shape.
97 * \param wibox The simplw window whose shape should be updated.
100 wibox_shape_update(wibox_t
*wibox
)
102 if(wibox
->window
== XCB_NONE
)
107 static bool warned
= false;
109 warn("The X server doesn't have the SHAPE extension; "
110 "can't change window's shape");
115 shape_update(wibox
->window
, XCB_SHAPE_SK_CLIP
, wibox
->shape
.clip
, 0);
116 shape_update(wibox
->window
, XCB_SHAPE_SK_BOUNDING
, wibox
->shape
.bounding
, - wibox
->border_width
);
118 wibox
->need_shape_update
= false;
122 wibox_draw_context_update(wibox_t
*w
, xcb_screen_t
*s
)
124 xcolor_t fg
= w
->ctx
.fg
, bg
= w
->ctx
.bg
;
125 int phys_screen
= w
->ctx
.phys_screen
;
127 draw_context_wipe(&w
->ctx
);
129 /* update draw context */
130 switch(w
->orientation
)
134 /* we need a new pixmap this way [ ] to render */
135 w
->ctx
.pixmap
= xcb_generate_id(globalconf
.connection
);
136 xcb_create_pixmap(globalconf
.connection
,
138 w
->ctx
.pixmap
, s
->root
,
141 draw_context_init(&w
->ctx
, phys_screen
,
144 w
->ctx
.pixmap
, &fg
, &bg
);
147 draw_context_init(&w
->ctx
, phys_screen
,
150 w
->pixmap
, &fg
, &bg
);
155 /** Initialize a wibox.
156 * \param w The wibox to initialize.
157 * \param phys_screen Physical screen number.
160 wibox_init(wibox_t
*w
, int phys_screen
)
162 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
164 w
->window
= xcb_generate_id(globalconf
.connection
);
165 xcb_create_window(globalconf
.connection
, s
->root_depth
, w
->window
, s
->root
,
166 w
->geometry
.x
, w
->geometry
.y
,
167 w
->geometry
.width
, w
->geometry
.height
,
168 w
->border_width
, XCB_COPY_FROM_PARENT
, s
->root_visual
,
169 XCB_CW_BACK_PIXMAP
| XCB_CW_BORDER_PIXEL
170 | XCB_CW_OVERRIDE_REDIRECT
| XCB_CW_EVENT_MASK
,
173 XCB_BACK_PIXMAP_PARENT_RELATIVE
,
174 w
->border_color
.pixel
,
176 XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
177 | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY
| XCB_EVENT_MASK_ENTER_WINDOW
178 | XCB_EVENT_MASK_LEAVE_WINDOW
| XCB_EVENT_MASK_STRUCTURE_NOTIFY
179 | XCB_EVENT_MASK_BUTTON_PRESS
| XCB_EVENT_MASK_BUTTON_RELEASE
180 | XCB_EVENT_MASK_POINTER_MOTION
| XCB_EVENT_MASK_EXPOSURE
181 | XCB_EVENT_MASK_PROPERTY_CHANGE
184 /* Create a pixmap. */
185 w
->pixmap
= xcb_generate_id(globalconf
.connection
);
186 xcb_create_pixmap(globalconf
.connection
, s
->root_depth
, w
->pixmap
, s
->root
,
187 w
->geometry
.width
, w
->geometry
.height
);
189 /* Update draw context physical screen, important for Zaphod. */
190 w
->ctx
.phys_screen
= phys_screen
;
191 wibox_draw_context_update(w
, s
);
193 /* The default GC is just a newly created associated to the root window */
194 w
->gc
= xcb_generate_id(globalconf
.connection
);
195 xcb_create_gc(globalconf
.connection
, w
->gc
, s
->root
, XCB_GC_FOREGROUND
| XCB_GC_BACKGROUND
,
196 (const uint32_t[]) { s
->black_pixel
, s
->white_pixel
});
198 wibox_shape_update(w
);
201 /** Refresh the window content by copying its pixmap data to its window.
202 * \param w The wibox to refresh.
205 wibox_refresh_pixmap(wibox_t
*w
)
207 wibox_refresh_pixmap_partial(w
, 0, 0, w
->geometry
.width
, w
->geometry
.height
);
210 /** Move and/or resize a wibox
211 * \param L The Lua VM state.
212 * \param udx The index of the wibox.
213 * \param geometry The new geometry.
216 wibox_moveresize(lua_State
*L
, int udx
, area_t geometry
)
218 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
221 int number_of_vals
= 0;
222 uint32_t moveresize_win_vals
[4], mask_vals
= 0;
224 if(w
->geometry
.x
!= geometry
.x
)
226 w
->geometry
.x
= moveresize_win_vals
[number_of_vals
++] = geometry
.x
;
227 mask_vals
|= XCB_CONFIG_WINDOW_X
;
230 if(w
->geometry
.y
!= geometry
.y
)
232 w
->geometry
.y
= moveresize_win_vals
[number_of_vals
++] = geometry
.y
;
233 mask_vals
|= XCB_CONFIG_WINDOW_Y
;
236 if(geometry
.width
> 0 && w
->geometry
.width
!= geometry
.width
)
238 w
->geometry
.width
= moveresize_win_vals
[number_of_vals
++] = geometry
.width
;
239 mask_vals
|= XCB_CONFIG_WINDOW_WIDTH
;
242 if(geometry
.height
> 0 && w
->geometry
.height
!= geometry
.height
)
244 w
->geometry
.height
= moveresize_win_vals
[number_of_vals
++] = geometry
.height
;
245 mask_vals
|= XCB_CONFIG_WINDOW_HEIGHT
;
248 if(mask_vals
& (XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT
))
250 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
251 /* orientation != East */
252 if(w
->pixmap
!= w
->ctx
.pixmap
)
253 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
254 w
->pixmap
= xcb_generate_id(globalconf
.connection
);
255 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
256 xcb_create_pixmap(globalconf
.connection
, s
->root_depth
, w
->pixmap
, s
->root
,
257 w
->geometry
.width
, w
->geometry
.height
);
258 wibox_draw_context_update(w
, s
);
262 xcb_configure_window(globalconf
.connection
, w
->window
, mask_vals
, moveresize_win_vals
);
264 w
->screen
= screen_getbycoord(w
->screen
, w
->geometry
.x
, w
->geometry
.y
);
266 if(mask_vals
& XCB_CONFIG_WINDOW_X
)
267 luaA_object_emit_signal(L
, udx
, "property::x", 0);
268 if(mask_vals
& XCB_CONFIG_WINDOW_Y
)
269 luaA_object_emit_signal(L
, udx
, "property::y", 0);
270 if(mask_vals
& XCB_CONFIG_WINDOW_WIDTH
)
271 luaA_object_emit_signal(L
, udx
, "property::width", 0);
272 if(mask_vals
& XCB_CONFIG_WINDOW_HEIGHT
)
273 luaA_object_emit_signal(L
, udx
, "property::height", 0);
277 #define DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(prop) \
278 if(w->geometry.prop != geometry.prop) \
280 w->geometry.prop = geometry.prop; \
281 luaA_object_emit_signal(L, udx, "property::" #prop, 0); \
283 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(x
)
284 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(y
)
285 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(width
)
286 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(height
)
287 #undef DO_WIBOX_GEOMETRY_CHECK_AND_EMIT
290 wibox_need_update(w
);
293 /** Refresh the window content by copying its pixmap data to its window.
294 * \param wibox The wibox to refresh.
295 * \param x The copy starting point x component.
296 * \param y The copy starting point y component.
297 * \param w The copy width from the x component.
298 * \param h The copy height from the y component.
301 wibox_refresh_pixmap_partial(wibox_t
*wibox
,
302 int16_t x
, int16_t y
,
303 uint16_t w
, uint16_t h
)
305 xcb_copy_area(globalconf
.connection
, wibox
->pixmap
,
306 wibox
->window
, wibox
->gc
, x
, y
, x
, y
,
311 wibox_set_opacity(lua_State
*L
, int udx
, double opacity
)
313 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
314 if(w
->opacity
!= opacity
)
316 w
->opacity
= opacity
;
318 window_opacity_set(w
->window
, opacity
);
319 luaA_object_emit_signal(L
, udx
, "property::opacity", 0);
323 /** Set a wibox border color.
324 * \param L The Lua VM state.
325 * \param idx The wibox to change border width.
326 * \param color The border color.
329 wibox_set_border_color(lua_State
*L
, int udx
, const xcolor_t
*color
)
331 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
332 xcb_change_window_attributes(globalconf
.connection
, w
->window
,
333 XCB_CW_BORDER_PIXEL
, &color
->pixel
);
334 w
->border_color
= *color
;
335 luaA_object_emit_signal(L
, udx
, "property::border_color", 0);
338 /** Set wibox orientation.
339 * \param L The Lua VM state.
340 * \param w The wibox.
341 * \param o The new orientation.
344 wibox_set_orientation(lua_State
*L
, int udx
, orientation_t o
)
346 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
347 if(o
!= w
->orientation
)
349 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
351 /* orientation != East */
352 if(w
->pixmap
!= w
->ctx
.pixmap
)
353 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
354 wibox_draw_context_update(w
, s
);
355 luaA_object_emit_signal(L
, udx
, "property::orientation", 0);
360 wibox_map(wibox_t
*wibox
)
362 xcb_map_window(globalconf
.connection
, wibox
->window
);
363 /* We must make sure the wibox does not display garbage */
364 wibox_need_update(wibox
);
365 /* Stack this wibox correctly */
369 /** Kick out systray windows.
370 * \param phys_screen Physical screen number.
373 wibox_systray_kickout(int phys_screen
)
375 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
377 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= s
->root
)
379 /* Who! Check that we're not deleting a wibox with a systray, because it
380 * may be its parent. If so, we reparent to root before, otherwise it will
382 xcb_reparent_window(globalconf
.connection
,
383 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
384 s
->root
, -512, -512);
386 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= s
->root
;
391 wibox_systray_refresh(wibox_t
*wibox
)
396 for(int i
= 0; i
< wibox
->widgets
.len
; i
++)
398 widget_node_t
*systray
= &wibox
->widgets
.tab
[i
];
399 if(systray
->widget
->type
== widget_systray
)
401 uint32_t config_back
[] = { wibox
->ctx
.bg
.pixel
};
402 uint32_t config_win_vals
[4];
403 uint32_t config_win_vals_off
[2] = { -512, -512 };
405 int phys_screen
= wibox
->ctx
.phys_screen
;
408 && systray
->widget
->isvisible
409 && systray
->geometry
.width
)
411 /* Set background of the systray window. */
412 xcb_change_window_attributes(globalconf
.connection
,
413 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
414 XCB_CW_BACK_PIXEL
, config_back
);
416 xcb_map_window(globalconf
.connection
, globalconf
.screens
.tab
[phys_screen
].systray
.window
);
418 switch(wibox
->orientation
)
421 config_win_vals
[0] = systray
->geometry
.y
;
422 config_win_vals
[1] = wibox
->geometry
.height
- systray
->geometry
.x
- systray
->geometry
.width
;
423 config_win_vals
[2] = systray
->geometry
.height
;
424 config_win_vals
[3] = systray
->geometry
.width
;
427 config_win_vals
[0] = systray
->geometry
.y
;
428 config_win_vals
[1] = systray
->geometry
.x
;
429 config_win_vals
[2] = systray
->geometry
.height
;
430 config_win_vals
[3] = systray
->geometry
.width
;
433 config_win_vals
[0] = systray
->geometry
.x
;
434 config_win_vals
[1] = systray
->geometry
.y
;
435 config_win_vals
[2] = systray
->geometry
.width
;
436 config_win_vals
[3] = systray
->geometry
.height
;
440 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= wibox
->window
)
442 xcb_reparent_window(globalconf
.connection
,
443 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
445 config_win_vals
[0], config_win_vals
[1]);
446 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= wibox
->window
;
448 xcb_configure_window(globalconf
.connection
,
449 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
451 | XCB_CONFIG_WINDOW_Y
452 | XCB_CONFIG_WINDOW_WIDTH
453 | XCB_CONFIG_WINDOW_HEIGHT
,
455 /* width = height = systray height */
456 config_win_vals
[2] = config_win_vals
[3] = systray
->geometry
.height
;
457 config_win_vals
[0] = 0;
460 return wibox_systray_kickout(phys_screen
);
462 switch(wibox
->orientation
)
465 config_win_vals
[1] = systray
->geometry
.width
- config_win_vals
[3];
466 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
468 em
= &globalconf
.embedded
.tab
[j
];
469 if(em
->phys_screen
== phys_screen
)
471 if(config_win_vals
[1] - config_win_vals
[2] >= (uint32_t) wibox
->geometry
.y
)
473 xcb_map_window(globalconf
.connection
, em
->win
);
474 xcb_configure_window(globalconf
.connection
, em
->win
,
476 | XCB_CONFIG_WINDOW_Y
477 | XCB_CONFIG_WINDOW_WIDTH
478 | XCB_CONFIG_WINDOW_HEIGHT
,
480 config_win_vals
[1] -= config_win_vals
[3];
483 xcb_configure_window(globalconf
.connection
, em
->win
,
485 | XCB_CONFIG_WINDOW_Y
,
486 config_win_vals_off
);
491 config_win_vals
[1] = 0;
492 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
494 em
= &globalconf
.embedded
.tab
[j
];
495 if(em
->phys_screen
== phys_screen
)
497 /* if(y + width <= wibox.y + systray.right) */
498 if(config_win_vals
[1] + config_win_vals
[3] <= (uint32_t) wibox
->geometry
.y
+ AREA_RIGHT(systray
->geometry
))
500 xcb_map_window(globalconf
.connection
, em
->win
);
501 xcb_configure_window(globalconf
.connection
, em
->win
,
503 | XCB_CONFIG_WINDOW_Y
504 | XCB_CONFIG_WINDOW_WIDTH
505 | XCB_CONFIG_WINDOW_HEIGHT
,
507 config_win_vals
[1] += config_win_vals
[3];
510 xcb_configure_window(globalconf
.connection
, em
->win
,
512 | XCB_CONFIG_WINDOW_Y
,
513 config_win_vals_off
);
518 config_win_vals
[1] = 0;
519 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
521 em
= &globalconf
.embedded
.tab
[j
];
522 if(em
->phys_screen
== phys_screen
)
524 /* if(x + width < systray.x + systray.width) */
525 if(config_win_vals
[0] + config_win_vals
[2] <= (uint32_t) AREA_RIGHT(systray
->geometry
) + wibox
->geometry
.x
)
527 xcb_map_window(globalconf
.connection
, em
->win
);
528 xcb_configure_window(globalconf
.connection
, em
->win
,
530 | XCB_CONFIG_WINDOW_Y
531 | XCB_CONFIG_WINDOW_WIDTH
532 | XCB_CONFIG_WINDOW_HEIGHT
,
534 config_win_vals
[0] += config_win_vals
[2];
537 xcb_configure_window(globalconf
.connection
, em
->win
,
539 | XCB_CONFIG_WINDOW_Y
,
540 config_win_vals_off
);
550 /** Get a wibox by its window.
551 * \param win The window id.
552 * \return A wibox if found, NULL otherwise.
555 wibox_getbywin(xcb_window_t win
)
557 foreach(w
, globalconf
.wiboxes
)
558 if((*w
)->window
== win
)
561 foreach(_c
, globalconf
.clients
)
564 if(c
->titlebar
&& c
->titlebar
->window
== win
)
572 * \param wibox The wibox to draw.
575 wibox_draw(wibox_t
*wibox
)
579 widget_render(wibox
);
580 wibox_refresh_pixmap(wibox
);
582 wibox
->need_update
= false;
585 wibox_systray_refresh(wibox
);
588 /** Refresh all wiboxes.
593 foreach(w
, globalconf
.wiboxes
)
595 if((*w
)->need_shape_update
)
596 wibox_shape_update(*w
);
597 if((*w
)->need_update
)
601 foreach(_c
, globalconf
.clients
)
604 if(c
->titlebar
&& c
->titlebar
->need_update
)
605 wibox_draw(c
->titlebar
);
609 /** Set a wibox visible or not.
610 * \param wibox The wibox.
611 * \param v The visible value.
614 wibox_set_visible(lua_State
*L
, int udx
, bool v
)
616 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
617 if(v
!= wibox
->visible
)
620 wibox
->mouse_over
= NULL
;
627 xcb_unmap_window(globalconf
.connection
, wibox
->window
);
629 /* kick out systray if needed */
630 wibox_systray_refresh(wibox
);
633 luaA_object_emit_signal(L
, udx
, "property::visible", 0);
635 hook_property(wibox
, "visible");
639 /** Destroy all X resources of a wibox.
640 * \param w The wibox to wipe.
643 wibox_wipe(wibox_t
*w
)
647 xcb_destroy_window(globalconf
.connection
, w
->window
);
648 w
->window
= XCB_NONE
;
652 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
653 w
->pixmap
= XCB_NONE
;
657 xcb_free_gc(globalconf
.connection
, w
->gc
);
660 draw_context_wipe(&w
->ctx
);
663 /** Remove a wibox from a screen.
664 * \param L The Lua VM state.
665 * \param udx Wibox to detach from screen.
668 wibox_detach(lua_State
*L
, int udx
)
670 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
675 /* save visible state */
677 wibox
->visible
= false;
678 wibox_systray_refresh(wibox
);
679 /* restore visibility */
682 wibox
->mouse_over
= NULL
;
686 foreach(item
, globalconf
.wiboxes
)
689 wibox_array_remove(&globalconf
.wiboxes
, item
);
693 hook_property(wibox
, "screen");
695 wibox
->screen
= NULL
;
696 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
698 luaA_object_unref(globalconf
.L
, wibox
);
702 /** Attach a wibox that is on top of the stack.
703 * \param s The screen to attach the wibox to.
706 wibox_attach(lua_State
*L
, int udx
, screen_t
*s
)
708 int phys_screen
= screen_virttophys(screen_array_indexof(&globalconf
.screens
, s
));
710 /* duplicate wibox */
711 lua_pushvalue(L
, udx
);
713 wibox_t
*wibox
= luaA_object_ref(globalconf
.L
, -1);
715 wibox_detach(L
, udx
);
717 /* Set the wibox screen */
720 /* Check that the wibox coordinates matches the screen. */
722 screen_getbycoord(wibox
->screen
, wibox
->geometry
.x
, wibox
->geometry
.y
);
724 /* If it does not match, move it to the screen coordinates */
725 if(cscreen
!= wibox
->screen
)
726 wibox_moveresize(L
, udx
, (area_t
) { .x
= s
->geometry
.x
,
728 .width
= wibox
->geometry
.width
,
729 .height
= wibox
->geometry
.height
});
731 wibox_array_append(&globalconf
.wiboxes
, wibox
);
733 wibox_init(wibox
, phys_screen
);
735 window_set_cursor(wibox
->window
,
736 xcursor_new(globalconf
.connection
, xcursor_font_fromstr(wibox
->cursor
)));
738 if(wibox
->opacity
!= -1)
739 window_opacity_set(wibox
->window
, wibox
->opacity
);
741 ewmh_update_strut(wibox
->window
, &wibox
->strut
);
746 wibox_need_update(wibox
);
748 hook_property(wibox
, "screen");
749 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
752 /** Create a new wibox.
753 * \param L The Lua VM state.
756 * \lparam A table with optionaly defined values:
757 * fg, bg, border_width, border_color, ontop, width and height.
758 * \lreturn A brand new wibox.
761 luaA_wibox_new(lua_State
*L
)
763 luaA_class_new(L
, &wibox_class
);
765 wibox_t
*w
= luaA_checkudata(L
, -1, &wibox_class
);
767 if(!w
->ctx
.fg
.initialized
)
768 w
->ctx
.fg
= globalconf
.colors
.fg
;
770 if(!w
->ctx
.bg
.initialized
)
771 w
->ctx
.bg
= globalconf
.colors
.bg
;
773 if(!w
->border_color
.initialized
)
774 w
->border_color
= globalconf
.colors
.bg
;
782 w
->cursor
= a_strdup("left_ptr");
784 if(!w
->geometry
.width
)
785 w
->geometry
.width
= 1;
787 if(!w
->geometry
.height
)
788 w
->geometry
.height
= 1;
793 /** Check if a wibox widget table has an item.
794 * \param L The Lua VM state.
795 * \param wibox The wibox.
796 * \param item The item to look for.
799 luaA_wibox_hasitem(lua_State
*L
, wibox_t
*wibox
, const void *item
)
801 if(wibox
->widgets_table
)
803 luaA_object_push(L
, wibox
);
804 luaA_object_push_item(L
, -1, wibox
->widgets_table
);
806 if(lua_topointer(L
, -1) == item
|| luaA_hasitem(L
, item
))
812 /** Invalidate a wibox by a Lua object (table, etc).
813 * \param L The Lua VM state.
814 * \param item The object identifier.
817 luaA_wibox_invalidate_byitem(lua_State
*L
, const void *item
)
819 foreach(w
, globalconf
.wiboxes
)
822 if(luaA_wibox_hasitem(L
, wibox
, item
))
825 wibox_need_update(wibox
);
826 lua_pop(L
, 1); /* remove widgets table */
831 foreach(_c
, globalconf
.clients
)
834 if(c
->titlebar
&& luaA_wibox_hasitem(L
, c
->titlebar
, item
))
837 wibox_need_update(c
->titlebar
);
838 lua_pop(L
, 1); /* remove widgets table */
843 /* Set or get the wibox geometry.
844 * \param L The Lua VM state.
845 * \return The number of elements pushed on stack.
847 * \lparam An optional table with wibox geometry.
848 * \lreturn The wibox geometry.
851 luaA_wibox_geometry(lua_State
*L
)
853 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
855 if(lua_gettop(L
) == 2)
859 luaA_checktable(L
, 2);
860 wingeom
.x
= luaA_getopt_number(L
, 2, "x", wibox
->geometry
.x
);
861 wingeom
.y
= luaA_getopt_number(L
, 2, "y", wibox
->geometry
.y
);
862 wingeom
.width
= luaA_getopt_number(L
, 2, "width", wibox
->geometry
.width
);
863 wingeom
.height
= luaA_getopt_number(L
, 2, "height", wibox
->geometry
.height
);
865 if(wingeom
.width
> 0 && wingeom
.height
> 0)
868 case WIBOX_TYPE_TITLEBAR
:
869 wibox_moveresize(L
, 1, (area_t
) { .x
= wibox
->geometry
.x
,
870 .y
= wibox
->geometry
.y
,
871 .width
= wingeom
.width
,
872 .height
= wingeom
.height
});
874 case WIBOX_TYPE_NORMAL
:
875 wibox_moveresize(L
, 1, wingeom
);
880 return luaA_pusharea(L
, wibox
->geometry
);
884 luaA_wibox_struts(lua_State
*L
)
886 wibox_t
*w
= luaA_checkudata(L
, 1, &wibox_class
);
888 if(lua_gettop(L
) == 2)
890 luaA_tostrut(L
, 2, &w
->strut
);
892 ewmh_update_strut(w
->window
, &w
->strut
);
893 luaA_object_emit_signal(L
, 1, "property::struts", 0);
895 screen_emit_signal(L
, w
->screen
, "property::workarea", 0);
898 return luaA_pushstrut(L
, w
->strut
);
901 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, ontop
, lua_pushboolean
)
902 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, cursor
, lua_pushstring
)
903 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, visible
, lua_pushboolean
)
904 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_width
, lua_pushnumber
)
905 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_color
, luaA_pushxcolor
)
908 luaA_wibox_set_x(lua_State
*L
, wibox_t
*wibox
)
910 wibox_moveresize(L
, -3, (area_t
) { .x
= luaL_checknumber(L
, -1),
911 .y
= wibox
->geometry
.y
,
912 .width
= wibox
->geometry
.width
,
913 .height
= wibox
->geometry
.height
});
918 luaA_wibox_get_x(lua_State
*L
, wibox_t
*wibox
)
920 lua_pushnumber(L
, wibox
->geometry
.x
);
925 luaA_wibox_set_y(lua_State
*L
, wibox_t
*wibox
)
927 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
928 .y
= luaL_checknumber(L
, -1),
929 .width
= wibox
->geometry
.width
,
930 .height
= wibox
->geometry
.height
});
935 luaA_wibox_get_y(lua_State
*L
, wibox_t
*wibox
)
937 lua_pushnumber(L
, wibox
->geometry
.y
);
942 luaA_wibox_set_width(lua_State
*L
, wibox_t
*wibox
)
944 int width
= luaL_checknumber(L
, -1);
946 luaL_error(L
, "invalid width");
947 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
948 .y
= wibox
->geometry
.y
,
950 .height
= wibox
->geometry
.height
});
955 luaA_wibox_get_width(lua_State
*L
, wibox_t
*wibox
)
957 lua_pushnumber(L
, wibox
->geometry
.width
);
962 luaA_wibox_set_height(lua_State
*L
, wibox_t
*wibox
)
964 int height
= luaL_checknumber(L
, -1);
966 luaL_error(L
, "invalid height");
967 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
968 .y
= wibox
->geometry
.y
,
969 .width
= wibox
->geometry
.width
,
975 luaA_wibox_get_height(lua_State
*L
, wibox_t
*wibox
)
977 lua_pushnumber(L
, wibox
->geometry
.height
);
981 /** Set the wibox foreground color.
982 * \param L The Lua VM state.
983 * \param wibox The wibox object.
984 * \return The number of elements pushed on stack.
987 luaA_wibox_set_fg(lua_State
*L
, wibox_t
*wibox
)
990 const char *buf
= luaL_checklstring(L
, -1, &len
);
991 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.fg
, buf
, len
)))
992 wibox
->need_update
= true;
993 luaA_object_emit_signal(L
, -3, "property::fg", 0);
997 /** Get the wibox foreground color.
998 * \param L The Lua VM state.
999 * \param wibox The wibox object.
1000 * \return The number of elements pushed on stack.
1003 luaA_wibox_get_fg(lua_State
*L
, wibox_t
*wibox
)
1005 return luaA_pushxcolor(L
, wibox
->ctx
.fg
);
1008 /** Set the wibox background color.
1009 * \param L The Lua VM state.
1010 * \param wibox The wibox object.
1011 * \return The number of elements pushed on stack.
1014 luaA_wibox_set_bg(lua_State
*L
, wibox_t
*wibox
)
1017 const char *buf
= luaL_checklstring(L
, -1, &len
);
1018 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.bg
, buf
, len
)))
1019 wibox
->need_update
= true;
1020 luaA_object_emit_signal(L
, -3, "property::bg", 0);
1024 /** Get the wibox background color.
1025 * \param L The Lua VM state.
1026 * \param wibox The wibox object.
1027 * \return The number of elements pushed on stack.
1030 luaA_wibox_get_bg(lua_State
*L
, wibox_t
*wibox
)
1032 return luaA_pushxcolor(L
, wibox
->ctx
.bg
);
1035 /** Set the wibox background image.
1036 * \param L The Lua VM state.
1037 * \param wibox The wibox object.
1038 * \return The number of elements pushed on stack.
1041 luaA_wibox_set_bg_image(lua_State
*L
, wibox_t
*wibox
)
1043 luaA_checkudata(L
, -1, &image_class
);
1044 luaA_object_unref_item(L
, -3, wibox
->bg_image
);
1045 wibox
->bg_image
= luaA_object_ref_item(L
, -3, -1);
1046 wibox
->need_update
= true;
1047 luaA_object_emit_signal(L
, -2, "property::bg_image", 0);
1051 /** Get the wibox background image.
1052 * \param L The Lua VM state.
1053 * \param wibox The wibox object.
1054 * \return The number of elements pushed on stack.
1057 luaA_wibox_get_bg_image(lua_State
*L
, wibox_t
*wibox
)
1059 return luaA_object_push_item(L
, 1, wibox
->bg_image
);
1062 /** Set the wibox on top status.
1063 * \param L The Lua VM state.
1064 * \param wibox The wibox object.
1065 * \return The number of elements pushed on stack.
1068 luaA_wibox_set_ontop(lua_State
*L
, wibox_t
*wibox
)
1070 bool b
= luaA_checkboolean(L
, -1);
1071 if(b
!= wibox
->ontop
)
1075 luaA_object_emit_signal(L
, -3, "property::ontop", 0);
1080 /** Set the wibox opacity.
1081 * \param L The Lua VM state.
1082 * \param wibox The wibox object.
1083 * \return The number of elements pushed on stack.
1086 luaA_wibox_set_opacity(lua_State
*L
, wibox_t
*wibox
)
1088 if(lua_isnil(L
, -1))
1089 wibox_set_opacity(L
, -3, -1);
1092 double d
= luaL_checknumber(L
, -1);
1093 if(d
>= 0 && d
<= 1)
1094 wibox_set_opacity(L
, -3, d
);
1099 /** Get the wibox opacity.
1100 * \param L The Lua VM state.
1101 * \param wibox The wibox object.
1102 * \return The number of elements pushed on stack.
1105 luaA_wibox_get_opacity(lua_State
*L
, wibox_t
*wibox
)
1107 if (wibox
->opacity
>= 0)
1109 lua_pushnumber(L
, wibox
->opacity
);
1115 /** Set the wibox alignment.
1116 * \param L The Lua VM state.
1117 * \param wibox The wibox object.
1118 * \return The number of elements pushed on stack.
1121 luaA_wibox_set_align(lua_State
*L
, wibox_t
*wibox
)
1124 const char *buf
= luaL_checklstring(L
, -1, &len
);
1125 wibox
->align
= draw_align_fromstr(buf
, len
);
1126 luaA_object_emit_signal(L
, -3, "property::align", 0);
1129 case WIBOX_TYPE_NORMAL
:
1130 luaA_deprecate(L
, "awful.wibox.align");
1132 case WIBOX_TYPE_TITLEBAR
:
1133 titlebar_update_geometry(client_getbytitlebar(wibox
));
1139 /** Get the wibox alignment.
1140 * \param L The Lua VM state.
1141 * \param wibox The wibox object.
1142 * \return The number of elements pushed on stack.
1145 luaA_wibox_get_align(lua_State
*L
, wibox_t
*wibox
)
1147 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1148 luaA_deprecate(L
, "awful.wibox.align");
1149 lua_pushstring(L
, draw_align_tostr(wibox
->align
));
1153 /** Set the wibox position.
1154 * \param L The Lua VM state.
1155 * \param wibox The wibox object.
1156 * \return The number of elements pushed on stack.
1159 luaA_wibox_set_position(lua_State
*L
, wibox_t
*wibox
)
1163 case WIBOX_TYPE_NORMAL
:
1167 if((buf
= luaL_checklstring(L
, -1, &len
)))
1169 luaA_deprecate(L
, "awful.wibox.attach");
1170 wibox
->position
= position_fromstr(buf
, len
);
1174 case WIBOX_TYPE_TITLEBAR
:
1175 return luaA_titlebar_set_position(L
, -3);
1180 /** Get the wibox position.
1181 * \param L The Lua VM state.
1182 * \param wibox The wibox object.
1183 * \return The number of elements pushed on stack.
1186 luaA_wibox_get_position(lua_State
*L
, wibox_t
*wibox
)
1188 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1189 luaA_deprecate(L
, "awful.wibox.attach");
1190 lua_pushstring(L
, position_tostr(wibox
->position
));
1194 /** Set the wibox (titlebar) client.
1195 * \param L The Lua VM state.
1196 * \param wibox The wibox object.
1197 * \return The number of elements pushed on stack.
1200 luaA_wibox_set_client(lua_State
*L
, wibox_t
*wibox
)
1203 if(lua_isnil(L
, -1))
1204 titlebar_client_detach(client_getbytitlebar(wibox
));
1207 client_t
*c
= luaA_client_checkudata(L
, -1);
1208 lua_pushvalue(L
, -3);
1209 titlebar_client_attach(c
);
1214 /** Get the wibox (titlebar) client.
1215 * \param L The Lua VM state.
1216 * \param wibox The wibox object.
1217 * \return The number of elements pushed on stack.
1220 luaA_wibox_get_client(lua_State
*L
, wibox_t
*wibox
)
1222 return luaA_object_push(L
, client_getbytitlebar(wibox
));
1225 /** Set the wibox cursor.
1226 * \param L The Lua VM state.
1227 * \param wibox The wibox object.
1228 * \return The number of elements pushed on stack.
1231 luaA_wibox_set_cursor(lua_State
*L
, wibox_t
*wibox
)
1233 const char *buf
= luaL_checkstring(L
, -1);
1236 uint16_t cursor_font
= xcursor_font_fromstr(buf
);
1239 xcb_cursor_t cursor
= xcursor_new(globalconf
.connection
, cursor_font
);
1240 p_delete(&wibox
->cursor
);
1241 wibox
->cursor
= a_strdup(buf
);
1242 window_set_cursor(wibox
->window
, cursor
);
1243 luaA_object_emit_signal(L
, -3, "property::cursor", 0);
1249 /** Set the wibox screen.
1250 * \param L The Lua VM state.
1251 * \param wibox The wibox object.
1252 * \return The number of elements pushed on stack.
1255 luaA_wibox_set_screen(lua_State
*L
, wibox_t
*wibox
)
1257 if(lua_isnil(L
, -1))
1259 wibox_detach(L
, -3);
1260 titlebar_client_detach(client_getbytitlebar(wibox
));
1264 int screen
= luaL_checknumber(L
, -1) - 1;
1265 luaA_checkscreen(screen
);
1266 if(!wibox
->screen
|| screen
!= screen_array_indexof(&globalconf
.screens
, wibox
->screen
))
1268 titlebar_client_detach(client_getbytitlebar(wibox
));
1269 wibox_attach(L
, -3, &globalconf
.screens
.tab
[screen
]);
1275 /** Get the wibox screen.
1276 * \param L The Lua VM state.
1277 * \param wibox The wibox object.
1278 * \return The number of elements pushed on stack.
1281 luaA_wibox_get_screen(lua_State
*L
, wibox_t
*wibox
)
1285 lua_pushnumber(L
, screen_array_indexof(&globalconf
.screens
, wibox
->screen
) + 1);
1289 /** Set the wibox orientation.
1290 * \param L The Lua VM state.
1291 * \param wibox The wibox object.
1292 * \return The number of elements pushed on stack.
1295 luaA_wibox_set_orientation(lua_State
*L
, wibox_t
*wibox
)
1298 const char *buf
= luaL_checklstring(L
, -1, &len
);
1301 wibox_set_orientation(L
, -3, orientation_fromstr(buf
, len
));
1302 wibox_need_update(wibox
);
1307 /** Get the wibox orientation.
1308 * \param L The Lua VM state.
1309 * \param wibox The wibox object.
1310 * \return The number of elements pushed on stack.
1313 luaA_wibox_get_orientation(lua_State
*L
, wibox_t
*wibox
)
1315 lua_pushstring(L
, orientation_tostr(wibox
->orientation
));
1319 /** Set the wibox border color.
1320 * \param L The Lua VM state.
1321 * \param wibox The wibox object.
1322 * \return The number of elements pushed on stack.
1325 luaA_wibox_set_border_color(lua_State
*L
, wibox_t
*wibox
)
1328 const char *buf
= luaL_checklstring(L
, -1, &len
);
1330 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->border_color
, buf
, len
)))
1332 wibox_set_border_color(L
, -3, &wibox
->border_color
);
1336 /** Set the wibox visibility.
1337 * \param L The Lua VM state.
1338 * \param wibox The wibox object.
1339 * \return The number of elements pushed on stack.
1342 luaA_wibox_set_visible(lua_State
*L
, wibox_t
*wibox
)
1344 bool b
= luaA_checkboolean(L
, -1);
1345 if(b
!= wibox
->visible
)
1348 case WIBOX_TYPE_NORMAL
:
1349 wibox_set_visible(L
, -3, b
);
1351 case WIBOX_TYPE_TITLEBAR
:
1352 titlebar_set_visible(wibox
, b
);
1358 /** Set the wibox widgets.
1359 * \param L The Lua VM state.
1360 * \param wibox The wibox object.
1361 * \return The number of elements pushed on stack.
1364 luaA_wibox_set_widgets(lua_State
*L
, wibox_t
*wibox
)
1366 if(luaA_isloop(L
, -1))
1368 luaA_warn(L
, "table is looping, cannot use this as widget table");
1371 /* duplicate table because next function will eat it */
1372 lua_pushvalue(L
, -1);
1373 wibox
->widgets_table
= luaA_object_ref_item(L
, -4, -1);
1374 luaA_object_emit_signal(L
, -3, "property::widgets", 0);
1375 wibox_need_update(wibox
);
1376 luaA_table2wtable(L
);
1380 /** Get the wibox widgets.
1381 * \param L The Lua VM state.
1382 * \param wibox The wibox object.
1383 * \return The number of elements pushed on stack.
1386 luaA_wibox_get_widgets(lua_State
*L
, wibox_t
*wibox
)
1388 return luaA_object_push_item(L
, 1, wibox
->widgets_table
);
1391 /** Get or set mouse buttons bindings to a wibox.
1392 * \param L The Lua VM state.
1395 * \lparam An array of mouse button bindings objects, or nothing.
1396 * \return The array of mouse button bindings objects of this wibox.
1399 luaA_wibox_buttons(lua_State
*L
)
1401 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
1403 if(lua_gettop(L
) == 2)
1405 luaA_button_array_set(L
, 1, 2, &wibox
->buttons
);
1406 luaA_object_emit_signal(L
, 1, "property::buttons", 0);
1409 return luaA_button_array_get(L
, 1, &wibox
->buttons
);
1412 /** Set the wibox border width.
1413 * \param L The Lua VM state.
1414 * \param wibox The wibox object.
1415 * \return The number of elements pushed on stack.
1418 luaA_wibox_set_border_width(lua_State
*L
, wibox_t
*wibox
)
1420 wibox_t
*w
= luaA_checkudata(L
, -3, &wibox_class
);
1421 uint32_t border_width
= luaL_checknumber(L
, -1);
1422 if(border_width
!= w
->border_width
)
1424 xcb_configure_window(globalconf
.connection
, w
->window
, XCB_CONFIG_WINDOW_BORDER_WIDTH
,
1426 w
->border_width
= border_width
;
1427 luaA_object_emit_signal(L
, -3, "property::border_width", 0);
1433 luaA_wibox_set_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1435 luaA_object_unref_item(L
, -3, wibox
->shape
.bounding
);
1436 wibox
->shape
.bounding
= luaA_object_ref_item(L
, -3, -1);
1437 wibox
->need_shape_update
= true;
1438 luaA_object_emit_signal(L
, -2, "property::shape_bounding", 0);
1443 luaA_wibox_get_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1445 return luaA_object_push_item(L
, 1, wibox
->shape
.bounding
);
1449 luaA_wibox_set_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1451 luaA_object_unref_item(L
, -3, wibox
->shape
.clip
);
1452 wibox
->shape
.clip
= luaA_object_ref_item(L
, -3, -1);
1453 wibox
->need_shape_update
= true;
1454 luaA_object_emit_signal(L
, -2, "property::shape_clip", 0);
1459 luaA_wibox_get_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1461 return luaA_object_push_item(L
, 1, wibox
->shape
.clip
);
1465 wibox_class_setup(lua_State
*L
)
1467 static const struct luaL_reg wibox_methods
[] =
1469 LUA_CLASS_METHODS(wibox
)
1470 { "__call", luaA_wibox_new
},
1474 static const struct luaL_reg wibox_meta
[] =
1476 LUA_OBJECT_META(wibox
)
1478 { "struts", luaA_wibox_struts
},
1479 { "buttons", luaA_wibox_buttons
},
1480 { "geometry", luaA_wibox_geometry
},
1481 { "__gc", luaA_wibox_gc
},
1485 luaA_class_setup(L
, &wibox_class
, "wibox", (lua_class_allocator_t
) wibox_new
,
1486 luaA_class_index_miss_property
, luaA_class_newindex_miss_property
,
1487 wibox_methods
, wibox_meta
);
1488 luaA_class_add_property(&wibox_class
, A_TK_WIDGETS
,
1489 (lua_class_propfunc_t
) luaA_wibox_set_widgets
,
1490 (lua_class_propfunc_t
) luaA_wibox_get_widgets
,
1491 (lua_class_propfunc_t
) luaA_wibox_set_widgets
);
1492 luaA_class_add_property(&wibox_class
, A_TK_OPACITY
,
1493 (lua_class_propfunc_t
) luaA_wibox_set_opacity
,
1494 (lua_class_propfunc_t
) luaA_wibox_get_opacity
,
1495 (lua_class_propfunc_t
) luaA_wibox_set_opacity
);
1496 luaA_class_add_property(&wibox_class
, A_TK_VISIBLE
,
1497 (lua_class_propfunc_t
) luaA_wibox_set_visible
,
1498 (lua_class_propfunc_t
) luaA_wibox_get_visible
,
1499 (lua_class_propfunc_t
) luaA_wibox_set_visible
);
1500 luaA_class_add_property(&wibox_class
, A_TK_BORDER_COLOR
,
1501 (lua_class_propfunc_t
) luaA_wibox_set_border_color
,
1502 (lua_class_propfunc_t
) luaA_wibox_get_border_color
,
1503 (lua_class_propfunc_t
) luaA_wibox_set_border_color
);
1504 luaA_class_add_property(&wibox_class
, A_TK_BORDER_WIDTH
,
1505 (lua_class_propfunc_t
) luaA_wibox_set_border_width
,
1506 (lua_class_propfunc_t
) luaA_wibox_get_border_width
,
1507 (lua_class_propfunc_t
) luaA_wibox_set_border_width
);
1508 luaA_class_add_property(&wibox_class
, A_TK_ORIENTATION
,
1509 (lua_class_propfunc_t
) luaA_wibox_set_orientation
,
1510 (lua_class_propfunc_t
) luaA_wibox_get_orientation
,
1511 (lua_class_propfunc_t
) luaA_wibox_set_orientation
);
1512 luaA_class_add_property(&wibox_class
, A_TK_ONTOP
,
1513 (lua_class_propfunc_t
) luaA_wibox_set_ontop
,
1514 (lua_class_propfunc_t
) luaA_wibox_get_ontop
,
1515 (lua_class_propfunc_t
) luaA_wibox_set_ontop
);
1516 luaA_class_add_property(&wibox_class
, A_TK_SCREEN
,
1518 (lua_class_propfunc_t
) luaA_wibox_get_screen
,
1519 (lua_class_propfunc_t
) luaA_wibox_set_screen
);
1520 luaA_class_add_property(&wibox_class
, A_TK_CURSOR
,
1521 (lua_class_propfunc_t
) luaA_wibox_set_cursor
,
1522 (lua_class_propfunc_t
) luaA_wibox_get_cursor
,
1523 (lua_class_propfunc_t
) luaA_wibox_set_cursor
);
1524 luaA_class_add_property(&wibox_class
, A_TK_CLIENT
,
1525 (lua_class_propfunc_t
) luaA_wibox_set_client
,
1526 (lua_class_propfunc_t
) luaA_wibox_get_client
,
1527 (lua_class_propfunc_t
) luaA_wibox_set_client
);
1528 luaA_class_add_property(&wibox_class
, A_TK_POSITION
,
1529 (lua_class_propfunc_t
) luaA_wibox_set_position
,
1530 (lua_class_propfunc_t
) luaA_wibox_get_position
,
1531 (lua_class_propfunc_t
) luaA_wibox_set_position
);
1532 luaA_class_add_property(&wibox_class
, A_TK_ALIGN
,
1533 (lua_class_propfunc_t
) luaA_wibox_set_align
,
1534 (lua_class_propfunc_t
) luaA_wibox_get_align
,
1535 (lua_class_propfunc_t
) luaA_wibox_set_align
);
1536 luaA_class_add_property(&wibox_class
, A_TK_FG
,
1537 (lua_class_propfunc_t
) luaA_wibox_set_fg
,
1538 (lua_class_propfunc_t
) luaA_wibox_get_fg
,
1539 (lua_class_propfunc_t
) luaA_wibox_set_fg
);
1540 luaA_class_add_property(&wibox_class
, A_TK_BG
,
1541 (lua_class_propfunc_t
) luaA_wibox_set_bg
,
1542 (lua_class_propfunc_t
) luaA_wibox_get_bg
,
1543 (lua_class_propfunc_t
) luaA_wibox_set_bg
);
1544 luaA_class_add_property(&wibox_class
, A_TK_BG_IMAGE
,
1545 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
,
1546 (lua_class_propfunc_t
) luaA_wibox_get_bg_image
,
1547 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
);
1548 luaA_class_add_property(&wibox_class
, A_TK_X
,
1549 (lua_class_propfunc_t
) luaA_wibox_set_x
,
1550 (lua_class_propfunc_t
) luaA_wibox_get_x
,
1551 (lua_class_propfunc_t
) luaA_wibox_set_x
);
1552 luaA_class_add_property(&wibox_class
, A_TK_Y
,
1553 (lua_class_propfunc_t
) luaA_wibox_set_y
,
1554 (lua_class_propfunc_t
) luaA_wibox_get_y
,
1555 (lua_class_propfunc_t
) luaA_wibox_set_y
);
1556 luaA_class_add_property(&wibox_class
, A_TK_WIDTH
,
1557 (lua_class_propfunc_t
) luaA_wibox_set_width
,
1558 (lua_class_propfunc_t
) luaA_wibox_get_width
,
1559 (lua_class_propfunc_t
) luaA_wibox_set_width
);
1560 luaA_class_add_property(&wibox_class
, A_TK_HEIGHT
,
1561 (lua_class_propfunc_t
) luaA_wibox_set_height
,
1562 (lua_class_propfunc_t
) luaA_wibox_get_height
,
1563 (lua_class_propfunc_t
) luaA_wibox_set_height
);
1564 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_BOUNDING
,
1565 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
,
1566 (lua_class_propfunc_t
) luaA_wibox_get_shape_bounding
,
1567 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
);
1568 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_CLIP
,
1569 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
,
1570 (lua_class_propfunc_t
) luaA_wibox_get_shape_clip
,
1571 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
);
1574 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80