From 327a0b3de75187a23bb01ce5e8e6992fd1106a81 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 21 Mar 2003 18:38:08 +0000 Subject: [PATCH] always adjust the frames size and position together, so there is no more weird resizing before moving and edge flickering when resizing from the top/left --- engines/engineinterface.h | 9 +++------ engines/openbox/openbox.c | 33 +++++++++++++++------------------ openbox/client.c | 17 +++++++---------- openbox/engine.c | 3 +-- openbox/engine.h | 3 +-- 5 files changed, 27 insertions(+), 38 deletions(-) diff --git a/engines/engineinterface.h b/engines/engineinterface.h index 96796edd..917ebd7c 100644 --- a/engines/engineinterface.h +++ b/engines/engineinterface.h @@ -18,12 +18,9 @@ typedef void EngineFrameGrabClient(Frame *self, Client *client); /* frame_release_client */ typedef void EngineFrameReleaseClient(Frame *self, Client *client); -/* frame_adjust_size */ -/*! Update the frame's size to match the client */ -typedef void EngineFrameAdjustSize(Frame *self); -/* frame_adjust_position */ -/*! Update the frame's position to match the client */ -typedef void EngineFrameAdjustPosition(Frame *self); +/* frame_adjust_area */ +/*! Update the frame's size/position to match the client */ +typedef void EngineFrameAdjustArea(Frame *self); /* 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 c488efba..06b36616 100644 --- a/engines/openbox/openbox.c +++ b/engines/openbox/openbox.c @@ -407,7 +407,7 @@ void frame_adjust_shape(ObFrame *self) #endif } -void frame_adjust_size(ObFrame *self) +void frame_adjust_area(ObFrame *self) { if (self->frame.client->decorations & Decor_Border) { self->bwidth = s_bwidth; @@ -461,11 +461,19 @@ void frame_adjust_size(ObFrame *self) XMapWindow(ob_display, self->handle); } else XUnmapWindow(ob_display, self->handle); - - XResizeWindow(ob_display, self->frame.window, self->width, - (self->frame.client->shaded ? TITLE_HEIGHT : - self->innersize.top + self->innersize.bottom + - self->frame.client->area.height)); + + /* 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 */ + XMoveResizeWindow(ob_display, self->frame.window, + self->frame.area.x, self->frame.area.y, + self->width, + (self->frame.client->shaded ? TITLE_HEIGHT : + self->innersize.top + self->innersize.bottom + + self->frame.client->area.height)); /* do this in two steps because clients whose gravity is set to 'Static' don't end up getting moved at all with an XMoveResizeWindow */ @@ -493,16 +501,6 @@ void frame_adjust_size(ObFrame *self) frame_adjust_shape(self); } -void frame_adjust_position(ObFrame *self) -{ - 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); - XMoveWindow(ob_display, self->frame.window, - self->frame.area.x, self->frame.area.y); -} - void frame_adjust_state(ObFrame *self) { render_max(self); @@ -548,8 +546,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_size(self); - frame_adjust_position(self); + frame_adjust_area(self); /* set all the windows for the frame in the client_map */ g_hash_table_insert(client_map, (gpointer)self->frame.window, client); diff --git a/openbox/client.c b/openbox/client.c index 0a8dd1c7..6728ef6f 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -815,10 +815,9 @@ void client_setup_decor_and_functions(Client *self) client_change_allowed_actions(self); if (self->frame) { - /* change the decors on the frame */ - engine_frame_adjust_size(self->frame); - /* with more/less decorations, we may need to be repositioned */ - engine_frame_adjust_position(self->frame); + /* change the decors on the frame, and with more/less decorations, + we may also need to be repositioned */ + engine_frame_adjust_area(self->frame); /* with new decor, the window's maximized size may change */ client_remaximize(self); } @@ -1386,12 +1385,9 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h, /* move/resize the frame to match the request */ if (self->frame) { - /* Adjust the size and then the position, as required by the EWMH */ - if (resized) - engine_frame_adjust_size(self->frame); - if (moved) { - engine_frame_adjust_position(self->frame); + engine_frame_adjust_area(self->frame); + if (moved) { if (!user || final) { XEvent event; event.type = ConfigureNotify; @@ -1625,7 +1621,8 @@ void client_shade(Client *self, gboolean shade) self->wmstate = shade ? IconicState : NormalState; self->shaded = shade; client_change_state(self); - engine_frame_adjust_size(self->frame); + /* resize the frame to just the titlebar */ + engine_frame_adjust_area(self->frame); } void client_close(Client *self) diff --git a/openbox/engine.c b/openbox/engine.c index b1873abc..23527739 100644 --- a/openbox/engine.c +++ b/openbox/engine.c @@ -42,8 +42,7 @@ static gboolean load(char *name) LOADSYM(frame_new, engine_frame_new); LOADSYM(frame_grab_client, engine_frame_grab_client); LOADSYM(frame_release_client, engine_frame_release_client); - LOADSYM(frame_adjust_size, engine_frame_adjust_size); - LOADSYM(frame_adjust_position, engine_frame_adjust_position); + LOADSYM(frame_adjust_area, engine_frame_adjust_area); LOADSYM(frame_adjust_shape, engine_frame_adjust_shape); LOADSYM(frame_adjust_state, engine_frame_adjust_state); LOADSYM(frame_adjust_focus, engine_frame_adjust_focus); diff --git a/openbox/engine.h b/openbox/engine.h index 067f02fb..a7274253 100644 --- a/openbox/engine.h +++ b/openbox/engine.h @@ -11,8 +11,7 @@ EngineFrameNew *engine_frame_new; EngineFrameGrabClient *engine_frame_grab_client; EngineFrameReleaseClient *engine_frame_release_client; -EngineFrameAdjustSize *engine_frame_adjust_size; -EngineFrameAdjustPosition *engine_frame_adjust_position; +EngineFrameAdjustArea *engine_frame_adjust_area; EngineFrameAdjustShape *engine_frame_adjust_shape; EngineFrameAdjustState *engine_frame_adjust_state; EngineFrameAdjustFocus *engine_frame_adjust_focus; -- 2.45.2