]> Dogcows Code - chaz/openbox/commitdiff
only perform the actions necessary when performing an engine_adjust_area. pass whethe...
authorDana Jansens <danakj@orodu.net>
Mon, 24 Mar 2003 19:52:09 +0000 (19:52 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 24 Mar 2003 19:52:09 +0000 (19:52 +0000)
engines/engineinterface.h
engines/openbox/openbox.c
openbox/client.c
openbox/event.c

index 917ebd7c6d39124e1046647af0c653759790eeee..5b9ec847b196bf81ce68596c7bd98f49ad221ee1 100644 (file)
@@ -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);
index eab6dfb772d535bee5b6f18aba90c2cd5b2ee739..a661931fff1fe9e9eb98da9d9d611cf9d25c3e81 100644 (file)
@@ -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);
index 21c9ac7ab8df5b9b6421a974407ae6ab0d5f9a65..b717b914f561323ee9fd2f5ebe12b161a3ec8757 100644 (file)
@@ -822,7 +822,7 @@ void client_setup_decor_and_functions(Client *self)
     if (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);
+       engine_frame_adjust_area(self->frame, TRUE, TRUE);
        /* with new decor, the window's maximized size may change */
        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 */
     if (self->frame) {
-        engine_frame_adjust_area(self->frame);
+        engine_frame_adjust_area(self->frame, moved, resized);
 
        if (moved) {
            if (!user || final) {
@@ -1630,7 +1630,7 @@ void client_shade(Client *self, gboolean shade)
     self->shaded = shade;
     client_change_state(self);
     /* 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)
index 1844e3f61bdcbe338dd5ac30cdb29ea73c0a686d..4be03d9445d71668f4040175a5a39212a309b0dc 100644 (file)
@@ -275,8 +275,6 @@ void event_process(XEvent *e)
        xwc.sibling = e->xconfigurerequest.above;
        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
           invalid request! */
        xerror_set_ignore(TRUE);
@@ -323,6 +321,7 @@ static void event_handle_client(Client *client, XEvent *e)
 {
     XEvent ce;
     Atom msgtype;
+        int i=0;
      
     switch (e->type) {
     case FocusIn:
@@ -330,10 +329,10 @@ static void event_handle_client(Client *client, XEvent *e)
         client_set_focused(client, e->type == FocusIn);
        break;
     case ConfigureRequest:
-       g_message("ConfigureRequest for window %lx", client->window);
        /* compress these */
        while (XCheckTypedWindowEvent(ob_display, client->window,
                                      ConfigureRequest, &ce)) {
+            ++i;
            /* XXX if this causes bad things.. we can compress config req's
               with the same mask. */
            e->xconfigurerequest.value_mask |=
@@ -352,6 +351,7 @@ static void event_handle_client(Client *client, XEvent *e)
            if (ce.xconfigurerequest.value_mask & CWStackMode)
                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 (client->iconic || client->shaded) return;
This page took 0.034945 seconds and 4 git commands to generate.