Misc redisign github/plugin origin/plugin plugin
authorBenoit Gschwind <doth.gschwind@gmail.com>
Sun, 24 Feb 2008 00:41:45 +0000 (01:41 +0100)
committerBenoit Gschwind <doth.gschwind@gmail.com>
Sun, 24 Feb 2008 00:41:45 +0000 (01:41 +0100)
engines/default/plugin.c
engines/default/plugin.h
engines/default/render.c
openbox/client.c
openbox/client.h
openbox/engine_interface.h
openbox/event.c
openbox/openbox.c
openbox/screen.c

index 1dbebfdbdb5a176485da9d19be7eca99040c7293..591830633938bd11d92695231f9790b0caee3cc6 100644 (file)
@@ -106,64 +106,70 @@ gpointer frame_new(struct _ObClient * client, Window w_client, Window w_frame)
 
     /* create the visible decor windows */
 
-    client_simple_create_window (client, &self->backback, self->window);
-    client_simple_create_window (client, &self->backfront, self->window);
+    client_simple_create_window(client, &self->backback, self->window);
+    client_simple_create_window(client, &self->backfront, self->window);
 
     /* set spesific data */
     mask = CWEventMask;
     attrib.event_mask = ELEMENT_EVENTMASK;
-    
-    client_create_window (client, &self->innerleft, self->window, mask, attrib);
-    client_create_window (client, &self->innertop, self->window, mask, attrib);
-    client_create_window (client, &self->innerright, self->window, mask, attrib);
-    client_create_window (client, &self->innerbottom, self->window, mask, attrib);
-
-    client_create_window (client, &self->innerblb, self->innerbottom, mask, attrib);
-    client_create_window (client, &self->innerbrb, self->innerbottom, mask, attrib);
-    client_create_window (client, &self->innerbll, self->innerleft, mask, attrib);
-    client_create_window (client, &self->innerbrr, self->innerright, mask, attrib);
-
-    client_create_window (client, &self->title, self->window, mask, attrib);
-    client_create_window (client, &self->titleleft, self->window, mask, attrib);
-    client_create_window (client, &self->titletop, self->window, mask, attrib);
-    client_create_window (client, &self->titletopleft, self->window, mask, attrib);
-    client_create_window (client, &self->titletopright, self->window, mask, attrib);
-    client_create_window (client, &self->titleright, self->window, mask, attrib);
-    client_create_window (client, &self->titlebottom, self->window, mask, attrib);
-    
-    client_create_window (client, &self->topresize, self->title, mask, attrib);
-    client_create_window (client, &self->tltresize, self->title, mask, attrib);
-    client_create_window (client, &self->tllresize, self->title, mask, attrib);
-    client_create_window (client, &self->trtresize, self->title, mask, attrib);
-    client_create_window (client, &self->trrresize, self->title, mask, attrib);
-    
-    client_create_window (client, &self->left, self->window, mask, attrib);
-    client_create_window (client, &self->right, self->window, mask, attrib);   
-
-    client_create_window (client, &self->label, self->title, mask, attrib);
-    client_create_window (client, &self->max, self->title, mask, attrib);
-    client_create_window (client, &self->close, self->title, mask, attrib);
-    client_create_window (client, &self->desk, self->title, mask, attrib);
-    client_create_window (client, &self->shade, self->title, mask, attrib);
-    client_create_window (client, &self->icon, self->title, mask, attrib);
-    client_create_window (client, &self->iconify, self->title, mask, attrib);
-    
-    client_create_window (client, &self->handle, self->window, mask, attrib);
-    
-    client_create_window (client, &self->lgrip, self->handle, mask, attrib);
-    client_create_window (client, &self->rgrip, self->handle, mask, attrib);
-
-    client_create_window (client, &self->handleleft, self->handle, mask, attrib);
-    client_create_window (client, &self->handleright, self->handle, mask, attrib);
-    
-    client_create_window (client, &self->handletop, self->window, mask, attrib);
-    client_create_window (client, &self->handlebottom, self->window, mask, attrib);
-    client_create_window (client, &self->lgripleft, self->window, mask, attrib);
-    client_create_window (client, &self->lgriptop, self->window, mask, attrib);
-    client_create_window (client, &self->lgripbottom, self->window, mask, attrib);
-    client_create_window (client, &self->rgripright, self->window, mask, attrib);
-    client_create_window (client, &self->rgriptop, self->window, mask, attrib);
-    client_create_window (client, &self->rgripbottom, self->window, mask, attrib);
+
+    client_create_window(client, &self->innerleft, self->window, mask, attrib);
+    client_create_window(client, &self->innertop, self->window, mask, attrib);
+    client_create_window(client, &self->innerright, self->window, mask, attrib);
+    client_create_window(client, &self->innerbottom, self->window, mask, attrib);
+
+    client_create_window(client, &self->innerblb, self->innerbottom, mask,
+            attrib);
+    client_create_window(client, &self->innerbrb, self->innerbottom, mask,
+            attrib);
+    client_create_window(client, &self->innerbll, self->innerleft, mask, attrib);
+    client_create_window(client, &self->innerbrr, self->innerright, mask,
+            attrib);
+
+    client_create_window(client, &self->title, self->window, mask, attrib);
+    client_create_window(client, &self->titleleft, self->window, mask, attrib);
+    client_create_window(client, &self->titletop, self->window, mask, attrib);
+    client_create_window(client, &self->titletopleft, self->window, mask,
+            attrib);
+    client_create_window(client, &self->titletopright, self->window, mask,
+            attrib);
+    client_create_window(client, &self->titleright, self->window, mask, attrib);
+    client_create_window(client, &self->titlebottom, self->window, mask, attrib);
+
+    client_create_window(client, &self->topresize, self->title, mask, attrib);
+    client_create_window(client, &self->tltresize, self->title, mask, attrib);
+    client_create_window(client, &self->tllresize, self->title, mask, attrib);
+    client_create_window(client, &self->trtresize, self->title, mask, attrib);
+    client_create_window(client, &self->trrresize, self->title, mask, attrib);
+
+    client_create_window(client, &self->left, self->window, mask, attrib);
+    client_create_window(client, &self->right, self->window, mask, attrib);
+
+    client_create_window(client, &self->label, self->title, mask, attrib);
+    client_create_window(client, &self->max, self->title, mask, attrib);
+    client_create_window(client, &self->close, self->title, mask, attrib);
+    client_create_window(client, &self->desk, self->title, mask, attrib);
+    client_create_window(client, &self->shade, self->title, mask, attrib);
+    client_create_window(client, &self->icon, self->title, mask, attrib);
+    client_create_window(client, &self->iconify, self->title, mask, attrib);
+
+    client_create_window(client, &self->handle, self->window, mask, attrib);
+
+    client_create_window(client, &self->lgrip, self->handle, mask, attrib);
+    client_create_window(client, &self->rgrip, self->handle, mask, attrib);
+
+    client_create_window(client, &self->handleleft, self->handle, mask, attrib);
+    client_create_window(client, &self->handleright, self->handle, mask, attrib);
+
+    client_create_window(client, &self->handletop, self->window, mask, attrib);
+    client_create_window(client, &self->handlebottom, self->window, mask,
+            attrib);
+    client_create_window(client, &self->lgripleft, self->window, mask, attrib);
+    client_create_window(client, &self->lgriptop, self->window, mask, attrib);
+    client_create_window(client, &self->lgripbottom, self->window, mask, attrib);
+    client_create_window(client, &self->rgripright, self->window, mask, attrib);
+    client_create_window(client, &self->rgriptop, self->window, mask, attrib);
+    client_create_window(client, &self->rgripbottom, self->window, mask, attrib);
 
     self->stitle = g_strdup("");
     self->focused = FALSE;
