wibox: move set window cursor code to window.c

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-05 15:56:00 +02:00
parent 6ca1732683
commit 8a0f2aca28
3 changed files with 15 additions and 15 deletions

16
wibox.c
View File

@ -329,18 +329,6 @@ wibox_orientation_set(wibox_t *w, orientation_t o)
} }
} }
/** Set wibox cursor.
* \param w The wibox.
* \param c The cursor.
*/
static void
wibox_cursor_set(wibox_t *w, xcb_cursor_t c)
{
if(w->window)
xcb_change_window_attributes(globalconf.connection, w->window, XCB_CW_CURSOR,
(const uint32_t[]) { c });
}
static void static void
wibox_map(wibox_t *wibox) wibox_map(wibox_t *wibox)
{ {
@ -708,7 +696,7 @@ wibox_attach(screen_t *s)
wibox_init(wibox, phys_screen); wibox_init(wibox, phys_screen);
wibox_cursor_set(wibox, window_set_cursor(wibox->window,
xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor))); xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor)));
wibox_opacity_set(wibox, wibox->opacity); wibox_opacity_set(wibox, wibox->opacity);
@ -1044,7 +1032,7 @@ luaA_wibox_newindex(lua_State *L)
xcb_cursor_t cursor = xcursor_new(globalconf.connection, cursor_font); xcb_cursor_t cursor = xcursor_new(globalconf.connection, cursor_font);
p_delete(&wibox->cursor); p_delete(&wibox->cursor);
wibox->cursor = a_strdup(buf); wibox->cursor = a_strdup(buf);
wibox_cursor_set(wibox, cursor); window_set_cursor(wibox->window, cursor);
} }
} }
break; break;

View File

@ -167,4 +167,15 @@ window_takefocus(xcb_window_t win)
XCB_EVENT_MASK_NO_EVENT, (char *) &ev); XCB_EVENT_MASK_NO_EVENT, (char *) &ev);
} }
/** Set wibox cursor.
* \param w The wibox.
* \param c The cursor.
*/
void
window_set_cursor(xcb_window_t w, xcb_cursor_t c)
{
xcb_change_window_attributes(globalconf.connection, w, XCB_CW_CURSOR,
(const uint32_t[]) { c });
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -32,6 +32,7 @@ double window_opacity_get(xcb_window_t);
double window_opacity_get_from_reply(xcb_get_property_reply_t *); double window_opacity_get_from_reply(xcb_get_property_reply_t *);
void window_opacity_set(xcb_window_t, double); void window_opacity_set(xcb_window_t, double);
void window_takefocus(xcb_window_t); void window_takefocus(xcb_window_t);
void window_set_cursor(xcb_window_t, xcb_cursor_t);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80