only perform the actions necessary when performing an engine_adjust_area. pass whether the client has moved or resized
This commit is contained in:
parent
2bdc37e920
commit
436c85576e
4 changed files with 101 additions and 86 deletions
|
@ -20,7 +20,8 @@ typedef void EngineFrameReleaseClient(Frame *self, Client *client);
|
||||||
|
|
||||||
/* frame_adjust_area */
|
/* frame_adjust_area */
|
||||||
/*! Update the frame's size/position to match the client */
|
/*! Update the frame's size/position to match the client */
|
||||||
typedef void EngineFrameAdjustArea(Frame *self);
|
typedef void EngineFrameAdjustArea(Frame *self, gboolean moved,
|
||||||
|
gboolean resized);
|
||||||
/* frame_adjust_shape */
|
/* frame_adjust_shape */
|
||||||
/*! Shape the frame window to the client window */
|
/*! Shape the frame window to the client window */
|
||||||
typedef void EngineFrameAdjustShape(Frame *self);
|
typedef void EngineFrameAdjustShape(Frame *self);
|
||||||
|
|
|
@ -406,75 +406,81 @@ void frame_adjust_shape(ObFrame *self)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_adjust_area(ObFrame *self)
|
void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
|
||||||
{
|
{
|
||||||
if (self->frame.client->decorations & Decor_Border) {
|
if (resized) {
|
||||||
self->bwidth = s_bwidth;
|
if (self->frame.client->decorations & Decor_Border) {
|
||||||
self->cbwidth = s_cbwidth;
|
self->bwidth = s_bwidth;
|
||||||
} else {
|
self->cbwidth = s_cbwidth;
|
||||||
self->bwidth = self->cbwidth = 0;
|
} else {
|
||||||
}
|
self->bwidth = self->cbwidth = 0;
|
||||||
STRUT_SET(self->innersize, self->cbwidth, self->cbwidth,
|
}
|
||||||
self->cbwidth, self->cbwidth);
|
STRUT_SET(self->innersize, self->cbwidth, self->cbwidth,
|
||||||
self->width = self->frame.client->area.width + self->cbwidth * 2;
|
self->cbwidth, self->cbwidth);
|
||||||
g_assert(self->width > 0);
|
self->width = self->frame.client->area.width + self->cbwidth * 2;
|
||||||
|
g_assert(self->width > 0);
|
||||||
|
|
||||||
/* set border widths */
|
/* set border widths */
|
||||||
XSetWindowBorderWidth(ob_display, self->frame.plate, self->cbwidth);
|
XSetWindowBorderWidth(ob_display, self->frame.plate, self->cbwidth);
|
||||||
XSetWindowBorderWidth(ob_display, self->frame.window, self->bwidth);
|
XSetWindowBorderWidth(ob_display, self->frame.window, self->bwidth);
|
||||||
XSetWindowBorderWidth(ob_display, self->title, self->bwidth);
|
XSetWindowBorderWidth(ob_display, self->title, self->bwidth);
|
||||||
XSetWindowBorderWidth(ob_display, self->handle, self->bwidth);
|
XSetWindowBorderWidth(ob_display, self->handle, self->bwidth);
|
||||||
XSetWindowBorderWidth(ob_display, self->lgrip, self->bwidth);
|
XSetWindowBorderWidth(ob_display, self->lgrip, self->bwidth);
|
||||||
XSetWindowBorderWidth(ob_display, self->rgrip, self->bwidth);
|
XSetWindowBorderWidth(ob_display, self->rgrip, self->bwidth);
|
||||||
|
|
||||||
/* position/size and map/unmap all the windows */
|
/* position/size and map/unmap all the windows */
|
||||||
|
|
||||||
/* they all default off, they're turned on in layout_title */
|
/* they all default off, they're turned on in layout_title */
|
||||||
self->icon_x = -1;
|
self->icon_x = -1;
|
||||||
self->desk_x = -1;
|
self->desk_x = -1;
|
||||||
self->icon_x = -1;
|
self->icon_x = -1;
|
||||||
self->label_x = -1;
|
self->label_x = -1;
|
||||||
self->max_x = -1;
|
self->max_x = -1;
|
||||||
self->close_x = -1;
|
self->close_x = -1;
|
||||||
|
|
||||||
if (self->frame.client->decorations & Decor_Titlebar) {
|
if (self->frame.client->decorations & Decor_Titlebar) {
|
||||||
XMoveResizeWindow(ob_display, self->title,
|
XMoveResizeWindow(ob_display, self->title,
|
||||||
-self->bwidth, -self->bwidth,
|
-self->bwidth, -self->bwidth,
|
||||||
self->width, TITLE_HEIGHT);
|
self->width, TITLE_HEIGHT);
|
||||||
self->innersize.top += TITLE_HEIGHT + self->bwidth;
|
self->innersize.top += TITLE_HEIGHT + self->bwidth;
|
||||||
XMapWindow(ob_display, self->title);
|
XMapWindow(ob_display, self->title);
|
||||||
|
|
||||||
/* layout the title bar elements */
|
/* layout the title bar elements */
|
||||||
layout_title(self);
|
layout_title(self);
|
||||||
} else {
|
} else {
|
||||||
XUnmapWindow(ob_display, self->title);
|
XUnmapWindow(ob_display, self->title);
|
||||||
/* make all the titlebar stuff not render */
|
/* make all the titlebar stuff not render */
|
||||||
self->frame.client->decorations &= ~(Decor_Icon | Decor_Iconify |
|
self->frame.client->decorations &= ~(Decor_Icon | Decor_Iconify |
|
||||||
Decor_Maximize | Decor_Close |
|
Decor_Maximize | Decor_Close |
|
||||||
Decor_AllDesktops);
|
Decor_AllDesktops);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self->frame.client->decorations & Decor_Handle) {
|
||||||
|
XMoveResizeWindow(ob_display, self->handle,
|
||||||
|
-self->bwidth, HANDLE_Y(self),
|
||||||
|
self->width, s_handle_height);
|
||||||
|
XMoveWindow(ob_display, self->lgrip,
|
||||||
|
-self->bwidth, -self->bwidth);
|
||||||
|
XMoveWindow(ob_display, self->rgrip,
|
||||||
|
-self->bwidth + self->width -
|
||||||
|
GRIP_WIDTH, -self->bwidth);
|
||||||
|
self->innersize.bottom += s_handle_height +
|
||||||
|
self->bwidth;
|
||||||
|
XMapWindow(ob_display, self->handle);
|
||||||
|
} else
|
||||||
|
XUnmapWindow(ob_display, self->handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->frame.client->decorations & Decor_Handle) {
|
if (moved) {
|
||||||
XMoveResizeWindow(ob_display, self->handle,
|
/* find the new coordinates */
|
||||||
-self->bwidth, HANDLE_Y(self),
|
self->frame.area.x = self->frame.client->area.x;
|
||||||
self->width, s_handle_height);
|
self->frame.area.y = self->frame.client->area.y;
|
||||||
XMoveWindow(ob_display, self->lgrip,
|
frame_client_gravity((Frame*)self,
|
||||||
-self->bwidth, -self->bwidth);
|
&self->frame.area.x, &self->frame.area.y);
|
||||||
XMoveWindow(ob_display, self->rgrip,
|
}
|
||||||
-self->bwidth + self->width -
|
|
||||||
GRIP_WIDTH, -self->bwidth);
|
|
||||||
self->innersize.bottom += s_handle_height +
|
|
||||||
self->bwidth;
|
|
||||||
XMapWindow(ob_display, self->handle);
|
|
||||||
} else
|
|
||||||
XUnmapWindow(ob_display, self->handle);
|
|
||||||
|
|
||||||
/* find the new coordinates */
|
/* move and resize the top level frame.
|
||||||
self->frame.area.x = self->frame.client->area.x;
|
shading can change without being moved or resized */
|
||||||
self->frame.area.y = self->frame.client->area.y;
|
|
||||||
frame_client_gravity((Frame*)self,
|
|
||||||
&self->frame.area.x, &self->frame.area.y);
|
|
||||||
/* move and resize the top level frame */
|
|
||||||
XMoveResizeWindow(ob_display, self->frame.window,
|
XMoveResizeWindow(ob_display, self->frame.window,
|
||||||
self->frame.area.x, self->frame.area.y,
|
self->frame.area.x, self->frame.area.y,
|
||||||
self->width,
|
self->width,
|
||||||
|
@ -482,30 +488,38 @@ void frame_adjust_area(ObFrame *self)
|
||||||
self->innersize.top + self->innersize.bottom +
|
self->innersize.top + self->innersize.bottom +
|
||||||
self->frame.client->area.height));
|
self->frame.client->area.height));
|
||||||
|
|
||||||
/* move and resize the plate */
|
if (resized) {
|
||||||
XMoveResizeWindow(ob_display, self->frame.plate,
|
/* move and resize the plate */
|
||||||
self->innersize.left - self->cbwidth,
|
XMoveResizeWindow(ob_display, self->frame.plate,
|
||||||
self->innersize.top - self->cbwidth,
|
self->innersize.left - self->cbwidth,
|
||||||
self->frame.client->area.width,
|
self->innersize.top - self->cbwidth,
|
||||||
self->frame.client->area.height);
|
self->frame.client->area.width,
|
||||||
/* when the client has StaticGravity, it likes to move around. */
|
self->frame.client->area.height);
|
||||||
XMoveWindow(ob_display, self->frame.client->window, 0, 0);
|
/* when the client has StaticGravity, it likes to move around. */
|
||||||
|
XMoveWindow(ob_display, self->frame.client->window, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
STRUT_SET(self->frame.size,
|
if (resized) {
|
||||||
self->innersize.left + self->bwidth,
|
STRUT_SET(self->frame.size,
|
||||||
self->innersize.top + self->bwidth,
|
self->innersize.left + self->bwidth,
|
||||||
self->innersize.right + self->bwidth,
|
self->innersize.top + self->bwidth,
|
||||||
self->innersize.bottom + self->bwidth);
|
self->innersize.right + self->bwidth,
|
||||||
|
self->innersize.bottom + self->bwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* shading can change without being moved or resized */
|
||||||
RECT_SET_SIZE(self->frame.area,
|
RECT_SET_SIZE(self->frame.area,
|
||||||
self->frame.client->area.width +
|
self->frame.client->area.width +
|
||||||
self->frame.size.left + self->frame.size.right,
|
self->frame.size.left + self->frame.size.right,
|
||||||
self->frame.client->area.height +
|
(self->frame.client->shaded ? TITLE_HEIGHT :
|
||||||
self->frame.size.top + self->frame.size.bottom);
|
self->frame.client->area.height +
|
||||||
|
self->frame.size.top + self->frame.size.bottom));
|
||||||
|
|
||||||
render(self);
|
if (resized) {
|
||||||
|
render(self);
|
||||||
|
|
||||||
frame_adjust_shape(self);
|
frame_adjust_shape(self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_adjust_state(ObFrame *self)
|
void frame_adjust_state(ObFrame *self)
|
||||||
|
@ -553,7 +567,7 @@ void frame_grab_client(ObFrame *self, Client *client)
|
||||||
/* map the client so it maps when the frame does */
|
/* map the client so it maps when the frame does */
|
||||||
XMapWindow(ob_display, client->window);
|
XMapWindow(ob_display, client->window);
|
||||||
|
|
||||||
frame_adjust_area(self);
|
frame_adjust_area(self, TRUE, TRUE);
|
||||||
|
|
||||||
/* set all the windows for the frame in the client_map */
|
/* set all the windows for the frame in the client_map */
|
||||||
g_hash_table_insert(client_map, (gpointer)self->frame.window, client);
|
g_hash_table_insert(client_map, (gpointer)self->frame.window, client);
|
||||||
|
|
|
@ -822,7 +822,7 @@ void client_setup_decor_and_functions(Client *self)
|
||||||
if (self->frame) {
|
if (self->frame) {
|
||||||
/* change the decors on the frame, and with more/less decorations,
|
/* change the decors on the frame, and with more/less decorations,
|
||||||
we may also need to be repositioned */
|
we may also need to be repositioned */
|
||||||
engine_frame_adjust_area(self->frame);
|
engine_frame_adjust_area(self->frame, TRUE, TRUE);
|
||||||
/* with new decor, the window's maximized size may change */
|
/* with new decor, the window's maximized size may change */
|
||||||
client_remaximize(self);
|
client_remaximize(self);
|
||||||
}
|
}
|
||||||
|
@ -1390,7 +1390,7 @@ 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) {
|
||||||
engine_frame_adjust_area(self->frame);
|
engine_frame_adjust_area(self->frame, moved, resized);
|
||||||
|
|
||||||
if (moved) {
|
if (moved) {
|
||||||
if (!user || final) {
|
if (!user || final) {
|
||||||
|
@ -1630,7 +1630,7 @@ void client_shade(Client *self, gboolean shade)
|
||||||
self->shaded = shade;
|
self->shaded = shade;
|
||||||
client_change_state(self);
|
client_change_state(self);
|
||||||
/* resize the frame to just the titlebar */
|
/* resize the frame to just the titlebar */
|
||||||
engine_frame_adjust_area(self->frame);
|
engine_frame_adjust_area(self->frame, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_close(Client *self)
|
void client_close(Client *self)
|
||||||
|
|
|
@ -275,8 +275,6 @@ void event_process(XEvent *e)
|
||||||
xwc.sibling = e->xconfigurerequest.above;
|
xwc.sibling = e->xconfigurerequest.above;
|
||||||
xwc.stack_mode = e->xconfigurerequest.detail;
|
xwc.stack_mode = e->xconfigurerequest.detail;
|
||||||
|
|
||||||
g_message("Proxying configure event for 0x%lx", window);
|
|
||||||
|
|
||||||
/* we are not to be held responsible if someone sends us an
|
/* we are not to be held responsible if someone sends us an
|
||||||
invalid request! */
|
invalid request! */
|
||||||
xerror_set_ignore(TRUE);
|
xerror_set_ignore(TRUE);
|
||||||
|
@ -323,6 +321,7 @@ static void event_handle_client(Client *client, XEvent *e)
|
||||||
{
|
{
|
||||||
XEvent ce;
|
XEvent ce;
|
||||||
Atom msgtype;
|
Atom msgtype;
|
||||||
|
int i=0;
|
||||||
|
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
|
@ -330,10 +329,10 @@ static void event_handle_client(Client *client, XEvent *e)
|
||||||
client_set_focused(client, e->type == FocusIn);
|
client_set_focused(client, e->type == FocusIn);
|
||||||
break;
|
break;
|
||||||
case ConfigureRequest:
|
case ConfigureRequest:
|
||||||
g_message("ConfigureRequest for window %lx", client->window);
|
|
||||||
/* compress these */
|
/* compress these */
|
||||||
while (XCheckTypedWindowEvent(ob_display, client->window,
|
while (XCheckTypedWindowEvent(ob_display, client->window,
|
||||||
ConfigureRequest, &ce)) {
|
ConfigureRequest, &ce)) {
|
||||||
|
++i;
|
||||||
/* XXX if this causes bad things.. we can compress config req's
|
/* XXX if this causes bad things.. we can compress config req's
|
||||||
with the same mask. */
|
with the same mask. */
|
||||||
e->xconfigurerequest.value_mask |=
|
e->xconfigurerequest.value_mask |=
|
||||||
|
@ -352,6 +351,7 @@ static void event_handle_client(Client *client, XEvent *e)
|
||||||
if (ce.xconfigurerequest.value_mask & CWStackMode)
|
if (ce.xconfigurerequest.value_mask & CWStackMode)
|
||||||
e->xconfigurerequest.detail = ce.xconfigurerequest.detail;
|
e->xconfigurerequest.detail = ce.xconfigurerequest.detail;
|
||||||
}
|
}
|
||||||
|
if (i) g_message("Compressed %d Configures", i);
|
||||||
|
|
||||||
/* if we are iconic (or shaded (fvwm does this)) ignore the event */
|
/* if we are iconic (or shaded (fvwm does this)) ignore the event */
|
||||||
if (client->iconic || client->shaded) return;
|
if (client->iconic || client->shaded) return;
|
||||||
|
|
Loading…
Reference in a new issue