add decoration state to the frame struct. make client_configure adjust the frame if the decorations do not match between the client and the frame, so that when they change it can send a configurenotify to the client.
This commit is contained in:
parent
d085756572
commit
069e9607fa
3 changed files with 18 additions and 15 deletions
|
@ -1027,10 +1027,7 @@ void client_setup_decor_and_functions(Client *self)
|
||||||
if (self->type == Type_Desktop && self->desktop != DESKTOP_ALL)
|
if (self->type == Type_Desktop && self->desktop != DESKTOP_ALL)
|
||||||
client_set_desktop(self, DESKTOP_ALL, FALSE);
|
client_set_desktop(self, DESKTOP_ALL, FALSE);
|
||||||
|
|
||||||
/* change the decors on the frame, and with more/less decorations,
|
/* adjust the client's decorations, etc. */
|
||||||
we may also need to be repositioned */
|
|
||||||
frame_adjust_area(self->frame, TRUE, TRUE);
|
|
||||||
/* with new decor, the window's maximized size may change */
|
|
||||||
client_reconfigure(self);
|
client_reconfigure(self);
|
||||||
} else {
|
} else {
|
||||||
/* this makes sure that these windows appear on all desktops */
|
/* this makes sure that these windows appear on all desktops */
|
||||||
|
@ -1775,6 +1772,9 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
|
||||||
|
|
||||||
/* move/resize the frame to match the request */
|
/* move/resize the frame to match the request */
|
||||||
if (self->frame) {
|
if (self->frame) {
|
||||||
|
if (self->decorations != self->frame->decorations)
|
||||||
|
moved = resized = TRUE;
|
||||||
|
|
||||||
if (moved || resized)
|
if (moved || resized)
|
||||||
frame_adjust_area(self->frame, moved, resized);
|
frame_adjust_area(self->frame, moved, resized);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ Frame *frame_new()
|
||||||
self = g_new(Frame, 1);
|
self = g_new(Frame, 1);
|
||||||
|
|
||||||
self->visible = FALSE;
|
self->visible = FALSE;
|
||||||
|
self->decorations = 0;
|
||||||
|
|
||||||
/* create all of the decor windows */
|
/* create all of the decor windows */
|
||||||
mask = CWOverrideRedirect | CWEventMask;
|
mask = CWOverrideRedirect | CWEventMask;
|
||||||
|
@ -165,7 +166,7 @@ void frame_adjust_shape(Frame *self)
|
||||||
ShapeBounding, ShapeSet);
|
ShapeBounding, ShapeSet);
|
||||||
|
|
||||||
num = 0;
|
num = 0;
|
||||||
if (self->client->decorations & Decor_Titlebar) {
|
if (self->decorations & Decor_Titlebar) {
|
||||||
xrect[0].x = -ob_rr_theme->bevel;
|
xrect[0].x = -ob_rr_theme->bevel;
|
||||||
xrect[0].y = -ob_rr_theme->bevel;
|
xrect[0].y = -ob_rr_theme->bevel;
|
||||||
xrect[0].width = self->width + self->bwidth * 2;
|
xrect[0].width = self->width + self->bwidth * 2;
|
||||||
|
@ -174,7 +175,7 @@ void frame_adjust_shape(Frame *self)
|
||||||
++num;
|
++num;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->client->decorations & Decor_Handle) {
|
if (self->decorations & Decor_Handle) {
|
||||||
xrect[1].x = -ob_rr_theme->bevel;
|
xrect[1].x = -ob_rr_theme->bevel;
|
||||||
xrect[1].y = FRAME_HANDLE_Y(self);
|
xrect[1].y = FRAME_HANDLE_Y(self);
|
||||||
xrect[1].width = self->width + self->bwidth * 2;
|
xrect[1].width = self->width + self->bwidth * 2;
|
||||||
|
@ -193,7 +194,8 @@ void frame_adjust_shape(Frame *self)
|
||||||
void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
|
void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
|
||||||
{
|
{
|
||||||
if (resized) {
|
if (resized) {
|
||||||
if (self->client->decorations & Decor_Border) {
|
self->decorations = self->client->decorations;
|
||||||
|
if (self->decorations & Decor_Border) {
|
||||||
self->bwidth = ob_rr_theme->bwidth;
|
self->bwidth = ob_rr_theme->bwidth;
|
||||||
self->cbwidth = ob_rr_theme->cbwidth;
|
self->cbwidth = ob_rr_theme->cbwidth;
|
||||||
} else {
|
} else {
|
||||||
|
@ -223,7 +225,7 @@ void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
|
||||||
self->max_x = -1;
|
self->max_x = -1;
|
||||||
self->close_x = -1;
|
self->close_x = -1;
|
||||||
|
|
||||||
if (self->client->decorations & Decor_Titlebar) {
|
if (self->decorations & Decor_Titlebar) {
|
||||||
XMoveResizeWindow(ob_display, self->title,
|
XMoveResizeWindow(ob_display, self->title,
|
||||||
-self->bwidth, -self->bwidth,
|
-self->bwidth, -self->bwidth,
|
||||||
self->width, ob_rr_theme->title_height);
|
self->width, ob_rr_theme->title_height);
|
||||||
|
@ -235,7 +237,7 @@ void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
|
||||||
} else
|
} else
|
||||||
XUnmapWindow(ob_display, self->title);
|
XUnmapWindow(ob_display, self->title);
|
||||||
|
|
||||||
if (self->client->decorations & Decor_Handle) {
|
if (self->decorations & Decor_Handle) {
|
||||||
XMoveResizeWindow(ob_display, self->handle,
|
XMoveResizeWindow(ob_display, self->handle,
|
||||||
-self->bwidth, FRAME_HANDLE_Y(self),
|
-self->bwidth, FRAME_HANDLE_Y(self),
|
||||||
self->width, ob_rr_theme->handle_height);
|
self->width, ob_rr_theme->handle_height);
|
||||||
|
@ -425,28 +427,28 @@ static void layout_title(Frame *self)
|
||||||
for (lc = ob_rr_theme->title_layout; *lc != '\0'; ++lc) {
|
for (lc = ob_rr_theme->title_layout; *lc != '\0'; ++lc) {
|
||||||
switch (*lc) {
|
switch (*lc) {
|
||||||
case 'N':
|
case 'N':
|
||||||
if (!(self->client->decorations & Decor_Icon)) break;
|
if (!(self->decorations & Decor_Icon)) break;
|
||||||
if (n) { *lc = ' '; break; } /* rm duplicates */
|
if (n) { *lc = ' '; break; } /* rm duplicates */
|
||||||
n = TRUE;
|
n = TRUE;
|
||||||
self->label_width -= (ob_rr_theme->button_size + 2 +
|
self->label_width -= (ob_rr_theme->button_size + 2 +
|
||||||
ob_rr_theme->bevel + 1);
|
ob_rr_theme->bevel + 1);
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
if (!(self->client->decorations & Decor_AllDesktops)) break;
|
if (!(self->decorations & Decor_AllDesktops)) break;
|
||||||
if (d) { *lc = ' '; break; } /* rm duplicates */
|
if (d) { *lc = ' '; break; } /* rm duplicates */
|
||||||
d = TRUE;
|
d = TRUE;
|
||||||
self->label_width -= (ob_rr_theme->button_size +
|
self->label_width -= (ob_rr_theme->button_size +
|
||||||
ob_rr_theme->bevel + 1);
|
ob_rr_theme->bevel + 1);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
if (!(self->client->decorations & Decor_Shade)) break;
|
if (!(self->decorations & Decor_Shade)) break;
|
||||||
if (s) { *lc = ' '; break; } /* rm duplicates */
|
if (s) { *lc = ' '; break; } /* rm duplicates */
|
||||||
s = TRUE;
|
s = TRUE;
|
||||||
self->label_width -= (ob_rr_theme->button_size +
|
self->label_width -= (ob_rr_theme->button_size +
|
||||||
ob_rr_theme->bevel + 1);
|
ob_rr_theme->bevel + 1);
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
if (!(self->client->decorations & Decor_Iconify)) break;
|
if (!(self->decorations & Decor_Iconify)) break;
|
||||||
if (i) { *lc = ' '; break; } /* rm duplicates */
|
if (i) { *lc = ' '; break; } /* rm duplicates */
|
||||||
i = TRUE;
|
i = TRUE;
|
||||||
self->label_width -= (ob_rr_theme->button_size +
|
self->label_width -= (ob_rr_theme->button_size +
|
||||||
|
@ -457,14 +459,14 @@ static void layout_title(Frame *self)
|
||||||
l = TRUE;
|
l = TRUE;
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
if (!(self->client->decorations & Decor_Maximize)) break;
|
if (!(self->decorations & Decor_Maximize)) break;
|
||||||
if (m) { *lc = ' '; break; } /* rm duplicates */
|
if (m) { *lc = ' '; break; } /* rm duplicates */
|
||||||
m = TRUE;
|
m = TRUE;
|
||||||
self->label_width -= (ob_rr_theme->button_size +
|
self->label_width -= (ob_rr_theme->button_size +
|
||||||
ob_rr_theme->bevel + 1);
|
ob_rr_theme->bevel + 1);
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
if (!(self->client->decorations & Decor_Close)) break;
|
if (!(self->decorations & Decor_Close)) break;
|
||||||
if (c) { *lc = ' '; break; } /* rm duplicates */
|
if (c) { *lc = ' '; break; } /* rm duplicates */
|
||||||
c = TRUE;
|
c = TRUE;
|
||||||
self->label_width -= (ob_rr_theme->button_size +
|
self->label_width -= (ob_rr_theme->button_size +
|
||||||
|
|
|
@ -37,6 +37,7 @@ typedef struct Frame {
|
||||||
Strut size;
|
Strut size;
|
||||||
Rect area;
|
Rect area;
|
||||||
gboolean visible;
|
gboolean visible;
|
||||||
|
int decorations;
|
||||||
|
|
||||||
Window title;
|
Window title;
|
||||||
Window label;
|
Window label;
|
||||||
|
|
Loading…
Reference in a new issue