2 * wibox.c - wibox functions
4 * Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <xcb/shape.h>
32 #include "common/xcursor.h"
33 #include "common/xutil.h"
35 LUA_OBJECT_FUNCS(wibox_class
, wibox_t
, wibox
)
37 /** Take care of garbage collecting a wibox.
38 * \param L The Lua VM state.
39 * \return The number of elements pushed on stack, 0!
42 luaA_wibox_gc(lua_State
*L
)
44 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
45 p_delete(&wibox
->cursor
);
47 button_array_wipe(&wibox
->buttons
);
48 widget_node_array_wipe(&wibox
->widgets
);
49 return luaA_object_gc(L
);
53 wibox_unref_simplified(wibox_t
**item
)
55 luaA_object_unref(globalconf
.L
, *item
);
59 wibox_need_update(wibox_t
*wibox
)
61 wibox
->need_update
= true;
62 wibox
->mouse_over
= NULL
;
68 const xcb_query_extension_reply_t
*reply
;
70 reply
= xcb_get_extension_data(globalconf
.connection
, &xcb_shape_id
);
71 if (!reply
|| !reply
->present
)
74 /* We don't need a specific version of SHAPE, no version check required */
79 shape_update(xcb_window_t win
, xcb_shape_kind_t kind
, image_t
*image
, int offset
)
84 shape
= image_to_1bit_pixmap(image
, win
);
89 xcb_shape_mask(globalconf
.connection
, XCB_SHAPE_SO_SET
, kind
,
90 win
, offset
, offset
, shape
);
92 if (shape
!= XCB_NONE
)
93 xcb_free_pixmap(globalconf
.connection
, shape
);
96 /** Update the window's shape.
97 * \param wibox The simplw window whose shape should be updated.
100 wibox_shape_update(wibox_t
*wibox
)
102 if(wibox
->window
== XCB_NONE
)
107 static bool warned
= false;
109 warn("The X server doesn't have the SHAPE extension; "
110 "can't change window's shape");
115 shape_update(wibox
->window
, XCB_SHAPE_SK_CLIP
, wibox
->shape
.clip
, 0);
116 shape_update(wibox
->window
, XCB_SHAPE_SK_BOUNDING
, wibox
->shape
.bounding
, - wibox
->border_width
);
118 wibox
->need_shape_update
= false;
122 wibox_draw_context_update(wibox_t
*w
, xcb_screen_t
*s
)
124 xcolor_t fg
= w
->ctx
.fg
, bg
= w
->ctx
.bg
;
125 int phys_screen
= w
->ctx
.phys_screen
;
127 draw_context_wipe(&w
->ctx
);
129 /* update draw context */
130 switch(w
->orientation
)
134 /* we need a new pixmap this way [ ] to render */
135 w
->ctx
.pixmap
= xcb_generate_id(globalconf
.connection
);
136 xcb_create_pixmap(globalconf
.connection
,
138 w
->ctx
.pixmap
, s
->root
,
141 draw_context_init(&w
->ctx
, phys_screen
,
144 w
->ctx
.pixmap
, &fg
, &bg
);
147 draw_context_init(&w
->ctx
, phys_screen
,
150 w
->pixmap
, &fg
, &bg
);
155 /** Initialize a wibox.
156 * \param w The wibox to initialize.
157 * \param phys_screen Physical screen number.
160 wibox_init(wibox_t
*w
, int phys_screen
)
162 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
164 w
->window
= xcb_generate_id(globalconf
.connection
);
165 xcb_create_window(globalconf
.connection
, s
->root_depth
, w
->window
, s
->root
,
166 w
->geometry
.x
, w
->geometry
.y
,
167 w
->geometry
.width
, w
->geometry
.height
,
168 w
->border_width
, XCB_COPY_FROM_PARENT
, s
->root_visual
,
169 XCB_CW_BACK_PIXMAP
| XCB_CW_BORDER_PIXEL
170 | XCB_CW_OVERRIDE_REDIRECT
| XCB_CW_EVENT_MASK
,
173 XCB_BACK_PIXMAP_PARENT_RELATIVE
,
174 w
->border_color
.pixel
,
176 XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
177 | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY
| XCB_EVENT_MASK_ENTER_WINDOW
178 | XCB_EVENT_MASK_LEAVE_WINDOW
| XCB_EVENT_MASK_STRUCTURE_NOTIFY
179 | XCB_EVENT_MASK_BUTTON_PRESS
| XCB_EVENT_MASK_BUTTON_RELEASE
180 | XCB_EVENT_MASK_POINTER_MOTION
| XCB_EVENT_MASK_EXPOSURE
181 | XCB_EVENT_MASK_PROPERTY_CHANGE
184 /* Create a pixmap. */
185 w
->pixmap
= xcb_generate_id(globalconf
.connection
);
186 xcb_create_pixmap(globalconf
.connection
, s
->root_depth
, w
->pixmap
, s
->root
,
187 w
->geometry
.width
, w
->geometry
.height
);
189 /* Update draw context physical screen, important for Zaphod. */
190 w
->ctx
.phys_screen
= phys_screen
;
191 wibox_draw_context_update(w
, s
);
193 /* The default GC is just a newly created associated to the root window */
194 w
->gc
= xcb_generate_id(globalconf
.connection
);
195 xcb_create_gc(globalconf
.connection
, w
->gc
, s
->root
, XCB_GC_FOREGROUND
| XCB_GC_BACKGROUND
,
196 (const uint32_t[]) { s
->black_pixel
, s
->white_pixel
});
198 wibox_shape_update(w
);
201 /** Refresh the window content by copying its pixmap data to its window.
202 * \param w The wibox to refresh.
205 wibox_refresh_pixmap(wibox_t
*w
)
207 wibox_refresh_pixmap_partial(w
, 0, 0, w
->geometry
.width
, w
->geometry
.height
);
210 /** Move and/or resize a wibox
211 * \param L The Lua VM state.
212 * \param udx The index of the wibox.
213 * \param geometry The new geometry.
216 wibox_moveresize(lua_State
*L
, int udx
, area_t geometry
)
218 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
221 int number_of_vals
= 0;
222 uint32_t moveresize_win_vals
[4], mask_vals
= 0;
224 if(w
->geometry
.x
!= geometry
.x
)
226 w
->geometry
.x
= moveresize_win_vals
[number_of_vals
++] = geometry
.x
;
227 mask_vals
|= XCB_CONFIG_WINDOW_X
;
230 if(w
->geometry
.y
!= geometry
.y
)
232 w
->geometry
.y
= moveresize_win_vals
[number_of_vals
++] = geometry
.y
;
233 mask_vals
|= XCB_CONFIG_WINDOW_Y
;
236 if(geometry
.width
> 0 && w
->geometry
.width
!= geometry
.width
)
238 w
->geometry
.width
= moveresize_win_vals
[number_of_vals
++] = geometry
.width
;
239 mask_vals
|= XCB_CONFIG_WINDOW_WIDTH
;
242 if(geometry
.height
> 0 && w
->geometry
.height
!= geometry
.height
)
244 w
->geometry
.height
= moveresize_win_vals
[number_of_vals
++] = geometry
.height
;
245 mask_vals
|= XCB_CONFIG_WINDOW_HEIGHT
;
248 if(mask_vals
& (XCB_CONFIG_WINDOW_WIDTH
| XCB_CONFIG_WINDOW_HEIGHT
))
250 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
251 /* orientation != East */
252 if(w
->pixmap
!= w
->ctx
.pixmap
)
253 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
254 w
->pixmap
= xcb_generate_id(globalconf
.connection
);
255 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
256 xcb_create_pixmap(globalconf
.connection
, s
->root_depth
, w
->pixmap
, s
->root
,
257 w
->geometry
.width
, w
->geometry
.height
);
258 wibox_draw_context_update(w
, s
);
262 client_ignore_enterleave_events();
265 xcb_configure_window(globalconf
.connection
, w
->window
, mask_vals
, moveresize_win_vals
);
267 /* Deactivatate BMA */
268 client_restore_enterleave_events();
270 w
->screen
= screen_getbycoord(w
->screen
, w
->geometry
.x
, w
->geometry
.y
);
272 if(mask_vals
& XCB_CONFIG_WINDOW_X
)
273 luaA_object_emit_signal(L
, udx
, "property::x", 0);
274 if(mask_vals
& XCB_CONFIG_WINDOW_Y
)
275 luaA_object_emit_signal(L
, udx
, "property::y", 0);
276 if(mask_vals
& XCB_CONFIG_WINDOW_WIDTH
)
277 luaA_object_emit_signal(L
, udx
, "property::width", 0);
278 if(mask_vals
& XCB_CONFIG_WINDOW_HEIGHT
)
279 luaA_object_emit_signal(L
, udx
, "property::height", 0);
283 #define DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(prop) \
284 if(w->geometry.prop != geometry.prop) \
286 w->geometry.prop = geometry.prop; \
287 luaA_object_emit_signal(L, udx, "property::" #prop, 0); \
289 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(x
)
290 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(y
)
291 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(width
)
292 DO_WIBOX_GEOMETRY_CHECK_AND_EMIT(height
)
293 #undef DO_WIBOX_GEOMETRY_CHECK_AND_EMIT
296 wibox_need_update(w
);
299 /** Refresh the window content by copying its pixmap data to its window.
300 * \param wibox The wibox to refresh.
301 * \param x The copy starting point x component.
302 * \param y The copy starting point y component.
303 * \param w The copy width from the x component.
304 * \param h The copy height from the y component.
307 wibox_refresh_pixmap_partial(wibox_t
*wibox
,
308 int16_t x
, int16_t y
,
309 uint16_t w
, uint16_t h
)
311 xcb_copy_area(globalconf
.connection
, wibox
->pixmap
,
312 wibox
->window
, wibox
->gc
, x
, y
, x
, y
,
317 wibox_set_opacity(lua_State
*L
, int udx
, double opacity
)
319 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
320 if(w
->opacity
!= opacity
)
322 w
->opacity
= opacity
;
324 window_opacity_set(w
->window
, opacity
);
325 luaA_object_emit_signal(L
, udx
, "property::opacity", 0);
329 /** Set a wibox border color.
330 * \param L The Lua VM state.
331 * \param idx The wibox to change border width.
332 * \param color The border color.
335 wibox_set_border_color(lua_State
*L
, int udx
, const xcolor_t
*color
)
337 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
338 xcb_change_window_attributes(globalconf
.connection
, w
->window
,
339 XCB_CW_BORDER_PIXEL
, &color
->pixel
);
340 w
->border_color
= *color
;
341 luaA_object_emit_signal(L
, udx
, "property::border_color", 0);
344 /** Set wibox orientation.
345 * \param L The Lua VM state.
346 * \param w The wibox.
347 * \param o The new orientation.
350 wibox_set_orientation(lua_State
*L
, int udx
, orientation_t o
)
352 wibox_t
*w
= luaA_checkudata(L
, udx
, &wibox_class
);
353 if(o
!= w
->orientation
)
355 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, w
->ctx
.phys_screen
);
357 /* orientation != East */
358 if(w
->pixmap
!= w
->ctx
.pixmap
)
359 xcb_free_pixmap(globalconf
.connection
, w
->ctx
.pixmap
);
360 wibox_draw_context_update(w
, s
);
361 luaA_object_emit_signal(L
, udx
, "property::orientation", 0);
366 wibox_map(wibox_t
*wibox
)
369 client_ignore_enterleave_events();
371 xcb_map_window(globalconf
.connection
, wibox
->window
);
372 /* Deactivatate BMA */
373 client_restore_enterleave_events();
374 /* We must make sure the wibox does not display garbage */
375 wibox_need_update(wibox
);
376 /* Stack this wibox correctly */
380 /** Kick out systray windows.
381 * \param phys_screen Physical screen number.
384 wibox_systray_kickout(int phys_screen
)
386 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
388 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= s
->root
)
390 /* Who! Check that we're not deleting a wibox with a systray, because it
391 * may be its parent. If so, we reparent to root before, otherwise it will
393 xcb_reparent_window(globalconf
.connection
,
394 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
395 s
->root
, -512, -512);
397 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= s
->root
;
402 wibox_systray_refresh(wibox_t
*wibox
)
407 for(int i
= 0; i
< wibox
->widgets
.len
; i
++)
409 widget_node_t
*systray
= &wibox
->widgets
.tab
[i
];
410 if(systray
->widget
->type
== widget_systray
)
412 uint32_t config_back
[] = { wibox
->ctx
.bg
.pixel
};
413 uint32_t config_win_vals
[4];
414 uint32_t config_win_vals_off
[2] = { -512, -512 };
416 int phys_screen
= wibox
->ctx
.phys_screen
;
419 && systray
->widget
->isvisible
420 && systray
->geometry
.width
)
422 /* Set background of the systray window. */
423 xcb_change_window_attributes(globalconf
.connection
,
424 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
425 XCB_CW_BACK_PIXEL
, config_back
);
427 xcb_map_window(globalconf
.connection
, globalconf
.screens
.tab
[phys_screen
].systray
.window
);
429 switch(wibox
->orientation
)
432 config_win_vals
[0] = systray
->geometry
.y
;
433 config_win_vals
[1] = wibox
->geometry
.height
- systray
->geometry
.x
- systray
->geometry
.width
;
434 config_win_vals
[2] = systray
->geometry
.height
;
435 config_win_vals
[3] = systray
->geometry
.width
;
438 config_win_vals
[0] = systray
->geometry
.y
;
439 config_win_vals
[1] = systray
->geometry
.x
;
440 config_win_vals
[2] = systray
->geometry
.height
;
441 config_win_vals
[3] = systray
->geometry
.width
;
444 config_win_vals
[0] = systray
->geometry
.x
;
445 config_win_vals
[1] = systray
->geometry
.y
;
446 config_win_vals
[2] = systray
->geometry
.width
;
447 config_win_vals
[3] = systray
->geometry
.height
;
451 if(globalconf
.screens
.tab
[phys_screen
].systray
.parent
!= wibox
->window
)
453 xcb_reparent_window(globalconf
.connection
,
454 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
456 config_win_vals
[0], config_win_vals
[1]);
457 globalconf
.screens
.tab
[phys_screen
].systray
.parent
= wibox
->window
;
459 xcb_configure_window(globalconf
.connection
,
460 globalconf
.screens
.tab
[phys_screen
].systray
.window
,
462 | XCB_CONFIG_WINDOW_Y
463 | XCB_CONFIG_WINDOW_WIDTH
464 | XCB_CONFIG_WINDOW_HEIGHT
,
466 /* width = height = systray height */
467 config_win_vals
[2] = config_win_vals
[3] = systray
->geometry
.height
;
468 config_win_vals
[0] = 0;
471 return wibox_systray_kickout(phys_screen
);
473 switch(wibox
->orientation
)
476 config_win_vals
[1] = systray
->geometry
.width
- config_win_vals
[3];
477 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
479 em
= &globalconf
.embedded
.tab
[j
];
480 if(em
->phys_screen
== phys_screen
)
482 if(config_win_vals
[1] - config_win_vals
[2] >= (uint32_t) wibox
->geometry
.y
)
484 xcb_map_window(globalconf
.connection
, em
->win
);
485 xcb_configure_window(globalconf
.connection
, em
->win
,
487 | XCB_CONFIG_WINDOW_Y
488 | XCB_CONFIG_WINDOW_WIDTH
489 | XCB_CONFIG_WINDOW_HEIGHT
,
491 config_win_vals
[1] -= config_win_vals
[3];
494 xcb_configure_window(globalconf
.connection
, em
->win
,
496 | XCB_CONFIG_WINDOW_Y
,
497 config_win_vals_off
);
502 config_win_vals
[1] = 0;
503 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
505 em
= &globalconf
.embedded
.tab
[j
];
506 if(em
->phys_screen
== phys_screen
)
508 /* if(y + width <= wibox.y + systray.right) */
509 if(config_win_vals
[1] + config_win_vals
[3] <= (uint32_t) wibox
->geometry
.y
+ AREA_RIGHT(systray
->geometry
))
511 xcb_map_window(globalconf
.connection
, em
->win
);
512 xcb_configure_window(globalconf
.connection
, em
->win
,
514 | XCB_CONFIG_WINDOW_Y
515 | XCB_CONFIG_WINDOW_WIDTH
516 | XCB_CONFIG_WINDOW_HEIGHT
,
518 config_win_vals
[1] += config_win_vals
[3];
521 xcb_configure_window(globalconf
.connection
, em
->win
,
523 | XCB_CONFIG_WINDOW_Y
,
524 config_win_vals_off
);
529 config_win_vals
[1] = 0;
530 for(int j
= 0; j
< globalconf
.embedded
.len
; j
++)
532 em
= &globalconf
.embedded
.tab
[j
];
533 if(em
->phys_screen
== phys_screen
)
535 /* if(x + width < systray.x + systray.width) */
536 if(config_win_vals
[0] + config_win_vals
[2] <= (uint32_t) AREA_RIGHT(systray
->geometry
) + wibox
->geometry
.x
)
538 xcb_map_window(globalconf
.connection
, em
->win
);
539 xcb_configure_window(globalconf
.connection
, em
->win
,
541 | XCB_CONFIG_WINDOW_Y
542 | XCB_CONFIG_WINDOW_WIDTH
543 | XCB_CONFIG_WINDOW_HEIGHT
,
545 config_win_vals
[0] += config_win_vals
[2];
548 xcb_configure_window(globalconf
.connection
, em
->win
,
550 | XCB_CONFIG_WINDOW_Y
,
551 config_win_vals_off
);
561 /** Get a wibox by its window.
562 * \param win The window id.
563 * \return A wibox if found, NULL otherwise.
566 wibox_getbywin(xcb_window_t win
)
568 foreach(w
, globalconf
.wiboxes
)
569 if((*w
)->window
== win
)
572 foreach(_c
, globalconf
.clients
)
575 if(c
->titlebar
&& c
->titlebar
->window
== win
)
583 * \param wibox The wibox to draw.
586 wibox_draw(wibox_t
*wibox
)
590 widget_render(wibox
);
591 wibox_refresh_pixmap(wibox
);
593 wibox
->need_update
= false;
596 wibox_systray_refresh(wibox
);
599 /** Refresh all wiboxes.
604 foreach(w
, globalconf
.wiboxes
)
606 if((*w
)->need_shape_update
)
607 wibox_shape_update(*w
);
608 if((*w
)->need_update
)
612 foreach(_c
, globalconf
.clients
)
615 if(c
->titlebar
&& c
->titlebar
->need_update
)
616 wibox_draw(c
->titlebar
);
620 /** Set a wibox visible or not.
621 * \param wibox The wibox.
622 * \param v The visible value.
625 wibox_set_visible(lua_State
*L
, int udx
, bool v
)
627 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
628 if(v
!= wibox
->visible
)
631 wibox
->mouse_over
= NULL
;
640 client_ignore_enterleave_events();
642 xcb_unmap_window(globalconf
.connection
, wibox
->window
);
644 client_restore_enterleave_events();
647 /* kick out systray if needed */
648 wibox_systray_refresh(wibox
);
651 luaA_object_emit_signal(L
, udx
, "property::visible", 0);
653 hook_property(wibox
, "visible");
657 /** Destroy all X resources of a wibox.
658 * \param w The wibox to wipe.
661 wibox_wipe(wibox_t
*w
)
666 client_ignore_enterleave_events();
667 xcb_destroy_window(globalconf
.connection
, w
->window
);
669 client_restore_enterleave_events();
670 w
->window
= XCB_NONE
;
674 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
675 w
->pixmap
= XCB_NONE
;
679 xcb_free_gc(globalconf
.connection
, w
->gc
);
682 draw_context_wipe(&w
->ctx
);
685 /** Remove a wibox from a screen.
686 * \param L The Lua VM state.
687 * \param udx Wibox to detach from screen.
690 wibox_detach(lua_State
*L
, int udx
)
692 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
697 /* save visible state */
699 wibox
->visible
= false;
700 wibox_systray_refresh(wibox
);
701 /* restore visibility */
704 wibox
->mouse_over
= NULL
;
708 foreach(item
, globalconf
.wiboxes
)
711 wibox_array_remove(&globalconf
.wiboxes
, item
);
715 hook_property(wibox
, "screen");
717 wibox
->screen
= NULL
;
718 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
720 luaA_object_unref(globalconf
.L
, wibox
);
724 /** Attach a wibox that is on top of the stack.
725 * \param s The screen to attach the wibox to.
728 wibox_attach(lua_State
*L
, int udx
, screen_t
*s
)
730 int phys_screen
= screen_virttophys(screen_array_indexof(&globalconf
.screens
, s
));
732 /* duplicate wibox */
733 lua_pushvalue(L
, udx
);
735 wibox_t
*wibox
= luaA_object_ref(globalconf
.L
, -1);
737 wibox_detach(L
, udx
);
739 /* Set the wibox screen */
742 /* Check that the wibox coordinates matches the screen. */
744 screen_getbycoord(wibox
->screen
, wibox
->geometry
.x
, wibox
->geometry
.y
);
746 /* If it does not match, move it to the screen coordinates */
747 if(cscreen
!= wibox
->screen
)
748 wibox_moveresize(L
, udx
, (area_t
) { .x
= s
->geometry
.x
,
750 .width
= wibox
->geometry
.width
,
751 .height
= wibox
->geometry
.height
});
753 wibox_array_append(&globalconf
.wiboxes
, wibox
);
755 wibox_init(wibox
, phys_screen
);
757 window_set_cursor(wibox
->window
,
758 xcursor_new(globalconf
.connection
, xcursor_font_fromstr(wibox
->cursor
)));
760 if(wibox
->opacity
!= -1)
761 window_opacity_set(wibox
->window
, wibox
->opacity
);
763 ewmh_update_strut(wibox
->window
, &wibox
->strut
);
768 wibox_need_update(wibox
);
770 hook_property(wibox
, "screen");
771 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
774 /** Create a new wibox.
775 * \param L The Lua VM state.
778 * \lparam A table with optionaly defined values:
779 * fg, bg, border_width, border_color, ontop, width and height.
780 * \lreturn A brand new wibox.
783 luaA_wibox_new(lua_State
*L
)
785 luaA_class_new(L
, &wibox_class
);
787 wibox_t
*w
= luaA_checkudata(L
, -1, &wibox_class
);
789 if(!w
->ctx
.fg
.initialized
)
790 w
->ctx
.fg
= globalconf
.colors
.fg
;
792 if(!w
->ctx
.bg
.initialized
)
793 w
->ctx
.bg
= globalconf
.colors
.bg
;
795 if(!w
->border_color
.initialized
)
796 w
->border_color
= globalconf
.colors
.bg
;
804 w
->cursor
= a_strdup("left_ptr");
806 if(!w
->geometry
.width
)
807 w
->geometry
.width
= 1;
809 if(!w
->geometry
.height
)
810 w
->geometry
.height
= 1;
815 /** Check if a wibox widget table has an item.
816 * \param L The Lua VM state.
817 * \param wibox The wibox.
818 * \param item The item to look for.
821 luaA_wibox_hasitem(lua_State
*L
, wibox_t
*wibox
, const void *item
)
823 if(wibox
->widgets_table
)
825 luaA_object_push(L
, wibox
);
826 luaA_object_push_item(L
, -1, wibox
->widgets_table
);
828 if(lua_topointer(L
, -1) == item
|| luaA_hasitem(L
, item
))
834 /** Invalidate a wibox by a Lua object (table, etc).
835 * \param L The Lua VM state.
836 * \param item The object identifier.
839 luaA_wibox_invalidate_byitem(lua_State
*L
, const void *item
)
841 foreach(w
, globalconf
.wiboxes
)
844 if(luaA_wibox_hasitem(L
, wibox
, item
))
847 wibox_need_update(wibox
);
848 lua_pop(L
, 1); /* remove widgets table */
853 foreach(_c
, globalconf
.clients
)
856 if(c
->titlebar
&& luaA_wibox_hasitem(L
, c
->titlebar
, item
))
859 wibox_need_update(c
->titlebar
);
860 lua_pop(L
, 1); /* remove widgets table */
865 /* Set or get the wibox geometry.
866 * \param L The Lua VM state.
867 * \return The number of elements pushed on stack.
869 * \lparam An optional table with wibox geometry.
870 * \lreturn The wibox geometry.
873 luaA_wibox_geometry(lua_State
*L
)
875 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
877 if(lua_gettop(L
) == 2)
881 luaA_checktable(L
, 2);
882 wingeom
.x
= luaA_getopt_number(L
, 2, "x", wibox
->geometry
.x
);
883 wingeom
.y
= luaA_getopt_number(L
, 2, "y", wibox
->geometry
.y
);
884 wingeom
.width
= luaA_getopt_number(L
, 2, "width", wibox
->geometry
.width
);
885 wingeom
.height
= luaA_getopt_number(L
, 2, "height", wibox
->geometry
.height
);
887 if(wingeom
.width
> 0 && wingeom
.height
> 0)
890 case WIBOX_TYPE_TITLEBAR
:
891 wibox_moveresize(L
, 1, (area_t
) { .x
= wibox
->geometry
.x
,
892 .y
= wibox
->geometry
.y
,
893 .width
= wingeom
.width
,
894 .height
= wingeom
.height
});
896 case WIBOX_TYPE_NORMAL
:
897 wibox_moveresize(L
, 1, wingeom
);
902 return luaA_pusharea(L
, wibox
->geometry
);
906 luaA_wibox_struts(lua_State
*L
)
908 wibox_t
*w
= luaA_checkudata(L
, 1, &wibox_class
);
910 if(lua_gettop(L
) == 2)
912 luaA_tostrut(L
, 2, &w
->strut
);
914 ewmh_update_strut(w
->window
, &w
->strut
);
915 luaA_object_emit_signal(L
, 1, "property::struts", 0);
917 screen_emit_signal(L
, w
->screen
, "property::workarea", 0);
920 return luaA_pushstrut(L
, w
->strut
);
923 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, ontop
, lua_pushboolean
)
924 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, cursor
, lua_pushstring
)
925 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, visible
, lua_pushboolean
)
926 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_width
, lua_pushnumber
)
927 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_color
, luaA_pushxcolor
)
930 luaA_wibox_set_x(lua_State
*L
, wibox_t
*wibox
)
932 wibox_moveresize(L
, -3, (area_t
) { .x
= luaL_checknumber(L
, -1),
933 .y
= wibox
->geometry
.y
,
934 .width
= wibox
->geometry
.width
,
935 .height
= wibox
->geometry
.height
});
940 luaA_wibox_get_x(lua_State
*L
, wibox_t
*wibox
)
942 lua_pushnumber(L
, wibox
->geometry
.x
);
947 luaA_wibox_set_y(lua_State
*L
, wibox_t
*wibox
)
949 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
950 .y
= luaL_checknumber(L
, -1),
951 .width
= wibox
->geometry
.width
,
952 .height
= wibox
->geometry
.height
});
957 luaA_wibox_get_y(lua_State
*L
, wibox_t
*wibox
)
959 lua_pushnumber(L
, wibox
->geometry
.y
);
964 luaA_wibox_set_width(lua_State
*L
, wibox_t
*wibox
)
966 int width
= luaL_checknumber(L
, -1);
968 luaL_error(L
, "invalid width");
969 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
970 .y
= wibox
->geometry
.y
,
972 .height
= wibox
->geometry
.height
});
977 luaA_wibox_get_width(lua_State
*L
, wibox_t
*wibox
)
979 lua_pushnumber(L
, wibox
->geometry
.width
);
984 luaA_wibox_set_height(lua_State
*L
, wibox_t
*wibox
)
986 int height
= luaL_checknumber(L
, -1);
988 luaL_error(L
, "invalid height");
989 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
990 .y
= wibox
->geometry
.y
,
991 .width
= wibox
->geometry
.width
,
997 luaA_wibox_get_height(lua_State
*L
, wibox_t
*wibox
)
999 lua_pushnumber(L
, wibox
->geometry
.height
);
1003 /** Set the wibox foreground color.
1004 * \param L The Lua VM state.
1005 * \param wibox The wibox object.
1006 * \return The number of elements pushed on stack.
1009 luaA_wibox_set_fg(lua_State
*L
, wibox_t
*wibox
)
1012 const char *buf
= luaL_checklstring(L
, -1, &len
);
1013 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.fg
, buf
, len
)))
1014 wibox
->need_update
= true;
1015 luaA_object_emit_signal(L
, -3, "property::fg", 0);
1019 /** Get the wibox foreground color.
1020 * \param L The Lua VM state.
1021 * \param wibox The wibox object.
1022 * \return The number of elements pushed on stack.
1025 luaA_wibox_get_fg(lua_State
*L
, wibox_t
*wibox
)
1027 return luaA_pushxcolor(L
, wibox
->ctx
.fg
);
1030 /** Set the wibox background 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_set_bg(lua_State
*L
, wibox_t
*wibox
)
1039 const char *buf
= luaL_checklstring(L
, -1, &len
);
1040 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.bg
, buf
, len
)))
1041 wibox
->need_update
= true;
1042 luaA_object_emit_signal(L
, -3, "property::bg", 0);
1046 /** Get the wibox background color.
1047 * \param L The Lua VM state.
1048 * \param wibox The wibox object.
1049 * \return The number of elements pushed on stack.
1052 luaA_wibox_get_bg(lua_State
*L
, wibox_t
*wibox
)
1054 return luaA_pushxcolor(L
, wibox
->ctx
.bg
);
1057 /** Set the wibox background image.
1058 * \param L The Lua VM state.
1059 * \param wibox The wibox object.
1060 * \return The number of elements pushed on stack.
1063 luaA_wibox_set_bg_image(lua_State
*L
, wibox_t
*wibox
)
1065 luaA_checkudata(L
, -1, &image_class
);
1066 luaA_object_unref_item(L
, -3, wibox
->bg_image
);
1067 wibox
->bg_image
= luaA_object_ref_item(L
, -3, -1);
1068 wibox
->need_update
= true;
1069 luaA_object_emit_signal(L
, -2, "property::bg_image", 0);
1073 /** Get the wibox background image.
1074 * \param L The Lua VM state.
1075 * \param wibox The wibox object.
1076 * \return The number of elements pushed on stack.
1079 luaA_wibox_get_bg_image(lua_State
*L
, wibox_t
*wibox
)
1081 return luaA_object_push_item(L
, 1, wibox
->bg_image
);
1084 /** Set the wibox on top status.
1085 * \param L The Lua VM state.
1086 * \param wibox The wibox object.
1087 * \return The number of elements pushed on stack.
1090 luaA_wibox_set_ontop(lua_State
*L
, wibox_t
*wibox
)
1092 bool b
= luaA_checkboolean(L
, -1);
1093 if(b
!= wibox
->ontop
)
1097 luaA_object_emit_signal(L
, -3, "property::ontop", 0);
1102 /** Set the wibox opacity.
1103 * \param L The Lua VM state.
1104 * \param wibox The wibox object.
1105 * \return The number of elements pushed on stack.
1108 luaA_wibox_set_opacity(lua_State
*L
, wibox_t
*wibox
)
1110 if(lua_isnil(L
, -1))
1111 wibox_set_opacity(L
, -3, -1);
1114 double d
= luaL_checknumber(L
, -1);
1115 if(d
>= 0 && d
<= 1)
1116 wibox_set_opacity(L
, -3, d
);
1121 /** Get the wibox opacity.
1122 * \param L The Lua VM state.
1123 * \param wibox The wibox object.
1124 * \return The number of elements pushed on stack.
1127 luaA_wibox_get_opacity(lua_State
*L
, wibox_t
*wibox
)
1129 if (wibox
->opacity
>= 0)
1131 lua_pushnumber(L
, wibox
->opacity
);
1137 /** Set the wibox alignment.
1138 * \param L The Lua VM state.
1139 * \param wibox The wibox object.
1140 * \return The number of elements pushed on stack.
1143 luaA_wibox_set_align(lua_State
*L
, wibox_t
*wibox
)
1146 const char *buf
= luaL_checklstring(L
, -1, &len
);
1147 wibox
->align
= draw_align_fromstr(buf
, len
);
1148 luaA_object_emit_signal(L
, -3, "property::align", 0);
1151 case WIBOX_TYPE_NORMAL
:
1152 luaA_deprecate(L
, "awful.wibox.align");
1154 case WIBOX_TYPE_TITLEBAR
:
1155 titlebar_update_geometry(client_getbytitlebar(wibox
));
1161 /** Get the wibox alignment.
1162 * \param L The Lua VM state.
1163 * \param wibox The wibox object.
1164 * \return The number of elements pushed on stack.
1167 luaA_wibox_get_align(lua_State
*L
, wibox_t
*wibox
)
1169 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1170 luaA_deprecate(L
, "awful.wibox.align");
1171 lua_pushstring(L
, draw_align_tostr(wibox
->align
));
1175 /** Set the wibox position.
1176 * \param L The Lua VM state.
1177 * \param wibox The wibox object.
1178 * \return The number of elements pushed on stack.
1181 luaA_wibox_set_position(lua_State
*L
, wibox_t
*wibox
)
1185 case WIBOX_TYPE_NORMAL
:
1189 if((buf
= luaL_checklstring(L
, -1, &len
)))
1191 luaA_deprecate(L
, "awful.wibox.attach");
1192 wibox
->position
= position_fromstr(buf
, len
);
1196 case WIBOX_TYPE_TITLEBAR
:
1197 return luaA_titlebar_set_position(L
, -3);
1202 /** Get the wibox position.
1203 * \param L The Lua VM state.
1204 * \param wibox The wibox object.
1205 * \return The number of elements pushed on stack.
1208 luaA_wibox_get_position(lua_State
*L
, wibox_t
*wibox
)
1210 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1211 luaA_deprecate(L
, "awful.wibox.attach");
1212 lua_pushstring(L
, position_tostr(wibox
->position
));
1216 /** Set the wibox (titlebar) client.
1217 * \param L The Lua VM state.
1218 * \param wibox The wibox object.
1219 * \return The number of elements pushed on stack.
1222 luaA_wibox_set_client(lua_State
*L
, wibox_t
*wibox
)
1225 if(lua_isnil(L
, -1))
1226 titlebar_client_detach(client_getbytitlebar(wibox
));
1229 client_t
*c
= luaA_client_checkudata(L
, -1);
1230 lua_pushvalue(L
, -3);
1231 titlebar_client_attach(c
);
1236 /** Get the wibox (titlebar) client.
1237 * \param L The Lua VM state.
1238 * \param wibox The wibox object.
1239 * \return The number of elements pushed on stack.
1242 luaA_wibox_get_client(lua_State
*L
, wibox_t
*wibox
)
1244 return luaA_object_push(L
, client_getbytitlebar(wibox
));
1247 /** Set the wibox cursor.
1248 * \param L The Lua VM state.
1249 * \param wibox The wibox object.
1250 * \return The number of elements pushed on stack.
1253 luaA_wibox_set_cursor(lua_State
*L
, wibox_t
*wibox
)
1255 const char *buf
= luaL_checkstring(L
, -1);
1258 uint16_t cursor_font
= xcursor_font_fromstr(buf
);
1261 xcb_cursor_t cursor
= xcursor_new(globalconf
.connection
, cursor_font
);
1262 p_delete(&wibox
->cursor
);
1263 wibox
->cursor
= a_strdup(buf
);
1264 window_set_cursor(wibox
->window
, cursor
);
1265 luaA_object_emit_signal(L
, -3, "property::cursor", 0);
1271 /** Set the wibox screen.
1272 * \param L The Lua VM state.
1273 * \param wibox The wibox object.
1274 * \return The number of elements pushed on stack.
1277 luaA_wibox_set_screen(lua_State
*L
, wibox_t
*wibox
)
1279 if(lua_isnil(L
, -1))
1281 wibox_detach(L
, -3);
1282 titlebar_client_detach(client_getbytitlebar(wibox
));
1286 int screen
= luaL_checknumber(L
, -1) - 1;
1287 luaA_checkscreen(screen
);
1288 if(!wibox
->screen
|| screen
!= screen_array_indexof(&globalconf
.screens
, wibox
->screen
))
1290 titlebar_client_detach(client_getbytitlebar(wibox
));
1291 wibox_attach(L
, -3, &globalconf
.screens
.tab
[screen
]);
1297 /** Get the wibox screen.
1298 * \param L The Lua VM state.
1299 * \param wibox The wibox object.
1300 * \return The number of elements pushed on stack.
1303 luaA_wibox_get_screen(lua_State
*L
, wibox_t
*wibox
)
1307 lua_pushnumber(L
, screen_array_indexof(&globalconf
.screens
, wibox
->screen
) + 1);
1311 /** Set the wibox orientation.
1312 * \param L The Lua VM state.
1313 * \param wibox The wibox object.
1314 * \return The number of elements pushed on stack.
1317 luaA_wibox_set_orientation(lua_State
*L
, wibox_t
*wibox
)
1320 const char *buf
= luaL_checklstring(L
, -1, &len
);
1323 wibox_set_orientation(L
, -3, orientation_fromstr(buf
, len
));
1324 wibox_need_update(wibox
);
1329 /** Get the wibox orientation.
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_get_orientation(lua_State
*L
, wibox_t
*wibox
)
1337 lua_pushstring(L
, orientation_tostr(wibox
->orientation
));
1341 /** Set the wibox border color.
1342 * \param L The Lua VM state.
1343 * \param wibox The wibox object.
1344 * \return The number of elements pushed on stack.
1347 luaA_wibox_set_border_color(lua_State
*L
, wibox_t
*wibox
)
1350 const char *buf
= luaL_checklstring(L
, -1, &len
);
1352 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->border_color
, buf
, len
)))
1354 wibox_set_border_color(L
, -3, &wibox
->border_color
);
1358 /** Set the wibox visibility.
1359 * \param L The Lua VM state.
1360 * \param wibox The wibox object.
1361 * \return The number of elements pushed on stack.
1364 luaA_wibox_set_visible(lua_State
*L
, wibox_t
*wibox
)
1366 bool b
= luaA_checkboolean(L
, -1);
1367 if(b
!= wibox
->visible
)
1370 case WIBOX_TYPE_NORMAL
:
1371 wibox_set_visible(L
, -3, b
);
1373 case WIBOX_TYPE_TITLEBAR
:
1374 titlebar_set_visible(wibox
, b
);
1380 /** Set the wibox widgets.
1381 * \param L The Lua VM state.
1382 * \param wibox The wibox object.
1383 * \return The number of elements pushed on stack.
1386 luaA_wibox_set_widgets(lua_State
*L
, wibox_t
*wibox
)
1388 if(luaA_isloop(L
, -1))
1390 luaA_warn(L
, "table is looping, cannot use this as widget table");
1393 /* duplicate table because next function will eat it */
1394 lua_pushvalue(L
, -1);
1395 wibox
->widgets_table
= luaA_object_ref_item(L
, -4, -1);
1396 luaA_object_emit_signal(L
, -3, "property::widgets", 0);
1397 wibox_need_update(wibox
);
1398 luaA_table2wtable(L
);
1402 /** Get 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_get_widgets(lua_State
*L
, wibox_t
*wibox
)
1410 return luaA_object_push_item(L
, 1, wibox
->widgets_table
);
1413 /** Get or set mouse buttons bindings to a wibox.
1414 * \param L The Lua VM state.
1417 * \lparam An array of mouse button bindings objects, or nothing.
1418 * \return The array of mouse button bindings objects of this wibox.
1421 luaA_wibox_buttons(lua_State
*L
)
1423 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
1425 if(lua_gettop(L
) == 2)
1427 luaA_button_array_set(L
, 1, 2, &wibox
->buttons
);
1428 luaA_object_emit_signal(L
, 1, "property::buttons", 0);
1431 return luaA_button_array_get(L
, 1, &wibox
->buttons
);
1434 /** Set the wibox border width.
1435 * \param L The Lua VM state.
1436 * \param wibox The wibox object.
1437 * \return The number of elements pushed on stack.
1440 luaA_wibox_set_border_width(lua_State
*L
, wibox_t
*wibox
)
1442 wibox_t
*w
= luaA_checkudata(L
, -3, &wibox_class
);
1443 uint32_t border_width
= luaL_checknumber(L
, -1);
1444 if(border_width
!= w
->border_width
)
1446 xcb_configure_window(globalconf
.connection
, w
->window
, XCB_CONFIG_WINDOW_BORDER_WIDTH
,
1448 w
->border_width
= border_width
;
1449 luaA_object_emit_signal(L
, -3, "property::border_width", 0);
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