@@ -275,7 +281,7 @@ void frame_adjust_shape(gpointer _self)
         {
             xrect[0].x = 0;
             xrect[0].y = 0;
-            xrect[0].width = self->area.width;
+            xrect[0].width = self->window_area.width;
             xrect[0].height = self->size.top;
             ++num;
         }
@@ -285,7 +291,7 @@ void frame_adjust_shape(gpointer _self)
         {
             xrect[1].x = 0;
             xrect[1].y = FRAME_HANDLE_Y(self);
-            xrect[1].width = self->area.width;
+            xrect[1].width = self->window_area.width;
             xrect[1].height = theme_config.handle_height +
             self->bwidth * 2;
             ++num;
@@ -348,7 +354,6 @@ void frame_ungrab(gpointer _self, GHashTable * window_map)
     g_hash_table_remove(window_map, &self->rgripright);
     g_hash_table_remove(window_map, &self->rgriptop);
     g_hash_table_remove(window_map, &self->rgripbottom);
-    
 
 }
 
@@ -380,10 +385,11 @@ ObFrameContext frame_context(gpointer _self, Window win, gint x, gint y)
             fx += theme_config.grip_width + self->bwidth;
         /* titletopright is way to the right edge */
         else if (win == self->titletopright)
-            fx += self->area.width - (theme_config.grip_width + self->bwidth);
+            fx += self->window_area.width - (theme_config.grip_width
+                    + self->bwidth);
         /* titleright is even more way to the right edge */
         else if (win == self->titleright)
-            fx += self->area.width - self->bwidth;
+            fx += self->window_area.width - self->bwidth;
 
         /* figure out if we're over the area that should be considered a
          button */
@@ -394,7 +400,7 @@ ObFrameContext frame_context(gpointer _self, Window win, gint x, gint y)
                 if (self->leftmost != OB_FRAME_CONTEXT_NONE)
                     return self->leftmost;
             }
