diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-03-24 19:52:09 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-03-24 19:52:09 +0000 |
| commit | 436c85576e99f4df81273f8b510a94605e676cab (patch) | |
| tree | 2b0041e03f17153464575d89cd6cac9b44033aab /engines | |
| parent | 2bdc37e9200bef650867d7b9b2a251327b922629 (diff) | |
only perform the actions necessary when performing an engine_adjust_area. pass whether the client has moved or resized
Diffstat (limited to 'engines')
| -rw-r--r-- | engines/engineinterface.h | 3 | ||||
| -rw-r--r-- | engines/openbox/openbox.c | 182 |
2 files changed, 100 insertions, 85 deletions
diff --git a/engines/engineinterface.h b/engines/engineinterface.h index 917ebd7c..5b9ec847 100644 --- a/engines/engineinterface.h +++ b/engines/engineinterface.h @@ -20,7 +20,8 @@ typedef void EngineFrameReleaseClient(Frame *self, Client *client); /* frame_adjust_area */ /*! 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 */ /*! Shape the frame window to the client window */ typedef void EngineFrameAdjustShape(Frame *self); diff --git a/engines/openbox/openbox.c b/engines/openbox/openbox.c index eab6dfb7..a661931f 100644 --- a/engines/openbox/openbox.c +++ b/engines/openbox/openbox.c @@ -406,75 +406,81 @@ void frame_adjust_shape(ObFrame *self) #endif } -void frame_adjust_area(ObFrame *self) +void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized) { - if (self->frame.client->decorations & Decor_Border) { - self->bwidth = s_bwidth; - self->cbwidth = s_cbwidth; - } else { - self->bwidth = self->cbwidth = 0; - } - STRUT_SET(self->innersize, self->cbwidth, self->cbwidth, - self->cbwidth, self->cbwidth); - self->width = self->frame.client->area.width + self->cbwidth * 2; - g_assert(self->width > 0); - - /* set border widths */ - XSetWindowBorderWidth(ob_display, self->frame.plate, self->cbwidth); - XSetWindowBorderWidth(ob_display, self->frame.window, self->bwidth); - XSetWindowBorderWidth(ob_display, self->title, self->bwidth); - XSetWindowBorderWidth(ob_display, self->handle, self->bwidth); - XSetWindowBorderWidth(ob_display, self->lgrip, self->bwidth); - XSetWindowBorderWidth(ob_display, self->rgrip, self->bwidth); + if (resized) { + if (self->frame.client->decorations & Decor_Border) { + self->bwidth = s_bwidth; + self->cbwidth = s_cbwidth; + } else { + self->bwidth = self->cbwidth = 0; + } + STRUT_SET(self->innersize, self->cbwidth, self->cbwidth, + self->cbwidth, self->cbwidth); + self->width = self->frame.client->area.width + self->cbwidth * 2; + g_assert(self->width > 0); + + /* set border widths */ + XSetWindowBorderWidth(ob_display, self->frame.plate, self->cbwidth); + XSetWindowBorderWidth(ob_display, self->frame.window, self->bwidth); + XSetWindowBorderWidth(ob_display, self->title, self->bwidth); + XSetWindowBorderWidth(ob_display, self->handle, self->bwidth); + XSetWindowBorderWidth(ob_display, self->lgrip, self->bwidth); + XSetWindowBorderWidth(ob_display, self->rgrip, self->bwidth); - /* position/size and map/unmap all the windows */ - - /* they all default off, they're turned on in layout_title */ - self->icon_x = -1; - self->desk_x = -1; - self->icon_x = -1; - self->label_x = -1; - self->max_x = -1; - self->close_x = -1; - - if (self->frame.client->decorations & Decor_Titlebar) { - XMoveResizeWindow(ob_display, self->title, - -self->bwidth, -self->bwidth, - self->width, TITLE_HEIGHT); - self->innersize.top += TITLE_HEIGHT + self->bwidth; - XMapWindow(ob_display, self->title); - - /* layout the title bar elements */ - layout_title(self); - } else { - XUnmapWindow(ob_display, self->title); - /* make all the titlebar stuff not render */ - self->frame.client->decorations &= ~(Decor_Icon | Decor_Iconify | - Decor_Maximize | Decor_Close | - Decor_AllDesktops); + /* position/size and map/unmap all the windows */ + + /* they all default off, they're turned on in layout_title */ + self->icon_x = -1; + self->desk_x = -1; + self->icon_x = -1; + self->label_x = -1; + self->max_x = -1; + self->close_x = -1; + + if (self->frame.client->decorations & Decor_Titlebar) { + XMoveResizeWindow(ob_display, self->title, + -self->bwidth, -self->bwidth, + self->width, TITLE_HEIGHT); + self->innersize.top += TITLE_HEIGHT + self->bwidth; + XMapWindow(ob_display, self->title); + + /* layout the title bar elements */ + layout_title(self); + } else { + XUnmapWindow(ob_display, self->title); + /* make all the titlebar stuff not render */ + self->frame.client->decorations &= ~(Decor_Icon | Decor_Iconify | + Decor_Maximize | Decor_Close | + 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) { - 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); - - /* find the new coordinates */ - self->frame.area.x = self->frame.client->area.x; - 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 */ + if (moved) { + /* find the new coordinates */ + self->frame.area.x = self->frame.client->area.x; + 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. + shading can change without being moved or resized */ XMoveResizeWindow(ob_display, self->frame.window, self->frame.area.x, self->frame.area.y, self->width, @@ -482,30 +488,38 @@ void frame_adjust_area(ObFrame *self) self->innersize.top + self->innersize.bottom + self->frame.client->area.height)); - /* move and resize the plate */ - XMoveResizeWindow(ob_display, self->frame.plate, - self->innersize.left - self->cbwidth, - self->innersize.top - self->cbwidth, - self->frame.client->area.width, - self->frame.client->area.height); - /* when the client has StaticGravity, it likes to move around. */ - XMoveWindow(ob_display, self->frame.client->window, 0, 0); - - STRUT_SET(self->frame.size, - self->innersize.left + self->bwidth, - self->innersize.top + self->bwidth, - self->innersize.right + self->bwidth, - self->innersize.bottom + self->bwidth); + if (resized) { + /* move and resize the plate */ + XMoveResizeWindow(ob_display, self->frame.plate, + self->innersize.left - self->cbwidth, + self->innersize.top - self->cbwidth, + self->frame.client->area.width, + self->frame.client->area.height); + /* when the client has StaticGravity, it likes to move around. */ + XMoveWindow(ob_display, self->frame.client->window, 0, 0); + } + + if (resized) { + STRUT_SET(self->frame.size, + self->innersize.left + self->bwidth, + self->innersize.top + 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, self->frame.client->area.width + self->frame.size.left + self->frame.size.right, - self->frame.client->area.height + - self->frame.size.top + self->frame.size.bottom); + (self->frame.client->shaded ? TITLE_HEIGHT : + 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) @@ -553,7 +567,7 @@ void frame_grab_client(ObFrame *self, Client *client) /* map the client so it maps when the frame does */ 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 */ g_hash_table_insert(client_map, (gpointer)self->frame.window, client); |
