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 simple 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_PIXEL
| XCB_CW_BORDER_PIXEL
| XCB_CW_BIT_GRAVITY
170 | XCB_CW_OVERRIDE_REDIRECT
| XCB_CW_EVENT_MASK
,
174 w
->border_color
.pixel
,
175 XCB_GRAVITY_NORTH_WEST
,
177 XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
178 | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY
| XCB_EVENT_MASK_ENTER_WINDOW
179 | XCB_EVENT_MASK_LEAVE_WINDOW
| XCB_EVENT_MASK_STRUCTURE_NOTIFY
180 | XCB_EVENT_MASK_BUTTON_PRESS
| XCB_EVENT_MASK_BUTTON_RELEASE
181 | XCB_EVENT_MASK_POINTER_MOTION
| XCB_EVENT_MASK_EXPOSURE
182 | XCB_EVENT_MASK_PROPERTY_CHANGE
185 /* Create a pixmap. */
186 w
->pixmap
= xcb_generate_id(globalconf
.connection
);
187 xcb_create_pixmap(globalconf
.connection
, s
->root_depth
, w
->pixmap
, s
->root
,
188 w
->geometry
.width
, w
->geometry
.height
);
190 /* Update draw context physical screen, important for Zaphod. */
191 w
->ctx
.phys_screen
= phys_screen
;
192 wibox_draw_context_update(w
, s
);
194 /* The default GC is just a newly created associated to the root window */
195 w
->gc
= xcb_generate_id(globalconf
.connection
);
196 xcb_create_gc(globalconf
.connection
, w
->gc
, s
->root
, XCB_GC_FOREGROUND
| XCB_GC_BACKGROUND
,
197 (const uint32_t[]) { s
->black_pixel
, s
->white_pixel
});
199 wibox_shape_update(w
);
202 /** Refresh the window content by copying its pixmap data to its window.
203 * \param w The wibox to refresh.
206 wibox_refresh_pixmap(wibox_t
*w
)
208 wibox_refresh_pixmap_partial(w
, 0, 0, w
->geometry
.width
, w
->geometry
.height
);
211 /** Move and/or resize a wibox
212 * \param L The Lua VM state.
213 * \param udx The index of the wibox.
214 * \param geometry The new geometry.
217 wibox_moveresize(lua_State
*L
, int udx
, area_t geometry
)
219 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
222 int number_of_vals
= 0;
223 uint32_t moveresize_win_vals
[4], mask_vals
= 0;
225 if(w
->geometry
.x
!= geometry
.x
)
227 w
->geometry
.x
= moveresize_win_vals
[number_of_vals
++] = geometry
.x
;
228 mask_vals
|= XCB_CONFIG_WINDOW_X
;
231 if(w
->geometry
.y
!= geometry
.y
)
233 w
->geometry
.y
= moveresize_win_vals
[number_of_vals
++] = geometry
.y
;
234 mask_vals
|= XCB_CONFIG_WINDOW_Y
;
237 if(geometry
.width
> 0 && w
->geometry
.width
!= geometry
.width
)
239 w
->geometry
.width
= moveresize_win_vals
[number_of_vals
++] = geometry
.width
;
240 mask_vals
|= XCB_CONFIG_WINDOW_WIDTH
;
243 if(geometry
.height
> 0 && w
->geometry
.height
!= geometry
.height
)
245 w
->geometry
.height
= moveresize_win_vals
[number_of_vals
++] = geometry
.height
;
246 mask_vals
|= XCB_CONFIG_WINDOW_HEIGHT
;
249 if(mask_vals
& (XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT
))
251 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
252 /* orientation != East */
253 if(w
->pixmap
!= w
->ctx
.pixmap
)
254 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
255 w
->pixmap
= xcb_generate_id(globalconf
.connection
);
256 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
257 xcb_create_pixmap(globalconf
.connection
, s
->root_depth
, w
->pixmap
, s
->root
,
258 w
->geometry
.width
, w
->geometry
.height
);
259 wibox_draw_context_update(w
, s
);
263 client_ignore_enterleave_events();
266 xcb_configure_window(globalconf
.connection
, w
->window
, mask_vals
, moveresize_win_vals
);
269 client_restore_enterleave_events();
271 w
->screen
= screen_getbycoord(w
->screen
, w
->geometry
.x
, w
->geometry
.y
);
273 if(mask_vals
& XCB_CONFIG_WINDOW_X
)
274 luaA_object_emit_signal(L
, udx
, "property::x", 0);
275 if(mask_vals
& XCB_CONFIG_WINDOW_Y
)
276 luaA_object_emit_signal(L
, udx
, "property::y", 0);
277 if(mask_vals
& XCB_CONFIG_WINDOW_WIDTH
)
278 luaA_object_emit_signal(L
, udx
, "property::width", 0);
279 if(mask_vals
& XCB_CONFIG_WINDOW_HEIGHT
)
280 luaA_object_emit_signal(L
, udx
, "property::height", 0);
284 #define DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(prop) \
285 if(w->geometry.prop != geometry.prop) \
287 w->geometry.prop = geometry.prop; \
288 luaA_object_emit_signal(L, udx, "property::" #prop, 0); \
290 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(x
)
291 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(y
)
292 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(width
)
293 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(height
)
294 #undef DO_WIBOX_GEOMETRY_CHECK_AND_EMIT
297 wibox_need_update(w
);
300 /** Refresh the window content by copying its pixmap data to its window.
301 * \param wibox The wibox to refresh.
302 * \param x The copy starting point x component.
303 * \param y The copy starting point y component.
304 * \param w The copy width from the x component.
305 * \param h The copy height from the y component.
308 wibox_refresh_pixmap_partial(wibox_t
*wibox
,
309 int16_t x
, int16_t y
,
310 uint16_t w
, uint16_t h
)
312 xcb_copy_area(globalconf
.connection
, wibox
->pixmap
,
313 wibox
->window
, wibox
->gc
, x
, y
, x
, y
,
318 wibox_set_opacity(lua_State
*L
, int udx
, double opacity
)
320 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
321 if(w
->opacity
!= opacity
)
323 w
->opacity
= opacity
;
325 window_opacity_set(w
->window
, opacity
);
326 luaA_object_emit_signal(L
, udx
, "property::opacity", 0);
330 /** Set a wibox border color.
331 * \param L The Lua VM state.
332 * \param udx The wibox to change border width.
333 * \param color The border color.
336 wibox_set_border_color(lua_State
*L
, int udx
, const xcolor_t
*color
)
338 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
339 if (w
->window
!= XCB_NONE
)
340 xcb_change_window_attributes(globalconf
.connection
, w
->window
,
341 XCB_CW_BORDER_PIXEL
, &color
->pixel
);
342 w
->border_color
= *color
;
343 luaA_object_emit_signal(L
, udx
, "property::border_color", 0);
346 /** Set wibox orientation.
347 * \param L The Lua VM state.
348 * \param udx The wibox to change orientation.
349 * \param o The new orientation.
352 wibox_set_orientation(lua_State
*L
, int udx
, orientation_t o
)
354 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
355 if(o
!= w
->orientation
)
357 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
359 /* orientation != East */
360 if(w
->pixmap
!= w
->ctx
.pixmap
)
361 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
362 wibox_draw_context_update(w
, s
);
363 luaA_object_emit_signal(L
, udx
, "property::orientation", 0);
368 wibox_map(wibox_t
*wibox
)
371 client_ignore_enterleave_events();
373 xcb_map_window(globalconf
.connection
, wibox
->window
);
375 client_restore_enterleave_events();
376 /* We must make sure the wibox does not display garbage */
377 wibox_need_update(wibox
);
378 /* Stack this wibox correctly */
382 /** Kick out systray windows.
383 * \param phys_screen Physical screen number.
386 wibox_systray_kickout(int phys_screen
)
388 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
390 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= s
->root
)
392 /* Who! Check that we're not deleting a wibox with a systray, because it
393 * may be its parent. If so, we reparent to root before, otherwise it will
395 xcb_reparent_window(globalconf
.connection
,
396 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
397 s
->root
, -512, -512);
399 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= s
->root
;
404 wibox_systray_refresh(wibox_t
*wibox
)
409 for(int i
= 0; i
< wibox
->widgets
.len
; i
++)
411 widget_node_t
*systray
= &wibox
->widgets
.tab
[i
];
412 if(systray
->widget
->type
== widget_systray
)
414 uint32_t config_back
[] = { wibox
->ctx
.bg
.pixel
};
415 uint32_t config_win_vals
[4];
416 uint32_t config_win_vals_off
[2] = { -512, -512 };
418 int phys_screen
= wibox
->ctx
.phys_screen
;
421 && systray
->widget
->isvisible
422 && systray
->geometry
.width
)
424 /* Set background of the systray window. */
425 xcb_change_window_attributes(globalconf
.connection
,
426 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
427 XCB_CW_BACK_PIXEL
, config_back
);
429 xcb_map_window(globalconf
.connection
, globalconf
.screens
.tab
[phys_screen
].systray
.window
);
431 switch(wibox
->orientation
)
434 config_win_vals
[0] = systray
->geometry
.y
;
435 config_win_vals
[1] = wibox
->geometry
.height
- systray
->geometry
.x
- systray
->geometry
.width
;
436 config_win_vals
[2] = systray
->geometry
.height
;
437 config_win_vals
[3] = systray
->geometry
.width
;
440 config_win_vals
[0] = systray
->geometry
.y
;
441 config_win_vals
[1] = systray
->geometry
.x
;
442 config_win_vals
[2] = systray
->geometry
.height
;
443 config_win_vals
[3] = systray
->geometry
.width
;
446 config_win_vals
[0] = systray
->geometry
.x
;
447 config_win_vals
[1] = systray
->geometry
.y
;
448 config_win_vals
[2] = systray
->geometry
.width
;
449 config_win_vals
[3] = systray
->geometry
.height
;
453 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= wibox
->window
)
455 xcb_reparent_window(globalconf
.connection
,
456 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
458 config_win_vals
[0], config_win_vals
[1]);
459 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= wibox
->window
;
461 xcb_configure_window(globalconf
.connection
,
462 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
464 | XCB_CONFIG_WINDOW_Y
465 | XCB_CONFIG_WINDOW_WIDTH
466 | XCB_CONFIG_WINDOW_HEIGHT
,
468 /* width = height = systray height */
469 config_win_vals
[2] = config_win_vals
[3] = systray
->geometry
.height
;
470 config_win_vals
[0] = 0;
473 return wibox_systray_kickout(phys_screen
);
475 switch(wibox
->orientation
)
478 config_win_vals
[1] = systray
->geometry
.width
- config_win_vals
[3];
479 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
481 em
= &globalconf
.embedded
.tab
[j
];
482 if(em
->phys_screen
== phys_screen
)
484 if(config_win_vals
[1] - config_win_vals
[2] >= (uint32_t) wibox
->geometry
.y
)
486 xcb_map_window(globalconf
.connection
, em
->win
);
487 xcb_configure_window(globalconf
.connection
, em
->win
,
489 | XCB_CONFIG_WINDOW_Y
490 | XCB_CONFIG_WINDOW_WIDTH
491 | XCB_CONFIG_WINDOW_HEIGHT
,
493 config_win_vals
[1] -= config_win_vals
[3];
496 xcb_configure_window(globalconf
.connection
, em
->win
,
498 | XCB_CONFIG_WINDOW_Y
,
499 config_win_vals_off
);
504 config_win_vals
[1] = 0;
505 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
507 em
= &globalconf
.embedded
.tab
[j
];
508 if(em
->phys_screen
== phys_screen
)
510 /* if(y + width <= wibox.y + systray.right) */
511 if(config_win_vals
[1] + config_win_vals
[3] <= (uint32_t) wibox
->geometry
.y
+ AREA_RIGHT(systray
->geometry
))
513 xcb_map_window(globalconf
.connection
, em
->win
);
514 xcb_configure_window(globalconf
.connection
, em
->win
,
516 | XCB_CONFIG_WINDOW_Y
517 | XCB_CONFIG_WINDOW_WIDTH
518 | XCB_CONFIG_WINDOW_HEIGHT
,
520 config_win_vals
[1] += config_win_vals
[3];
523 xcb_configure_window(globalconf
.connection
, em
->win
,
525 | XCB_CONFIG_WINDOW_Y
,
526 config_win_vals_off
);
531 config_win_vals
[1] = 0;
532 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
534 em
= &globalconf
.embedded
.tab
[j
];
535 if(em
->phys_screen
== phys_screen
)
537 /* if(x + width < systray.x + systray.width) */
538 if(config_win_vals
[0] + config_win_vals
[2] <= (uint32_t) AREA_RIGHT(systray
->geometry
) + wibox
->geometry
.x
)
540 xcb_map_window(globalconf
.connection
, em
->win
);
541 xcb_configure_window(globalconf
.connection
, em
->win
,
543 | XCB_CONFIG_WINDOW_Y
544 | XCB_CONFIG_WINDOW_WIDTH
545 | XCB_CONFIG_WINDOW_HEIGHT
,
547 config_win_vals
[0] += config_win_vals
[2];
550 xcb_configure_window(globalconf
.connection
, em
->win
,
552 | XCB_CONFIG_WINDOW_Y
,
553 config_win_vals_off
);
563 /** Get a wibox by its window.
564 * \param win The window id.
565 * \return A wibox if found, NULL otherwise.
568 wibox_getbywin(xcb_window_t win
)
570 foreach(w
, globalconf
.wiboxes
)
571 if((*w
)->window
== win
)
574 foreach(_c
, globalconf
.clients
)
577 if(c
->titlebar
&& c
->titlebar
->window
== win
)
585 * \param wibox The wibox to draw.
588 wibox_draw(wibox_t
*wibox
)
592 widget_render(wibox
);
593 wibox_refresh_pixmap(wibox
);
595 wibox
->need_update
= false;
598 wibox_systray_refresh(wibox
);
601 /** Refresh all wiboxes.
606 foreach(w
, globalconf
.wiboxes
)
608 if((*w
)->need_shape_update
)
609 wibox_shape_update(*w
);
610 if((*w
)->need_update
)
614 foreach(_c
, globalconf
.clients
)
617 if(c
->titlebar
&& c
->titlebar
->need_update
)
618 wibox_draw(c
->titlebar
);
622 /** Set a wibox visible or not.
623 * \param L The Lua VM state.
624 * \param udx The wibox.
625 * \param v The visible value.
628 wibox_set_visible(lua_State
*L
, int udx
, bool v
)
630 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
631 if(v
!= wibox
->visible
)
634 wibox
->mouse_over
= NULL
;
643 client_ignore_enterleave_events();
645 xcb_unmap_window(globalconf
.connection
, wibox
->window
);
647 client_restore_enterleave_events();
650 /* kick out systray if needed */
651 wibox_systray_refresh(wibox
);
654 luaA_object_emit_signal(L
, udx
, "property::visible", 0);
656 hook_property(wibox
, "visible");
660 /** Destroy all X resources of a wibox.
661 * \param w The wibox to wipe.
664 wibox_wipe(wibox_t
*w
)
669 client_ignore_enterleave_events();
670 xcb_destroy_window(globalconf
.connection
, w
->window
);
672 client_restore_enterleave_events();
673 w
->window
= XCB_NONE
;
677 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
678 w
->pixmap
= XCB_NONE
;
682 xcb_free_gc(globalconf
.connection
, w
->gc
);
685 draw_context_wipe(&w
->ctx
);
688 /** Remove a wibox from a screen.
689 * \param L The Lua VM state.
690 * \param udx Wibox to detach from screen.
693 wibox_detach(lua_State
*L
, int udx
)
695 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
700 /* save visible state */
702 wibox
->visible
= false;
703 wibox_systray_refresh(wibox
);
704 /* restore visibility */
707 wibox
->mouse_over
= NULL
;
711 foreach(item
, globalconf
.wiboxes
)
714 wibox_array_remove(&globalconf
.wiboxes
, item
);
718 hook_property(wibox
, "screen");
720 if(strut_has_value(&wibox
->strut
))
721 screen_emit_signal(L
, wibox
->screen
, "property::workarea", 0);
723 wibox
->screen
= NULL
;
724 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
726 luaA_object_unref(globalconf
.L
, wibox
);
730 /** Attach a wibox that is on top of the stack.
731 * \param L The Lua VM state.
732 * \param udx The wibox to attach.
733 * \param s The screen to attach the wibox to.
736 wibox_attach(lua_State
*L
, int udx
, screen_t
*s
)
738 int phys_screen
= screen_virttophys(screen_array_indexof(&globalconf
.screens
, s
));
740 /* duplicate wibox */
741 lua_pushvalue(L
, udx
);
743 wibox_t
*wibox
= luaA_object_ref_class(globalconf
.L
, -1, &wibox_class
);
745 wibox_detach(L
, udx
);
747 /* Set the wibox screen */
750 /* Check that the wibox coordinates matches the screen. */
752 screen_getbycoord(wibox
->screen
, wibox
->geometry
.x
, wibox
->geometry
.y
);
754 /* If it does not match, move it to the screen coordinates */
755 if(cscreen
!= wibox
->screen
)
756 wibox_moveresize(L
, udx
, (area_t
) { .x
= s
->geometry
.x
,
758 .width
= wibox
->geometry
.width
,
759 .height
= wibox
->geometry
.height
});
761 wibox_array_append(&globalconf
.wiboxes
, wibox
);
763 wibox_init(wibox
, phys_screen
);
765 window_set_cursor(wibox
->window
,
766 xcursor_new(globalconf
.connection
, xcursor_font_fromstr(wibox
->cursor
)));
768 if(wibox
->opacity
!= -1)
769 window_opacity_set(wibox
->window
, wibox
->opacity
);
771 ewmh_update_strut(wibox
->window
, &wibox
->strut
);
776 wibox_need_update(wibox
);
778 hook_property(wibox
, "screen");
779 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
781 if(strut_has_value(&wibox
->strut
))
782 screen_emit_signal(L
, wibox
->screen
, "property::workarea", 0);
785 /** Create a new wibox.
786 * \param L The Lua VM state.
789 * \lparam A table with optionally defined values:
790 * fg, bg, border_width, border_color, ontop, width and height.
791 * \lreturn A brand new wibox.
794 luaA_wibox_new(lua_State
*L
)
796 luaA_class_new(L
, &wibox_class
);
798 wibox_t
*w
= luaA_checkudata(L
, -1, &wibox_class
);
800 if(!w
->ctx
.fg
.initialized
)
801 w
->ctx
.fg
= globalconf
.colors
.fg
;
803 if(!w
->ctx
.bg
.initialized
)
804 w
->ctx
.bg
= globalconf
.colors
.bg
;
806 if(!w
->border_color
.initialized
)
807 w
->border_color
= globalconf
.colors
.bg
;
815 w
->cursor
= a_strdup("left_ptr");
817 if(!w
->geometry
.width
)
818 w
->geometry
.width
= 1;
820 if(!w
->geometry
.height
)
821 w
->geometry
.height
= 1;
826 /** Check if a wibox widget table has an item.
827 * \param L The Lua VM state.
828 * \param wibox The wibox.
829 * \param item The item to look for.
832 luaA_wibox_hasitem(lua_State
*L
, wibox_t
*wibox
, const void *item
)
834 if(wibox
->widgets_table
)
836 luaA_object_push(L
, wibox
);
837 luaA_object_push_item(L
, -1, wibox
->widgets_table
);
839 if(lua_topointer(L
, -1) == item
|| luaA_hasitem(L
, item
))
845 /** Invalidate a wibox by a Lua object (table, etc).
846 * \param L The Lua VM state.
847 * \param item The object identifier.
850 luaA_wibox_invalidate_byitem(lua_State
*L
, const void *item
)
852 foreach(w
, globalconf
.wiboxes
)
855 if(luaA_wibox_hasitem(L
, wibox
, item
))
858 wibox_need_update(wibox
);
859 lua_pop(L
, 1); /* remove widgets table */
864 foreach(_c
, globalconf
.clients
)
867 if(c
->titlebar
&& luaA_wibox_hasitem(L
, c
->titlebar
, item
))
870 wibox_need_update(c
->titlebar
);
871 lua_pop(L
, 1); /* remove widgets table */
876 /* Set or get the wibox geometry.
877 * \param L The Lua VM state.
878 * \return The number of elements pushed on stack.
880 * \lparam An optional table with wibox geometry.
881 * \lreturn The wibox geometry.
884 luaA_wibox_geometry(lua_State
*L
)
886 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
888 if(lua_gettop(L
) == 2)
892 luaA_checktable(L
, 2);
893 wingeom
.x
= luaA_getopt_number(L
, 2, "x", wibox
->geometry
.x
);
894 wingeom
.y
= luaA_getopt_number(L
, 2, "y", wibox
->geometry
.y
);
895 wingeom
.width
= luaA_getopt_number(L
, 2, "width", wibox
->geometry
.width
);
896 wingeom
.height
= luaA_getopt_number(L
, 2, "height", wibox
->geometry
.height
);
898 if(wingeom
.width
> 0 && wingeom
.height
> 0)
901 case WIBOX_TYPE_TITLEBAR
:
902 wibox_moveresize(L
, 1, (area_t
) { .x
= wibox
->geometry
.x
,
903 .y
= wibox
->geometry
.y
,
904 .width
= wingeom
.width
,
905 .height
= wingeom
.height
});
907 case WIBOX_TYPE_NORMAL
:
908 wibox_moveresize(L
, 1, wingeom
);
913 return luaA_pusharea(L
, wibox
->geometry
);
917 luaA_wibox_struts(lua_State
*L
)
919 wibox_t
*w
= luaA_checkudata(L
, 1, &wibox_class
);
921 if(lua_gettop(L
) == 2)
923 luaA_tostrut(L
, 2, &w
->strut
);
925 ewmh_update_strut(w
->window
, &w
->strut
);
926 luaA_object_emit_signal(L
, 1, "property::struts", 0);
928 screen_emit_signal(L
, w
->screen
, "property::workarea", 0);
931 return luaA_pushstrut(L
, w
->strut
);
934 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, ontop
, lua_pushboolean
)
935 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, cursor
, lua_pushstring
)
936 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, visible
, lua_pushboolean
)
937 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_width
, lua_pushnumber
)
938 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_color
, luaA_pushxcolor
)
941 luaA_wibox_set_x(lua_State
*L
, wibox_t
*wibox
)
943 wibox_moveresize(L
, -3, (area_t
) { .x
= luaL_checknumber(L
, -1),
944 .y
= wibox
->geometry
.y
,
945 .width
= wibox
->geometry
.width
,
946 .height
= wibox
->geometry
.height
});
951 luaA_wibox_get_x(lua_State
*L
, wibox_t
*wibox
)
953 lua_pushnumber(L
, wibox
->geometry
.x
);
958 luaA_wibox_set_y(lua_State
*L
, wibox_t
*wibox
)
960 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
961 .y
= luaL_checknumber(L
, -1),
962 .width
= wibox
->geometry
.width
,
963 .height
= wibox
->geometry
.height
});
968 luaA_wibox_get_y(lua_State
*L
, wibox_t
*wibox
)
970 lua_pushnumber(L
, wibox
->geometry
.y
);
975 luaA_wibox_set_width(lua_State
*L
, wibox_t
*wibox
)
977 int width
= luaL_checknumber(L
, -1);
979 luaL_error(L
, "invalid width");
980 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
981 .y
= wibox
->geometry
.y
,
983 .height
= wibox
->geometry
.height
});
988 luaA_wibox_get_width(lua_State
*L
, wibox_t
*wibox
)
990 lua_pushnumber(L
, wibox
->geometry
.width
);
995 luaA_wibox_set_height(lua_State
*L
, wibox_t
*wibox
)
997 int height
= luaL_checknumber(L
, -1);
999 luaL_error(L
, "invalid height");
1000 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
1001 .y
= wibox
->geometry
.y
,
1002 .width
= wibox
->geometry
.width
,
1003 .height
= height
});
1008 luaA_wibox_get_height(lua_State
*L
, wibox_t
*wibox
)
1010 lua_pushnumber(L
, wibox
->geometry
.height
);
1014 /** Set the wibox foreground color.
1015 * \param L The Lua VM state.
1016 * \param wibox The wibox object.
1017 * \return The number of elements pushed on stack.
1020 luaA_wibox_set_fg(lua_State
*L
, wibox_t
*wibox
)
1023 const char *buf
= luaL_checklstring(L
, -1, &len
);
1024 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.fg
, buf
, len
)))
1025 wibox
->need_update
= true;
1026 luaA_object_emit_signal(L
, -3, "property::fg", 0);
1030 /** Get the wibox foreground color.
1031 * \param L The Lua VM state.
1032 * \param wibox The wibox object.
1033 * \return The number of elements pushed on stack.
1036 luaA_wibox_get_fg(lua_State
*L
, wibox_t
*wibox
)
1038 return luaA_pushxcolor(L
, wibox
->ctx
.fg
);
1041 /** Set the wibox background color.
1042 * \param L The Lua VM state.
1043 * \param wibox The wibox object.
1044 * \return The number of elements pushed on stack.
1047 luaA_wibox_set_bg(lua_State
*L
, wibox_t
*wibox
)
1050 const char *buf
= luaL_checklstring(L
, -1, &len
);
1051 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.bg
, buf
, len
)))
1053 uint32_t mask
= XCB_CW_BACK_PIXEL
;
1054 uint32_t values
[] = { wibox
->ctx
.bg
.pixel
};
1056 wibox
->need_update
= true;
1058 if (wibox
->window
!= XCB_NONE
)
1059 xcb_change_window_attributes(globalconf
.connection
,
1064 luaA_object_emit_signal(L
, -3, "property::bg", 0);
1068 /** Get the wibox background color.
1069 * \param L The Lua VM state.
1070 * \param wibox The wibox object.
1071 * \return The number of elements pushed on stack.
1074 luaA_wibox_get_bg(lua_State
*L
, wibox_t
*wibox
)
1076 return luaA_pushxcolor(L
, wibox
->ctx
.bg
);
1079 /** Set the wibox background image.
1080 * \param L The Lua VM state.
1081 * \param wibox The wibox object.
1082 * \return The number of elements pushed on stack.
1085 luaA_wibox_set_bg_image(lua_State
*L
, wibox_t
*wibox
)
1087 luaA_checkudata(L
, -1, &image_class
);
1088 luaA_object_unref_item(L
, -3, wibox
->bg_image
);
1089 wibox
->bg_image
= luaA_object_ref_item(L
, -3, -1);
1090 wibox
->need_update
= true;
1091 luaA_object_emit_signal(L
, -2, "property::bg_image", 0);
1095 /** Get the wibox background image.
1096 * \param L The Lua VM state.
1097 * \param wibox The wibox object.
1098 * \return The number of elements pushed on stack.
1101 luaA_wibox_get_bg_image(lua_State
*L
, wibox_t
*wibox
)
1103 return luaA_object_push_item(L
, 1, wibox
->bg_image
);
1106 /** Set the wibox on top status.
1107 * \param L The Lua VM state.
1108 * \param wibox The wibox object.
1109 * \return The number of elements pushed on stack.
1112 luaA_wibox_set_ontop(lua_State
*L
, wibox_t
*wibox
)
1114 bool b
= luaA_checkboolean(L
, -1);
1115 if(b
!= wibox
->ontop
)
1119 luaA_object_emit_signal(L
, -3, "property::ontop", 0);
1124 /** Set the wibox opacity.
1125 * \param L The Lua VM state.
1126 * \param wibox The wibox object.
1127 * \return The number of elements pushed on stack.
1130 luaA_wibox_set_opacity(lua_State
*L
, wibox_t
*wibox
)
1132 if(lua_isnil(L
, -1))
1133 wibox_set_opacity(L
, -3, -1);
1136 double d
= luaL_checknumber(L
, -1);
1137 if(d
>= 0 && d
<= 1)
1138 wibox_set_opacity(L
, -3, d
);
1143 /** Get the wibox opacity.
1144 * \param L The Lua VM state.
1145 * \param wibox The wibox object.
1146 * \return The number of elements pushed on stack.
1149 luaA_wibox_get_opacity(lua_State
*L
, wibox_t
*wibox
)
1151 if (wibox
->opacity
>= 0)
1153 lua_pushnumber(L
, wibox
->opacity
);
1159 /** Set the wibox alignment.
1160 * \param L The Lua VM state.
1161 * \param wibox The wibox object.
1162 * \return The number of elements pushed on stack.
1165 luaA_wibox_set_align(lua_State
*L
, wibox_t
*wibox
)
1168 const char *buf
= luaL_checklstring(L
, -1, &len
);
1169 wibox
->align
= draw_align_fromstr(buf
, len
);
1170 luaA_object_emit_signal(L
, -3, "property::align", 0);
1173 case WIBOX_TYPE_NORMAL
:
1174 luaA_deprecate(L
, "awful.wibox.align");
1176 case WIBOX_TYPE_TITLEBAR
:
1177 titlebar_update_geometry(client_getbytitlebar(wibox
));
1183 /** Get the wibox alignment.
1184 * \param L The Lua VM state.
1185 * \param wibox The wibox object.
1186 * \return The number of elements pushed on stack.
1189 luaA_wibox_get_align(lua_State
*L
, wibox_t
*wibox
)
1191 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1192 luaA_deprecate(L
, "awful.wibox.align");
1193 lua_pushstring(L
, draw_align_tostr(wibox
->align
));
1197 /** Set the wibox position.
1198 * \param L The Lua VM state.
1199 * \param wibox The wibox object.
1200 * \return The number of elements pushed on stack.
1203 luaA_wibox_set_position(lua_State
*L
, wibox_t
*wibox
)
1207 case WIBOX_TYPE_NORMAL
:
1211 if((buf
= luaL_checklstring(L
, -1, &len
)))
1213 luaA_deprecate(L
, "awful.wibox.attach");
1214 wibox
->position
= position_fromstr(buf
, len
);
1218 case WIBOX_TYPE_TITLEBAR
:
1219 return luaA_titlebar_set_position(L
, -3);
1224 /** Get the wibox position.
1225 * \param L The Lua VM state.
1226 * \param wibox The wibox object.
1227 * \return The number of elements pushed on stack.
1230 luaA_wibox_get_position(lua_State
*L
, wibox_t
*wibox
)
1232 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1233 luaA_deprecate(L
, "awful.wibox.attach");
1234 lua_pushstring(L
, position_tostr(wibox
->position
));
1238 /** Set the wibox (titlebar) client.
1239 * \param L The Lua VM state.
1240 * \param wibox The wibox object.
1241 * \return The number of elements pushed on stack.
1244 luaA_wibox_set_client(lua_State
*L
, wibox_t
*wibox
)
1247 if(lua_isnil(L
, -1))
1248 titlebar_client_detach(client_getbytitlebar(wibox
));
1251 client_t
*c
= luaA_client_checkudata(L
, -1);
1252 lua_pushvalue(L
, -3);
1253 titlebar_client_attach(c
);
1258 /** Get the wibox (titlebar) client.
1259 * \param L The Lua VM state.
1260 * \param wibox The wibox object.
1261 * \return The number of elements pushed on stack.
1264 luaA_wibox_get_client(lua_State
*L
, wibox_t
*wibox
)
1266 return luaA_object_push(L
, client_getbytitlebar(wibox
));
1269 /** Set the wibox cursor.
1270 * \param L The Lua VM state.
1271 * \param wibox The wibox object.
1272 * \return The number of elements pushed on stack.
1275 luaA_wibox_set_cursor(lua_State
*L
, wibox_t
*wibox
)
1277 const char *buf
= luaL_checkstring(L
, -1);
1280 uint16_t cursor_font
= xcursor_font_fromstr(buf
);
1283 xcb_cursor_t cursor
= xcursor_new(globalconf
.connection
, cursor_font
);
1284 p_delete(&wibox
->cursor
);
1285 wibox
->cursor
= a_strdup(buf
);
1286 window_set_cursor(wibox
->window
, cursor
);
1287 luaA_object_emit_signal(L
, -3, "property::cursor", 0);
1293 /** Set the wibox screen.
1294 * \param L The Lua VM state.
1295 * \param wibox The wibox object.
1296 * \return The number of elements pushed on stack.
1299 luaA_wibox_set_screen(lua_State
*L
, wibox_t
*wibox
)
1301 if(lua_isnil(L
, -1))
1303 wibox_detach(L
, -3);
1304 titlebar_client_detach(client_getbytitlebar(wibox
));
1308 int screen
= luaL_checknumber(L
, -1) - 1;
1309 luaA_checkscreen(screen
);
1310 if(!wibox
->screen
|| screen
!= screen_array_indexof(&globalconf
.screens
, wibox
->screen
))
1312 titlebar_client_detach(client_getbytitlebar(wibox
));
1313 wibox_attach(L
, -3, &globalconf
.screens
.tab
[screen
]);
1319 /** Get the wibox screen.
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_get_screen(lua_State
*L
, wibox_t
*wibox
)
1329 lua_pushnumber(L
, screen_array_indexof(&globalconf
.screens
, wibox
->screen
) + 1);
1333 /** Set the wibox orientation.
1334 * \param L The Lua VM state.
1335 * \param wibox The wibox object.
1336 * \return The number of elements pushed on stack.
1339 luaA_wibox_set_orientation(lua_State
*L
, wibox_t
*wibox
)
1342 const char *buf
= luaL_checklstring(L
, -1, &len
);
1345 wibox_set_orientation(L
, -3, orientation_fromstr(buf
, len
));
1346 wibox_need_update(wibox
);
1351 /** Get the wibox orientation.
1352 * \param L The Lua VM state.
1353 * \param wibox The wibox object.
1354 * \return The number of elements pushed on stack.
1357 luaA_wibox_get_orientation(lua_State
*L
, wibox_t
*wibox
)
1359 lua_pushstring(L
, orientation_tostr(wibox
->orientation
));
1363 /** Set the wibox border color.
1364 * \param L The Lua VM state.
1365 * \param wibox The wibox object.
1366 * \return The number of elements pushed on stack.
1369 luaA_wibox_set_border_color(lua_State
*L
, wibox_t
*wibox
)
1372 const char *buf
= luaL_checklstring(L
, -1, &len
);
1374 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->border_color
, buf
, len
)))
1376 wibox_set_border_color(L
, -3, &wibox
->border_color
);
1380 /** Set the wibox visibility.
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_set_visible(lua_State
*L
, wibox_t
*wibox
)
1388 bool b
= luaA_checkboolean(L
, -1);
1389 if(b
!= wibox
->visible
)
1392 case WIBOX_TYPE_NORMAL
:
1393 wibox_set_visible(L
, -3, b
);
1395 case WIBOX_TYPE_TITLEBAR
:
1396 titlebar_set_visible(wibox
, b
);
1402 /** Set the wibox widgets.
1403 * \param L The Lua VM state.
1404 * \param wibox The wibox object.
1405 * \return The number of elements pushed on stack.
1408 luaA_wibox_set_widgets(lua_State
*L
, wibox_t
*wibox
)
1410 if(luaA_isloop(L
, -1))
1412 luaA_warn(L
, "table is looping, cannot use this as widget table");
1415 /* duplicate table because next function will eat it */
1416 lua_pushvalue(L
, -1);
1417 wibox
->widgets_table
= luaA_object_ref_item(L
, -4, -1);
1418 luaA_object_emit_signal(L
, -3, "property::widgets", 0);
1419 wibox_need_update(wibox
);
1420 luaA_table2wtable(L
);
1424 /** Get the wibox widgets.
1425 * \param L The Lua VM state.
1426 * \param wibox The wibox object.
1427 * \return The number of elements pushed on stack.
1430 luaA_wibox_get_widgets(lua_State
*L
, wibox_t
*wibox
)
1432 return luaA_object_push_item(L
, 1, wibox
->widgets_table
);
1435 /** Get or set mouse buttons bindings to a wibox.
1436 * \param L The Lua VM state.
1439 * \lparam An array of mouse button bindings objects, or nothing.
1440 * \return The array of mouse button bindings objects of this wibox.
1443 luaA_wibox_buttons(lua_State
*L
)
1445 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
1447 if(lua_gettop(L
) == 2)
1449 luaA_button_array_set(L
, 1, 2, &wibox
->buttons
);
1450 luaA_object_emit_signal(L
, 1, "property::buttons", 0);
1453 return luaA_button_array_get(L
, 1, &wibox
->buttons
);
1456 /** Set the wibox border width.
1457 * \param L The Lua VM state.
1458 * \param wibox The wibox object.
1459 * \return The number of elements pushed on stack.
1462 luaA_wibox_set_border_width(lua_State
*L
, wibox_t
*wibox
)
1464 wibox_t
*w
= luaA_checkudata(L
, -3, &wibox_class
);
1465 uint32_t border_width
= luaL_checknumber(L
, -1);
1466 if(border_width
!= w
->border_width
)
1468 if (w
->window
!= XCB_NONE
)
1469 xcb_configure_window(globalconf
.connection
, w
->window
, XCB_CONFIG_WINDOW_BORDER_WIDTH
,
1471 w
->border_width
= border_width
;
1472 /* Need update if transparent background */
1473 wibox_need_update(w
);
1474 luaA_object_emit_signal(L
, -3, "property::border_width", 0);
1480 luaA_wibox_set_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1482 luaA_checkudata(L
, -1, &image_class
);
1483 luaA_object_unref_item(L
, -3, wibox
->shape
.bounding
);
1484 wibox
->shape
.bounding
= luaA_object_ref_item(L
, -3, -1);
1485 wibox
->need_shape_update
= true;
1486 luaA_object_emit_signal(L
, -2, "property::shape_bounding", 0);
1491 luaA_wibox_get_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1493 return luaA_object_push_item(L
, 1, wibox
->shape
.bounding
);
1497 luaA_wibox_set_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1499 luaA_checkudata(L
, -1, &image_class
);
1500 luaA_object_unref_item(L
, -3, wibox
->shape
.clip
);
1501 wibox
->shape
.clip
= luaA_object_ref_item(L
, -3, -1);
1502 wibox
->need_shape_update
= true;
1503 luaA_object_emit_signal(L
, -2, "property::shape_clip", 0);
1508 luaA_wibox_get_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1510 return luaA_object_push_item(L
, 1, wibox
->shape
.clip
);
1514 wibox_class_setup(lua_State
*L
)
1516 static const struct luaL_reg wibox_methods
[] =
1518 LUA_CLASS_METHODS(wibox
)
1519 { "__call", luaA_wibox_new
},
1523 static const struct luaL_reg wibox_meta
[] =
1525 LUA_OBJECT_META(wibox
)
1527 { "struts", luaA_wibox_struts
},
1528 { "buttons", luaA_wibox_buttons
},
1529 { "geometry", luaA_wibox_geometry
},
1530 { "__gc", luaA_wibox_gc
},
1534 luaA_class_setup(L
, &wibox_class
, "wibox", (lua_class_allocator_t
) wibox_new
,
1535 luaA_class_index_miss_property
, luaA_class_newindex_miss_property
,
1536 wibox_methods
, wibox_meta
);
1537 luaA_class_add_property(&wibox_class
, A_TK_WIDGETS
,
1538 (lua_class_propfunc_t
) luaA_wibox_set_widgets
,
1539 (lua_class_propfunc_t
) luaA_wibox_get_widgets
,
1540 (lua_class_propfunc_t
) luaA_wibox_set_widgets
);
1541 luaA_class_add_property(&wibox_class
, A_TK_OPACITY
,
1542 (lua_class_propfunc_t
) luaA_wibox_set_opacity
,
1543 (lua_class_propfunc_t
) luaA_wibox_get_opacity
,
1544 (lua_class_propfunc_t
) luaA_wibox_set_opacity
);
1545 luaA_class_add_property(&wibox_class
, A_TK_VISIBLE
,
1546 (lua_class_propfunc_t
) luaA_wibox_set_visible
,
1547 (lua_class_propfunc_t
) luaA_wibox_get_visible
,
1548 (lua_class_propfunc_t
) luaA_wibox_set_visible
);
1549 luaA_class_add_property(&wibox_class
, A_TK_BORDER_COLOR
,
1550 (lua_class_propfunc_t
) luaA_wibox_set_border_color
,
1551 (lua_class_propfunc_t
) luaA_wibox_get_border_color
,
1552 (lua_class_propfunc_t
) luaA_wibox_set_border_color
);
1553 luaA_class_add_property(&wibox_class
, A_TK_BORDER_WIDTH
,
1554 (lua_class_propfunc_t
) luaA_wibox_set_border_width
,
1555 (lua_class_propfunc_t
) luaA_wibox_get_border_width
,
1556 (lua_class_propfunc_t
) luaA_wibox_set_border_width
);
1557 luaA_class_add_property(&wibox_class
, A_TK_ORIENTATION
,
1558 (lua_class_propfunc_t
) luaA_wibox_set_orientation
,
1559 (lua_class_propfunc_t
) luaA_wibox_get_orientation
,
1560 (lua_class_propfunc_t
) luaA_wibox_set_orientation
);
1561 luaA_class_add_property(&wibox_class
, A_TK_ONTOP
,
1562 (lua_class_propfunc_t
) luaA_wibox_set_ontop
,
1563 (lua_class_propfunc_t
) luaA_wibox_get_ontop
,
1564 (lua_class_propfunc_t
) luaA_wibox_set_ontop
);
1565 luaA_class_add_property(&wibox_class
, A_TK_SCREEN
,
1567 (lua_class_propfunc_t
) luaA_wibox_get_screen
,
1568 (lua_class_propfunc_t
) luaA_wibox_set_screen
);
1569 luaA_class_add_property(&wibox_class
, A_TK_CURSOR
,
1570 (lua_class_propfunc_t
) luaA_wibox_set_cursor
,
1571 (lua_class_propfunc_t
) luaA_wibox_get_cursor
,
1572 (lua_class_propfunc_t
) luaA_wibox_set_cursor
);
1573 luaA_class_add_property(&wibox_class
, A_TK_CLIENT
,
1574 (lua_class_propfunc_t
) luaA_wibox_set_client
,
1575 (lua_class_propfunc_t
) luaA_wibox_get_client
,
1576 (lua_class_propfunc_t
) luaA_wibox_set_client
);
1577 luaA_class_add_property(&wibox_class
, A_TK_POSITION
,
1578 (lua_class_propfunc_t
) luaA_wibox_set_position
,
1579 (lua_class_propfunc_t
) luaA_wibox_get_position
,
1580 (lua_class_propfunc_t
) luaA_wibox_set_position
);
1581 luaA_class_add_property(&wibox_class
, A_TK_ALIGN
,
1582 (lua_class_propfunc_t
) luaA_wibox_set_align
,
1583 (lua_class_propfunc_t
) luaA_wibox_get_align
,
1584 (lua_class_propfunc_t
) luaA_wibox_set_align
);
1585 luaA_class_add_property(&wibox_class
, A_TK_FG
,
1586 (lua_class_propfunc_t
) luaA_wibox_set_fg
,
1587 (lua_class_propfunc_t
) luaA_wibox_get_fg
,
1588 (lua_class_propfunc_t
) luaA_wibox_set_fg
);
1589 luaA_class_add_property(&wibox_class
, A_TK_BG
,
1590 (lua_class_propfunc_t
) luaA_wibox_set_bg
,
1591 (lua_class_propfunc_t
) luaA_wibox_get_bg
,
1592 (lua_class_propfunc_t
) luaA_wibox_set_bg
);
1593 luaA_class_add_property(&wibox_class
, A_TK_BG_IMAGE
,
1594 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
,
1595 (lua_class_propfunc_t
) luaA_wibox_get_bg_image
,
1596 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
);
1597 luaA_class_add_property(&wibox_class
, A_TK_X
,
1598 (lua_class_propfunc_t
) luaA_wibox_set_x
,
1599 (lua_class_propfunc_t
) luaA_wibox_get_x
,
1600 (lua_class_propfunc_t
) luaA_wibox_set_x
);
1601 luaA_class_add_property(&wibox_class
, A_TK_Y
,
1602 (lua_class_propfunc_t
) luaA_wibox_set_y
,
1603 (lua_class_propfunc_t
) luaA_wibox_get_y
,
1604 (lua_class_propfunc_t
) luaA_wibox_set_y
);
1605 luaA_class_add_property(&wibox_class
, A_TK_WIDTH
,
1606 (lua_class_propfunc_t
) luaA_wibox_set_width
,
1607 (lua_class_propfunc_t
) luaA_wibox_get_width
,
1608 (lua_class_propfunc_t
) luaA_wibox_set_width
);
1609 luaA_class_add_property(&wibox_class
, A_TK_HEIGHT
,
1610 (lua_class_propfunc_t
) luaA_wibox_set_height
,
1611 (lua_class_propfunc_t
) luaA_wibox_get_height
,
1612 (lua_class_propfunc_t
) luaA_wibox_set_height
);
1613 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_BOUNDING
,
1614 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
,
1615 (lua_class_propfunc_t
) luaA_wibox_get_shape_bounding
,
1616 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
);
1617 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_CLIP
,
1618 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
,
1619 (lua_class_propfunc_t
) luaA_wibox_get_shape_clip
,
1620 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
);
1623 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80