-            else if (fx >= (self->area.width - (self->bwidth
+            else if (fx >= (self->window_area.width - (self->bwidth
                     + theme_config.paddingx + 1 + theme_config.button_size))) {
                 if (self->rightmost != OB_FRAME_CONTEXT_NONE)
                     return self->rightmost;
@@ -532,28 +538,514 @@ void frame_set_decorations(gpointer self, ObFrameDecorations d)
 
 void frame_get_window_area(gpointer self, Rect * r)
 {
-    /* *r = (OBDEFAULTFRAME(self)->area) ??? */ 
-    memcpy(r, &(OBDEFAULTFRAME(self)->area), sizeof(Rect));
+    /* *r = (OBDEFAULTFRAME(self)->area) ??? */
+    memcpy(r, &(OBDEFAULTFRAME(self)->window_area), sizeof(Rect));
 }
 void frame_set_client_area(gpointer self, Rect r)
 {
-    OBDEFAULTFRAME(self)->client_area = r;
+    //OBDEFAULTFRAME(self)->client_area = r;
+}
+
+void frame_compute_layout (ObDefaultFrame * self)
+{
+    if (self->decorations & OB_FRAME_DECOR_BORDER || config_theme_keepborder) {
+        self->bwidth = theme_config.fbwidth;
+    }
+    else {
+        self->bwidth = 0;
+    }
+
+    if (self->decorations & OB_FRAME_DECOR_BORDER) {
+        self->cbwidth_l = theme_config.cbwidthx;
+        self->cbwidth_r = theme_config.cbwidthx;
+        self->cbwidth_t = theme_config.cbwidthy;
+        self->cbwidth_b = theme_config.cbwidthy;
+    }
+    else {
+        self->cbwidth_l = 0;
+        self->cbwidth_t = 0;
+        self->cbwidth_r = 0;
+        self->cbwidth_b = 0;
+    }
+
+    if (self->max_horz) {
+        self->cbwidth_l = 0;
+        self->cbwidth_r = 0;
+        self->width = self->client_area.width;
+        if (self->max_vert)
+            self->cbwidth_b = 0;
+    }
+    else {
+        self->width = self->client_area.width + self->cbwidth_l
+                + self->cbwidth_r;
+    }
+
+    /* some elements are sized based of the width, so don't let them have
+     negative values */
+    self->width = MAX(self->width, (theme_config.grip_width + self->bwidth) * 2
+            + 1);
+
+    /* set boders */
+    STRUT_SET(self->size, self->cbwidth_l
+            + (!self->max_horz ? self->bwidth : 0), self->cbwidth_t
+            + self->bwidth, self->cbwidth_r + (!self->max_horz ? self->bwidth
+            : 0), self->cbwidth_b
+            + (!self->max_horz || !self->max_vert ? self->bwidth : 0));
+
+    /* ajust it */
+    if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
+        self->size.top += theme_config.title_height + self->bwidth;
+    if (self->decorations & OB_FRAME_DECOR_HANDLE && theme_config.handle_height
+            > 0) {
+        self->size.bottom += theme_config.handle_height + self->bwidth;
+    }
+
+    /* shading can change without being moved or resized */
+    RECT_SET_SIZE(self->window_area, self->client_area.width + self->size.left
+            + self->size.right, (self->shaded ? theme_config.title_height
+            + self->bwidth * 2 : self->client_area.height + self->size.top
+            + self->size.bottom));
+
+}
+
+void frame_fake_update_layout(gpointer _self, Rect area)
+{
+    ObDefaultFrame * self = (ObDefaultFrame *) _self;
+    if ((area.height != self->client_area.height)
+    || (area.width != self->client_area.width))
+    {
+        self->need_update = TRUE;
+        frame_compute_layout(self);
+    }
 }
 
-void frame_update_layout(gpointer _self, Rect area, gboolean is_resize, gboolean is_fake)
+void frame_render(gpointer _self, Rect area)
 {
     ObDefaultFrame * self = (ObDefaultFrame *) _self;
     Strut oldsize;
+    oldsize = self->size;
+
+    if ((area.height != self->client_area.height)
+    || (area.width != self->client_area.width))
+    {
+        self->need_update = TRUE;
+    }
+    /* we don't move anything */
+    gboolean is_move = area.x != self->client_area.x || area.y
+            != self->client_area.y;
+
+    self->client_area = area;
+    self->window_area = self->client_area;
+
+    /* do this before changing the frame's status like max_horz max_vert */
+    frame_adjust_cursors(self);
+
+    /* if we move or resize */
+    if (TRUE) {
+        frame_compute_layout(self);
+
+        /* position/size and map/unmap all the windows */
+        gint innercornerheight = theme_config.grip_width - self->size.bottom;
+
+        if (self->cbwidth_l) {
+            XMoveResizeWindow(obp_display, self->innerleft, self->size.left
+                    - self->cbwidth_l, self->size.top, self->cbwidth_l,
+                    self->client_area.height);
+
+            XMapWindow(obp_display, self->innerleft);
+        }
+        else
+            XUnmapWindow(obp_display, self->innerleft);
+
+        if (self->cbwidth_l && innercornerheight > 0) {
+            XMoveResizeWindow(obp_display, self->innerbll, 0,
+                    self->client_area.height - (theme_config.grip_width
+                            - self->size.bottom), self->cbwidth_l,
+                    theme_config.grip_width - self->size.bottom);
+
+            XMapWindow(obp_display, self->innerbll);
+        }
+        else
+            XUnmapWindow(obp_display, self->innerbll);
+
+        if (self->cbwidth_r) {
+            XMoveResizeWindow(obp_display, self->innerright, self->size.left
+                    + self->client_area.width, self->size.top, self->cbwidth_r,
+                    self->client_area.height);
+
+            XMapWindow(obp_display, self->innerright);
+        }
+        else
+            XUnmapWindow(obp_display, self->innerright);
+
+        if (self->cbwidth_r && innercornerheight > 0) {
+            XMoveResizeWindow(obp_display, self->innerbrr, 0,
+                    self->client_area.height - (theme_config.grip_width
+                            - self->size.bottom), self->cbwidth_r,
+                    theme_config.grip_width - self->size.bottom);
+
+            XMapWindow(obp_display, self->innerbrr);
+        }
+        else
+            XUnmapWindow(obp_display, self->innerbrr);
+
+        if (self->cbwidth_t) {
+            XMoveResizeWindow(
+                    obp_display,
+                    self->innertop,
+                    self->size.left - self->cbwidth_l,
+                    self->size.top - self->cbwidth_t,
+                    self->client_area.width + self->cbwidth_l + self->cbwidth_r,
+                    self->cbwidth_t);
+
+            XMapWindow(obp_display, self->innertop);
+        }
+        else
+            XUnmapWindow(obp_display, self->innertop);
+
+        if (self->cbwidth_b) {
+            XMoveResizeWindow(obp_display, self->innerbottom, self->size.left
+                    - self->cbwidth_l, self->size.top
+                    + self->client_area.height, self->client_area.width
+                    + self->cbwidth_l + self->cbwidth_r, self->cbwidth_b);
+
+            XMoveResizeWindow(obp_display, self->innerblb, 0, 0,
+                    theme_config.grip_width + self->bwidth, self->cbwidth_b);
+            XMoveResizeWindow(obp_display, self->innerbrb,
+                    self->client_area.width + self->cbwidth_l + self->cbwidth_r
+                            - (theme_config.grip_width + self->bwidth), 0,
+                    theme_config.grip_width + self->bwidth, self->cbwidth_b);
+
+            XMapWindow(obp_display, self->innerbottom);
+            XMapWindow(obp_display, self->innerblb);
+            XMapWindow(obp_display, self->innerbrb);
+        }
+        else {
+            XUnmapWindow(obp_display, self->innerbottom);
+            XUnmapWindow(obp_display, self->innerblb);
+            XUnmapWindow(obp_display, self->innerbrb);
+        }
+
+        if (self->bwidth) {
+            gint titlesides;
+
+            /* height of titleleft and titleright */
+            titlesides = (!self->max_horz ? theme_config.grip_width : 0);
+
+            XMoveResizeWindow(obp_display, self->titletop,
+                    theme_config.grip_width + self->bwidth, 0,
+                    /* width + bwidth*2 - bwidth*2 - grips*2 */
+                    self->width - theme_config.grip_width * 2, self->bwidth);
+            XMoveResizeWindow(obp_display, self->titletopleft, 0, 0,
+                    theme_config.grip_width + self->bwidth, self->bwidth);
+            XMoveResizeWindow(obp_display, self->titletopright,
+                    self->client_area.width + self->size.left
+                            + self->size.right - theme_config.grip_width
+                            - self->bwidth, 0, theme_config.grip_width
+                            + self->bwidth, self->bwidth);
+
+            if (titlesides > 0) {
+                XMoveResizeWindow(obp_display, self->titleleft, 0,
+                        self->bwidth, self->bwidth, titlesides);
+                XMoveResizeWindow(obp_display, self->titleright,
+                        self->client_area.width + self->size.left
+                                + self->size.right - self->bwidth,
+                        self->bwidth, self->bwidth, titlesides);
+
+                XMapWindow(obp_display, self->titleleft);
+                XMapWindow(obp_display, self->titleright);
+            }
+            else {
+                XUnmapWindow(obp_display, self->titleleft);
+                XUnmapWindow(obp_display, self->titleright);
+            }
+
+            XMapWindow(obp_display, self->titletop);
+            XMapWindow(obp_display, self->titletopleft);
+            XMapWindow(obp_display, self->titletopright);
+
+            if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
+                XMoveResizeWindow(obp_display, self->titlebottom,
+                        (self->max_horz ? 0 : self->bwidth),
+                        theme_config.title_height + self->bwidth, self->width,
+                        self->bwidth);
+
+                XMapWindow(obp_display, self->titlebottom);
+            }
+            else
+                XUnmapWindow(obp_display, self->titlebottom);
+        }
+        else {
+            XUnmapWindow(obp_display, self->titlebottom);
+
+            XUnmapWindow(obp_display, self->titletop);
+            XUnmapWindow(obp_display, self->titletopleft);
+            XUnmapWindow(obp_display, self->titletopright);
+            XUnmapWindow(obp_display, self->titleleft);
+            XUnmapWindow(obp_display, self->titleright);
+        }
+
+        if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
+            XMoveResizeWindow(obp_display, self->title, (self->max_horz ? 0
+                    : self->bwidth), self->bwidth, self->width,
+                    theme_config.title_height);
+
+            XMapWindow(obp_display, self->title);
+
+            if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+                XMoveResizeWindow(obp_display, self->topresize,
+                        theme_config.grip_width, 0, self->width
+                                - theme_config.grip_width *2,
+                        theme_config.paddingy + 1);
+
+                XMoveWindow(obp_display, self->tltresize, 0, 0);
+                XMoveWindow(obp_display, self->tllresize, 0, 0);
+                XMoveWindow(obp_display, self->trtresize, self->width
+                        - theme_config.grip_width, 0);
+                XMoveWindow(obp_display, self->trrresize, self->width
+                        - theme_config.paddingx - 1, 0);
+
+                XMapWindow(obp_display, self->topresize);
+                XMapWindow(obp_display, self->tltresize);
+                XMapWindow(obp_display, self->tllresize);
+                XMapWindow(obp_display, self->trtresize);
+                XMapWindow(obp_display, self->trrresize);
+            }
+            else {
+                XUnmapWindow(obp_display, self->topresize);
+                XUnmapWindow(obp_display, self->tltresize);
+                XUnmapWindow(obp_display, self->tllresize);
+                XUnmapWindow(obp_display, self->trtresize);
+                XUnmapWindow(obp_display, self->trrresize);
+            }
+        }
+        else
+            XUnmapWindow(obp_display, self->title);
+
+        if ((self->decorations & OB_FRAME_DECOR_TITLEBAR))
+            /* layout the title bar elements */
+            layout_title(self);
+
+        gint sidebwidth = self->max_horz ? 0 : self->bwidth;
+
+        if (self->bwidth && self->size.bottom) {
+            XMoveResizeWindow(obp_display, self->handlebottom,
+                    theme_config.grip_width + self->bwidth + sidebwidth,
+                    self->size.top + self->client_area.height
+                            + self->size.bottom - self->bwidth, self->width
+                            - (theme_config.grip_width + sidebwidth) * 2,
+                    self->bwidth);
+
+            if (sidebwidth) {
+                XMoveResizeWindow(obp_display, self->lgripleft, 0,
+                        self->size.top + self->client_area.height
+                                + self->size.bottom
+                                - (!self->max_horz ? theme_config.grip_width
+                                        : self->size.bottom - self->cbwidth_b),
+                        self->bwidth,
+                        (!self->max_horz ? theme_config.grip_width
+                                : self->size.bottom - self->cbwidth_b));
+                XMoveResizeWindow(obp_display, self->rgripright,
+                        self->size.left + self->client_area.width
+                                + self->size.right - self->bwidth,
+                        self->size.top + self->client_area.height
+                                + self->size.bottom
+                                - (!self->max_horz ? theme_config.grip_width
+                                        : self->size.bottom - self->cbwidth_b),
+                        self->bwidth,
+                        (!self->max_horz ? theme_config.grip_width
+                                : self->size.bottom - self->cbwidth_b));
+
+                XMapWindow(obp_display, self->lgripleft);
+                XMapWindow(obp_display, self->rgripright);
+            }
+            else {
+                XUnmapWindow(obp_display, self->lgripleft);
+                XUnmapWindow(obp_display, self->rgripright);
+            }
+
+            XMoveResizeWindow(obp_display, self->lgripbottom, sidebwidth,
+                    self->size.top + self->client_area.height
+                            + self->size.bottom - self->bwidth,
+                    theme_config.grip_width + self->bwidth, self->bwidth);
+            XMoveResizeWindow(obp_display, self->rgripbottom, self->size.left
+                    + self->client_area.width + self->size.right - self->bwidth
+                    - sidebwidth - theme_config.grip_width, self->size.top
+                    + self->client_area.height + self->size.bottom
+                    - self->bwidth, theme_config.grip_width + self->bwidth,
+                    self->bwidth);
+
+            XMapWindow(obp_display, self->handlebottom);
+            XMapWindow(obp_display, self->lgripbottom);
+            XMapWindow(obp_display, self->rgripbottom);
+
+            if (self->decorations & OB_FRAME_DECOR_HANDLE
+                    && theme_config.handle_height > 0) {
+                XMoveResizeWindow(obp_display, self->handletop,
+                        theme_config.grip_width + self->bwidth + sidebwidth, 
+                        FRAME_HANDLE_Y(self), self->width - (theme_config.grip_width
+                                + sidebwidth) * 2, self->bwidth);
+                XMapWindow(obp_display, self->handletop);
+
+                if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+                    XMoveResizeWindow(obp_display, self->handleleft,
+                            theme_config.grip_width, 0, self->bwidth,
+                            theme_config.handle_height);
+                    XMoveResizeWindow(obp_display, self->handleright,
+                            self->width - theme_config.grip_width
+                                    - self->bwidth, 0, self->bwidth,
+                            theme_config.handle_height);
+
+                    XMoveResizeWindow(obp_display, self->lgriptop, sidebwidth, 
+                    FRAME_HANDLE_Y(self), theme_config.grip_width + self->bwidth,
+                            self->bwidth);
+                    XMoveResizeWindow(obp_display, self->rgriptop,
+                            self->size.left + self->client_area.width
+                                    + self->size.right - self->bwidth
+                                    - sidebwidth - theme_config.grip_width, 
+                            FRAME_HANDLE_Y(self), theme_config.grip_width
+                                    + self->bwidth, self->bwidth);
+
+                    XMapWindow(obp_display, self->handleleft);
+                    XMapWindow(obp_display, self->handleright);
+                    XMapWindow(obp_display, self->lgriptop);
+                    XMapWindow(obp_display, self->rgriptop);
+                }
+                else {
+                    XUnmapWindow(obp_display, self->handleleft);
+                    XUnmapWindow(obp_display, self->handleright);
+                    XUnmapWindow(obp_display, self->lgriptop);
+                    XUnmapWindow(obp_display, self->rgriptop);
+                }
+            }
+            else {
+                XUnmapWindow(obp_display, self->handleleft);
+                XUnmapWindow(obp_display, self->handleright);
+                XUnmapWindow(obp_display, self->lgriptop);
+                XUnmapWindow(obp_display, self->rgriptop);
+
+                XUnmapWindow(obp_display, self->handletop);
+            }
+        }
+        else {
+            XUnmapWindow(obp_display, self->handleleft);
+            XUnmapWindow(obp_display, self->handleright);
+            XUnmapWindow(obp_display, self->lgriptop);
+            XUnmapWindow(obp_display, self->rgriptop);
+
+            XUnmapWindow(obp_display, self->handletop);
+
+            XUnmapWindow(obp_display, self->handlebottom);
+            XUnmapWindow(obp_display, self->lgripleft);
+            XUnmapWindow(obp_display, self->rgripright);
+            XUnmapWindow(obp_display, self->lgripbottom);
+            XUnmapWindow(obp_display, self->rgripbottom);
+        }
+
+        if (self->decorations & OB_FRAME_DECOR_HANDLE
+                && theme_config.handle_height > 0) {
+            XMoveResizeWindow(obp_display, self->handle, sidebwidth, 
+            FRAME_HANDLE_Y(self) + self->bwidth, self->width,
+                    theme_config.handle_height);
+            XMapWindow(obp_display, self->handle);
+
+            if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+                XMoveResizeWindow(obp_display, self->lgrip, 0, 0,
+                        theme_config.grip_width, theme_config.handle_height);
+                XMoveResizeWindow(obp_display, self->rgrip, self->width
+                        - theme_config.grip_width, 0, theme_config.grip_width,
+                        theme_config.handle_height);
+
+                XMapWindow(obp_display, self->lgrip);
+                XMapWindow(obp_display, self->rgrip);
+            }
+            else {
+                XUnmapWindow(obp_display, self->lgrip);
+                XUnmapWindow(obp_display, self->rgrip);
+            }
+        }
+        else {
+            XUnmapWindow(obp_display, self->lgrip);
+            XUnmapWindow(obp_display, self->rgrip);
+
+            XUnmapWindow(obp_display, self->handle);
+        }
+
+        if (self->bwidth && !self->max_horz && (self->client_area.height
+                + self->size.top + self->size.bottom) > theme_config.grip_width
+                * 2) {
+            XMoveResizeWindow(obp_display, self->left, 0, self->bwidth
+                    + theme_config.grip_width, self->bwidth,
+                    self->client_area.height + self->size.top
+                            + self->size.bottom - theme_config.grip_width * 2);
+
+            XMapWindow(obp_display, self->left);
+        }
+        else
+            XUnmapWindow(obp_display, self->left);
+
+        if (self->bwidth && !self->max_horz && (self->client_area.height
+                + self->size.top + self->size.bottom) > theme_config.grip_width
+                * 2) {
+            XMoveResizeWindow(obp_display, self->right, self->client_area.width
+                    + self->cbwidth_l + self->cbwidth_r + self->bwidth,
+                    self->bwidth + theme_config.grip_width, self->bwidth,
+                    self->client_area.height + self->size.top
+                            + self->size.bottom - theme_config.grip_width * 2);
+
+            XMapWindow(obp_display, self->right);
+        }
+        else
+            XUnmapWindow(obp_display, self->right);
+
+        XMoveResizeWindow(obp_display, self->backback, self->size.left,
+                self->size.top, self->client_area.width,
+                self->client_area.height);
 
+        /* move and resize the top level frame.
+         shading can change without being moved or resized.
+         but don't do this during an iconify animation. it will be
+         reflected afterwards.
+         */
+        /*XResizeWindow(obp_display, self->window, self->window_area.width,
+                self->window_area.height);*/
+
+        frame_update_skin(self);
+        frame_adjust_shape(self);
+
+        if (!STRUT_EQUAL(self->size, oldsize)) {
+            gulong vals[4];
+            vals[0] = self->size.left;
+            vals[1] = self->size.right;
+            vals[2] = self->size.top;
+            vals[3] = self->size.bottom;
+            OBT_PROP_SETA32(self->client->w_client, NET_FRAME_EXTENTS,
+                    CARDINAL, vals, 4);
+            OBT_PROP_SETA32(self->client->w_client, KDE_NET_WM_FRAME_STRUT,
+                    CARDINAL, vals, 4);
+        }
+
+        if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
+            XResizeWindow(obp_display, self->label, self->label_width,
+                    theme_config.label_height);
+
+        self->need_update = FALSE;
+    }
+}
+
+void frame_update_layout(gpointer _self, Rect area, gboolean is_resize,
+        gboolean is_fake)
+{
+    ObDefaultFrame * self = (ObDefaultFrame *) _self;
+    Strut oldsize;
     oldsize = self->size;
     self->client_area = area;
-    self->area = self->client_area;
+    self->window_area = self->client_area;
 
     /* do this before changing the frame's status like max_horz max_vert */
     frame_adjust_cursors(self);
 
-    if (self->decorations & OB_FRAME_DECOR_BORDER
-            || (config_theme_keepborder)) {
+    if (self->decorations & OB_FRAME_DECOR_BORDER || (config_theme_keepborder)) {
         self->bwidth = theme_config.fbwidth;
     }
     else {
@@ -966,7 +1458,7 @@ void frame_update_layout(gpointer _self, Rect area, gboolean is_resize, gboolean
     }
 
     /* shading can change without being moved or resized */
-    RECT_SET_SIZE(self->area, self->client_area.width + self->size.left
+    RECT_SET_SIZE(self->window_area, self->client_area.width + self->size.left
             + self->size.right, (self->shaded ? theme_config.title_height
             + self->bwidth * 2 : self->client_area.height + self->size.top
             + self->size.bottom));
@@ -974,9 +1466,9 @@ void frame_update_layout(gpointer _self, Rect area, gboolean is_resize, gboolean
     if ((is_resize) && !is_fake) {
         /* find the new coordinates, done after setting the frame.size, for
          frame_client_gravity. */
-        self->area.x = self->client_area.x;
-        self->area.y = self->client_area.y;
-        frame_client_gravity(OBDEFAULTFRAME(_self)->client, &self->area.x, &self->area.y);
+        self->window_area.x = self->client_area.x;
+        self->window_area.y = self->client_area.y;
+        frame_client_gravity(OBDEFAULTFRAME(_self)->client, &self->window_area.x, &self->window_area.y);
     }
 
     if (!is_fake) {
@@ -985,8 +1477,9 @@ void frame_update_layout(gpointer _self, Rect area, gboolean is_resize, gboolean
          but don't do this during an iconify animation. it will be
          reflected afterwards.
          */
-        XMoveResizeWindow(obp_display, self->window, self->area.x,
-                self->area.y, self->area.width, self->area.height);
+        XMoveResizeWindow(obp_display, self->window, self->window_area.x,
+                self->window_area.y, self->window_area.width,
+                self->window_area.height);
 
         if (is_resize) {
             //frame_update_skin(self);
@@ -1223,8 +1716,7 @@ void layout_title(ObDefaultFrame * self)
         }
         else {
             x = right;
-            lc = config_title_layout
-                    + strlen(config_title_layout)-1;
+            lc = config_title_layout + strlen(config_title_layout)-1;
             firstcon = &self->rightmost;
         }
 
@@ -1477,11 +1969,10 @@ if(!call_trigger_func)
 }
 }
 
-ObFrameEngine engine = {
-        0, /* gpointer handler */
-        "libdefault.la", /* gchar * filename */
-        "Default", /* gchar * name */
-        init, //gint (*init) (Display * display, gint screen);
+ObFrameEngine engine = { 0, /* gpointer handler */
+"libdefault.la", /* gchar * filename */
+"Default", /* gchar * name */
+init, //gint (*init) (Display * display, gint screen);
         0, /* */
         frame_new, //gpointer (*frame_new) (struct _ObClient *c);
         frame_free, //void (*frame_free) (gpointer self);
@@ -1501,6 +1992,8 @@ ObFrameEngine engine = {
         frame_get_window_area, /* */
         frame_set_client_area, /* */
         /* Draw the frame */
+        frame_fake_update_layout, /* */
+        frame_render, /* */
         frame_update_layout, /* */
         frame_update_skin, /* */
         frame_set_hover_flag, /* */
index 13f817bb4b3ca3de41bca90fe2e896aca8f46e55..10c59ef2adfd9acd4e2785df8cb45ad86f0171b5 100644 (file)
@@ -44,9 +44,10 @@ struct _ObDefaultFrame
     guint decorations;
 
     Strut size;
-    Rect area;
-    Rect client_area;
 
+    Rect client_area;
+    Rect window_area;
+    
     gint bwidth;
 
     ObFrameButton hover_flag;
@@ -148,6 +149,8 @@ struct _ObDefaultFrame
     gboolean need_render;
 
     GTimeVal iconify_animation_end;
+    
+    gboolean need_update;
 
 };
 
@@ -173,6 +176,8 @@ void frame_set_is_max_vert(gpointer, gboolean);
 void frame_set_is_max_horz(gpointer, gboolean);
 void frame_set_is_shaded(gpointer, gboolean);
 
+void frame_fake_update_layout(gpointer, Rect);
+void frame_render(gpointer, Rect);
 void frame_update_layout(gpointer, Rect, gboolean, gboolean);
 void frame_adjust_client_area(gpointer self);
 void frame_adjust_state(gpointer self);
index e1f826c4a3ef3a13a08c59c2d72f694c7985b448..26e8091fd88861795767a9cb33a17b102fbbe1e8 100644 (file)
@@ -309,7 +309,6 @@ void frame_update_skin(gpointer _self)
         }
     }
 
-    XFlush(obp_display);
 }
 
 static void framerender_label(ObDefaultFrame *self, RrAppearance *a)
index 2a9cf49961da2a19b192b264e170861f1c304b3e..4826532ab5b13796ed8c092aa4fc63392b62af97 100644 (file)
@@ -250,11 +250,12 @@ void client_manage(Window window, ObPrompt *prompt)
         XChangeSaveSet(obt_display, window, SetModeInsert);
 
     /* create decorations */
-    client_simple_create_window (self, &self->w_frame, RootWindow(obt_display, ob_screen));
+    client_simple_create_window(self, &self->w_frame, RootWindow(obt_display, ob_screen));
+    
     self->frame = frame_engine.frame_new(self, self->w_client, self->w_frame);
     /* reparent the client to the frame */
     XReparentWindow(obt_display, self->w_client, self->w_frame, 0, 0);
-
+        
     /*
      When reparenting the client window, it is usually not mapped yet, since
      this occurs from a MapRequest. However, in the case where Openbox is
@@ -268,7 +269,7 @@ void client_manage(Window window, ObPrompt *prompt)
      req's) the ButtonPress is to catch clicks on the client border */
     XSelectInput(obt_display, self->w_frame, FRAME_EVENTMASK);
 
-    frame_engine.frame_grab(self->frame, window_map);
+    //frame_engine.frame_grab(self->frame, window_map);
 
     /* we've grabbed everything and set everything that we need to at mapping
      time now */
@@ -316,8 +317,7 @@ void client_manage(Window window, ObPrompt *prompt)
     frame_engine.frame_set_is_focus(self->frame, FALSE);
     frame_engine.frame_set_decorations(self->frame, self->decorations);
     frame_engine.frame_update_title(self->frame, self->title);
-    frame_engine.frame_update_layout(self->frame, self->area, FALSE, TRUE);
-    //frame_engine->frame_update_skin (self->frame);
+    frame_engine.frame_fake_update_layout(self->frame, self->area);
 
     /* where the frame was placed is where the window was originally */
     place = self->area;
@@ -609,12 +609,12 @@ ObClient *client_fake_manage(Window window)
     self->frame = frame_engine.frame_new(self, self->w_client, self->w_frame);
     frame_engine.frame_set_decorations(self->frame, self->decorations);
     frame_engine.frame_update_title(self->frame, self->title);
-    frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+    frame_engine.frame_render(self->frame, self->area);
     /* if this occurs while we are focus cycling, the indicator needs to
      match the changes */
     if (focus_cycle_target == self)
         focus_cycle_draw_indicator(self);
-    frame_engine.frame_update_skin(self->frame);
+    //frame_engine.frame_update_skin(self->frame);
 
     Strut size;
     frame_engine.frame_get_size(self->frame, &size);
@@ -1997,7 +1997,7 @@ void client_update_title(ObClient *self)
     if (self->frame) {
         /* update title render */
         frame_engine.frame_update_title(self->frame, self->title);
-        frame_engine.frame_update_skin(self->frame);
+        //frame_engine.frame_update_skin(self->frame);
     }
 
     /* update the icon title */
@@ -2395,14 +2395,14 @@ static void client_change_state(ObClient *self)
     if (self->undecorated)
         netstate[num++] = OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED);
     OBT_PROP_SETA32(self->w_client, NET_WM_STATE, ATOM, netstate, num);
-
+/*
     if (self->frame) {
-        frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+        frame_engine.frame_render(self->frame, self->area);*/
         /* if this occurs while we are focus cycling, the indicator needs to
          match the changes */
-        if (focus_cycle_target == self)
+    /*    if (focus_cycle_target == self)
             focus_cycle_draw_indicator(self);
-    }
+    }*/
 }
 
 ObClient *client_search_focus_tree(ObClient *self)
@@ -2717,7 +2717,7 @@ static void client_apply_startup_state(ObClient *self, gint x, gint y, gint w,
     /* save the area, and make it where it should be for the premax stuff */
     oldarea = self->area;
     RECT_SET(self->area, x, y, w, h);
-    frame_engine.frame_set_client_area(self->frame, self->area);
+    frame_engine.frame_fake_update_layout (self->frame, self->area);
 
     /* apply the states. these are in a carefully crafted order.. */
 
@@ -2751,11 +2751,12 @@ static void client_apply_startup_state(ObClient *self, gint x, gint y, gint w,
      */
     self->area = oldarea;
     frame_engine.frame_set_decorations(self->frame, self->decorations);
-    frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+    frame_engine.frame_render(self->frame, self->area);
     /* when the client has StaticGravity, it likes to move around.
      also this correctly positions the client when it maps.
      this also needs to be run when the frame's decorations sizes change!
      */
+    client_move_frame (self);
     Strut size;
     frame_engine.frame_get_size(self->frame, &size);
     XMoveResizeWindow(obt_display, self->w_client, size.left, size.top,
@@ -2840,13 +2841,18 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h,
         gint *logicalw, gint *logicalh, gboolean user)
 {
     Rect desired = { *x, *y, *w, *h };
+    Strut extends_size;
+
+    frame_engine.frame_get_size(self->frame, &extends_size);
+    
+    /* Here we get the desired frame rect from the desired size of client */
     frame_rect_to_frame(self, &desired);
 
     /* make the frame recalculate its dimentions n shit without changing
      anything visible for real, this way the constraints below can work with
      the updated frame dimensions. */
-    frame_engine.frame_set_decorations(self->frame, self->decorations);
-    frame_engine.frame_update_layout(self->frame, self->area, FALSE, TRUE);
+    //frame_engine.frame_set_decorations(self->frame, self->decorations);
+    //frame_engine.frame_fake_update_layout(self->frame, self->area);
 
     /* gets the frame's position */
     frame_client_gravity(self, x, y);
@@ -2855,6 +2861,7 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h,
 
     /* set the size and position if fullscreen */
     if (self->fullscreen) {
+
         Rect *a;
         guint i;
 
@@ -2880,16 +2887,14 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h,
         a = screen_area(self->desktop, i,
                 (self->max_horz && self->max_vert ? NULL : &desired));
 
-        Strut size;
-        frame_engine.frame_get_size(self->frame, &size);
         /* set the size and position if maximized */
         if (self->max_horz) {
             *x = a->x;
-            *w = a->width - size.left - size.right;
+            *w = a->width - extends_size.left - extends_size.right;
         }
         if (self->max_vert) {
             *y = a->y;
-            *h = a->height - size.top - size.bottom;
+            *h = a->height - extends_size.top - extends_size.bottom;
         }
 
         user = FALSE; /* ignore if the client can't be moved/resized when it
@@ -3029,9 +3034,7 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
     gint logicalw, logicalh;
 
     Strut size;
-    frame_engine.frame_get_size(self->frame, &size);
     Rect area;
-    frame_engine.frame_get_window_area(self->frame, &area);
 
     /* find the new x, y, width, and height (and logical size) */
     client_try_configure(self, &x, &y, &w, &h, &logicalw, &logicalh, user);
@@ -3049,8 +3052,6 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
     frame_engine.frame_get_window_area(self->frame, &oldframe);
     RECT_SET(self->area, x, y, w, h);
 
-    frame_engine.frame_set_client_area(self->frame, self->area);
-
     /* for app-requested resizes, always resize if 'resized' is true.
      for user-requested ones, only resize if final is true, or when
      resizing in redraw mode */
@@ -3059,14 +3060,13 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
 
     /* if the client is enlarging, then resize the client before the frame */
     if (send_resize_client && (w > oldw || h > oldh)) {
-        frame_engine.frame_set_decorations(self->frame, self->decorations);
-        frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
-        /* if this occurs while we are focus cycling, the indicator needs to
-         match the changes */
-        if (focus_cycle_target == self)
-            focus_cycle_draw_indicator(self);
+        frame_engine.frame_get_size(self->frame, &size);
+        XMoveResizeWindow(obt_display, self->w_client,
+                          size.left, size.top,
+                          MAX(w, oldw), MAX(h, oldh));
     }
 
+
     /* find the frame's dimensions and move/resize it */
     fmoved = moved;
     fresized = resized;
@@ -3087,8 +3087,8 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
          would change what window gets the event */
         mouse_replay_pointer();
 
-        frame_engine.frame_set_decorations(self->frame, self->decorations);
-        frame_engine.frame_update_layout(self->frame, self->area, TRUE, FALSE);
+        frame_engine.frame_render(self->frame, self->area);
+        client_move_frame (self);
 
         /* if this occurs while we are focus cycling, the indicator needs to
          match the changes */
@@ -3104,6 +3104,8 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
         gint oldry = self->root_pos.y;
         /* we have reset the client to 0 border width, so don't include
          it in these coords */
+        frame_engine.frame_get_size (self->frame, &size);
+        frame_engine.frame_get_window_area (self->frame, &area);
         POINT_SET(self->root_pos, area.x + size.left - self->border_width,
                 area.y + size.top - self->border_width);
         if (self->root_pos.x != oldrx || self->root_pos.y != oldry)
@@ -3153,33 +3155,17 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
      in the direction that is growing
      */
     if (send_resize_client && (w <= oldw || h <= oldh)) {
-        frame_engine.frame_set_decorations(self->frame, self->decorations);
-        frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
-        /* if this occurs while we are focus cycling, the indicator needs to
-         match the changes */
-        if (focus_cycle_target == self)
-            focus_cycle_draw_indicator(self);
-    }
-
-    if (user && final) {
-        /* when the client has StaticGravity, it likes to move around.
-         also this correctly positions the client when it maps.
-         this also needs to be run when the frame's decorations sizes change!
-         */
-        Strut size;
         frame_engine.frame_get_size(self->frame, &size);
-        XMoveResizeWindow(obt_display, self->w_client, size.left, size.top,
-                self->area.width, self->area.height);
-        frame_engine.frame_update_skin(self->frame);
+        XMoveResizeWindow(obt_display, self->w_client,
+                          size.left, size.top, w, h);
     }
 
     XFlush(obt_display);
 
     /* if it moved between monitors, then this can affect the stacking
      layer of this window or others - for fullscreen windows */
-    Rect current_frame;
-    frame_engine.frame_get_window_area(self->frame, &current_frame);
-    if (screen_find_monitor(&current_frame) != screen_find_monitor(&oldframe)) {
+    frame_engine.frame_get_window_area(self->frame, &area);
+    if (screen_find_monitor(&area) != screen_find_monitor(&oldframe)) {
         client_calc_layer(self);
     }
 }
@@ -3398,7 +3384,7 @@ void client_shade(ObClient *self, gboolean shade)
     client_change_wm_state(self); /* the window is being hidden/shown */
     /* resize the frame to just the titlebar */
     frame_engine.frame_set_is_shaded(self->frame, self->shaded);
-    frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+    frame_engine.frame_render(self->frame, self->area);
     /* if this occurs while we are focus cycling, the indicator needs to
      match the changes */
     if (focus_cycle_target == self)
@@ -3555,7 +3541,7 @@ static void client_set_desktop_recursive(ObClient *self, guint target,
         OBT_PROP_SET32(self->w_client, NET_WM_DESKTOP, CARDINAL, target);
         /* the frame can display the current desktop state */
         frame_engine.frame_set_decorations(self->frame, self->decorations);
-        frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+        frame_engine.frame_render(self->frame, self->area);
         /* if this occurs while we are focus cycling, the indicator needs to
          match the changes */
         if (focus_cycle_target == self)
@@ -4537,12 +4523,13 @@ gboolean client_has_group_siblings(ObClient *self)
 void client_show_frame(ObClient * self)
 {
     frame_engine.frame_set_is_visible(self->frame, TRUE);
-    frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+    frame_engine.frame_render(self->frame, self->area);
+    client_move_frame(self);
     /* if this occurs while we are focus cycling, the indicator needs to
      match the changes */
     if (focus_cycle_target == self)
         focus_cycle_draw_indicator(self);
-    frame_engine.frame_update_skin(self->frame);
+    //frame_engine.frame_update_skin(self->frame);
     /* Grab the server to make sure that the frame window is mapped before
      the client gets its MapNotify, i.e. to make sure the client is
      _visible_ when it gets MapNotify. */
@@ -4579,7 +4566,7 @@ gboolean client_flash_timeout(gpointer data)
     self->flash_on = !self->flash_on;
     if (!self->focused) {
         frame_engine.frame_set_is_focus(self->frame, self->flash_on);
-        frame_engine.frame_update_skin(self->frame);
+        //frame_engine.frame_update_skin(self->frame);
         self->focused = FALSE;
     }
     return TRUE; /* go again */
@@ -4607,11 +4594,10 @@ void client_flash_done(gpointer data)
     ObClient * self = (ObClient *) data;
     if (self->focused != self->flash_on) {
         frame_engine.frame_set_is_focus(self->frame, self->focused);
-        frame_engine.frame_update_skin(self->frame);
+        //frame_engine.frame_update_skin(self->frame);
     }
 }
 
-
 void client_simple_create_window(ObClient * self, Window * dst, Window parent)
 {
     gulong mask = 0;
@@ -4651,3 +4637,31 @@ void client_create_window(ObClient * self, Window * dst, Window parent, gulong m
     /* Register the frame */
     g_hash_table_insert(window_map, dst, self);
 }
+
+void client_update_extends_attributes (ObClient * self)
+{
+    Strut size;
+    frame_engine.frame_get_size (self->frame, &size);
+    //if (!STRUT_EQUAL(self->size, oldsize)) {
+        gulong vals[4];
+        vals[0] = size.left;
+        vals[1] = size.right;
+        vals[2] = size.top;
+        vals[3] = size.bottom;
+        OBT_PROP_SETA32(self->w_client, NET_FRAME_EXTENTS,
+                CARDINAL, vals, 4);
+        OBT_PROP_SETA32(self->w_client, KDE_NET_WM_FRAME_STRUT,
+                CARDINAL, vals, 4);
+    //}
+}
+
+void client_move_frame(ObClient * self)
+{
+    Rect area;
+    frame_engine.frame_get_window_area(self->frame, &area);
+    area.x = self->area.x;
+    area.y = self->area.y;
+    frame_client_gravity(self, &area.x, &area.y);
+    XMoveResizeWindow(obt_display, self->w_frame, area.x, area.y,
+            area.width, area.height);
+}
index 6184f728f99e7b632e1fdf0871246ae8dfcedf67..9581878ba34b72891492e4d0bc50bdc3f8799f21 100644 (file)
@@ -744,4 +744,6 @@ void client_flash_done(gpointer);
 
 void client_simple_create_window (ObClient *, Window *, Window);
 void client_create_window(ObClient *, Window *, Window, gulong, XSetWindowAttributes);
+
+void client_move_frame (ObClient * self);
 #endif
index a793c303096f55c92a2559513897a94b5b15769d..b72ed5a6393241a30f768e7e9b8e63567a76610a 100644 (file)
@@ -161,6 +161,8 @@ struct _ObFrameEngine
     /* set the requested client area */
     void (*frame_set_client_area)(gpointer, Rect);
     /* Update size, move/resize windows */
+    void (*frame_fake_update_layout) (gpointer, Rect);
+    void (*frame_render) (gpointer, Rect);
     void (*frame_update_layout)(gpointer self, Rect, gboolean is_resize,
             gboolean is_fake);
     /* Update skin, color/texture windows */ 
index 0c370f75998b45490961bbb76137705b8e56adab..46edbdf6043bd22fc24c456679f3706c4f448adf 100644 (file)
@@ -528,12 +528,12 @@ static void event_process(const XEvent *ec, gpointer data)
                from our Inferior up to us. This happens when iconifying a
                window with RevertToParent focus */
             frame_engine.frame_set_is_focus(client->frame, FALSE);
-            frame_engine.frame_update_layout (client->frame, client->area, FALSE, FALSE);
+            frame_engine.frame_render (client->frame, client->area);
             /* if this occurs while we are focus cycling, the indicator needs to
              match the changes */
             if (focus_cycle_target == client)
                 focus_cycle_draw_indicator(client);
-            frame_engine.frame_update_skin(client->frame);
+            //frame_engine.frame_update_skin(client->frame);
             /* focus_set_client(NULL) has already been called */
         }
         else if (e->xfocus.detail == NotifyPointerRoot ||
@@ -597,12 +597,12 @@ static void event_process(const XEvent *ec, gpointer data)
         else if (client != focus_client) {
             focus_left_screen = FALSE;
             frame_engine.frame_set_is_focus(client->frame, TRUE);
-            frame_engine.frame_update_layout (client->frame, client->area, FALSE, FALSE);
+            frame_engine.frame_render (client->frame, client->area);
             /* if this occurs while we are focus cycling, the indicator needs to
              match the changes */
             if (focus_cycle_target == client)
                 focus_cycle_draw_indicator(client);
-            frame_engine.frame_update_skin (client->frame);
+            //frame_engine.frame_update_skin (client->frame);
             focus_set_client(client);
             client_calc_layer(client);
             client_bring_helper_windows(client);
@@ -648,12 +648,12 @@ static void event_process(const XEvent *ec, gpointer data)
 
         if (client && client != focus_client) {
           frame_engine.frame_set_is_focus(client->frame, FALSE);
-          frame_engine.frame_update_layout (client->frame, client->area, FALSE, FALSE);
+          frame_engine.frame_render (client->frame, client->area);
           /* if this occurs while we are focus cycling, the indicator needs to
            match the changes */
           if (focus_cycle_target == client)
               focus_cycle_draw_indicator(client);
-          frame_engine.frame_update_skin(client->frame);
+          //frame_engine.frame_update_skin(client->frame);
             /* focus_set_client(NULL) has already been called in this
                section or by focus_fallback */
         }
index 79b4da89f0de4e9c87d13c2a6e7269fd38be3c6e..02a6bb45548c0b51662f2a58b1e6e6da8a9e165b 100644 (file)
@@ -337,7 +337,7 @@ gint main(gint argc, gchar **argv)
                     /* the new config can change the window's decorations */
                     client_setup_decor_and_functions(c, FALSE);
                     /* redraw the frames */
-                    frame_engine.frame_update_layout (c->frame, c->area, FALSE, FALSE);
+                    frame_engine.frame_render (c->frame, c->area);
                     /* if this occurs while we are focus cycling, the indicator needs to
                      match the changes */
                     if (focus_cycle_target == c)
index a679bfbfa89674c950c03b2b921ef02738b9ba43..215bee8d565dcde0bf8623437c5c010a4529f43a 100644 (file)
@@ -573,13 +573,13 @@ static void screen_fallback_focus(void)
             /* reduce flicker by hiliting now rather than waiting for the
                server FocusIn event */
         frame_engine.frame_set_is_focus (c->frame, TRUE);
-        frame_engine.frame_update_layout (c->frame, c->area, FALSE, FALSE);
+        frame_engine.frame_render (c->frame, c->area);
         /* if this occurs while we are focus cycling, the indicator needs to
          match the changes */
         if (focus_cycle_target == c)
             focus_cycle_draw_indicator(c);
-        frame_engine.frame_update_skin (c->frame);
-            /* do this here so that if you switch desktops to a window with
+        //frame_engine.frame_update_skin (c->frame);
+        /* do this here so that if you switch desktops to a window with
                helper windows then the helper windows won't flash */
             client_bring_helper_windows(c);
         }
@@ -1234,12 +1234,12 @@ void screen_show_desktop(gboolean show, ObClient *show_only)
                 /* reduce flicker by hiliting now rather than waiting for the
                    server FocusIn event */
         frame_engine.frame_set_is_focus(c->frame, TRUE);
-        frame_engine.frame_update_layout (c->frame, c->area, FALSE, FALSE);
+        frame_engine.frame_render (c->frame, c->area);
         /* if this occurs while we are focus cycling, the indicator needs to
          match the changes */
         if (focus_cycle_target == c)
             focus_cycle_draw_indicator(c);
-        frame_engine.frame_update_skin (c->frame);
+        //frame_engine.frame_update_skin (c->frame);
             }
         }
     }