From 8a0f2aca28757472aa1d434ac699aad34d4d5767 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 5 Aug 2009 15:56:00 +0200 Subject: [PATCH] wibox: move set window cursor code to window.c Signed-off-by: Julien Danjou --- wibox.c | 18 +++--------------- window.c | 11 +++++++++++ window.h | 1 + 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/wibox.c b/wibox.c index c8f27d24..7220f6ea 100644 --- a/wibox.c +++ b/wibox.c @@ -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 wibox_map(wibox_t *wibox) { @@ -708,8 +696,8 @@ wibox_attach(screen_t *s) wibox_init(wibox, phys_screen); - wibox_cursor_set(wibox, - xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor))); + window_set_cursor(wibox->window, + xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor))); 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); p_delete(&wibox->cursor); wibox->cursor = a_strdup(buf); - wibox_cursor_set(wibox, cursor); + window_set_cursor(wibox->window, cursor); } } break; diff --git a/window.c b/window.c index 0c888f24..3d0bdbca 100644 --- a/window.c +++ b/window.c @@ -167,4 +167,15 @@ window_takefocus(xcb_window_t win) 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 diff --git a/window.h b/window.h index 47d68045..321074b2 100644 --- a/window.h +++ b/window.h @@ -32,6 +32,7 @@ double window_opacity_get(xcb_window_t); double window_opacity_get_from_reply(xcb_get_property_reply_t *); void window_opacity_set(xcb_window_t, double); void window_takefocus(xcb_window_t); +void window_set_cursor(xcb_window_t, xcb_cursor_t); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80