change event.c to use a frame pointer instead of client pointer in framedecor
authorDerek Foreman <manmower@gmail.com>
Tue, 27 May 2003 00:47:45 +0000 (00:47 +0000)
committerDerek Foreman <manmower@gmail.com>
Tue, 27 May 2003 00:47:45 +0000 (00:47 +0000)
frame.c now supports more decor anchors

yay for 1 to many commit logs

openbox/event.c
openbox/frame.c

index b89ec8b5b2e66a25cc5fc2893d0481532e4356bf..19beeae66202d38408dd7f1212e707f8b4d60324 100644 (file)
@@ -443,7 +443,7 @@ static void event_process(XEvent *e)
             client = WINDOW_AS_CLIENT(obwin);
             break;
         case Window_Decoration:
-            client = WINDOW_AS_DECORATION(obwin)->client;
+            client = WINDOW_AS_DECORATION(obwin)->frame->client;
             break;
         case Window_Internal:
             /* not to be used for events */
index dd13c5be5930659b6d1d9f5797db4408c8475ef4..d07f266168d09a679109de913fd7056152d37513 100644 (file)
@@ -406,32 +406,62 @@ void frame_frame_gravity(Frame *self, int *x, int *y)
 void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
 {
     FrameDecor *dec;
-    int i, le = 0, re = 0, te = 0, be = 0, temp, center;
+    Rect *cr;
+    int i, le = 0, re = 0, te = 0, be = 0, temp;
+
+    if (resized)
+        for (i = 0; i < self->framedecors; i++) {
+            dec = &self->framedecor[i];
+            cr = &self->client->area;
+            if (dec->type & self->client->decorations)
+                switch (dec->anchor) {
+                case Decor_TopLeft:
+                    temp = dec->position.x + dec->position.width;
+                    if (temp > le) le = temp;
+                    temp = dec->position.y + dec->position.height;
+                    if (temp > te) te = temp;
+                break;
 
-    for (i = 0; i < self->framedecors; i++) {
-        dec = &self->framedecor[i];
-        if (dec->type & self->client->decorations)
-            switch (dec->anchor) {
                 case Decor_Top:
-                    center = self->client->area.width/2;
                     temp = dec->position.y + dec->position.height;
-                    printf("extends by %d\n", temp);
                     if (temp > te) te = temp;
+                    if (dec->position.width > cr->width) {
+                        temp = (dec->position.width - cr->width)/2;
+                        if (temp > re) re = temp;
+                        if (temp > le) le = temp;
+                    }
+                break;
+
+                case Decor_TopRight:
+                    temp = dec->position.x + dec->position.width;
+                    if (temp > re) re = temp;
+                    temp = dec->position.y + dec->position.height;
+                    if (temp > te) te = temp;
+                break;
+
+                case Decor_Left:
+                    temp = dec->position.x + dec->position.width;
+                    if (temp > le) le = temp;
+                    if (dec->position.height > cr->height) {
+                        temp = (dec->position.height - cr->height)/2;
+                        if (temp > be) be = temp;
+                        if (temp > te) te = temp;
+                    }
+                break;
+
+                case Decor_Right:
+                    temp = dec->position.x + dec->position.width;
+                    if (temp > re) re = temp;
+                    if (dec->position.height > cr->height) {
+                        temp = (dec->position.height - cr->height)/2;
+                        if (temp > be) be = temp;
+                        if (temp > te) te = temp;
+                    }
+                break;
 
-                    printf("putting crap at %d, %d, %d, %d\n",
-                                      dec->position.x,
-                                      dec->position.y,
-                                      dec->position.width,
-                                      dec->position.height);
-                    XMoveResizeWindow(ob_display, dec->window,
-                                      dec->position.x,
-                                      dec->position.y,
-                                      dec->position.width,
-                                      dec->position.height);
-                    break;
             }
-    }
-
+        }
+printf("frame extends by %d, %d, %d, %d\n", le, te, le, be);
     if (resized) {
         if (self->client->decorations & Decor_Border) {
             self->bwidth = theme_bwidth;
@@ -442,7 +472,7 @@ void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
         STRUT_SET(self->size, self->cbwidth + le, 
                   self->cbwidth + te, self->cbwidth + re, self->cbwidth + be);
 
-        self->width = self->client->area.width + self->cbwidth * 2;
+        self->width = self->client->area.width + self->cbwidth * 2 + re + le;
         g_assert(self->width > 0);
     }
     if (resized) {