wibox: add cursor property
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
5a4784b646
commit
d61c6f5ae9
|
@ -19,6 +19,7 @@ Control
|
|||
coords
|
||||
conffile
|
||||
Ctrl
|
||||
cursor
|
||||
east
|
||||
ellipsize
|
||||
end
|
||||
|
|
|
@ -90,6 +90,8 @@ typedef struct
|
|||
widget_t *mouse_over;
|
||||
/** Need update */
|
||||
bool need_update;
|
||||
/** Cursor */
|
||||
char *cursor;
|
||||
} wibox_t;
|
||||
ARRAY_TYPE(wibox_t *, wibox)
|
||||
|
||||
|
|
22
wibox.c
22
wibox.c
|
@ -24,6 +24,7 @@
|
|||
#include "titlebar.h"
|
||||
#include "client.h"
|
||||
#include "ewmh.h"
|
||||
#include "common/xcursor.h"
|
||||
|
||||
extern awesome_t globalconf;
|
||||
|
||||
|
@ -604,6 +605,9 @@ wibox_attach(wibox_t *wibox, screen_t *s)
|
|||
|
||||
simplewindow_border_color_set(&wibox->sw, &wibox->sw.border.color);
|
||||
|
||||
simplewindow_cursor_set(&wibox->sw,
|
||||
xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor)));
|
||||
|
||||
/* All the other wibox and ourselves need to be repositioned */
|
||||
for(int i = 0; i < s->wiboxes.len; i++)
|
||||
wibox_position_update(s->wiboxes.tab[i]);
|
||||
|
@ -687,6 +691,7 @@ luaA_wibox_new(lua_State *L)
|
|||
|
||||
w->screen = SCREEN_UNDEF;
|
||||
w->isvisible = true;
|
||||
w->cursor = a_strdup("left_ptr");
|
||||
|
||||
for(i = 0; i <= reqs_nbr; i++)
|
||||
xcolor_init_reply(reqs[i]);
|
||||
|
@ -767,6 +772,7 @@ luaA_wibox_invalidate_byitem(lua_State *L, const void *item)
|
|||
* \lfield bg Background color.
|
||||
* \lfield position The position.
|
||||
* \lfield ontop On top of other windows.
|
||||
* \lfield cursor The mouse cursor.
|
||||
*/
|
||||
static int
|
||||
luaA_wibox_index(lua_State *L)
|
||||
|
@ -825,6 +831,9 @@ luaA_wibox_index(lua_State *L)
|
|||
else
|
||||
lua_pushnil(L);
|
||||
break;
|
||||
case A_TK_CURSOR:
|
||||
lua_pushstring(L, (*wibox)->cursor);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -935,6 +944,19 @@ luaA_wibox_newindex(lua_State *L)
|
|||
titlebar_client_attach(*c, *wibox);
|
||||
}
|
||||
break;
|
||||
case A_TK_CURSOR:
|
||||
if((buf = luaL_checkstring(L, 3)))
|
||||
{
|
||||
uint16_t cursor_font = xcursor_font_fromstr(buf);
|
||||
if(cursor_font)
|
||||
{
|
||||
xcb_cursor_t cursor = xcursor_new(globalconf.connection, cursor_font);
|
||||
p_delete(&(*wibox)->cursor);
|
||||
(*wibox)->cursor = a_strdup(buf);
|
||||
simplewindow_cursor_set(&(*wibox)->sw, cursor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case A_TK_SCREEN:
|
||||
if(lua_isnil(L, 3))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue