add client_set_undecorated().
add support for the _OB_WM_STATE_UNDECORATED state hint.
This commit is contained in:
parent
b2dd343095
commit
b4fa843575
3 changed files with 180 additions and 152 deletions
|
@ -1214,8 +1214,7 @@ void action_toggle_decorations(union ActionData *data)
|
||||||
ObClient *c = data->client.any.c;
|
ObClient *c = data->client.any.c;
|
||||||
|
|
||||||
client_action_start(data);
|
client_action_start(data);
|
||||||
c->decorate = !c->decorate;
|
client_set_undecorated(c, !c->undecorated);
|
||||||
client_setup_decor_and_functions(c);
|
|
||||||
client_action_end(data);
|
client_action_end(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,6 @@ void client_manage(Window window)
|
||||||
self->title_count = 1;
|
self->title_count = 1;
|
||||||
self->wmstate = NormalState;
|
self->wmstate = NormalState;
|
||||||
self->layer = -1;
|
self->layer = -1;
|
||||||
self->decorate = TRUE;
|
|
||||||
self->desktop = screen_num_desktops; /* always an invalid value */
|
self->desktop = screen_num_desktops; /* always an invalid value */
|
||||||
|
|
||||||
client_get_all(self);
|
client_get_all(self);
|
||||||
|
@ -794,6 +793,8 @@ static void client_get_state(ObClient *self)
|
||||||
self->above = TRUE;
|
self->above = TRUE;
|
||||||
else if (state[i] == prop_atoms.net_wm_state_below)
|
else if (state[i] == prop_atoms.net_wm_state_below)
|
||||||
self->below = TRUE;
|
self->below = TRUE;
|
||||||
|
else if (state[i] == prop_atoms.ob_wm_state_undecorated)
|
||||||
|
self->undecorated = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(state);
|
g_free(state);
|
||||||
|
@ -1157,7 +1158,7 @@ void client_setup_decor_and_functions(ObClient *self)
|
||||||
|
|
||||||
/* finally, the user can have requested no decorations, which overrides
|
/* finally, the user can have requested no decorations, which overrides
|
||||||
everything */
|
everything */
|
||||||
if (!self->decorate)
|
if (self->undecorated)
|
||||||
self->decorations = OB_FRAME_DECOR_BORDER;
|
self->decorations = OB_FRAME_DECOR_BORDER;
|
||||||
|
|
||||||
/* if we don't have a titlebar, then we cannot shade! */
|
/* if we don't have a titlebar, then we cannot shade! */
|
||||||
|
@ -1585,7 +1586,7 @@ void client_update_icons(ObClient *self)
|
||||||
static void client_change_state(ObClient *self)
|
static void client_change_state(ObClient *self)
|
||||||
{
|
{
|
||||||
guint32 state[2];
|
guint32 state[2];
|
||||||
guint32 netstate[10];
|
guint32 netstate[11];
|
||||||
guint num;
|
guint num;
|
||||||
|
|
||||||
state[0] = self->wmstate;
|
state[0] = self->wmstate;
|
||||||
|
@ -1613,6 +1614,8 @@ static void client_change_state(ObClient *self)
|
||||||
netstate[num++] = prop_atoms.net_wm_state_above;
|
netstate[num++] = prop_atoms.net_wm_state_above;
|
||||||
if (self->below)
|
if (self->below)
|
||||||
netstate[num++] = prop_atoms.net_wm_state_below;
|
netstate[num++] = prop_atoms.net_wm_state_below;
|
||||||
|
if (self->undecorated)
|
||||||
|
netstate[num++] = prop_atoms.ob_wm_state_undecorated;
|
||||||
PROP_SETA32(self->window, net_wm_state, atom, netstate, num);
|
PROP_SETA32(self->window, net_wm_state, atom, netstate, num);
|
||||||
|
|
||||||
client_calc_layer(self);
|
client_calc_layer(self);
|
||||||
|
@ -1753,6 +1756,10 @@ static void client_apply_startup_state(ObClient *self)
|
||||||
self->fullscreen = FALSE;
|
self->fullscreen = FALSE;
|
||||||
client_fullscreen(self, TRUE, FALSE);
|
client_fullscreen(self, TRUE, FALSE);
|
||||||
}
|
}
|
||||||
|
if (self->undecorated) {
|
||||||
|
self->undecorated = FALSE;
|
||||||
|
client_set_undecorated(self, TRUE);
|
||||||
|
}
|
||||||
if (self->shaded) {
|
if (self->shaded) {
|
||||||
self->shaded = FALSE;
|
self->shaded = FALSE;
|
||||||
client_shade(self, TRUE);
|
client_shade(self, TRUE);
|
||||||
|
@ -2352,6 +2359,7 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
||||||
{
|
{
|
||||||
gboolean shaded = self->shaded;
|
gboolean shaded = self->shaded;
|
||||||
gboolean fullscreen = self->fullscreen;
|
gboolean fullscreen = self->fullscreen;
|
||||||
|
gboolean undecorated = self->undecorated;
|
||||||
gboolean max_horz = self->max_horz;
|
gboolean max_horz = self->max_horz;
|
||||||
gboolean max_vert = self->max_vert;
|
gboolean max_vert = self->max_vert;
|
||||||
int i;
|
int i;
|
||||||
|
@ -2379,7 +2387,7 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
||||||
action = self->max_horz ? prop_atoms.net_wm_state_remove :
|
action = self->max_horz ? prop_atoms.net_wm_state_remove :
|
||||||
prop_atoms.net_wm_state_add;
|
prop_atoms.net_wm_state_add;
|
||||||
else if (state == prop_atoms.net_wm_state_shaded)
|
else if (state == prop_atoms.net_wm_state_shaded)
|
||||||
action = self->shaded ? prop_atoms.net_wm_state_remove :
|
action = shaded ? prop_atoms.net_wm_state_remove :
|
||||||
prop_atoms.net_wm_state_add;
|
prop_atoms.net_wm_state_add;
|
||||||
else if (state == prop_atoms.net_wm_state_skip_taskbar)
|
else if (state == prop_atoms.net_wm_state_skip_taskbar)
|
||||||
action = self->skip_taskbar ?
|
action = self->skip_taskbar ?
|
||||||
|
@ -2390,7 +2398,7 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
||||||
prop_atoms.net_wm_state_remove :
|
prop_atoms.net_wm_state_remove :
|
||||||
prop_atoms.net_wm_state_add;
|
prop_atoms.net_wm_state_add;
|
||||||
else if (state == prop_atoms.net_wm_state_fullscreen)
|
else if (state == prop_atoms.net_wm_state_fullscreen)
|
||||||
action = self->fullscreen ?
|
action = fullscreen ?
|
||||||
prop_atoms.net_wm_state_remove :
|
prop_atoms.net_wm_state_remove :
|
||||||
prop_atoms.net_wm_state_add;
|
prop_atoms.net_wm_state_add;
|
||||||
else if (state == prop_atoms.net_wm_state_above)
|
else if (state == prop_atoms.net_wm_state_above)
|
||||||
|
@ -2399,6 +2407,9 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
||||||
else if (state == prop_atoms.net_wm_state_below)
|
else if (state == prop_atoms.net_wm_state_below)
|
||||||
action = self->below ? prop_atoms.net_wm_state_remove :
|
action = self->below ? prop_atoms.net_wm_state_remove :
|
||||||
prop_atoms.net_wm_state_add;
|
prop_atoms.net_wm_state_add;
|
||||||
|
else if (state == prop_atoms.ob_wm_state_undecorated)
|
||||||
|
action = undecorated ? prop_atoms.net_wm_state_remove :
|
||||||
|
prop_atoms.net_wm_state_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == prop_atoms.net_wm_state_add) {
|
if (action == prop_atoms.net_wm_state_add) {
|
||||||
|
@ -2421,6 +2432,8 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
||||||
self->above = TRUE;
|
self->above = TRUE;
|
||||||
} else if (state == prop_atoms.net_wm_state_below) {
|
} else if (state == prop_atoms.net_wm_state_below) {
|
||||||
self->below = TRUE;
|
self->below = TRUE;
|
||||||
|
} else if (state == prop_atoms.ob_wm_state_undecorated) {
|
||||||
|
undecorated = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { /* action == prop_atoms.net_wm_state_remove */
|
} else { /* action == prop_atoms.net_wm_state_remove */
|
||||||
|
@ -2442,6 +2455,8 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
||||||
self->above = FALSE;
|
self->above = FALSE;
|
||||||
} else if (state == prop_atoms.net_wm_state_below) {
|
} else if (state == prop_atoms.net_wm_state_below) {
|
||||||
self->below = FALSE;
|
self->below = FALSE;
|
||||||
|
} else if (state == prop_atoms.ob_wm_state_undecorated) {
|
||||||
|
undecorated = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2468,6 +2483,8 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
||||||
client_fullscreen(self, fullscreen, TRUE);
|
client_fullscreen(self, fullscreen, TRUE);
|
||||||
if (shaded != self->shaded)
|
if (shaded != self->shaded)
|
||||||
client_shade(self, shaded);
|
client_shade(self, shaded);
|
||||||
|
if (undecorated != self->undecorated)
|
||||||
|
client_set_undecorated(self, undecorated);
|
||||||
client_calc_layer(self);
|
client_calc_layer(self);
|
||||||
client_change_state(self); /* change the hint to reflect these changes */
|
client_change_state(self); /* change the hint to reflect these changes */
|
||||||
}
|
}
|
||||||
|
@ -2745,6 +2762,15 @@ void client_set_layer(ObClient *self, int layer)
|
||||||
client_change_state(self); /* reflect this in the state hints */
|
client_change_state(self); /* reflect this in the state hints */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void client_set_undecorated(ObClient *self, gboolean undecorated)
|
||||||
|
{
|
||||||
|
if (self->undecorated != undecorated) {
|
||||||
|
self->undecorated = undecorated;
|
||||||
|
client_setup_decor_and_functions(self);
|
||||||
|
client_change_state(self); /* reflect this in the state hints */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
guint client_monitor(ObClient *self)
|
guint client_monitor(ObClient *self)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
|
@ -250,10 +250,10 @@ struct _ObClient
|
||||||
*/
|
*/
|
||||||
guint decorations;
|
guint decorations;
|
||||||
|
|
||||||
/*! A user option. When this is set to FALSE the client will not ever
|
/*! A user option. When this is set to TRUE the client will not ever
|
||||||
be decorated.
|
be decorated.
|
||||||
*/
|
*/
|
||||||
gboolean decorate;
|
gboolean undecorated;
|
||||||
|
|
||||||
/*! A bitmask of values in the ObFunctions enum
|
/*! A bitmask of values in the ObFunctions enum
|
||||||
The values in the variable specify the ways in which the user is allowed
|
The values in the variable specify the ways in which the user is allowed
|
||||||
|
@ -520,6 +520,9 @@ int client_directional_edge_search(ObClient *c, ObDirection dir);
|
||||||
*/
|
*/
|
||||||
void client_set_layer(ObClient *self, int layer);
|
void client_set_layer(ObClient *self, int layer);
|
||||||
|
|
||||||
|
/*! Set a client window to have decorations or not */
|
||||||
|
void client_set_undecorated(ObClient *self, gboolean undecorated);
|
||||||
|
|
||||||
guint client_monitor(ObClient *self);
|
guint client_monitor(ObClient *self);
|
||||||
|
|
||||||
void client_update_sm_client_id(ObClient *self);
|
void client_update_sm_client_id(ObClient *self);
|
||||||
|
|
Loading…
Reference in a new issue