2 * wibox.c - wibox functions
4 * Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <xcb/shape.h>
32 #include "common/xcursor.h"
33 #include "common/xutil.h"
35 LUA_OBJECT_FUNCS(wibox_class
, wibox_t
, wibox
)
37 /** Take care of garbage collecting a wibox.
38 * \param L The Lua VM state.
39 * \return The number of elements pushed on stack, 0!
42 luaA_wibox_gc(lua_State
*L
)
44 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
45 p_delete(&wibox
->cursor
);
47 button_array_wipe(&wibox
->buttons
);
48 widget_node_array_wipe(&wibox
->widgets
);
49 return luaA_object_gc(L
);
53 wibox_unref_simplified(wibox_t
**item
)
55 luaA_object_unref(globalconf
.L
, *item
);
59 wibox_need_update(wibox_t
*wibox
)
61 wibox
->need_update
= true;
62 wibox
->mouse_over
= NULL
;
68 const xcb_query_extension_reply_t
*reply
;
70 reply
= xcb_get_extension_data(globalconf
.connection
, &xcb_shape_id
);
71 if (!reply
|| !reply
->present
)
74 /* We don't need a specific version of SHAPE, no version check required */
79 shape_update(xcb_window_t win
, xcb_shape_kind_t kind
, image_t
*image
, int offset
)
84 shape
= image_to_1bit_pixmap(image
, win
);
89 xcb_shape_mask(globalconf
.connection
, XCB_SHAPE_SO_SET
, kind
,
90 win
, offset
, offset
, shape
);
92 if (shape
!= XCB_NONE
)
93 xcb_free_pixmap(globalconf
.connection
, shape
);
96 /** Update the window's shape.
97 * \param wibox The simple window whose shape should be updated.
100 wibox_shape_update(wibox_t
*wibox
)
102 if(wibox
->window
== XCB_NONE
)
107 static bool warned
= false;
109 warn("The X server doesn't have the SHAPE extension; "
110 "can't change window's shape");
115 shape_update(wibox
->window
, XCB_SHAPE_SK_CLIP
, wibox
->shape
.clip
, 0);
116 shape_update(wibox
->window
, XCB_SHAPE_SK_BOUNDING
, wibox
->shape
.bounding
, - wibox
->border_width
);
118 wibox
->need_shape_update
= false;
122 wibox_draw_context_update(wibox_t
*w
, xcb_screen_t
*s
)
124 xcolor_t fg
= w
->ctx
.fg
, bg
= w
->ctx
.bg
;
125 int phys_screen
= w
->ctx
.phys_screen
;
127 draw_context_wipe(&w
->ctx
);
129 /* update draw context */
130 switch(w
->orientation
)
134 /* we need a new pixmap this way [ ] to render */
135 w
->ctx
.pixmap
= xcb_generate_id(globalconf
.connection
);
136 xcb_create_pixmap(globalconf
.connection
,
138 w
->ctx
.pixmap
, s
->root
,
141 draw_context_init(&w
->ctx
, phys_screen
,
144 w
->ctx
.pixmap
, &fg
, &bg
);
147 draw_context_init(&w
->ctx
, phys_screen
,
150 w
->pixmap
, &fg
, &bg
);
155 /** Initialize a wibox.
156 * \param w The wibox to initialize.
157 * \param phys_screen Physical screen number.
160 wibox_init(wibox_t
*w
, int phys_screen
)
162 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
164 w
->window
= xcb_generate_id(globalconf
.connection
);
165 xcb_create_window(globalconf
.connection
, s
->root_depth
, w
->window
, s
->root
,
166 w
->geometry
.x
, w
->geometry
.y
,
167 w
->geometry
.width
, w
->geometry
.height
,
168 w
->border_width
, XCB_COPY_FROM_PARENT
, s
->root_visual
,
169 XCB_CW_BACK_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
);
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 udx 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 udx The wibox to change orientation.
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
);
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 L The Lua VM state.
622 * \param udx The wibox.
623 * \param v The visible value.
626 wibox_set_visible(lua_State
*L
, int udx
, bool v
)
628 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
629 if(v
!= wibox
->visible
)
632 wibox
->mouse_over
= NULL
;
641 client_ignore_enterleave_events();
643 xcb_unmap_window(globalconf
.connection
, wibox
->window
);
645 client_restore_enterleave_events();
648 /* kick out systray if needed */
649 wibox_systray_refresh(wibox
);
652 luaA_object_emit_signal(L
, udx
, "property::visible", 0);
654 hook_property(wibox
, "visible");
658 /** Destroy all X resources of a wibox.
659 * \param w The wibox to wipe.
662 wibox_wipe(wibox_t
*w
)
667 client_ignore_enterleave_events();
668 xcb_destroy_window(globalconf
.connection
, w
->window
);
670 client_restore_enterleave_events();
671 w
->window
= XCB_NONE
;
675 xcb_free_pixmap(globalconf
.connection
, w
->pixmap
);
676 w
->pixmap
= XCB_NONE
;
680 xcb_free_gc(globalconf
.connection
, w
->gc
);
683 draw_context_wipe(&w
->ctx
);
686 /** Remove a wibox from a screen.
687 * \param L The Lua VM state.
688 * \param udx Wibox to detach from screen.
691 wibox_detach(lua_State
*L
, int udx
)
693 wibox_t
*wibox
= luaA_checkudata(L
, udx
, &wibox_class
);
698 /* save visible state */
700 wibox
->visible
= false;
701 wibox_systray_refresh(wibox
);
702 /* restore visibility */
705 wibox
->mouse_over
= NULL
;
709 foreach(item
, globalconf
.wiboxes
)
712 wibox_array_remove(&globalconf
.wiboxes
, item
);
716 hook_property(wibox
, "screen");
718 if(strut_has_value(&wibox
->strut
))
719 screen_emit_signal(L
, wibox
->screen
, "property::workarea", 0);
721 wibox
->screen
= NULL
;
722 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
724 luaA_object_unref(globalconf
.L
, wibox
);
728 /** Attach a wibox that is on top of the stack.
729 * \param L The Lua VM state.
730 * \param udx The wibox to attach.
731 * \param s The screen to attach the wibox to.
734 wibox_attach(lua_State
*L
, int udx
, screen_t
*s
)
736 int phys_screen
= screen_virttophys(screen_array_indexof(&globalconf
.screens
, s
));
738 /* duplicate wibox */
739 lua_pushvalue(L
, udx
);
741 wibox_t
*wibox
= luaA_object_ref_class(globalconf
.L
, -1, &wibox_class
);
743 wibox_detach(L
, udx
);
745 /* Set the wibox screen */
748 /* Check that the wibox coordinates matches the screen. */
750 screen_getbycoord(wibox
->screen
, wibox
->geometry
.x
, wibox
->geometry
.y
);
752 /* If it does not match, move it to the screen coordinates */
753 if(cscreen
!= wibox
->screen
)
754 wibox_moveresize(L
, udx
, (area_t
) { .x
= s
->geometry
.x
,
756 .width
= wibox
->geometry
.width
,
757 .height
= wibox
->geometry
.height
});
759 wibox_array_append(&globalconf
.wiboxes
, wibox
);
761 wibox_init(wibox
, phys_screen
);
763 window_set_cursor(wibox
->window
,
764 xcursor_new(globalconf
.connection
, xcursor_font_fromstr(wibox
->cursor
)));
766 if(wibox
->opacity
!= -1)
767 window_opacity_set(wibox
->window
, wibox
->opacity
);
769 ewmh_update_strut(wibox
->window
, &wibox
->strut
);
774 wibox_need_update(wibox
);
776 hook_property(wibox
, "screen");
777 luaA_object_emit_signal(L
, udx
, "property::screen", 0);
779 if(strut_has_value(&wibox
->strut
))
780 screen_emit_signal(L
, wibox
->screen
, "property::workarea", 0);
783 /** Create a new wibox.
784 * \param L The Lua VM state.
787 * \lparam A table with optionally defined values:
788 * fg, bg, border_width, border_color, ontop, width and height.
789 * \lreturn A brand new wibox.
792 luaA_wibox_new(lua_State
*L
)
794 luaA_class_new(L
, &wibox_class
);
796 wibox_t
*w
= luaA_checkudata(L
, -1, &wibox_class
);
798 if(!w
->ctx
.fg
.initialized
)
799 w
->ctx
.fg
= globalconf
.colors
.fg
;
801 if(!w
->ctx
.bg
.initialized
)
802 w
->ctx
.bg
= globalconf
.colors
.bg
;
804 if(!w
->border_color
.initialized
)
805 w
->border_color
= globalconf
.colors
.bg
;
813 w
->cursor
= a_strdup("left_ptr");
815 if(!w
->geometry
.width
)
816 w
->geometry
.width
= 1;
818 if(!w
->geometry
.height
)
819 w
->geometry
.height
= 1;
824 /** Check if a wibox widget table has an item.
825 * \param L The Lua VM state.
826 * \param wibox The wibox.
827 * \param item The item to look for.
830 luaA_wibox_hasitem(lua_State
*L
, wibox_t
*wibox
, const void *item
)
832 if(wibox
->widgets_table
)
834 luaA_object_push(L
, wibox
);
835 luaA_object_push_item(L
, -1, wibox
->widgets_table
);
837 if(lua_topointer(L
, -1) == item
|| luaA_hasitem(L
, item
))
843 /** Invalidate a wibox by a Lua object (table, etc).
844 * \param L The Lua VM state.
845 * \param item The object identifier.
848 luaA_wibox_invalidate_byitem(lua_State
*L
, const void *item
)
850 foreach(w
, globalconf
.wiboxes
)
853 if(luaA_wibox_hasitem(L
, wibox
, item
))
856 wibox_need_update(wibox
);
857 lua_pop(L
, 1); /* remove widgets table */
862 foreach(_c
, globalconf
.clients
)
865 if(c
->titlebar
&& luaA_wibox_hasitem(L
, c
->titlebar
, item
))
868 wibox_need_update(c
->titlebar
);
869 lua_pop(L
, 1); /* remove widgets table */
874 /* Set or get the wibox geometry.
875 * \param L The Lua VM state.
876 * \return The number of elements pushed on stack.
878 * \lparam An optional table with wibox geometry.
879 * \lreturn The wibox geometry.
882 luaA_wibox_geometry(lua_State
*L
)
884 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
886 if(lua_gettop(L
) == 2)
890 luaA_checktable(L
, 2);
891 wingeom
.x
= luaA_getopt_number(L
, 2, "x", wibox
->geometry
.x
);
892 wingeom
.y
= luaA_getopt_number(L
, 2, "y", wibox
->geometry
.y
);
893 wingeom
.width
= luaA_getopt_number(L
, 2, "width", wibox
->geometry
.width
);
894 wingeom
.height
= luaA_getopt_number(L
, 2, "height", wibox
->geometry
.height
);
896 if(wingeom
.width
> 0 && wingeom
.height
> 0)
899 case WIBOX_TYPE_TITLEBAR
:
900 wibox_moveresize(L
, 1, (area_t
) { .x
= wibox
->geometry
.x
,
901 .y
= wibox
->geometry
.y
,
902 .width
= wingeom
.width
,
903 .height
= wingeom
.height
});
905 case WIBOX_TYPE_NORMAL
:
906 wibox_moveresize(L
, 1, wingeom
);
911 return luaA_pusharea(L
, wibox
->geometry
);
915 luaA_wibox_struts(lua_State
*L
)
917 wibox_t
*w
= luaA_checkudata(L
, 1, &wibox_class
);
919 if(lua_gettop(L
) == 2)
921 luaA_tostrut(L
, 2, &w
->strut
);
923 ewmh_update_strut(w
->window
, &w
->strut
);
924 luaA_object_emit_signal(L
, 1, "property::struts", 0);
926 screen_emit_signal(L
, w
->screen
, "property::workarea", 0);
929 return luaA_pushstrut(L
, w
->strut
);
932 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, ontop
, lua_pushboolean
)
933 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, cursor
, lua_pushstring
)
934 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, visible
, lua_pushboolean
)
935 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_width
, lua_pushnumber
)
936 LUA_OBJECT_EXPORT_PROPERTY(wibox
, wibox_t
, border_color
, luaA_pushxcolor
)
939 luaA_wibox_set_x(lua_State
*L
, wibox_t
*wibox
)
941 wibox_moveresize(L
, -3, (area_t
) { .x
= luaL_checknumber(L
, -1),
942 .y
= wibox
->geometry
.y
,
943 .width
= wibox
->geometry
.width
,
944 .height
= wibox
->geometry
.height
});
949 luaA_wibox_get_x(lua_State
*L
, wibox_t
*wibox
)
951 lua_pushnumber(L
, wibox
->geometry
.x
);
956 luaA_wibox_set_y(lua_State
*L
, wibox_t
*wibox
)
958 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
959 .y
= luaL_checknumber(L
, -1),
960 .width
= wibox
->geometry
.width
,
961 .height
= wibox
->geometry
.height
});
966 luaA_wibox_get_y(lua_State
*L
, wibox_t
*wibox
)
968 lua_pushnumber(L
, wibox
->geometry
.y
);
973 luaA_wibox_set_width(lua_State
*L
, wibox_t
*wibox
)
975 int width
= luaL_checknumber(L
, -1);
977 luaL_error(L
, "invalid width");
978 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
979 .y
= wibox
->geometry
.y
,
981 .height
= wibox
->geometry
.height
});
986 luaA_wibox_get_width(lua_State
*L
, wibox_t
*wibox
)
988 lua_pushnumber(L
, wibox
->geometry
.width
);
993 luaA_wibox_set_height(lua_State
*L
, wibox_t
*wibox
)
995 int height
= luaL_checknumber(L
, -1);
997 luaL_error(L
, "invalid height");
998 wibox_moveresize(L
, -3, (area_t
) { .x
= wibox
->geometry
.x
,
999 .y
= wibox
->geometry
.y
,
1000 .width
= wibox
->geometry
.width
,
1001 .height
= height
});
1006 luaA_wibox_get_height(lua_State
*L
, wibox_t
*wibox
)
1008 lua_pushnumber(L
, wibox
->geometry
.height
);
1012 /** Set the wibox foreground color.
1013 * \param L The Lua VM state.
1014 * \param wibox The wibox object.
1015 * \return The number of elements pushed on stack.
1018 luaA_wibox_set_fg(lua_State
*L
, wibox_t
*wibox
)
1021 const char *buf
= luaL_checklstring(L
, -1, &len
);
1022 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.fg
, buf
, len
)))
1023 wibox
->need_update
= true;
1024 luaA_object_emit_signal(L
, -3, "property::fg", 0);
1028 /** Get the wibox foreground color.
1029 * \param L The Lua VM state.
1030 * \param wibox The wibox object.
1031 * \return The number of elements pushed on stack.
1034 luaA_wibox_get_fg(lua_State
*L
, wibox_t
*wibox
)
1036 return luaA_pushxcolor(L
, wibox
->ctx
.fg
);
1039 /** Set the wibox background color.
1040 * \param L The Lua VM state.
1041 * \param wibox The wibox object.
1042 * \return The number of elements pushed on stack.
1045 luaA_wibox_set_bg(lua_State
*L
, wibox_t
*wibox
)
1048 const char *buf
= luaL_checklstring(L
, -1, &len
);
1049 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->ctx
.bg
, buf
, len
)))
1050 wibox
->need_update
= true;
1051 luaA_object_emit_signal(L
, -3, "property::bg", 0);
1055 /** Get the wibox background color.
1056 * \param L The Lua VM state.
1057 * \param wibox The wibox object.
1058 * \return The number of elements pushed on stack.
1061 luaA_wibox_get_bg(lua_State
*L
, wibox_t
*wibox
)
1063 return luaA_pushxcolor(L
, wibox
->ctx
.bg
);
1066 /** Set the wibox background image.
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_set_bg_image(lua_State
*L
, wibox_t
*wibox
)
1074 luaA_checkudata(L
, -1, &image_class
);
1075 luaA_object_unref_item(L
, -3, wibox
->bg_image
);
1076 wibox
->bg_image
= luaA_object_ref_item(L
, -3, -1);
1077 wibox
->need_update
= true;
1078 luaA_object_emit_signal(L
, -2, "property::bg_image", 0);
1082 /** Get the wibox background image.
1083 * \param L The Lua VM state.
1084 * \param wibox The wibox object.
1085 * \return The number of elements pushed on stack.
1088 luaA_wibox_get_bg_image(lua_State
*L
, wibox_t
*wibox
)
1090 return luaA_object_push_item(L
, 1, wibox
->bg_image
);
1093 /** Set the wibox on top status.
1094 * \param L The Lua VM state.
1095 * \param wibox The wibox object.
1096 * \return The number of elements pushed on stack.
1099 luaA_wibox_set_ontop(lua_State
*L
, wibox_t
*wibox
)
1101 bool b
= luaA_checkboolean(L
, -1);
1102 if(b
!= wibox
->ontop
)
1106 luaA_object_emit_signal(L
, -3, "property::ontop", 0);
1111 /** Set the wibox opacity.
1112 * \param L The Lua VM state.
1113 * \param wibox The wibox object.
1114 * \return The number of elements pushed on stack.
1117 luaA_wibox_set_opacity(lua_State
*L
, wibox_t
*wibox
)
1119 if(lua_isnil(L
, -1))
1120 wibox_set_opacity(L
, -3, -1);
1123 double d
= luaL_checknumber(L
, -1);
1124 if(d
>= 0 && d
<= 1)
1125 wibox_set_opacity(L
, -3, d
);
1130 /** Get the wibox opacity.
1131 * \param L The Lua VM state.
1132 * \param wibox The wibox object.
1133 * \return The number of elements pushed on stack.
1136 luaA_wibox_get_opacity(lua_State
*L
, wibox_t
*wibox
)
1138 if (wibox
->opacity
>= 0)
1140 lua_pushnumber(L
, wibox
->opacity
);
1146 /** Set the wibox alignment.
1147 * \param L The Lua VM state.
1148 * \param wibox The wibox object.
1149 * \return The number of elements pushed on stack.
1152 luaA_wibox_set_align(lua_State
*L
, wibox_t
*wibox
)
1155 const char *buf
= luaL_checklstring(L
, -1, &len
);
1156 wibox
->align
= draw_align_fromstr(buf
, len
);
1157 luaA_object_emit_signal(L
, -3, "property::align", 0);
1160 case WIBOX_TYPE_NORMAL
:
1161 luaA_deprecate(L
, "awful.wibox.align");
1163 case WIBOX_TYPE_TITLEBAR
:
1164 titlebar_update_geometry(client_getbytitlebar(wibox
));
1170 /** Get the wibox alignment.
1171 * \param L The Lua VM state.
1172 * \param wibox The wibox object.
1173 * \return The number of elements pushed on stack.
1176 luaA_wibox_get_align(lua_State
*L
, wibox_t
*wibox
)
1178 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1179 luaA_deprecate(L
, "awful.wibox.align");
1180 lua_pushstring(L
, draw_align_tostr(wibox
->align
));
1184 /** Set the wibox position.
1185 * \param L The Lua VM state.
1186 * \param wibox The wibox object.
1187 * \return The number of elements pushed on stack.
1190 luaA_wibox_set_position(lua_State
*L
, wibox_t
*wibox
)
1194 case WIBOX_TYPE_NORMAL
:
1198 if((buf
= luaL_checklstring(L
, -1, &len
)))
1200 luaA_deprecate(L
, "awful.wibox.attach");
1201 wibox
->position
= position_fromstr(buf
, len
);
1205 case WIBOX_TYPE_TITLEBAR
:
1206 return luaA_titlebar_set_position(L
, -3);
1211 /** Get the wibox position.
1212 * \param L The Lua VM state.
1213 * \param wibox The wibox object.
1214 * \return The number of elements pushed on stack.
1217 luaA_wibox_get_position(lua_State
*L
, wibox_t
*wibox
)
1219 if(wibox
->type
== WIBOX_TYPE_NORMAL
)
1220 luaA_deprecate(L
, "awful.wibox.attach");
1221 lua_pushstring(L
, position_tostr(wibox
->position
));
1225 /** Set the wibox (titlebar) client.
1226 * \param L The Lua VM state.
1227 * \param wibox The wibox object.
1228 * \return The number of elements pushed on stack.
1231 luaA_wibox_set_client(lua_State
*L
, wibox_t
*wibox
)
1234 if(lua_isnil(L
, -1))
1235 titlebar_client_detach(client_getbytitlebar(wibox
));
1238 client_t
*c
= luaA_client_checkudata(L
, -1);
1239 lua_pushvalue(L
, -3);
1240 titlebar_client_attach(c
);
1245 /** Get the wibox (titlebar) client.
1246 * \param L The Lua VM state.
1247 * \param wibox The wibox object.
1248 * \return The number of elements pushed on stack.
1251 luaA_wibox_get_client(lua_State
*L
, wibox_t
*wibox
)
1253 return luaA_object_push(L
, client_getbytitlebar(wibox
));
1256 /** Set the wibox cursor.
1257 * \param L The Lua VM state.
1258 * \param wibox The wibox object.
1259 * \return The number of elements pushed on stack.
1262 luaA_wibox_set_cursor(lua_State
*L
, wibox_t
*wibox
)
1264 const char *buf
= luaL_checkstring(L
, -1);
1267 uint16_t cursor_font
= xcursor_font_fromstr(buf
);
1270 xcb_cursor_t cursor
= xcursor_new(globalconf
.connection
, cursor_font
);
1271 p_delete(&wibox
->cursor
);
1272 wibox
->cursor
= a_strdup(buf
);
1273 window_set_cursor(wibox
->window
, cursor
);
1274 luaA_object_emit_signal(L
, -3, "property::cursor", 0);
1280 /** Set the wibox screen.
1281 * \param L The Lua VM state.
1282 * \param wibox The wibox object.
1283 * \return The number of elements pushed on stack.
1286 luaA_wibox_set_screen(lua_State
*L
, wibox_t
*wibox
)
1288 if(lua_isnil(L
, -1))
1290 wibox_detach(L
, -3);
1291 titlebar_client_detach(client_getbytitlebar(wibox
));
1295 int screen
= luaL_checknumber(L
, -1) - 1;
1296 luaA_checkscreen(screen
);
1297 if(!wibox
->screen
|| screen
!= screen_array_indexof(&globalconf
.screens
, wibox
->screen
))
1299 titlebar_client_detach(client_getbytitlebar(wibox
));
1300 wibox_attach(L
, -3, &globalconf
.screens
.tab
[screen
]);
1306 /** Get the wibox screen.
1307 * \param L The Lua VM state.
1308 * \param wibox The wibox object.
1309 * \return The number of elements pushed on stack.
1312 luaA_wibox_get_screen(lua_State
*L
, wibox_t
*wibox
)
1316 lua_pushnumber(L
, screen_array_indexof(&globalconf
.screens
, wibox
->screen
) + 1);
1320 /** Set the wibox orientation.
1321 * \param L The Lua VM state.
1322 * \param wibox The wibox object.
1323 * \return The number of elements pushed on stack.
1326 luaA_wibox_set_orientation(lua_State
*L
, wibox_t
*wibox
)
1329 const char *buf
= luaL_checklstring(L
, -1, &len
);
1332 wibox_set_orientation(L
, -3, orientation_fromstr(buf
, len
));
1333 wibox_need_update(wibox
);
1338 /** Get the wibox orientation.
1339 * \param L The Lua VM state.
1340 * \param wibox The wibox object.
1341 * \return The number of elements pushed on stack.
1344 luaA_wibox_get_orientation(lua_State
*L
, wibox_t
*wibox
)
1346 lua_pushstring(L
, orientation_tostr(wibox
->orientation
));
1350 /** Set the wibox border color.
1351 * \param L The Lua VM state.
1352 * \param wibox The wibox object.
1353 * \return The number of elements pushed on stack.
1356 luaA_wibox_set_border_color(lua_State
*L
, wibox_t
*wibox
)
1359 const char *buf
= luaL_checklstring(L
, -1, &len
);
1361 if(xcolor_init_reply(xcolor_init_unchecked(&wibox
->border_color
, buf
, len
)))
1363 wibox_set_border_color(L
, -3, &wibox
->border_color
);
1367 /** Set the wibox visibility.
1368 * \param L The Lua VM state.
1369 * \param wibox The wibox object.
1370 * \return The number of elements pushed on stack.
1373 luaA_wibox_set_visible(lua_State
*L
, wibox_t
*wibox
)
1375 bool b
= luaA_checkboolean(L
, -1);
1376 if(b
!= wibox
->visible
)
1379 case WIBOX_TYPE_NORMAL
:
1380 wibox_set_visible(L
, -3, b
);
1382 case WIBOX_TYPE_TITLEBAR
:
1383 titlebar_set_visible(wibox
, b
);
1389 /** Set the wibox widgets.
1390 * \param L The Lua VM state.
1391 * \param wibox The wibox object.
1392 * \return The number of elements pushed on stack.
1395 luaA_wibox_set_widgets(lua_State
*L
, wibox_t
*wibox
)
1397 if(luaA_isloop(L
, -1))
1399 luaA_warn(L
, "table is looping, cannot use this as widget table");
1402 /* duplicate table because next function will eat it */
1403 lua_pushvalue(L
, -1);
1404 wibox
->widgets_table
= luaA_object_ref_item(L
, -4, -1);
1405 luaA_object_emit_signal(L
, -3, "property::widgets", 0);
1406 wibox_need_update(wibox
);
1407 luaA_table2wtable(L
);
1411 /** Get the wibox widgets.
1412 * \param L The Lua VM state.
1413 * \param wibox The wibox object.
1414 * \return The number of elements pushed on stack.
1417 luaA_wibox_get_widgets(lua_State
*L
, wibox_t
*wibox
)
1419 return luaA_object_push_item(L
, 1, wibox
->widgets_table
);
1422 /** Get or set mouse buttons bindings to a wibox.
1423 * \param L The Lua VM state.
1426 * \lparam An array of mouse button bindings objects, or nothing.
1427 * \return The array of mouse button bindings objects of this wibox.
1430 luaA_wibox_buttons(lua_State
*L
)
1432 wibox_t
*wibox
= luaA_checkudata(L
, 1, &wibox_class
);
1434 if(lua_gettop(L
) == 2)
1436 luaA_button_array_set(L
, 1, 2, &wibox
->buttons
);
1437 luaA_object_emit_signal(L
, 1, "property::buttons", 0);
1440 return luaA_button_array_get(L
, 1, &wibox
->buttons
);
1443 /** Set the wibox border width.
1444 * \param L The Lua VM state.
1445 * \param wibox The wibox object.
1446 * \return The number of elements pushed on stack.
1449 luaA_wibox_set_border_width(lua_State
*L
, wibox_t
*wibox
)
1451 wibox_t
*w
= luaA_checkudata(L
, -3, &wibox_class
);
1452 uint32_t border_width
= luaL_checknumber(L
, -1);
1453 if(border_width
!= w
->border_width
)
1455 xcb_configure_window(globalconf
.connection
, w
->window
, XCB_CONFIG_WINDOW_BORDER_WIDTH
,
1457 w
->border_width
= border_width
;
1458 luaA_object_emit_signal(L
, -3, "property::border_width", 0);
1464 luaA_wibox_set_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1466 luaA_checkudata(L
, -1, &image_class
);
1467 luaA_object_unref_item(L
, -3, wibox
->shape
.bounding
);
1468 wibox
->shape
.bounding
= luaA_object_ref_item(L
, -3, -1);
1469 wibox
->need_shape_update
= true;
1470 luaA_object_emit_signal(L
, -2, "property::shape_bounding", 0);
1475 luaA_wibox_get_shape_bounding(lua_State
*L
, wibox_t
*wibox
)
1477 return luaA_object_push_item(L
, 1, wibox
->shape
.bounding
);
1481 luaA_wibox_set_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1483 luaA_checkudata(L
, -1, &image_class
);
1484 luaA_object_unref_item(L
, -3, wibox
->shape
.clip
);
1485 wibox
->shape
.clip
= luaA_object_ref_item(L
, -3, -1);
1486 wibox
->need_shape_update
= true;
1487 luaA_object_emit_signal(L
, -2, "property::shape_clip", 0);
1492 luaA_wibox_get_shape_clip(lua_State
*L
, wibox_t
*wibox
)
1494 return luaA_object_push_item(L
, 1, wibox
->shape
.clip
);
1498 wibox_class_setup(lua_State
*L
)
1500 static const struct luaL_reg wibox_methods
[] =
1502 LUA_CLASS_METHODS(wibox
)
1503 { "__call", luaA_wibox_new
},
1507 static const struct luaL_reg wibox_meta
[] =
1509 LUA_OBJECT_META(wibox
)
1511 { "struts", luaA_wibox_struts
},
1512 { "buttons", luaA_wibox_buttons
},
1513 { "geometry", luaA_wibox_geometry
},
1514 { "__gc", luaA_wibox_gc
},
1518 luaA_class_setup(L
, &wibox_class
, "wibox", (lua_class_allocator_t
) wibox_new
,
1519 luaA_class_index_miss_property
, luaA_class_newindex_miss_property
,
1520 wibox_methods
, wibox_meta
);
1521 luaA_class_add_property(&wibox_class
, A_TK_WIDGETS
,
1522 (lua_class_propfunc_t
) luaA_wibox_set_widgets
,
1523 (lua_class_propfunc_t
) luaA_wibox_get_widgets
,
1524 (lua_class_propfunc_t
) luaA_wibox_set_widgets
);
1525 luaA_class_add_property(&wibox_class
, A_TK_OPACITY
,
1526 (lua_class_propfunc_t
) luaA_wibox_set_opacity
,
1527 (lua_class_propfunc_t
) luaA_wibox_get_opacity
,
1528 (lua_class_propfunc_t
) luaA_wibox_set_opacity
);
1529 luaA_class_add_property(&wibox_class
, A_TK_VISIBLE
,
1530 (lua_class_propfunc_t
) luaA_wibox_set_visible
,
1531 (lua_class_propfunc_t
) luaA_wibox_get_visible
,
1532 (lua_class_propfunc_t
) luaA_wibox_set_visible
);
1533 luaA_class_add_property(&wibox_class
, A_TK_BORDER_COLOR
,
1534 (lua_class_propfunc_t
) luaA_wibox_set_border_color
,
1535 (lua_class_propfunc_t
) luaA_wibox_get_border_color
,
1536 (lua_class_propfunc_t
) luaA_wibox_set_border_color
);
1537 luaA_class_add_property(&wibox_class
, A_TK_BORDER_WIDTH
,
1538 (lua_class_propfunc_t
) luaA_wibox_set_border_width
,
1539 (lua_class_propfunc_t
) luaA_wibox_get_border_width
,
1540 (lua_class_propfunc_t
) luaA_wibox_set_border_width
);
1541 luaA_class_add_property(&wibox_class
, A_TK_ORIENTATION
,
1542 (lua_class_propfunc_t
) luaA_wibox_set_orientation
,
1543 (lua_class_propfunc_t
) luaA_wibox_get_orientation
,
1544 (lua_class_propfunc_t
) luaA_wibox_set_orientation
);
1545 luaA_class_add_property(&wibox_class
, A_TK_ONTOP
,
1546 (lua_class_propfunc_t
) luaA_wibox_set_ontop
,
1547 (lua_class_propfunc_t
) luaA_wibox_get_ontop
,
1548 (lua_class_propfunc_t
) luaA_wibox_set_ontop
);
1549 luaA_class_add_property(&wibox_class
, A_TK_SCREEN
,
1551 (lua_class_propfunc_t
) luaA_wibox_get_screen
,
1552 (lua_class_propfunc_t
) luaA_wibox_set_screen
);
1553 luaA_class_add_property(&wibox_class
, A_TK_CURSOR
,
1554 (lua_class_propfunc_t
) luaA_wibox_set_cursor
,
1555 (lua_class_propfunc_t
) luaA_wibox_get_cursor
,
1556 (lua_class_propfunc_t
) luaA_wibox_set_cursor
);
1557 luaA_class_add_property(&wibox_class
, A_TK_CLIENT
,
1558 (lua_class_propfunc_t
) luaA_wibox_set_client
,
1559 (lua_class_propfunc_t
) luaA_wibox_get_client
,
1560 (lua_class_propfunc_t
) luaA_wibox_set_client
);
1561 luaA_class_add_property(&wibox_class
, A_TK_POSITION
,
1562 (lua_class_propfunc_t
) luaA_wibox_set_position
,
1563 (lua_class_propfunc_t
) luaA_wibox_get_position
,
1564 (lua_class_propfunc_t
) luaA_wibox_set_position
);
1565 luaA_class_add_property(&wibox_class
, A_TK_ALIGN
,
1566 (lua_class_propfunc_t
) luaA_wibox_set_align
,
1567 (lua_class_propfunc_t
) luaA_wibox_get_align
,
1568 (lua_class_propfunc_t
) luaA_wibox_set_align
);
1569 luaA_class_add_property(&wibox_class
, A_TK_FG
,
1570 (lua_class_propfunc_t
) luaA_wibox_set_fg
,
1571 (lua_class_propfunc_t
) luaA_wibox_get_fg
,
1572 (lua_class_propfunc_t
) luaA_wibox_set_fg
);
1573 luaA_class_add_property(&wibox_class
, A_TK_BG
,
1574 (lua_class_propfunc_t
) luaA_wibox_set_bg
,
1575 (lua_class_propfunc_t
) luaA_wibox_get_bg
,
1576 (lua_class_propfunc_t
) luaA_wibox_set_bg
);
1577 luaA_class_add_property(&wibox_class
, A_TK_BG_IMAGE
,
1578 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
,
1579 (lua_class_propfunc_t
) luaA_wibox_get_bg_image
,
1580 (lua_class_propfunc_t
) luaA_wibox_set_bg_image
);
1581 luaA_class_add_property(&wibox_class
, A_TK_X
,
1582 (lua_class_propfunc_t
) luaA_wibox_set_x
,
1583 (lua_class_propfunc_t
) luaA_wibox_get_x
,
1584 (lua_class_propfunc_t
) luaA_wibox_set_x
);
1585 luaA_class_add_property(&wibox_class
, A_TK_Y
,
1586 (lua_class_propfunc_t
) luaA_wibox_set_y
,
1587 (lua_class_propfunc_t
) luaA_wibox_get_y
,
1588 (lua_class_propfunc_t
) luaA_wibox_set_y
);
1589 luaA_class_add_property(&wibox_class
, A_TK_WIDTH
,
1590 (lua_class_propfunc_t
) luaA_wibox_set_width
,
1591 (lua_class_propfunc_t
) luaA_wibox_get_width
,
1592 (lua_class_propfunc_t
) luaA_wibox_set_width
);
1593 luaA_class_add_property(&wibox_class
, A_TK_HEIGHT
,
1594 (lua_class_propfunc_t
) luaA_wibox_set_height
,
1595 (lua_class_propfunc_t
) luaA_wibox_get_height
,
1596 (lua_class_propfunc_t
) luaA_wibox_set_height
);
1597 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_BOUNDING
,
1598 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
,
1599 (lua_class_propfunc_t
) luaA_wibox_get_shape_bounding
,
1600 (lua_class_propfunc_t
) luaA_wibox_set_shape_bounding
);
1601 luaA_class_add_property(&wibox_class
, A_TK_SHAPE_CLIP
,
1602 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
,
1603 (lua_class_propfunc_t
) luaA_wibox_get_shape_clip
,
1604 (lua_class_propfunc_t
) luaA_wibox_set_shape_clip
);
1607 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80