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 /** Set a wibox opacity.
211 * \param L The Lua VM state.
212 * \param w The index wibox the adjust the opacity of.
213 * \param opacity A value between 0 and 1 which describes the opacity.
216 wibox_opacity_set(lua_State
*L
, int udx
, double opacity
)
218 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
219 w
->opacity
= opacity
;
220 if(w
->window
!= XCB_NONE
)
221 window_opacity_set(w
->window
, opacity
);
222 luaA_object_emit_signal(globalconf
.L
, udx
, "property::opacity", 0);
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 xcb_configure_window(globalconf
.connection
, w
->window
, mask_vals
, moveresize_win_vals
);
279 w
->screen
= screen_getbycoord(w
->screen
, w
->geometry
.x
, w
->geometry
.y
);
281 if(mask_vals
& XCB_CONFIG_WINDOW_X
)
282 luaA_object_emit_signal(L
, udx
, "property::x", 0);
283 if(mask_vals
& XCB_CONFIG_WINDOW_Y
)
284 luaA_object_emit_signal(L
, udx
, "property::y", 0);
285 if(mask_vals
& XCB_CONFIG_WINDOW_WIDTH
)
286 luaA_object_emit_signal(L
, udx
, "property::width", 0);
287 if(mask_vals
& XCB_CONFIG_WINDOW_HEIGHT
)
288 luaA_object_emit_signal(L
, udx
, "property::height", 0);
292 #define DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(prop) \
293 if(w->geometry.prop != geometry.prop) \
295 w->geometry.prop = geometry.prop; \
296 luaA_object_emit_signal(L, udx, "property::" #prop, 0); \
298 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(x
)
299 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(y
)
300 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(width
)
301 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(height
)
302 #undef DO_WIBOX_GEOMETRY_CHECK_AND_EMIT
305 wibox_need_update(w
);
308 /** Refresh the window content by copying its pixmap data to its window.
309 * \param wibox The wibox to refresh.
310 * \param x The copy starting point x component.
311 * \param y The copy starting point y component.
312 * \param w The copy width from the x component.
313 * \param h The copy height from the y component.
316 wibox_refresh_pixmap_partial(wibox_t
*wibox
,
317 int16_t x
, int16_t y
,
318 uint16_t w
, uint16_t h
)
320 xcb_copy_area(globalconf
.connection
, wibox
->pixmap
,
321 wibox
->window
, wibox
->gc
, x
, y
, x
, y
,
326 wibox_set_opacity(lua_State
*L
, int udx
, double opacity
)
328 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
329 if(w
->opacity
!= opacity
)
331 w
->opacity
= opacity
;
333 window_opacity_set(w
->window
, opacity
);
334 luaA_object_emit_signal(L
, udx
, "property::opacity", 0);
338 /** Set a wibox border width.
339 * \param L The Lua VM state.
340 * \param idx The wibox to change border width.
341 * \param border_width The border width in pixel.
344 wibox_set_border_width(lua_State
*L
, int udx
, uint32_t border_width
)
346 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
347 xcb_configure_window(globalconf
.connection
, w
->window
, XCB_CONFIG_WINDOW_BORDER_WIDTH
,
349 w
->border_width
= border_width
;
350 luaA_object_emit_signal(L
, udx
, "property::border_width", 0);
353 /** Set a wibox border color.
354 * \param L The Lua VM state.
355 * \param idx The wibox to change border width.
356 * \param color The border color.
359 wibox_set_border_color(lua_State
*L
, int udx
, const xcolor_t
*color
)
361 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
362 xcb_change_window_attributes(globalconf
.connection
, w
->window
,
363 XCB_CW_BORDER_PIXEL
, &color
->pixel
);
364 w
->border_color
= *color
;
365 luaA_object_emit_signal(L
, udx
, "property::border_color", 0);
368 /** Set wibox orientation.
369 * \param L The Lua VM state.
370 * \param w The wibox.
371 * \param o The new orientation.
374 wibox_set_orientation(lua_State
*L
, int udx
, orientation_t o
)
376 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
377 if(o
!= w
->orientation
)
379 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
381 /* orientation != East */
382 if(w
->pixmap
!= w
->ctx
.pixmap
)
383 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
384 wibox_draw_context_update(w
, s
);
385 luaA_object_emit_signal(L
, udx
, "property::orientation", 0);
390 wibox_map(wibox_t
*wibox
)
392 xcb_map_window(globalconf
.connection
, wibox
->window
);
393 /* We must make sure the wibox does not display garbage */
394 wibox_need_update(wibox
);
395 /* Stack this wibox correctly */
399 /** Kick out systray windows.
400 * \param phys_screen Physical screen number.
403 wibox_systray_kickout(int phys_screen
)
405 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
407 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= s
->root
)
409 /* Who! Check that we're not deleting a wibox with a systray, because it
410 * may be its parent. If so, we reparent to root before, otherwise it will
412 xcb_reparent_window(globalconf
.connection
,
413 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
414 s
->root
, -512, -512);
416 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= s
->root
;
421 wibox_systray_refresh(wibox_t
*wibox
)
426 for(int i
= 0; i
< wibox
->widgets
.len
; i
++)
428 widget_node_t
*systray
= &wibox
->widgets
.tab
[i
];
429 if(systray
->widget
->type
== widget_systray
)
431 uint32_t config_back
[] = { wibox
->ctx
.bg
.pixel
};
432 uint32_t config_win_vals
[4];
433 uint32_t config_win_vals_off
[2] = { -512, -512 };
435 int phys_screen
= wibox
->ctx
.phys_screen
;
438 && systray
->widget
->isvisible
439 && systray
->geometry
.width
)
441 /* Set background of the systray window. */
442 xcb_change_window_attributes(globalconf
.connection
,
443 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
444 XCB_CW_BACK_PIXEL
, config_back
);
446 xcb_map_window(globalconf
.connection
, globalconf
.screens
.tab
[phys_screen
].systray
.window
);
448 switch(wibox
->orientation
)
451 config_win_vals
[0] = systray
->geometry
.y
;
452 config_win_vals
[1] = wibox
->geometry
.height
- systray
->geometry
.x
- systray
->geometry
.width
;
453 config_win_vals
[2] = systray
->geometry
.height
;
454 config_win_vals
[3] = systray
->geometry
.width
;
457 config_win_vals
[0] = systray
->geometry
.y
;
458 config_win_vals
[1] = systray
->geometry
.x
;
459 config_win_vals
[2] = systray
->geometry
.height
;
460 config_win_vals
[3] = systray
->geometry
.width
;
463 config_win_vals
[0] = systray
->geometry
.x
;
464 config_win_vals
[1] = systray
->geometry
.y
;
465 config_win_vals
[2] = systray
->geometry
.width
;
466 config_win_vals
[3] = systray
->geometry
.height
;
470 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= wibox
->window
)
472 xcb_reparent_window(globalconf
.connection
,
473 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
475 config_win_vals
[0], config_win_vals
[1]);
476 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= wibox
->window
;
478 xcb_configure_window(globalconf
.connection
,
479 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
481 | XCB_CONFIG_WINDOW_Y
482 | XCB_CONFIG_WINDOW_WIDTH
483 | XCB_CONFIG_WINDOW_HEIGHT
,
485 /* width = height = systray height */
486 config_win_vals
[2] = config_win_vals
[3] = systray
->geometry
.height
;
487 config_win_vals
[0] = 0;
490 return wibox_systray_kickout(phys_screen
);
492 switch(wibox
->orientation
)
495 config_win_vals
[1] = systray
->geometry
.width
- config_win_vals
[3];
496 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
498 em
= &globalconf
.embedded
.tab
[j
];
499 if(em
->phys_screen
== phys_screen
)
501 if(config_win_vals
[1] - config_win_vals
[2] >= (uint32_t) wibox
->geometry
.y
)
503 xcb_map_window(globalconf
.connection
, em
->win
);
504 xcb_configure_window(globalconf
.connection
, em
->win
,
506 | XCB_CONFIG_WINDOW_Y
507 | XCB_CONFIG_WINDOW_WIDTH
508 | XCB_CONFIG_WINDOW_HEIGHT
,
510 config_win_vals
[1] -= config_win_vals
[3];
513 xcb_configure_window(globalconf
.connection
, em
->win
,
515 | XCB_CONFIG_WINDOW_Y
,
516 config_win_vals_off
);
521 config_win_vals
[1] = 0;
522 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
524 em
= &globalconf
.embedded
.tab
[j
];
525 if(em
->phys_screen
== phys_screen
)
527 /* if(y + width <= wibox.y + systray.right) */
528 if(config_win_vals
[1] + config_win_vals
[3] <= (uint32_t) wibox
->geometry
.y
+ AREA_RIGHT(systray
->geometry
))
530 xcb_map_window(globalconf
.connection
, em
->win
);
531 xcb_configure_window(globalconf
.connection
, em
->win
,
533 | XCB_CONFIG_WINDOW_Y
534 | XCB_CONFIG_WINDOW_WIDTH
535 | XCB_CONFIG_WINDOW_HEIGHT
,
537 config_win_vals
[1] += config_win_vals
[3];
540 xcb_configure_window(globalconf
.connection
, em
->win
,
542 | XCB_CONFIG_WINDOW_Y
,
543 config_win_vals_off
);
548 config_win_vals
[1] = 0;
549 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
551 em
= &globalconf
.embedded
.tab
[j
];
552 if(em
->phys_screen
== phys_screen
)
554 /* if(x + width < systray.x + systray.width) */
555 if(config_win_vals
[0] + config_win_vals
[2] <= (uint32_t) AREA_RIGHT(systray
->geometry
) + wibox
->geometry
.x
)
557 xcb_map_window(globalconf
.connection
, em
->win
);
558 xcb_configure_window(globalconf
.connection
, em
->win
,
560 | XCB_CONFIG_WINDOW_Y
561 | XCB_CONFIG_WINDOW_WIDTH
562 | XCB_CONFIG_WINDOW_HEIGHT
,
564 config_win_vals
[0] += config_win_vals
[2];
567 xcb_configure_window(globalconf
.connection
, em
->win
,
569 | XCB_CONFIG_WINDOW_Y
,
570 config_win_vals_off
);
580 /** Get a wibox by its window.
581 * \param win The window id.
582 * \return A wibox if found, NULL otherwise.
585 wibox_getbywin(xcb_window_t win
)
587 foreach(w
, globalconf
.wiboxes
)
588 if((*w
)->window
== win
)
591 foreach(_c
, globalconf
.clients
)
594 if(c
->titlebar
&& c
->titlebar
->window
== win
)
602 * \param wibox The wibox to draw.
605 wibox_draw(wibox_t
*wibox
)
609 widget_render(wibox
);
610 wibox_refresh_pixmap(wibox
);
612 wibox
->need_update
= false;
615 wibox_systray_refresh(wibox
);
618 /** Refresh all wiboxes.
623 foreach(w
, globalconf
.wiboxes
)
625 if((*w
)->need_shape_update
)
626 wibox_shape_update(*w
);
627 if((*w
)->need_update
)
631 foreach(_c
, globalconf
.clients
)
634 if(c
->titlebar
&& c
->titlebar
->need_update
)
635 wibox_draw(c
->titlebar
);
639 /** Set a wibox visible or not.
640 * \param wibox The wibox.
641 * \param v The visible value.
644 wibox_set_visible(lua_State
*L
, int udx
, bool v
)
646 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
647 if(v
!= wibox
->visible
)
650 wibox
->mouse_over
= NULL
;
657 xcb_unmap_window(globalconf
.connection
, wibox
->window
);
659 /* kick out systray if needed */
660 wibox_systray_refresh(wibox
);
663 luaA_object_emit_signal(L
, udx
, "property::visible", 0);
665 hook_property(wibox
, "visible");
669 /** Destroy all X resources of a wibox.
670 * \param w The wibox to wipe.
673 wibox_wipe(wibox_t
*w
)
677 xcb_destroy_window(globalconf
.connection
, w
->window
);
678 w
->window
= XCB_NONE
;
682 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
683 w
->pixmap
= XCB_NONE
;
687 xcb_free_gc(globalconf
.connection
, w
->gc
);
690 draw_context_wipe(&w
->ctx
);
693 /** Remove a wibox from a screen.
694 * \param L The Lua VM state.
695 * \param udx Wibox to detach from screen.
698 wibox_detach(lua_State
*L
, int udx
)
700 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
705 /* save visible state */
707 wibox
->visible
= false;
708 wibox_systray_refresh(wibox
);
709 /* restore visibility */
712 wibox
->mouse_over
= NULL
;
716 foreach(item
, globalconf
.wiboxes
)
719 wibox_array_remove(&globalconf
.wiboxes
, item
);
723 hook_property(wibox
, "screen");
725 wibox
->screen
= NULL
;
726 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
728 luaA_object_unref(globalconf
.L
, wibox
);
732 /** Attach a wibox that is on top of the stack.
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(globalconf
.L
, -1);
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);
782 /** Create a new wibox.
783 * \param L The Lua VM state.
786 * \lparam A table with optionaly defined values:
787 * fg, bg, border_width, border_color, ontop, width and height.
788 * \lreturn A brand new wibox.
791 luaA_wibox_new(lua_State
*L
)
793 luaA_class_new(L
, &wibox_class
);
795 wibox_t
*w
= luaA_checkudata(L
, -1, &wibox_class
);
797 if(!w
->ctx
.fg
.initialized
)
798 w
->ctx
.fg
= globalconf
.colors
.fg
;
800 if(!w
->ctx
.bg
.initialized
)
801 w
->ctx
.bg
= globalconf
.colors
.bg
;
803 if(!w
->border_color
.initialized
)
804 w
->border_color
= globalconf
.colors
.bg
;
812 w
->cursor
= a_strdup("left_ptr");
814 if(!w
->geometry
.width
)
815 w
->geometry
.width
= 1;
817 if(!w
->geometry
.height
)
818 w
->geometry
.height
= 1;
823 /** Check if a wibox widget table has an item.
824 * \param L The Lua VM state.
825 * \param wibox The wibox.
826 * \param item The item to look for.
829 luaA_wibox_hasitem(lua_State
*L
, wibox_t
*wibox
, const void *item
)
831 if(wibox
->widgets_table
)
833 luaA_object_push(L
, wibox
);
834 luaA_object_push_item(L
, -1, wibox
->widgets_table
);
836 if(lua_topointer(L
, -1) == item
|| luaA_hasitem(L
, item
))
842 /** Invalidate a wibox by a Lua object (table, etc).
843 * \param L The Lua VM state.
844 * \param item The object identifier.
847 luaA_wibox_invalidate_byitem(lua_State
*L
, const void *item
)
849 foreach(w
, globalconf
.wiboxes
)
852 if(luaA_wibox_hasitem(L
, wibox
, item
))
855 wibox_need_update(wibox
);
856 lua_pop(L
, 1); /* remove widgets table */
861 foreach(_c
, globalconf
.clients
)
864 if(c
->titlebar
&& luaA_wibox_hasitem(L
, c
->titlebar
, item
))
867 wibox_need_update(c
->titlebar
);
868 lua_pop(L
, 1); /* remove widgets table */
873 /* Set or get the wibox geometry.
874 * \param L The Lua VM state.
875 * \return The number of elements pushed on stack.
877 * \lparam An optional table with wibox geometry.
878 * \lreturn The wibox geometry.
881 luaA_wibox_geometry(lua_State
*L
)
883 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
885 if(lua_gettop(L
) == 2)
889 luaA_checktable(L
, 2);
890 wingeom
.x
= luaA_getopt_number(L
, 2, "x", wibox
->geometry
.x
);
891 wingeom
.y
= luaA_getopt_number(L
, 2, "y", wibox
->geometry
.y
);
892 wingeom
.width
= luaA_getopt_number(L
, 2, "width", wibox
->geometry
.width
);
893 wingeom
.height
= luaA_getopt_number(L
, 2, "height", wibox
->geometry
.height
);
895 if(wingeom
.width
> 0 && wingeom
.height
> 0)
898 case WIBOX_TYPE_TITLEBAR
:
899 wibox_moveresize(L
, 1, (area_t
) { .x
= wibox
->geometry
.x
,
900 .y
= wibox
->geometry
.y
,
901 .width
= wingeom
.width
,
902 .height
= wingeom
.height
});
904 case WIBOX_TYPE_NORMAL
:
905 wibox_moveresize(L
, 1, wingeom
);
910 return luaA_pusharea(L
, wibox
->geometry
);
914 luaA_wibox_struts(lua_State
*L
)
916 wibox_t
*w
= luaA_checkudata(L
, 1, &wibox_class
);
918 if(lua_gettop(L
) == 2)
920 luaA_tostrut(L
, 2, &w
->strut
);
922 ewmh_update_strut(w
->window
, &w
->strut
);
923 luaA_object_emit_signal(L
, 1, "property::struts", 0);
925 screen_emit_signal(L
, w
->screen
, "property::workarea", 0);
928 return luaA_pushstrut(L
, w
->strut
);
931 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, ontop
, lua_pushboolean
)
932 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, cursor
, lua_pushstring
)
933 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, visible
, lua_pushboolean
)
934 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_width
, lua_pushnumber
)
935 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_color
, luaA_pushxcolor
)
938 luaA_wibox_set_x(lua_State
*L
, wibox_t
*wibox
)
940 wibox_moveresize(L
, -3, (area_t
) { .x
= luaL_checknumber(L
, -1),
941 .y
= wibox
->geometry
.y
,
942 .width
= wibox
->geometry
.width
,
943 .height
= wibox
->geometry
.height
});
948 luaA_wibox_get_x(lua_State
*L
, wibox_t
*wibox
)
950 lua_pushnumber(L
, wibox
->geometry
.x
);
955 luaA_wibox_set_y(lua_State
*L
, wibox_t
*wibox
)
957 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
958 .y
= luaL_checknumber(L
, -1),
959 .width
= wibox
->geometry
.width
,
960 .height
= wibox
->geometry
.height
});
965 luaA_wibox_get_y(lua_State
*L
, wibox_t
*wibox
)
967 lua_pushnumber(L
, wibox
->geometry
.y
);
972 luaA_wibox_set_width(lua_State
*L
, wibox_t
*wibox
)
974 int width
= luaL_checknumber(L
, -1);
976 luaL_error(L
, "invalid width");
977 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
978 .y
= wibox
->geometry
.y
,
980 .height
= wibox
->geometry
.height
});
985 luaA_wibox_get_width(lua_State
*L
, wibox_t
*wibox
)
987 lua_pushnumber(L
, wibox
->geometry
.width
);
992 luaA_wibox_set_height(lua_State
*L
, wibox_t
*wibox
)
994 int height
= luaL_checknumber(L
, -1);
996 luaL_error(L
, "invalid height");
997 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
998 .y
= wibox
->geometry
.y
,
999 .width
= wibox
->geometry
.width
,
1000 .height
= height
});
1005 luaA_wibox_get_height(lua_State
*L
, wibox_t
*wibox
)
1007 lua_pushnumber(L
, wibox
->geometry
.height
);
1011 /** Set the wibox foreground color.
1012 * \param L The Lua VM state.
1013 * \param wibox The wibox object.
1014 * \return The number of elements pushed on stack.
1017 luaA_wibox_set_fg(lua_State
*L
, wibox_t
*wibox
)
1020 const char *buf
= luaL_checklstring(L
, -1, &len
);
1021 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.fg
, buf
, len
)))
1022 wibox
->need_update
= true;
1023 luaA_object_emit_signal(L
, -3, "property::fg", 0);
1027 /** Get the wibox foreground color.
1028 * \param L The Lua VM state.
1029 * \param wibox The wibox object.
1030 * \return The number of elements pushed on stack.
1033 luaA_wibox_get_fg(lua_State
*L
, wibox_t
*wibox
)
1035 return luaA_pushxcolor(L
, wibox
->ctx
.fg
);
1038 /** Set the wibox background color.
1039 * \param L The Lua VM state.
1040 * \param wibox The wibox object.
1041 * \return The number of elements pushed on stack.
1044 luaA_wibox_set_bg(lua_State
*L
, wibox_t
*wibox
)
1047 const char *buf
= luaL_checklstring(L
, -1, &len
);
1048 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.bg
, buf
, len
)))
1049 wibox
->need_update
= true;
1050 luaA_object_emit_signal(L
, -3, "property::bg", 0);
1054 /** Get the wibox background color.
1055 * \param L The Lua VM state.
1056 * \param wibox The wibox object.
1057 * \return The number of elements pushed on stack.
1060 luaA_wibox_get_bg(lua_State
*L
, wibox_t
*wibox
)
1062 return luaA_pushxcolor(L
, wibox
->ctx
.bg
);
1065 /** Set the wibox background image.
1066 * \param L The Lua VM state.
1067 * \param wibox The wibox object.
1068 * \return The number of elements pushed on stack.
1071 luaA_wibox_set_bg_image(lua_State
*L
, wibox_t
*wibox
)
1073 luaA_checkudata(L
, -1, &image_class
);
1074 luaA_object_unref_item(L
, -3, wibox
->bg_image
);
1075 wibox
->bg_image
= luaA_object_ref_item(L
, -3, -1);
1076 wibox
->need_update
= true;
1077 luaA_object_emit_signal(L
, -2, "property::bg_image", 0);
1081 /** Get the wibox background image.
1082 * \param L The Lua VM state.
1083 * \param wibox The wibox object.
1084 * \return The number of elements pushed on stack.
1087 luaA_wibox_get_bg_image(lua_State
*L
, wibox_t
*wibox
)
1089 return luaA_object_push_item(L
, 1, wibox
->bg_image
);
1092 /** Set the wibox on top status.
1093 * \param L The Lua VM state.
1094 * \param wibox The wibox object.
1095 * \return The number of elements pushed on stack.
1098 luaA_wibox_set_ontop(lua_State
*L
, wibox_t
*wibox
)
1100 bool b
= luaA_checkboolean(L
, -1);
1101 if(b
!= wibox
->ontop
)
1105 luaA_object_emit_signal(L
, -3, "property::ontop", 0);
1110 /** Set the wibox opacity.
1111 * \param L The Lua VM state.
1112 * \param wibox The wibox object.
1113 * \return The number of elements pushed on stack.
1116 luaA_wibox_set_opacity(lua_State
*L
, wibox_t
*wibox
)
1118 if(lua_isnil(L
, -1))
1119 wibox_opacity_set(L
, -3, -1);
1122 double d
= luaL_checknumber(L
, -1);
1123 if(d
>= 0 && d
<= 1)
1124 wibox_opacity_set(L
, -3, d
);
1129 /** Get the wibox opacity.
1130 * \param L The Lua VM state.
1131 * \param wibox The wibox object.
1132 * \return The number of elements pushed on stack.
1135 luaA_wibox_get_opacity(lua_State
*L
, wibox_t
*wibox
)
1137 if (wibox
->opacity
>= 0)
1139 lua_pushnumber(L
, wibox
->opacity
);
1145 /** Set the wibox alignment.
1146 * \param L The Lua VM state.
1147 * \param wibox The wibox object.
1148 * \return The number of elements pushed on stack.
1151 luaA_wibox_set_align(lua_State
*L
, wibox_t
*wibox
)
1154 const char *buf
= luaL_checklstring(L
, -1, &len
);
1155 wibox
->align
= draw_align_fromstr(buf
, len
);
1156 luaA_object_emit_signal(L
, -3, "property::align", 0);
1159 case WIBOX_TYPE_NORMAL
:
1160 luaA_deprecate(L
, "awful.wibox.align");
1162 case WIBOX_TYPE_TITLEBAR
:
1163 titlebar_update_geometry(client_getbytitlebar(wibox
));
1169 /** Get the wibox alignment.
1170 * \param L The Lua VM state.
1171 * \param wibox The wibox object.
1172 * \return The number of elements pushed on stack.
1175 luaA_wibox_get_align(lua_State
*L
, wibox_t
*wibox
)
1177 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1178 luaA_deprecate(L
, "awful.wibox.align");
1179 lua_pushstring(L
, draw_align_tostr(wibox
->align
));
1183 /** Set the wibox position.
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_set_position(lua_State
*L
, wibox_t
*wibox
)
1193 case WIBOX_TYPE_NORMAL
:
1197 if((buf
= luaL_checklstring(L
, -1, &len
)))
1199 luaA_deprecate(L
, "awful.wibox.attach");
1200 wibox
->position
= position_fromstr(buf
, len
);
1204 case WIBOX_TYPE_TITLEBAR
:
1205 return luaA_titlebar_set_position(L
, -3);
1210 /** Get the wibox position.
1211 * \param L The Lua VM state.
1212 * \param wibox The wibox object.
1213 * \return The number of elements pushed on stack.
1216 luaA_wibox_get_position(lua_State
*L
, wibox_t
*wibox
)
1218 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1219 luaA_deprecate(L
, "awful.wibox.attach");
1220 lua_pushstring(L
, position_tostr(wibox
->position
));
1224 /** Set the wibox (titlebar) client.
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_set_client(lua_State
*L
, wibox_t
*wibox
)
1233 if(lua_isnil(L
, -1))
1234 titlebar_client_detach(client_getbytitlebar(wibox
));
1237 client_t
*c
= luaA_client_checkudata(L
, -1);
1238 lua_pushvalue(L
, -3);
1239 titlebar_client_attach(c
);
1244 /** Get the wibox (titlebar) client.
1245 * \param L The Lua VM state.
1246 * \param wibox The wibox object.
1247 * \return The number of elements pushed on stack.
1250 luaA_wibox_get_client(lua_State
*L
, wibox_t
*wibox
)
1252 return luaA_object_push(L
, client_getbytitlebar(wibox
));
1255 /** Set the wibox cursor.
1256 * \param L The Lua VM state.
1257 * \param wibox The wibox object.
1258 * \return The number of elements pushed on stack.
1261 luaA_wibox_set_cursor(lua_State
*L
, wibox_t
*wibox
)
1263 const char *buf
= luaL_checkstring(L
, -1);
1266 uint16_t cursor_font
= xcursor_font_fromstr(buf
);
1269 xcb_cursor_t cursor
= xcursor_new(globalconf
.connection
, cursor_font
);
1270 p_delete(&wibox
->cursor
);
1271 wibox
->cursor
= a_strdup(buf
);
1272 window_set_cursor(wibox
->window
, cursor
);
1273 luaA_object_emit_signal(L
, -3, "property::cursor", 0);
1279 /** Set the wibox screen.
1280 * \param L The Lua VM state.
1281 * \param wibox The wibox object.
1282 * \return The number of elements pushed on stack.
1285 luaA_wibox_set_screen(lua_State
*L
, wibox_t
*wibox
)
1287 if(lua_isnil(L
, -1))
1289 wibox_detach(L
, -3);
1290 titlebar_client_detach(client_getbytitlebar(wibox
));
1294 int screen
= luaL_checknumber(L
, -1) - 1;
1295 luaA_checkscreen(screen
);
1296 if(!wibox
->screen
|| screen
!= screen_array_indexof(&globalconf
.screens
, wibox
->screen
))
1298 titlebar_client_detach(client_getbytitlebar(wibox
));
1299 wibox_attach(L
, -3, &globalconf
.screens
.tab
[screen
]);
1305 /** Get the wibox screen.
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_get_screen(lua_State
*L
, wibox_t
*wibox
)
1315 lua_pushnumber(L
, screen_array_indexof(&globalconf
.screens
, wibox
->screen
) + 1);
1319 /** Set the wibox orientation.
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_orientation(lua_State
*L
, wibox_t
*wibox
)
1328 const char *buf
= luaL_checklstring(L
, -1, &len
);
1331 wibox_set_orientation(L
, -3, orientation_fromstr(buf
, len
));
1332 wibox_need_update(wibox
);
1337 /** Get the wibox orientation.
1338 * \param L The Lua VM state.
1339 * \param wibox The wibox object.
1340 * \return The number of elements pushed on stack.
1343 luaA_wibox_get_orientation(lua_State
*L
, wibox_t
*wibox
)
1345 lua_pushstring(L
, orientation_tostr(wibox
->orientation
));
1349 /** Set the wibox border color.
1350 * \param L The Lua VM state.
1351 * \param wibox The wibox object.
1352 * \return The number of elements pushed on stack.
1355 luaA_wibox_set_border_color(lua_State
*L
, wibox_t
*wibox
)
1358 const char *buf
= luaL_checklstring(L
, -1, &len
);
1360 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->border_color
, buf
, len
)))
1362 wibox_set_border_color(L
, -3, &wibox
->border_color
);
1366 /** Set the wibox visibility.
1367 * \param L The Lua VM state.
1368 * \param wibox The wibox object.
1369 * \return The number of elements pushed on stack.
1372 luaA_wibox_set_visible(lua_State
*L
, wibox_t
*wibox
)
1374 bool b
= luaA_checkboolean(L
, -1);
1375 if(b
!= wibox
->visible
)
1378 case WIBOX_TYPE_NORMAL
:
1379 wibox_set_visible(L
, -3, b
);
1381 case WIBOX_TYPE_TITLEBAR
:
1382 titlebar_set_visible(wibox
, b
);
1388 /** Set the wibox widgets.
1389 * \param L The Lua VM state.
1390 * \param wibox The wibox object.
1391 * \return The number of elements pushed on stack.
1394 luaA_wibox_set_widgets(lua_State
*L
, wibox_t
*wibox
)
1396 if(luaA_isloop(L
, -1))
1398 luaA_warn(L
, "table is looping, cannot use this as widget table");
1401 /* duplicate table because next function will eat it */
1402 lua_pushvalue(L
, -1);
1403 wibox
->widgets_table
= luaA_object_ref_item(L
, -4, -1);
1404 luaA_object_emit_signal(L
, -3, "property::widgets", 0);
1405 wibox_need_update(wibox
);
1406 luaA_table2wtable(L
);
1410 /** Get the wibox widgets.
1411 * \param L The Lua VM state.
1412 * \param wibox The wibox object.
1413 * \return The number of elements pushed on stack.
1416 luaA_wibox_get_widgets(lua_State
*L
, wibox_t
*wibox
)
1418 return luaA_object_push_item(L
, 1, wibox
->widgets_table
);
1421 /** Get or set mouse buttons bindings to a wibox.
1422 * \param L The Lua VM state.
1425 * \lparam An array of mouse button bindings objects, or nothing.
1426 * \return The array of mouse button bindings objects of this wibox.
1429 luaA_wibox_buttons(lua_State
*L
)
1431 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
1433 if(lua_gettop(L
) == 2)
1435 luaA_button_array_set(L
, 1, 2, &wibox
->buttons
);
1436 luaA_object_emit_signal(L
, 1, "property::buttons", 0);
1439 return luaA_button_array_get(L
, 1, &wibox
->buttons
);
1442 /** Set the wibox border width.
1443 * \param L The Lua VM state.
1444 * \param wibox The wibox object.
1445 * \return The number of elements pushed on stack.
1448 luaA_wibox_set_border_width(lua_State
*L
, wibox_t
*wibox
)
1450 wibox_set_border_width(L
, -3, luaL_checknumber(L
, -1));
1455 luaA_wibox_set_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1457 luaA_object_unref_item(L
, -3, wibox
->shape
.bounding
);
1458 wibox
->shape
.bounding
= luaA_object_ref_item(L
, -3, -1);
1459 wibox
->need_shape_update
= true;
1460 luaA_object_emit_signal(L
, -2, "property::shape_bounding", 0);
1465 luaA_wibox_get_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1467 return luaA_object_push_item(L
, 1, wibox
->shape
.bounding
);
1471 luaA_wibox_set_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1473 luaA_object_unref_item(L
, -3, wibox
->shape
.clip
);
1474 wibox
->shape
.clip
= luaA_object_ref_item(L
, -3, -1);
1475 wibox
->need_shape_update
= true;
1476 luaA_object_emit_signal(L
, -2, "property::shape_clip", 0);
1481 luaA_wibox_get_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1483 return luaA_object_push_item(L
, 1, wibox
->shape
.clip
);
1487 wibox_class_setup(lua_State
*L
)
1489 static const struct luaL_reg wibox_methods
[] =
1491 LUA_CLASS_METHODS(wibox
)
1492 { "__call", luaA_wibox_new
},
1496 static const struct luaL_reg wibox_meta
[] =
1498 LUA_OBJECT_META(wibox
)
1500 { "struts", luaA_wibox_struts
},
1501 { "buttons", luaA_wibox_buttons
},
1502 { "geometry", luaA_wibox_geometry
},
1503 { "__gc", luaA_wibox_gc
},
1507 luaA_class_setup(L
, &wibox_class
, "wibox", (lua_class_allocator_t
) wibox_new
,
1508 luaA_class_index_miss_property
, luaA_class_newindex_miss_property
,
1509 wibox_methods
, wibox_meta
);
1510 luaA_class_add_property(&wibox_class
, A_TK_WIDGETS
,
1511 (lua_class_propfunc_t
) luaA_wibox_set_widgets
,
1512 (lua_class_propfunc_t
) luaA_wibox_get_widgets
,
1513 (lua_class_propfunc_t
) luaA_wibox_set_widgets
);
1514 luaA_class_add_property(&wibox_class
, A_TK_OPACITY
,
1515 (lua_class_propfunc_t
) luaA_wibox_set_opacity
,
1516 (lua_class_propfunc_t
) luaA_wibox_get_opacity
,
1517 (lua_class_propfunc_t
) luaA_wibox_set_opacity
);
1518 luaA_class_add_property(&wibox_class
, A_TK_VISIBLE
,
1519 (lua_class_propfunc_t
) luaA_wibox_set_visible
,
1520 (lua_class_propfunc_t
) luaA_wibox_get_visible
,
1521 (lua_class_propfunc_t
) luaA_wibox_set_visible
);
1522 luaA_class_add_property(&wibox_class
, A_TK_BORDER_COLOR
,
1523 (lua_class_propfunc_t
) luaA_wibox_set_border_color
,
1524 (lua_class_propfunc_t
) luaA_wibox_get_border_color
,
1525 (lua_class_propfunc_t
) luaA_wibox_set_border_color
);
1526 luaA_class_add_property(&wibox_class
, A_TK_BORDER_WIDTH
,
1527 (lua_class_propfunc_t
) luaA_wibox_set_border_width
,
1528 (lua_class_propfunc_t
) luaA_wibox_get_border_width
,
1529 (lua_class_propfunc_t
) luaA_wibox_set_border_width
);
1530 luaA_class_add_property(&wibox_class
, A_TK_ORIENTATION
,
1531 (lua_class_propfunc_t
) luaA_wibox_set_orientation
,
1532 (lua_class_propfunc_t
) luaA_wibox_get_orientation
,
1533 (lua_class_propfunc_t
) luaA_wibox_set_orientation
);
1534 luaA_class_add_property(&wibox_class
, A_TK_ONTOP
,
1535 (lua_class_propfunc_t
) luaA_wibox_set_ontop
,
1536 (lua_class_propfunc_t
) luaA_wibox_get_ontop
,
1537 (lua_class_propfunc_t
) luaA_wibox_set_ontop
);
1538 luaA_class_add_property(&wibox_class
, A_TK_SCREEN
,
1540 (lua_class_propfunc_t
) luaA_wibox_get_screen
,
1541 (lua_class_propfunc_t
) luaA_wibox_set_screen
);
1542 luaA_class_add_property(&wibox_class
, A_TK_CURSOR
,
1543 (lua_class_propfunc_t
) luaA_wibox_set_cursor
,
1544 (lua_class_propfunc_t
) luaA_wibox_get_cursor
,
1545 (lua_class_propfunc_t
) luaA_wibox_set_cursor
);
1546 luaA_class_add_property(&wibox_class
, A_TK_CLIENT
,
1547 (lua_class_propfunc_t
) luaA_wibox_set_client
,
1548 (lua_class_propfunc_t
) luaA_wibox_get_client
,
1549 (lua_class_propfunc_t
) luaA_wibox_set_client
);
1550 luaA_class_add_property(&wibox_class
, A_TK_POSITION
,
1551 (lua_class_propfunc_t
) luaA_wibox_set_position
,
1552 (lua_class_propfunc_t
) luaA_wibox_get_position
,
1553 (lua_class_propfunc_t
) luaA_wibox_set_position
);
1554 luaA_class_add_property(&wibox_class
, A_TK_ALIGN
,
1555 (lua_class_propfunc_t
) luaA_wibox_set_align
,
1556 (lua_class_propfunc_t
) luaA_wibox_get_align
,
1557 (lua_class_propfunc_t
) luaA_wibox_set_align
);
1558 luaA_class_add_property(&wibox_class
, A_TK_FG
,
1559 (lua_class_propfunc_t
) luaA_wibox_set_fg
,
1560 (lua_class_propfunc_t
) luaA_wibox_get_fg
,
1561 (lua_class_propfunc_t
) luaA_wibox_set_fg
);
1562 luaA_class_add_property(&wibox_class
, A_TK_BG
,
1563 (lua_class_propfunc_t
) luaA_wibox_set_bg
,
1564 (lua_class_propfunc_t
) luaA_wibox_get_bg
,
1565 (lua_class_propfunc_t
) luaA_wibox_set_bg
);
1566 luaA_class_add_property(&wibox_class
, A_TK_BG_IMAGE
,
1567 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
,
1568 (lua_class_propfunc_t
) luaA_wibox_get_bg_image
,
1569 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
);
1570 luaA_class_add_property(&wibox_class
, A_TK_X
,
1571 (lua_class_propfunc_t
) luaA_wibox_set_x
,
1572 (lua_class_propfunc_t
) luaA_wibox_get_x
,
1573 (lua_class_propfunc_t
) luaA_wibox_set_x
);
1574 luaA_class_add_property(&wibox_class
, A_TK_Y
,
1575 (lua_class_propfunc_t
) luaA_wibox_set_y
,
1576 (lua_class_propfunc_t
) luaA_wibox_get_y
,
1577 (lua_class_propfunc_t
) luaA_wibox_set_y
);
1578 luaA_class_add_property(&wibox_class
, A_TK_WIDTH
,
1579 (lua_class_propfunc_t
) luaA_wibox_set_width
,
1580 (lua_class_propfunc_t
) luaA_wibox_get_width
,
1581 (lua_class_propfunc_t
) luaA_wibox_set_width
);
1582 luaA_class_add_property(&wibox_class
, A_TK_HEIGHT
,
1583 (lua_class_propfunc_t
) luaA_wibox_set_height
,
1584 (lua_class_propfunc_t
) luaA_wibox_get_height
,
1585 (lua_class_propfunc_t
) luaA_wibox_set_height
);
1586 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_BOUNDING
,
1587 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
,
1588 (lua_class_propfunc_t
) luaA_wibox_get_shape_bounding
,
1589 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
);
1590 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_CLIP
,
1591 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
,
1592 (lua_class_propfunc_t
) luaA_wibox_get_shape_clip
,
1593 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
);
1596 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80