titlebar: use need_update system (like statusbar, …)
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
18fab522f9
commit
063bf2083d
|
@ -169,12 +169,14 @@ a_xcb_check_cb(EV_P_ ev_check *w, int revents)
|
|||
|
||||
layout_refresh();
|
||||
statusbar_refresh();
|
||||
titlebar_refresh();
|
||||
|
||||
/* need to resync */
|
||||
xcb_aux_sync(globalconf.connection);
|
||||
}
|
||||
layout_refresh();
|
||||
statusbar_refresh();
|
||||
titlebar_refresh();
|
||||
xcb_aux_sync(globalconf.connection);
|
||||
}
|
||||
|
||||
|
@ -465,6 +467,7 @@ main(int argc, char **argv)
|
|||
/* refresh everything before waiting events */
|
||||
layout_refresh();
|
||||
statusbar_refresh();
|
||||
titlebar_refresh();
|
||||
|
||||
/* main event loop */
|
||||
ev_loop(globalconf.loop, 0);
|
||||
|
|
2
mouse.c
2
mouse.c
|
@ -686,6 +686,8 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox)
|
|||
|
||||
/* resize the client */
|
||||
client_resize(c, geo, false);
|
||||
/* redaw titlebar live */
|
||||
titlebar_draw(c);
|
||||
|
||||
/* draw the infobox */
|
||||
if(sw)
|
||||
|
|
|
@ -182,6 +182,8 @@ struct titlebar_t
|
|||
xcolor_t color;
|
||||
int width;
|
||||
} border;
|
||||
/** Need update */
|
||||
bool need_update;
|
||||
};
|
||||
|
||||
/** Delete a titlebar structure.
|
||||
|
|
24
titlebar.c
24
titlebar.c
|
@ -138,6 +138,20 @@ titlebar_draw(client_t *c)
|
|||
simplewindow_refresh_pixmap(c->titlebar->sw);
|
||||
|
||||
draw_context_delete(&ctx);
|
||||
|
||||
c->titlebar->need_update = false;
|
||||
}
|
||||
|
||||
/** Titlebar refresh function.
|
||||
*/
|
||||
void
|
||||
titlebar_refresh(void)
|
||||
{
|
||||
client_t *c;
|
||||
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(c->titlebar && c->titlebar->need_update)
|
||||
titlebar_draw(c);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -280,7 +294,7 @@ titlebar_init(client_t *c)
|
|||
if(client_isvisible(c, c->screen))
|
||||
globalconf.screens[c->screen].need_arrange = true;
|
||||
|
||||
titlebar_draw(c);
|
||||
c->titlebar->need_update = true;
|
||||
}
|
||||
|
||||
/** Create a new titlebar.
|
||||
|
@ -365,7 +379,7 @@ luaA_titlebar_widget_add(lua_State *L)
|
|||
widget_node_list_append(&(*tb)->widgets, w);
|
||||
widget_ref(widget);
|
||||
|
||||
titlebar_draw(client_getbytitlebar(*tb));
|
||||
(*tb)->need_update = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -394,7 +408,7 @@ luaA_titlebar_widget_remove(lua_State *L)
|
|||
widget_unref(widget);
|
||||
widget_node_list_detach(&(*tb)->widgets, w);
|
||||
p_delete(&w);
|
||||
titlebar_draw(client_getbytitlebar(*tb));
|
||||
(*tb)->need_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,13 +502,13 @@ luaA_titlebar_newindex(lua_State *L)
|
|||
if((buf = luaL_checklstring(L, 3, &len)))
|
||||
if(xcolor_init(&(*titlebar)->colors.fg, globalconf.connection,
|
||||
globalconf.default_screen, buf, len))
|
||||
titlebar_draw(client_getbytitlebar(*titlebar));
|
||||
(*titlebar)->need_update = true;
|
||||
return 0;
|
||||
case A_TK_BG:
|
||||
if((buf = luaL_checklstring(L, 3, &len)))
|
||||
if(xcolor_init(&(*titlebar)->colors.bg, globalconf.connection,
|
||||
globalconf.default_screen, buf, len))
|
||||
titlebar_draw(client_getbytitlebar(*titlebar));
|
||||
(*titlebar)->need_update = true;
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
|
|
|
@ -29,6 +29,7 @@ client_t * client_getbytitlebarwin(xcb_window_t);
|
|||
void titlebar_geometry_compute(client_t *, area_t, area_t *);
|
||||
void titlebar_draw(client_t *);
|
||||
void titlebar_init(client_t *);
|
||||
void titlebar_refresh(void);
|
||||
|
||||
int luaA_titlebar_userdata_new(lua_State *, titlebar_t *);
|
||||
|
||||
|
@ -111,7 +112,7 @@ titlebar_update_geometry_floating(client_t *c)
|
|||
|
||||
titlebar_geometry_compute(c, c->geometry, &geom);
|
||||
simplewindow_moveresize(c->titlebar->sw, geom.x, geom.y, geom.width, geom.height);
|
||||
titlebar_draw(c);
|
||||
c->titlebar->need_update = true;
|
||||
}
|
||||
|
||||
/** Update the titlebar geometry for a tiled client.
|
||||
|
@ -128,7 +129,7 @@ titlebar_update_geometry_tiled(client_t *c, area_t geometry)
|
|||
|
||||
titlebar_geometry_compute(c, geometry, &geom);
|
||||
simplewindow_moveresize(c->titlebar->sw, geom.x, geom.y, geom.width, geom.height);
|
||||
titlebar_draw(c);
|
||||
c->titlebar->need_update = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue