From 20cafb4851a64d81d7acd67b78762177efc557fc Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 23 Dec 2011 16:43:24 +0100 Subject: [PATCH] drawin: Remove bg_color property The default background color (None) means that the server will leave the window's content untouched when an exposure happens. This should get rid of all cases of "flashing window". The real background will later be drawn while awesome is handling the expose event. Signed-off-by: Uli Schlachter --- lib/wibox/init.lua.in | 1 - objects/drawin.c | 31 +------------------------------ objects/drawin.h | 2 -- 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/lib/wibox/init.lua.in b/lib/wibox/init.lua.in index b34df0aef..c53dadcff 100644 --- a/lib/wibox/init.lua.in +++ b/lib/wibox/init.lua.in @@ -130,7 +130,6 @@ function set_bg(wibox, c) -- Alpha isn't supported for backgrounds colstr = string_format("#%02x%02x%02x", r, g, b) end - wibox.drawin.bg_color = colstr wibox.background_color = c wibox.draw() end diff --git a/objects/drawin.c b/objects/drawin.c index e5a03cdf4..69178ff5f 100644 --- a/objects/drawin.c +++ b/objects/drawin.c @@ -140,12 +140,11 @@ drawin_init(drawin_t *w) w->geometry.x, w->geometry.y, w->geometry.width, w->geometry.height, w->border_width, XCB_COPY_FROM_PARENT, globalconf.visual->visual_id, - XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY + XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | XCB_CW_COLORMAP | XCB_CW_CURSOR, (const uint32_t []) { - w->bg_color.pixel, w->border_color.pixel, XCB_GRAVITY_NORTH_WEST, 1, @@ -392,33 +391,10 @@ luaA_drawin_geometry(lua_State *L) return luaA_pusharea(L, drawin->geometry); } -/** Set the drawin background color. - * \param L The Lua VM state. - * \param drawin The drawin object. - * \return The number of elements pushed on stack. - */ -static int -luaA_drawin_set_bg_color(lua_State *L, drawin_t *drawin) -{ - size_t len; - const char *color_name = luaL_checklstring(L, -1, &len); - - if(color_name && - color_init_reply(color_init_unchecked(&drawin->bg_color, color_name, len))) - { - xcb_change_window_attributes(globalconf.connection, drawin->window, - XCB_CW_BACK_PIXEL, &drawin->bg_color.pixel); - luaA_object_emit_signal(L, -3, "property::bg_color", 0); - } - - return 0; -} - LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, ontop, lua_pushboolean) LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, cursor, lua_pushstring) LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, visible, lua_pushboolean) -LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, bg_color, luaA_pushcolor) static int luaA_drawin_set_x(lua_State *L, drawin_t *drawin) @@ -630,10 +606,6 @@ drawin_class_setup(lua_State *L) (lua_class_propfunc_t) luaA_drawin_set_height, (lua_class_propfunc_t) luaA_drawin_get_height, (lua_class_propfunc_t) luaA_drawin_set_height); - luaA_class_add_property(&window_class, "bg_color", - (lua_class_propfunc_t) luaA_drawin_set_bg_color, - (lua_class_propfunc_t) luaA_drawin_get_bg_color, - (lua_class_propfunc_t) luaA_drawin_set_bg_color); luaA_class_add_property(&drawin_class, "type", (lua_class_propfunc_t) luaA_window_set_type, (lua_class_propfunc_t) luaA_window_get_type, @@ -641,7 +613,6 @@ drawin_class_setup(lua_State *L) signal_add(&drawin_class.signals, "mouse::enter"); signal_add(&drawin_class.signals, "mouse::leave"); - signal_add(&drawin_class.signals, "property::bg_color"); signal_add(&drawin_class.signals, "property::border_width"); signal_add(&drawin_class.signals, "property::cursor"); signal_add(&drawin_class.signals, "property::height"); diff --git a/objects/drawin.h b/objects/drawin.h index d7c4d5943..154f95368 100644 --- a/objects/drawin.h +++ b/objects/drawin.h @@ -37,8 +37,6 @@ struct drawin_t bool visible; /** Cursor */ char *cursor; - /** Background color */ - color_t bg_color; /** The pixmap copied to the window object. */ xcb_pixmap_t pixmap; /** Surface for drawing to the pixmap. */