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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-12-23 16:43:24 +01:00
parent 2e8a4fafbc
commit 20cafb4851
3 changed files with 1 additions and 33 deletions

View file

@ -130,7 +130,6 @@ function set_bg(wibox, c)
-- Alpha isn't supported for backgrounds -- Alpha isn't supported for backgrounds
colstr = string_format("#%02x%02x%02x", r, g, b) colstr = string_format("#%02x%02x%02x", r, g, b)
end end
wibox.drawin.bg_color = colstr
wibox.background_color = c wibox.background_color = c
wibox.draw() wibox.draw()
end end

View file

@ -140,12 +140,11 @@ drawin_init(drawin_t *w)
w->geometry.x, w->geometry.y, w->geometry.x, w->geometry.y,
w->geometry.width, w->geometry.height, w->geometry.width, w->geometry.height,
w->border_width, XCB_COPY_FROM_PARENT, globalconf.visual->visual_id, 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_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | XCB_CW_COLORMAP
| XCB_CW_CURSOR, | XCB_CW_CURSOR,
(const uint32_t []) (const uint32_t [])
{ {
w->bg_color.pixel,
w->border_color.pixel, w->border_color.pixel,
XCB_GRAVITY_NORTH_WEST, XCB_GRAVITY_NORTH_WEST,
1, 1,
@ -392,33 +391,10 @@ luaA_drawin_geometry(lua_State *L)
return luaA_pusharea(L, drawin->geometry); 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, ontop, lua_pushboolean)
LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, cursor, lua_pushstring) 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, visible, lua_pushboolean)
LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, bg_color, luaA_pushcolor)
static int static int
luaA_drawin_set_x(lua_State *L, drawin_t *drawin) 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_set_height,
(lua_class_propfunc_t) luaA_drawin_get_height, (lua_class_propfunc_t) luaA_drawin_get_height,
(lua_class_propfunc_t) luaA_drawin_set_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", luaA_class_add_property(&drawin_class, "type",
(lua_class_propfunc_t) luaA_window_set_type, (lua_class_propfunc_t) luaA_window_set_type,
(lua_class_propfunc_t) luaA_window_get_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::enter");
signal_add(&drawin_class.signals, "mouse::leave"); 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::border_width");
signal_add(&drawin_class.signals, "property::cursor"); signal_add(&drawin_class.signals, "property::cursor");
signal_add(&drawin_class.signals, "property::height"); signal_add(&drawin_class.signals, "property::height");

View file

@ -37,8 +37,6 @@ struct drawin_t
bool visible; bool visible;
/** Cursor */ /** Cursor */
char *cursor; char *cursor;
/** Background color */
color_t bg_color;
/** The pixmap copied to the window object. */ /** The pixmap copied to the window object. */
xcb_pixmap_t pixmap; xcb_pixmap_t pixmap;
/** Surface for drawing to the pixmap. */ /** Surface for drawing to the pixmap. */