]> Dogcows Code - chaz/openbox/commitdiff
always adjust the frames size and position together, so there is no more weird resizi...
authorDana Jansens <danakj@orodu.net>
Fri, 21 Mar 2003 18:38:08 +0000 (18:38 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 21 Mar 2003 18:38:08 +0000 (18:38 +0000)
engines/engineinterface.h
engines/openbox/openbox.c
openbox/client.c
openbox/engine.c
openbox/engine.h

index 96796eddf27475dec6dfec0f75f2412aa3052be2..917ebd7c6d39124e1046647af0c653759790eeee 100644 (file)
@@ -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);
index c488efbaf4dbef8cd6e8a92591dec74df6dc9c36..06b366168161fc079580d6710aae632d1ecd7506 100644 (file)
@@ -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);
index 0a8dd1c7d2c0aeac27dd593fc8b9293496a9cbf0..6728ef6fa3d436af25ed6eea2ac70f178b4b9e5e 100644 (file)
@@ -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)
index b1873abc9ba939307558a930e920320a11d813c1..235277397ffddafaf287b3557401d6f3853f76a1 100644 (file)
@@ -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);
index 067f02fb7407f7732dac5286242747b7bbbc0a35..a727425333157185743cbb67a17bf948c29fce3f 100644 (file)
@@ -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;
This page took 0.029628 seconds and 4 git commands to generate.