[client] Add and honor the noborder attribute

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-28 14:33:45 +02:00
parent fa5169fc9f
commit 3ab739553c
4 changed files with 32 additions and 12 deletions

View File

@ -871,21 +871,35 @@ luaA_client_focus_get(lua_State *L __attribute__ ((unused)))
return 1; return 1;
} }
/** Set client border width.
* \c The client.
* \ width The border width.
*/
void
client_setborder(client_t *c, uint32_t width)
{
if(c->noborder && width > 0)
return;
c->border = width;
xcb_configure_window(globalconf.connection, c->win,
XCB_CONFIG_WINDOW_BORDER_WIDTH, &width);
globalconf.screens[c->screen].need_arrange = true;
}
/** Set the client border width and color.
* \param The border width in pixel.
* \param The border color.
*/
static int static int
luaA_client_border_set(lua_State *L) luaA_client_border_set(lua_State *L)
{ {
client_t **c = luaL_checkudata(L, 1, "client"); client_t **c = luaL_checkudata(L, 1, "client");
int width = luaA_getopt_number(L, 2, "width", -1); uint32_t width = luaA_getopt_number(L, 2, "width", 0);
const char *colorstr = luaA_getopt_string(L, 2, "color", NULL); const char *colorstr = luaA_getopt_string(L, 2, "color", NULL);
xcolor_t color; xcolor_t color;
if(width >= 0) client_setborder(*c, width);
{
(*c)->border = width;
globalconf.screens[(*c)->screen].need_arrange = true;
xcb_configure_window(globalconf.connection, (*c)->win,
XCB_CONFIG_WINDOW_BORDER_WIDTH, (uint32_t *) &width);
}
if(colorstr if(colorstr
&& draw_color_new(globalconf.connection, (*c)->phys_screen, colorstr, &color)) && draw_color_new(globalconf.connection, (*c)->phys_screen, colorstr, &color))

View File

@ -42,6 +42,7 @@ void client_saveprops(client_t *);
void client_kill(client_t *); void client_kill(client_t *);
void client_setfloating(client_t *, bool, layer_t); void client_setfloating(client_t *, bool, layer_t);
char * client_markup_parse(client_t *, const char *, ssize_t); char * client_markup_parse(client_t *, const char *, ssize_t);
void client_setborder(client_t *, uint32_t);
int luaA_client_userdata_new(client_t *); int luaA_client_userdata_new(client_t *);

11
ewmh.c
View File

@ -286,8 +286,9 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
c->titlebar.position = c->titlebar_oldposition; c->titlebar.position = c->titlebar_oldposition;
xcb_map_window(globalconf.connection, c->titlebar_sw->window); xcb_map_window(globalconf.connection, c->titlebar_sw->window);
} }
c->border = c->oldborder; c->noborder = false;
c->ismax = false; c->ismax = false;
client_setborder(c, c->oldborder);
client_setfloating(c, c->wasfloating, c->oldlayer); client_setfloating(c, c->wasfloating, c->oldlayer);
} }
else if(set == _NET_WM_STATE_ADD) else if(set == _NET_WM_STATE_ADD)
@ -302,9 +303,10 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
xcb_unmap_window(globalconf.connection, c->titlebar_sw->window); xcb_unmap_window(globalconf.connection, c->titlebar_sw->window);
c->titlebar.position = Off; c->titlebar.position = Off;
} }
c->oldborder = c->border;
c->border = 0;
c->ismax = true; c->ismax = true;
c->oldborder = c->border;
client_setborder(c, 0);
c->noborder = true;
client_setfloating(c, true, LAYER_FULLSCREEN); client_setfloating(c, true, LAYER_FULLSCREEN);
} }
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS); widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
@ -348,7 +350,6 @@ ewmh_process_window_type_atom(client_t *c, xcb_atom_t state)
else if(state == net_wm_window_type_dock else if(state == net_wm_window_type_dock
|| state == net_wm_window_type_splash) || state == net_wm_window_type_splash)
{ {
c->border = 0;
c->skip = true; c->skip = true;
c->isfixed = true; c->isfixed = true;
if(c->titlebar.position) if(c->titlebar.position)
@ -356,6 +357,8 @@ ewmh_process_window_type_atom(client_t *c, xcb_atom_t state)
xcb_unmap_window(globalconf.connection, c->titlebar_sw->window); xcb_unmap_window(globalconf.connection, c->titlebar_sw->window);
c->titlebar.position = Off; c->titlebar.position = Off;
} }
client_setborder(c, 0);
c->noborder = true;
client_setfloating(c, true, LAYER_ABOVE); client_setfloating(c, true, LAYER_ABOVE);
} }
else if (state == net_wm_window_type_dialog) else if (state == net_wm_window_type_dialog)

View File

@ -246,6 +246,8 @@ struct client_t
int basew, baseh, incw, inch, maxw, maxh, minw, minh; int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int minax, maxax, minay, maxay; int minax, maxax, minay, maxay;
int border, oldborder; int border, oldborder;
/** True if the client does not want any border */
bool noborder;
/** Has urgency hint */ /** Has urgency hint */
bool isurgent; bool isurgent;
/** Store previous floating state before maximizing */ /** Store previous floating state before maximizing */