From fb78e257715bf9072db1c4a345cffcd9decc497a Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 27 May 2003 00:47:45 +0000 Subject: [PATCH] change event.c to use a frame pointer instead of client pointer in framedecor frame.c now supports more decor anchors yay for 1 to many commit logs --- openbox/event.c | 2 +- openbox/frame.c | 72 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index b89ec8b5..19beeae6 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -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 */ diff --git a/openbox/frame.c b/openbox/frame.c index dd13c5be..d07f2661 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -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) { -- 2.34.1