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
);
52 /** Wipe an array of widget_node. Release references to widgets.
53 * \param L The Lua VM state.
54 * \param idx The index of the wibox on the stack.
57 wibox_widget_node_array_wipe(lua_State
*L
, int idx
)
59 wibox_t
*wibox
= luaA_checkudata(L
, idx
, &wibox_class
);
60 foreach(widget_node
, wibox
->widgets
)
61 luaA_object_unref_item(globalconf
.L
, idx
, widget_node
);
62 widget_node_array_wipe(&wibox
->widgets
);
67 wibox_unref_simplified(wibox_t
**item
)
69 luaA_object_unref(globalconf
.L
, *item
);
73 wibox_need_update(wibox_t
*wibox
)
75 wibox
->need_update
= true;
76 wibox_clear_mouse_over(wibox
);
82 const xcb_query_extension_reply_t
*reply
;
84 reply
= xcb_get_extension_data(globalconf
.connection
, &xcb_shape_id
);
85 if (!reply
|| !reply
->present
)
88 /* We don't need a specific version of SHAPE, no version check required */
93 shape_update(xcb_window_t win
, xcb_shape_kind_t kind
, image_t
*image
, int offset
)
98 shape
= image_to_1bit_pixmap(image
, win
);
100 /* Reset the shape */
103 xcb_shape_mask(globalconf
.connection
, XCB_SHAPE_SO_SET
, kind
,
104 win
, offset
, offset
, shape
);
106 if (shape
!= XCB_NONE
)
107 xcb_free_pixmap(globalconf
.connection
, shape
);
110 /** Update the window's shape.
111 * \param wibox The simple window whose shape should be updated.
114 wibox_shape_update(wibox_t
*wibox
)
116 if(wibox
->window
== XCB_NONE
)
121 static bool warned
= false;
123 warn("The X server doesn't have the SHAPE extension; "
124 "can't change window's shape");
129 shape_update(wibox
->window
, XCB_SHAPE_SK_CLIP
, wibox
->shape
.clip
, 0);
130 shape_update(wibox
->window
, XCB_SHAPE_SK_BOUNDING
, wibox
->shape
.bounding
, - wibox
->border_width
);
132 wibox
->need_shape_update
= false;
136 wibox_draw_context_update(wibox_t
*w
, xcb_screen_t
*s
)
138 xcolor_t fg
= w
->ctx
.fg
, bg
= w
->ctx
.bg
;
139 int phys_screen
= w
->ctx
.phys_screen
;
141 draw_context_wipe(&w
->ctx
);
143 /* update draw context */
144 switch(w
->orientation
)
148 /* we need a new pixmap this way [ ] to render */
149 w
->ctx
.pixmap
= xcb_generate_id(globalconf
.connection
);
150 xcb_create_pixmap(globalconf
.connection
,
152 w
->ctx
.pixmap
, s
->root
,
155 draw_context_init(&w
->ctx
, phys_screen
,
158 w
->ctx
.pixmap
, &fg
, &bg
);
161 draw_context_init(&w
->ctx
, phys_screen
,
164 w
->pixmap
, &fg
, &bg
);
169 /** Initialize a wibox.
170 * \param w The wibox to initialize.
171 * \param phys_screen Physical screen number.
174 wibox_init(wibox_t
*w
, int phys_screen
)
176 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
178 w
->window
= xcb_generate_id(globalconf
.connection
);
179 xcb_create_window(globalconf
.connection
, s
->root_depth
, w
->window
, s
->root
,
180 w
->geometry
.x
, w
->geometry
.y
,
181 w
->geometry
.width
, w
->geometry
.height
,
182 w
->border_width
, XCB_COPY_FROM_PARENT
, s
->root_visual
,
183 XCB_CW_BACK_PIXEL
| XCB_CW_BORDER_PIXEL
| XCB_CW_BIT_GRAVITY
184 | XCB_CW_OVERRIDE_REDIRECT
| XCB_CW_EVENT_MASK
,
188 w
->border_color
.pixel
,
189 XCB_GRAVITY_NORTH_WEST
,
191 XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
192 | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY
| XCB_EVENT_MASK_ENTER_WINDOW
193 | XCB_EVENT_MASK_LEAVE_WINDOW
| XCB_EVENT_MASK_STRUCTURE_NOTIFY
194 | XCB_EVENT_MASK_BUTTON_PRESS
| XCB_EVENT_MASK_BUTTON_RELEASE
195 | XCB_EVENT_MASK_POINTER_MOTION
| XCB_EVENT_MASK_EXPOSURE
196 | XCB_EVENT_MASK_PROPERTY_CHANGE
199 /* Create a pixmap. */
200 w
->pixmap
= xcb_generate_id(globalconf
.connection
);
201 xcb_create_pixmap(globalconf
.connection
, s
->root_depth
, w
->pixmap
, s
->root
,
202 w
->geometry
.width
, w
->geometry
.height
);
204 /* Update draw context physical screen, important for Zaphod. */
205 w
->ctx
.phys_screen
= phys_screen
;
206 wibox_draw_context_update(w
, s
);
208 /* The default GC is just a newly created associated to the root window */
209 w
->gc
= xcb_generate_id(globalconf
.connection
);
210 xcb_create_gc(globalconf
.connection
, w
->gc
, s
->root
, XCB_GC_FOREGROUND
| XCB_GC_BACKGROUND
,
211 (const uint32_t[]) { s
->black_pixel
, s
->white_pixel
});
213 wibox_shape_update(w
);
216 /** Refresh the window content by copying its pixmap data to its window.
217 * \param w The wibox to refresh.
220 wibox_refresh_pixmap(wibox_t
*w
)
222 wibox_refresh_pixmap_partial(w
, 0, 0, w
->geometry
.width
, w
->geometry
.height
);
225 /** Move and/or resize a wibox
226 * \param L The Lua VM state.
227 * \param udx The index of the wibox.
228 * \param geometry The new geometry.
231 wibox_moveresize(lua_State
*L
, int udx
, area_t geometry
)
233 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
236 int number_of_vals
= 0;
237 uint32_t moveresize_win_vals
[4], mask_vals
= 0;
239 if(w
->geometry
.x
!= geometry
.x
)
241 w
->geometry
.x
= moveresize_win_vals
[number_of_vals
++] = geometry
.x
;
242 mask_vals
|= XCB_CONFIG_WINDOW_X
;
245 if(w
->geometry
.y
!= geometry
.y
)
247 w
->geometry
.y
= moveresize_win_vals
[number_of_vals
++] = geometry
.y
;
248 mask_vals
|= XCB_CONFIG_WINDOW_Y
;
251 if(geometry
.width
> 0 && w
->geometry
.width
!= geometry
.width
)
253 w
->geometry
.width
= moveresize_win_vals
[number_of_vals
++] = geometry
.width
;
254 mask_vals
|= XCB_CONFIG_WINDOW_WIDTH
;
257 if(geometry
.height
> 0 && w
->geometry
.height
!= geometry
.height
)
259 w
->geometry
.height
= moveresize_win_vals
[number_of_vals
++] = geometry
.height
;
260 mask_vals
|= XCB_CONFIG_WINDOW_HEIGHT
;
263 if(mask_vals
& (XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT
))
265 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
266 /* orientation != East */
267 if(w
->pixmap
!= w
->ctx
.pixmap
)
268 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
269 w
->pixmap
= xcb_generate_id(globalconf
.connection
);
270 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
271 xcb_create_pixmap(globalconf
.connection
, s
->root_depth
, w
->pixmap
, s
->root
,
272 w
->geometry
.width
, w
->geometry
.height
);
273 wibox_draw_context_update(w
, s
);
277 client_ignore_enterleave_events();
280 xcb_configure_window(globalconf
.connection
, w
->window
, mask_vals
, moveresize_win_vals
);
283 client_restore_enterleave_events();
285 w
->screen
= screen_getbycoord(w
->screen
, w
->geometry
.x
, w
->geometry
.y
);
287 if(mask_vals
& XCB_CONFIG_WINDOW_X
)
288 luaA_object_emit_signal(L
, udx
, "property::x", 0);
289 if(mask_vals
& XCB_CONFIG_WINDOW_Y
)
290 luaA_object_emit_signal(L
, udx
, "property::y", 0);
291 if(mask_vals
& XCB_CONFIG_WINDOW_WIDTH
)
292 luaA_object_emit_signal(L
, udx
, "property::width", 0);
293 if(mask_vals
& XCB_CONFIG_WINDOW_HEIGHT
)
294 luaA_object_emit_signal(L
, udx
, "property::height", 0);
298 #define DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(prop) \
299 if(w->geometry.prop != geometry.prop) \
301 w->geometry.prop = geometry.prop; \
302 luaA_object_emit_signal(L, udx, "property::" #prop, 0); \
304 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(x
)
305 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(y
)
306 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(width
)
307 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(height
)
308 #undef DO_WIBOX_GEOMETRY_CHECK_AND_EMIT
311 wibox_need_update(w
);
314 /** Refresh the window content by copying its pixmap data to its window.
315 * \param wibox The wibox to refresh.
316 * \param x The copy starting point x component.
317 * \param y The copy starting point y component.
318 * \param w The copy width from the x component.
319 * \param h The copy height from the y component.
322 wibox_refresh_pixmap_partial(wibox_t
*wibox
,
323 int16_t x
, int16_t y
,
324 uint16_t w
, uint16_t h
)
326 xcb_copy_area(globalconf
.connection
, wibox
->pixmap
,
327 wibox
->window
, wibox
->gc
, x
, y
, x
, y
,
332 wibox_set_opacity(lua_State
*L
, int udx
, double opacity
)
334 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
335 if(w
->opacity
!= opacity
)
337 w
->opacity
= opacity
;
339 window_opacity_set(w
->window
, opacity
);
340 luaA_object_emit_signal(L
, udx
, "property::opacity", 0);
344 /** Set a wibox border color.
345 * \param L The Lua VM state.
346 * \param udx The wibox to change border width.
347 * \param color The border color.
350 wibox_set_border_color(lua_State
*L
, int udx
, const xcolor_t
*color
)
352 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
353 if (w
->window
!= XCB_NONE
)
354 xcb_change_window_attributes(globalconf
.connection
, w
->window
,
355 XCB_CW_BORDER_PIXEL
, &color
->pixel
);
356 w
->border_color
= *color
;
357 luaA_object_emit_signal(L
, udx
, "property::border_color", 0);
360 /** Set wibox orientation.
361 * \param L The Lua VM state.
362 * \param udx The wibox to change orientation.
363 * \param o The new orientation.
366 wibox_set_orientation(lua_State
*L
, int udx
, orientation_t o
)
368 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
369 if(o
!= w
->orientation
)
371 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
373 /* orientation != East */
374 if(w
->pixmap
!= w
->ctx
.pixmap
)
375 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
376 wibox_draw_context_update(w
, s
);
377 luaA_object_emit_signal(L
, udx
, "property::orientation", 0);
382 wibox_map(wibox_t
*wibox
)
385 client_ignore_enterleave_events();
387 xcb_map_window(globalconf
.connection
, wibox
->window
);
389 client_restore_enterleave_events();
390 /* We must make sure the wibox does not display garbage */
391 wibox_need_update(wibox
);
392 /* Stack this wibox correctly */
396 /** Kick out systray windows.
397 * \param phys_screen Physical screen number.
400 wibox_systray_kickout(int phys_screen
)
402 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
404 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= s
->root
)
406 /* Who! Check that we're not deleting a wibox with a systray, because it
407 * may be its parent. If so, we reparent to root before, otherwise it will
409 xcb_reparent_window(globalconf
.connection
,
410 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
411 s
->root
, -512, -512);
413 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= s
->root
;
418 wibox_systray_refresh(wibox_t
*wibox
)
420 wibox
->has_systray
= false;
425 for(int i
= 0; i
< wibox
->widgets
.len
; i
++)
427 widget_node_t
*systray
= &wibox
->widgets
.tab
[i
];
428 if(systray
->widget
->type
== widget_systray
)
430 uint32_t config_back
[] = { wibox
->ctx
.bg
.pixel
};
431 uint32_t config_win_vals
[4];
432 uint32_t config_win_vals_off
[2] = { -512, -512 };
434 int phys_screen
= wibox
->ctx
.phys_screen
;
436 wibox
->has_systray
= true;
439 && systray
->widget
->isvisible
440 && systray
->geometry
.width
)
442 /* Set background of the systray window. */
443 xcb_change_window_attributes(globalconf
.connection
,
444 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
445 XCB_CW_BACK_PIXEL
, config_back
);
447 xcb_map_window(globalconf
.connection
, globalconf
.screens
.tab
[phys_screen
].systray
.window
);
449 switch(wibox
->orientation
)
452 config_win_vals
[0] = systray
->geometry
.y
;
453 config_win_vals
[1] = wibox
->geometry
.height
- systray
->geometry
.x
- systray
->geometry
.width
;
454 config_win_vals
[2] = systray
->geometry
.height
;
455 config_win_vals
[3] = systray
->geometry
.width
;
458 config_win_vals
[0] = systray
->geometry
.y
;
459 config_win_vals
[1] = systray
->geometry
.x
;
460 config_win_vals
[2] = systray
->geometry
.height
;
461 config_win_vals
[3] = systray
->geometry
.width
;
464 config_win_vals
[0] = systray
->geometry
.x
;
465 config_win_vals
[1] = systray
->geometry
.y
;
466 config_win_vals
[2] = systray
->geometry
.width
;
467 config_win_vals
[3] = systray
->geometry
.height
;
471 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= wibox
->window
)
473 xcb_reparent_window(globalconf
.connection
,
474 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
476 config_win_vals
[0], config_win_vals
[1]);
477 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= wibox
->window
;
479 xcb_configure_window(globalconf
.connection
,
480 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
482 | XCB_CONFIG_WINDOW_Y
483 | XCB_CONFIG_WINDOW_WIDTH
484 | XCB_CONFIG_WINDOW_HEIGHT
,
486 /* width = height = systray height */
487 config_win_vals
[2] = config_win_vals
[3] = systray
->geometry
.height
;
488 config_win_vals
[0] = 0;
491 return wibox_systray_kickout(phys_screen
);
493 switch(wibox
->orientation
)
496 config_win_vals
[1] = systray
->geometry
.width
- config_win_vals
[3];
497 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
499 em
= &globalconf
.embedded
.tab
[j
];
500 if(em
->phys_screen
== phys_screen
)
502 if(config_win_vals
[1] - config_win_vals
[2] >= (uint32_t) wibox
->geometry
.y
)
504 xcb_map_window(globalconf
.connection
, em
->win
);
505 xcb_configure_window(globalconf
.connection
, em
->win
,
507 | XCB_CONFIG_WINDOW_Y
508 | XCB_CONFIG_WINDOW_WIDTH
509 | XCB_CONFIG_WINDOW_HEIGHT
,
511 config_win_vals
[1] -= config_win_vals
[3];
514 xcb_configure_window(globalconf
.connection
, em
->win
,
516 | XCB_CONFIG_WINDOW_Y
,
517 config_win_vals_off
);
522 config_win_vals
[1] = 0;
523 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
525 em
= &globalconf
.embedded
.tab
[j
];
526 if(em
->phys_screen
== phys_screen
)
528 /* if(y + width <= wibox.y + systray.right) */
529 if(config_win_vals
[1] + config_win_vals
[3] <= (uint32_t) wibox
->geometry
.y
+ AREA_RIGHT(systray
->geometry
))
531 xcb_map_window(globalconf
.connection
, em
->win
);
532 xcb_configure_window(globalconf
.connection
, em
->win
,
534 | XCB_CONFIG_WINDOW_Y
535 | XCB_CONFIG_WINDOW_WIDTH
536 | XCB_CONFIG_WINDOW_HEIGHT
,
538 config_win_vals
[1] += config_win_vals
[3];
541 xcb_configure_window(globalconf
.connection
, em
->win
,
543 | XCB_CONFIG_WINDOW_Y
,
544 config_win_vals_off
);
549 config_win_vals
[1] = 0;
550 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
552 em
= &globalconf
.embedded
.tab
[j
];
553 if(em
->phys_screen
== phys_screen
)
555 /* if(x + width < systray.x + systray.width) */
556 if(config_win_vals
[0] + config_win_vals
[2] <= (uint32_t) AREA_RIGHT(systray
->geometry
) + wibox
->geometry
.x
)
558 xcb_map_window(globalconf
.connection
, em
->win
);
559 xcb_configure_window(globalconf
.connection
, em
->win
,
561 | XCB_CONFIG_WINDOW_Y
562 | XCB_CONFIG_WINDOW_WIDTH
563 | XCB_CONFIG_WINDOW_HEIGHT
,
565 config_win_vals
[0] += config_win_vals
[2];
568 xcb_configure_window(globalconf
.connection
, em
->win
,
570 | XCB_CONFIG_WINDOW_Y
,
571 config_win_vals_off
);
581 /** Get a wibox by its window.
582 * \param win The window id.
583 * \return A wibox if found, NULL otherwise.
586 wibox_getbywin(xcb_window_t win
)
588 foreach(w
, globalconf
.wiboxes
)
589 if((*w
)->window
== win
)
592 foreach(_c
, globalconf
.clients
)
595 if(c
->titlebar
&& c
->titlebar
->window
== win
)
603 * \param wibox The wibox to draw.
606 wibox_draw(wibox_t
*wibox
)
610 widget_render(wibox
);
611 wibox_refresh_pixmap(wibox
);
613 wibox
->need_update
= false;
616 wibox_systray_refresh(wibox
);
619 /** Refresh all wiboxes.
624 foreach(w
, globalconf
.wiboxes
)
626 if((*w
)->need_shape_update
)
627 wibox_shape_update(*w
);
628 if((*w
)->need_update
)
632 foreach(_c
, globalconf
.clients
)
635 if(c
->titlebar
&& c
->titlebar
->need_update
)
636 wibox_draw(c
->titlebar
);
640 /** Clear the wibox' mouse_over pointer.
641 * \param wibox The wibox.
644 wibox_clear_mouse_over(wibox_t
*wibox
)
646 if (wibox
->mouse_over
)
648 luaA_object_unref(globalconf
.L
, wibox
->mouse_over
);
649 wibox
->mouse_over
= NULL
;
653 /** Set a wibox visible or not.
654 * \param L The Lua VM state.
655 * \param udx The wibox.
656 * \param v The visible value.
659 wibox_set_visible(lua_State
*L
, int udx
, bool v
)
661 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
662 if(v
!= wibox
->visible
)
665 wibox_clear_mouse_over(wibox
);
674 client_ignore_enterleave_events();
676 xcb_unmap_window(globalconf
.connection
, wibox
->window
);
678 client_restore_enterleave_events();
681 /* kick out systray if needed */
682 wibox_systray_refresh(wibox
);
685 luaA_object_emit_signal(L
, udx
, "property::visible", 0);
687 hook_property(wibox
, "visible");
691 /** Destroy all X resources of a wibox.
692 * \param w The wibox to wipe.
695 wibox_wipe(wibox_t
*w
)
699 int phys_screen
= w
->ctx
.phys_screen
;
702 client_ignore_enterleave_events();
703 /* Make sure we don't accidentally kill the systray window */
704 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
== w
->window
)
705 wibox_systray_kickout(phys_screen
);
706 xcb_destroy_window(globalconf
.connection
, w
->window
);
708 client_restore_enterleave_events();
709 w
->window
= XCB_NONE
;
713 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
714 w
->pixmap
= XCB_NONE
;
718 xcb_free_gc(globalconf
.connection
, w
->gc
);
721 draw_context_wipe(&w
->ctx
);
724 /** Remove a wibox from a screen.
725 * \param L The Lua VM state.
726 * \param udx Wibox to detach from screen.
729 wibox_detach(lua_State
*L
, int udx
)
731 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
736 /* save visible state */
738 wibox
->visible
= false;
739 wibox_systray_refresh(wibox
);
740 /* restore visibility */
743 wibox_clear_mouse_over(wibox
);
747 foreach(item
, globalconf
.wiboxes
)
750 wibox_array_remove(&globalconf
.wiboxes
, item
);
754 hook_property(wibox
, "screen");
756 if(strut_has_value(&wibox
->strut
))
757 screen_emit_signal(L
, wibox
->screen
, "property::workarea", 0);
759 wibox
->screen
= NULL
;
760 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
762 luaA_object_unref(globalconf
.L
, wibox
);
766 /** Attach a wibox that is on top of the stack.
767 * \param L The Lua VM state.
768 * \param udx The wibox to attach.
769 * \param s The screen to attach the wibox to.
772 wibox_attach(lua_State
*L
, int udx
, screen_t
*s
)
774 int phys_screen
= screen_virttophys(screen_array_indexof(&globalconf
.screens
, s
));
776 /* duplicate wibox */
777 lua_pushvalue(L
, udx
);
779 wibox_t
*wibox
= luaA_object_ref_class(globalconf
.L
, -1, &wibox_class
);
781 wibox_detach(L
, udx
);
783 /* Set the wibox screen */
786 /* Check that the wibox coordinates matches the screen. */
788 screen_getbycoord(wibox
->screen
, wibox
->geometry
.x
, wibox
->geometry
.y
);
790 /* If it does not match, move it to the screen coordinates */
791 if(cscreen
!= wibox
->screen
)
792 wibox_moveresize(L
, udx
, (area_t
) { .x
= s
->geometry
.x
,
794 .width
= wibox
->geometry
.width
,
795 .height
= wibox
->geometry
.height
});
797 wibox_array_append(&globalconf
.wiboxes
, wibox
);
799 wibox_init(wibox
, phys_screen
);
801 window_set_cursor(wibox
->window
,
802 xcursor_new(globalconf
.connection
, xcursor_font_fromstr(wibox
->cursor
)));
804 if(wibox
->opacity
!= -1)
805 window_opacity_set(wibox
->window
, wibox
->opacity
);
807 ewmh_update_strut(wibox
->window
, &wibox
->strut
);
812 wibox_need_update(wibox
);
814 hook_property(wibox
, "screen");
815 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
817 if(strut_has_value(&wibox
->strut
))
818 screen_emit_signal(L
, wibox
->screen
, "property::workarea", 0);
821 /** Create a new wibox.
822 * \param L The Lua VM state.
825 * \lparam A table with optionally defined values:
826 * fg, bg, border_width, border_color, ontop, width and height.
827 * \lreturn A brand new wibox.
830 luaA_wibox_new(lua_State
*L
)
832 luaA_class_new(L
, &wibox_class
);
834 wibox_t
*w
= luaA_checkudata(L
, -1, &wibox_class
);
836 if(!w
->ctx
.fg
.initialized
)
837 w
->ctx
.fg
= globalconf
.colors
.fg
;
839 if(!w
->ctx
.bg
.initialized
)
840 w
->ctx
.bg
= globalconf
.colors
.bg
;
842 if(!w
->border_color
.initialized
)
843 w
->border_color
= globalconf
.colors
.bg
;
851 w
->cursor
= a_strdup("left_ptr");
853 if(!w
->geometry
.width
)
854 w
->geometry
.width
= 1;
856 if(!w
->geometry
.height
)
857 w
->geometry
.height
= 1;
862 /** Check if a wibox widget table has an item.
863 * \param L The Lua VM state.
864 * \param wibox The wibox.
865 * \param item The item to look for.
868 luaA_wibox_hasitem(lua_State
*L
, wibox_t
*wibox
, const void *item
)
870 if(wibox
->widgets_table
)
872 luaA_object_push(L
, wibox
);
873 luaA_object_push_item(L
, -1, wibox
->widgets_table
);
875 if(lua_topointer(L
, -1) == item
|| luaA_hasitem(L
, item
))
881 /** Invalidate a wibox by a Lua object (table, etc).
882 * \param L The Lua VM state.
883 * \param item The object identifier.
886 luaA_wibox_invalidate_byitem(lua_State
*L
, const void *item
)
888 foreach(w
, globalconf
.wiboxes
)
891 if(luaA_wibox_hasitem(L
, wibox
, item
))
894 wibox_need_update(wibox
);
895 lua_pop(L
, 1); /* remove widgets table */
900 foreach(_c
, globalconf
.clients
)
903 if(c
->titlebar
&& luaA_wibox_hasitem(L
, c
->titlebar
, item
))
906 wibox_need_update(c
->titlebar
);
907 lua_pop(L
, 1); /* remove widgets table */
912 /* Set or get the wibox geometry.
913 * \param L The Lua VM state.
914 * \return The number of elements pushed on stack.
916 * \lparam An optional table with wibox geometry.
917 * \lreturn The wibox geometry.
920 luaA_wibox_geometry(lua_State
*L
)
922 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
924 if(lua_gettop(L
) == 2)
928 luaA_checktable(L
, 2);
929 wingeom
.x
= luaA_getopt_number(L
, 2, "x", wibox
->geometry
.x
);
930 wingeom
.y
= luaA_getopt_number(L
, 2, "y", wibox
->geometry
.y
);
931 wingeom
.width
= luaA_getopt_number(L
, 2, "width", wibox
->geometry
.width
);
932 wingeom
.height
= luaA_getopt_number(L
, 2, "height", wibox
->geometry
.height
);
934 if(wingeom
.width
> 0 && wingeom
.height
> 0)
937 case WIBOX_TYPE_TITLEBAR
:
938 wibox_moveresize(L
, 1, (area_t
) { .x
= wibox
->geometry
.x
,
939 .y
= wibox
->geometry
.y
,
940 .width
= wingeom
.width
,
941 .height
= wingeom
.height
});
943 case WIBOX_TYPE_NORMAL
:
944 wibox_moveresize(L
, 1, wingeom
);
949 return luaA_pusharea(L
, wibox
->geometry
);
953 luaA_wibox_struts(lua_State
*L
)
955 wibox_t
*w
= luaA_checkudata(L
, 1, &wibox_class
);
957 if(lua_gettop(L
) == 2)
959 luaA_tostrut(L
, 2, &w
->strut
);
961 ewmh_update_strut(w
->window
, &w
->strut
);
962 luaA_object_emit_signal(L
, 1, "property::struts", 0);
964 screen_emit_signal(L
, w
->screen
, "property::workarea", 0);
967 return luaA_pushstrut(L
, w
->strut
);
970 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, ontop
, lua_pushboolean
)
971 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, cursor
, lua_pushstring
)
972 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, visible
, lua_pushboolean
)
973 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_width
, lua_pushnumber
)
974 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_color
, luaA_pushxcolor
)
977 luaA_wibox_set_x(lua_State
*L
, wibox_t
*wibox
)
979 wibox_moveresize(L
, -3, (area_t
) { .x
= luaL_checknumber(L
, -1),
980 .y
= wibox
->geometry
.y
,
981 .width
= wibox
->geometry
.width
,
982 .height
= wibox
->geometry
.height
});
987 luaA_wibox_get_x(lua_State
*L
, wibox_t
*wibox
)
989 lua_pushnumber(L
, wibox
->geometry
.x
);
994 luaA_wibox_set_y(lua_State
*L
, wibox_t
*wibox
)
996 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
997 .y
= luaL_checknumber(L
, -1),
998 .width
= wibox
->geometry
.width
,
999 .height
= wibox
->geometry
.height
});
1004 luaA_wibox_get_y(lua_State
*L
, wibox_t
*wibox
)
1006 lua_pushnumber(L
, wibox
->geometry
.y
);
1011 luaA_wibox_set_width(lua_State
*L
, wibox_t
*wibox
)
1013 int width
= luaL_checknumber(L
, -1);
1015 luaL_error(L
, "invalid width");
1016 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
1017 .y
= wibox
->geometry
.y
,
1019 .height
= wibox
->geometry
.height
});
1024 luaA_wibox_get_width(lua_State
*L
, wibox_t
*wibox
)
1026 lua_pushnumber(L
, wibox
->geometry
.width
);
1031 luaA_wibox_set_height(lua_State
*L
, wibox_t
*wibox
)
1033 int height
= luaL_checknumber(L
, -1);
1035 luaL_error(L
, "invalid height");
1036 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
1037 .y
= wibox
->geometry
.y
,
1038 .width
= wibox
->geometry
.width
,
1039 .height
= height
});
1044 luaA_wibox_get_height(lua_State
*L
, wibox_t
*wibox
)
1046 lua_pushnumber(L
, wibox
->geometry
.height
);
1050 /** Set the wibox foreground color.
1051 * \param L The Lua VM state.
1052 * \param wibox The wibox object.
1053 * \return The number of elements pushed on stack.
1056 luaA_wibox_set_fg(lua_State
*L
, wibox_t
*wibox
)
1059 const char *buf
= luaL_checklstring(L
, -1, &len
);
1060 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.fg
, buf
, len
)))
1061 wibox
->need_update
= true;
1062 luaA_object_emit_signal(L
, -3, "property::fg", 0);
1066 /** Get the wibox foreground color.
1067 * \param L The Lua VM state.
1068 * \param wibox The wibox object.
1069 * \return The number of elements pushed on stack.
1072 luaA_wibox_get_fg(lua_State
*L
, wibox_t
*wibox
)
1074 return luaA_pushxcolor(L
, wibox
->ctx
.fg
);
1077 /** Set the wibox background color.
1078 * \param L The Lua VM state.
1079 * \param wibox The wibox object.
1080 * \return The number of elements pushed on stack.
1083 luaA_wibox_set_bg(lua_State
*L
, wibox_t
*wibox
)
1086 const char *buf
= luaL_checklstring(L
, -1, &len
);
1087 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.bg
, buf
, len
)))
1089 uint32_t mask
= XCB_CW_BACK_PIXEL
;
1090 uint32_t values
[] = { wibox
->ctx
.bg
.pixel
};
1092 wibox
->need_update
= true;
1094 if (wibox
->window
!= XCB_NONE
)
1095 xcb_change_window_attributes(globalconf
.connection
,
1100 luaA_object_emit_signal(L
, -3, "property::bg", 0);
1104 /** Get the wibox background color.
1105 * \param L The Lua VM state.
1106 * \param wibox The wibox object.
1107 * \return The number of elements pushed on stack.
1110 luaA_wibox_get_bg(lua_State
*L
, wibox_t
*wibox
)
1112 return luaA_pushxcolor(L
, wibox
->ctx
.bg
);
1115 /** Set the wibox background image.
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_bg_image(lua_State
*L
, wibox_t
*wibox
)
1123 luaA_checkudata(L
, -1, &image_class
);
1124 luaA_object_unref_item(L
, -3, wibox
->bg_image
);
1125 wibox
->bg_image
= luaA_object_ref_item(L
, -3, -1);
1126 wibox
->need_update
= true;
1127 luaA_object_emit_signal(L
, -2, "property::bg_image", 0);
1131 /** Get the wibox background image.
1132 * \param L The Lua VM state.
1133 * \param wibox The wibox object.
1134 * \return The number of elements pushed on stack.
1137 luaA_wibox_get_bg_image(lua_State
*L
, wibox_t
*wibox
)
1139 return luaA_object_push_item(L
, 1, wibox
->bg_image
);
1142 /** Set the wibox on top status.
1143 * \param L The Lua VM state.
1144 * \param wibox The wibox object.
1145 * \return The number of elements pushed on stack.
1148 luaA_wibox_set_ontop(lua_State
*L
, wibox_t
*wibox
)
1150 bool b
= luaA_checkboolean(L
, -1);
1151 if(b
!= wibox
->ontop
)
1155 luaA_object_emit_signal(L
, -3, "property::ontop", 0);
1160 /** Set the wibox opacity.
1161 * \param L The Lua VM state.
1162 * \param wibox The wibox object.
1163 * \return The number of elements pushed on stack.
1166 luaA_wibox_set_opacity(lua_State
*L
, wibox_t
*wibox
)
1168 if(lua_isnil(L
, -1))
1169 wibox_set_opacity(L
, -3, -1);
1172 double d
= luaL_checknumber(L
, -1);
1173 if(d
>= 0 && d
<= 1)
1174 wibox_set_opacity(L
, -3, d
);
1179 /** Get the wibox opacity.
1180 * \param L The Lua VM state.
1181 * \param wibox The wibox object.
1182 * \return The number of elements pushed on stack.
1185 luaA_wibox_get_opacity(lua_State
*L
, wibox_t
*wibox
)
1187 if (wibox
->opacity
>= 0)
1189 lua_pushnumber(L
, wibox
->opacity
);
1195 /** Set the wibox alignment.
1196 * \param L The Lua VM state.
1197 * \param wibox The wibox object.
1198 * \return The number of elements pushed on stack.
1201 luaA_wibox_set_align(lua_State
*L
, wibox_t
*wibox
)
1204 const char *buf
= luaL_checklstring(L
, -1, &len
);
1205 wibox
->align
= draw_align_fromstr(buf
, len
);
1206 luaA_object_emit_signal(L
, -3, "property::align", 0);
1209 case WIBOX_TYPE_NORMAL
:
1210 luaA_deprecate(L
, "awful.wibox.align");
1212 case WIBOX_TYPE_TITLEBAR
:
1213 titlebar_update_geometry(client_getbytitlebar(wibox
));
1219 /** Get the wibox alignment.
1220 * \param L The Lua VM state.
1221 * \param wibox The wibox object.
1222 * \return The number of elements pushed on stack.
1225 luaA_wibox_get_align(lua_State
*L
, wibox_t
*wibox
)
1227 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1228 luaA_deprecate(L
, "awful.wibox.align");
1229 lua_pushstring(L
, draw_align_tostr(wibox
->align
));
1233 /** Set the wibox position.
1234 * \param L The Lua VM state.
1235 * \param wibox The wibox object.
1236 * \return The number of elements pushed on stack.
1239 luaA_wibox_set_position(lua_State
*L
, wibox_t
*wibox
)
1243 case WIBOX_TYPE_NORMAL
:
1247 if((buf
= luaL_checklstring(L
, -1, &len
)))
1249 luaA_deprecate(L
, "awful.wibox.attach");
1250 wibox
->position
= position_fromstr(buf
, len
);
1254 case WIBOX_TYPE_TITLEBAR
:
1255 return luaA_titlebar_set_position(L
, -3);
1260 /** Get the wibox position.
1261 * \param L The Lua VM state.
1262 * \param wibox The wibox object.
1263 * \return The number of elements pushed on stack.
1266 luaA_wibox_get_position(lua_State
*L
, wibox_t
*wibox
)
1268 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1269 luaA_deprecate(L
, "awful.wibox.attach");
1270 lua_pushstring(L
, position_tostr(wibox
->position
));
1274 /** Set the wibox (titlebar) client.
1275 * \param L The Lua VM state.
1276 * \param wibox The wibox object.
1277 * \return The number of elements pushed on stack.
1280 luaA_wibox_set_client(lua_State
*L
, wibox_t
*wibox
)
1283 if(lua_isnil(L
, -1))
1284 titlebar_client_detach(client_getbytitlebar(wibox
));
1287 client_t
*c
= luaA_client_checkudata(L
, -1);
1288 lua_pushvalue(L
, -3);
1289 titlebar_client_attach(c
);
1294 /** Get the wibox (titlebar) client.
1295 * \param L The Lua VM state.
1296 * \param wibox The wibox object.
1297 * \return The number of elements pushed on stack.
1300 luaA_wibox_get_client(lua_State
*L
, wibox_t
*wibox
)
1302 return luaA_object_push(L
, client_getbytitlebar(wibox
));
1305 /** Set the wibox cursor.
1306 * \param L The Lua VM state.
1307 * \param wibox The wibox object.
1308 * \return The number of elements pushed on stack.
1311 luaA_wibox_set_cursor(lua_State
*L
, wibox_t
*wibox
)
1313 const char *buf
= luaL_checkstring(L
, -1);
1316 uint16_t cursor_font
= xcursor_font_fromstr(buf
);
1319 xcb_cursor_t cursor
= xcursor_new(globalconf
.connection
, cursor_font
);
1320 p_delete(&wibox
->cursor
);
1321 wibox
->cursor
= a_strdup(buf
);
1322 window_set_cursor(wibox
->window
, cursor
);
1323 luaA_object_emit_signal(L
, -3, "property::cursor", 0);
1329 /** Set the wibox screen.
1330 * \param L The Lua VM state.
1331 * \param wibox The wibox object.
1332 * \return The number of elements pushed on stack.
1335 luaA_wibox_set_screen(lua_State
*L
, wibox_t
*wibox
)
1337 if(lua_isnil(L
, -1))
1339 wibox_detach(L
, -3);
1340 titlebar_client_detach(client_getbytitlebar(wibox
));
1344 int screen
= luaL_checknumber(L
, -1) - 1;
1345 luaA_checkscreen(screen
);
1346 if(!wibox
->screen
|| screen
!= screen_array_indexof(&globalconf
.screens
, wibox
->screen
))
1348 titlebar_client_detach(client_getbytitlebar(wibox
));
1349 wibox_attach(L
, -3, &globalconf
.screens
.tab
[screen
]);
1355 /** Get the wibox screen.
1356 * \param L The Lua VM state.
1357 * \param wibox The wibox object.
1358 * \return The number of elements pushed on stack.
1361 luaA_wibox_get_screen(lua_State
*L
, wibox_t
*wibox
)
1365 lua_pushnumber(L
, screen_array_indexof(&globalconf
.screens
, wibox
->screen
) + 1);
1369 /** Set the wibox orientation.
1370 * \param L The Lua VM state.
1371 * \param wibox The wibox object.
1372 * \return The number of elements pushed on stack.
1375 luaA_wibox_set_orientation(lua_State
*L
, wibox_t
*wibox
)
1378 const char *buf
= luaL_checklstring(L
, -1, &len
);
1381 wibox_set_orientation(L
, -3, orientation_fromstr(buf
, len
));
1382 wibox_need_update(wibox
);
1387 /** Get the wibox orientation.
1388 * \param L The Lua VM state.
1389 * \param wibox The wibox object.
1390 * \return The number of elements pushed on stack.
1393 luaA_wibox_get_orientation(lua_State
*L
, wibox_t
*wibox
)
1395 lua_pushstring(L
, orientation_tostr(wibox
->orientation
));
1399 /** Set the wibox border color.
1400 * \param L The Lua VM state.
1401 * \param wibox The wibox object.
1402 * \return The number of elements pushed on stack.
1405 luaA_wibox_set_border_color(lua_State
*L
, wibox_t
*wibox
)
1408 const char *buf
= luaL_checklstring(L
, -1, &len
);
1410 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->border_color
, buf
, len
)))
1412 wibox_set_border_color(L
, -3, &wibox
->border_color
);
1416 /** Set the wibox visibility.
1417 * \param L The Lua VM state.
1418 * \param wibox The wibox object.
1419 * \return The number of elements pushed on stack.
1422 luaA_wibox_set_visible(lua_State
*L
, wibox_t
*wibox
)
1424 bool b
= luaA_checkboolean(L
, -1);
1425 if(b
!= wibox
->visible
)
1428 case WIBOX_TYPE_NORMAL
:
1429 wibox_set_visible(L
, -3, b
);
1431 case WIBOX_TYPE_TITLEBAR
:
1432 titlebar_set_visible(wibox
, b
);
1438 /** Set the wibox widgets.
1439 * \param L The Lua VM state.
1440 * \param wibox The wibox object.
1441 * \return The number of elements pushed on stack.
1444 luaA_wibox_set_widgets(lua_State
*L
, wibox_t
*wibox
)
1446 if(luaA_isloop(L
, -1))
1448 luaA_warn(L
, "table is looping, cannot use this as widget table");
1451 /* duplicate table because next function will eat it */
1452 lua_pushvalue(L
, -1);
1453 wibox
->widgets_table
= luaA_object_ref_item(L
, -4, -1);
1454 luaA_object_emit_signal(L
, -3, "property::widgets", 0);
1455 wibox_need_update(wibox
);
1456 luaA_table2wtable(L
);
1460 /** Get the wibox widgets.
1461 * \param L The Lua VM state.
1462 * \param wibox The wibox object.
1463 * \return The number of elements pushed on stack.
1466 luaA_wibox_get_widgets(lua_State
*L
, wibox_t
*wibox
)
1468 return luaA_object_push_item(L
, 1, wibox
->widgets_table
);
1471 /** Get or set mouse buttons bindings to a wibox.
1472 * \param L The Lua VM state.
1475 * \lparam An array of mouse button bindings objects, or nothing.
1476 * \return The array of mouse button bindings objects of this wibox.
1479 luaA_wibox_buttons(lua_State
*L
)
1481 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
1483 if(lua_gettop(L
) == 2)
1485 luaA_button_array_set(L
, 1, 2, &wibox
->buttons
);
1486 luaA_object_emit_signal(L
, 1, "property::buttons", 0);
1489 return luaA_button_array_get(L
, 1, &wibox
->buttons
);
1492 /** Set the wibox border width.
1493 * \param L The Lua VM state.
1494 * \param wibox The wibox object.
1495 * \return The number of elements pushed on stack.
1498 luaA_wibox_set_border_width(lua_State
*L
, wibox_t
*wibox
)
1500 wibox_t
*w
= luaA_checkudata(L
, -3, &wibox_class
);
1501 int32_t border_width
= luaL_checknumber(L
, -1);
1502 if(border_width
!= w
->border_width
&& border_width
>= 0)
1504 if (w
->window
!= XCB_NONE
)
1505 xcb_configure_window(globalconf
.connection
, w
->window
, XCB_CONFIG_WINDOW_BORDER_WIDTH
,
1506 (uint32_t[]) { border_width
});
1507 w
->border_width
= border_width
;
1508 /* Need update if transparent background */
1509 wibox_need_update(w
);
1510 luaA_object_emit_signal(L
, -3, "property::border_width", 0);
1516 luaA_wibox_set_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1518 luaA_checkudata(L
, -1, &image_class
);
1519 luaA_object_unref_item(L
, -3, wibox
->shape
.bounding
);
1520 wibox
->shape
.bounding
= luaA_object_ref_item(L
, -3, -1);
1521 wibox
->need_shape_update
= true;
1522 luaA_object_emit_signal(L
, -2, "property::shape_bounding", 0);
1527 luaA_wibox_get_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1529 return luaA_object_push_item(L
, 1, wibox
->shape
.bounding
);
1533 luaA_wibox_set_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1535 luaA_checkudata(L
, -1, &image_class
);
1536 luaA_object_unref_item(L
, -3, wibox
->shape
.clip
);
1537 wibox
->shape
.clip
= luaA_object_ref_item(L
, -3, -1);
1538 wibox
->need_shape_update
= true;
1539 luaA_object_emit_signal(L
, -2, "property::shape_clip", 0);
1544 luaA_wibox_get_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1546 return luaA_object_push_item(L
, 1, wibox
->shape
.clip
);
1550 wibox_class_setup(lua_State
*L
)
1552 static const struct luaL_reg wibox_methods
[] =
1554 LUA_CLASS_METHODS(wibox
)
1555 { "__call", luaA_wibox_new
},
1559 static const struct luaL_reg wibox_meta
[] =
1561 LUA_OBJECT_META(wibox
)
1563 { "struts", luaA_wibox_struts
},
1564 { "buttons", luaA_wibox_buttons
},
1565 { "geometry", luaA_wibox_geometry
},
1566 { "__gc", luaA_wibox_gc
},
1570 luaA_class_setup(L
, &wibox_class
, "wibox", (lua_class_allocator_t
) wibox_new
,
1571 luaA_class_index_miss_property
, luaA_class_newindex_miss_property
,
1572 wibox_methods
, wibox_meta
);
1573 luaA_class_add_property(&wibox_class
, A_TK_WIDGETS
,
1574 (lua_class_propfunc_t
) luaA_wibox_set_widgets
,
1575 (lua_class_propfunc_t
) luaA_wibox_get_widgets
,
1576 (lua_class_propfunc_t
) luaA_wibox_set_widgets
);
1577 luaA_class_add_property(&wibox_class
, A_TK_OPACITY
,
1578 (lua_class_propfunc_t
) luaA_wibox_set_opacity
,
1579 (lua_class_propfunc_t
) luaA_wibox_get_opacity
,
1580 (lua_class_propfunc_t
) luaA_wibox_set_opacity
);
1581 luaA_class_add_property(&wibox_class
, A_TK_VISIBLE
,
1582 (lua_class_propfunc_t
) luaA_wibox_set_visible
,
1583 (lua_class_propfunc_t
) luaA_wibox_get_visible
,
1584 (lua_class_propfunc_t
) luaA_wibox_set_visible
);
1585 luaA_class_add_property(&wibox_class
, A_TK_BORDER_COLOR
,
1586 (lua_class_propfunc_t
) luaA_wibox_set_border_color
,
1587 (lua_class_propfunc_t
) luaA_wibox_get_border_color
,
1588 (lua_class_propfunc_t
) luaA_wibox_set_border_color
);
1589 luaA_class_add_property(&wibox_class
, A_TK_BORDER_WIDTH
,
1590 (lua_class_propfunc_t
) luaA_wibox_set_border_width
,
1591 (lua_class_propfunc_t
) luaA_wibox_get_border_width
,
1592 (lua_class_propfunc_t
) luaA_wibox_set_border_width
);
1593 luaA_class_add_property(&wibox_class
, A_TK_ORIENTATION
,
1594 (lua_class_propfunc_t
) luaA_wibox_set_orientation
,
1595 (lua_class_propfunc_t
) luaA_wibox_get_orientation
,
1596 (lua_class_propfunc_t
) luaA_wibox_set_orientation
);
1597 luaA_class_add_property(&wibox_class
, A_TK_ONTOP
,
1598 (lua_class_propfunc_t
) luaA_wibox_set_ontop
,
1599 (lua_class_propfunc_t
) luaA_wibox_get_ontop
,
1600 (lua_class_propfunc_t
) luaA_wibox_set_ontop
);
1601 luaA_class_add_property(&wibox_class
, A_TK_SCREEN
,
1603 (lua_class_propfunc_t
) luaA_wibox_get_screen
,
1604 (lua_class_propfunc_t
) luaA_wibox_set_screen
);
1605 luaA_class_add_property(&wibox_class
, A_TK_CURSOR
,
1606 (lua_class_propfunc_t
) luaA_wibox_set_cursor
,
1607 (lua_class_propfunc_t
) luaA_wibox_get_cursor
,
1608 (lua_class_propfunc_t
) luaA_wibox_set_cursor
);
1609 luaA_class_add_property(&wibox_class
, A_TK_CLIENT
,
1610 (lua_class_propfunc_t
) luaA_wibox_set_client
,
1611 (lua_class_propfunc_t
) luaA_wibox_get_client
,
1612 (lua_class_propfunc_t
) luaA_wibox_set_client
);
1613 luaA_class_add_property(&wibox_class
, A_TK_POSITION
,
1614 (lua_class_propfunc_t
) luaA_wibox_set_position
,
1615 (lua_class_propfunc_t
) luaA_wibox_get_position
,
1616 (lua_class_propfunc_t
) luaA_wibox_set_position
);
1617 luaA_class_add_property(&wibox_class
, A_TK_ALIGN
,
1618 (lua_class_propfunc_t
) luaA_wibox_set_align
,
1619 (lua_class_propfunc_t
) luaA_wibox_get_align
,
1620 (lua_class_propfunc_t
) luaA_wibox_set_align
);
1621 luaA_class_add_property(&wibox_class
, A_TK_FG
,
1622 (lua_class_propfunc_t
) luaA_wibox_set_fg
,
1623 (lua_class_propfunc_t
) luaA_wibox_get_fg
,
1624 (lua_class_propfunc_t
) luaA_wibox_set_fg
);
1625 luaA_class_add_property(&wibox_class
, A_TK_BG
,
1626 (lua_class_propfunc_t
) luaA_wibox_set_bg
,
1627 (lua_class_propfunc_t
) luaA_wibox_get_bg
,
1628 (lua_class_propfunc_t
) luaA_wibox_set_bg
);
1629 luaA_class_add_property(&wibox_class
, A_TK_BG_IMAGE
,
1630 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
,
1631 (lua_class_propfunc_t
) luaA_wibox_get_bg_image
,
1632 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
);
1633 luaA_class_add_property(&wibox_class
, A_TK_X
,
1634 (lua_class_propfunc_t
) luaA_wibox_set_x
,
1635 (lua_class_propfunc_t
) luaA_wibox_get_x
,
1636 (lua_class_propfunc_t
) luaA_wibox_set_x
);
1637 luaA_class_add_property(&wibox_class
, A_TK_Y
,
1638 (lua_class_propfunc_t
) luaA_wibox_set_y
,
1639 (lua_class_propfunc_t
) luaA_wibox_get_y
,
1640 (lua_class_propfunc_t
) luaA_wibox_set_y
);
1641 luaA_class_add_property(&wibox_class
, A_TK_WIDTH
,
1642 (lua_class_propfunc_t
) luaA_wibox_set_width
,
1643 (lua_class_propfunc_t
) luaA_wibox_get_width
,
1644 (lua_class_propfunc_t
) luaA_wibox_set_width
);
1645 luaA_class_add_property(&wibox_class
, A_TK_HEIGHT
,
1646 (lua_class_propfunc_t
) luaA_wibox_set_height
,
1647 (lua_class_propfunc_t
) luaA_wibox_get_height
,
1648 (lua_class_propfunc_t
) luaA_wibox_set_height
);
1649 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_BOUNDING
,
1650 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
,
1651 (lua_class_propfunc_t
) luaA_wibox_get_shape_bounding
,
1652 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
);
1653 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_CLIP
,
1654 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
,
1655 (lua_class_propfunc_t
) luaA_wibox_get_shape_clip
,
1656 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
);
1659 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80