X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fframe.c;h=ba452166bc12c67962726a2058202ab687e921d7;hb=a16f1374eed70bc30a85f35f56c05d3073c6f0e0;hp=43b50722e5f4866a77bbed8e36fd8415d7e63a17;hpb=b8f207892a11b53365c47b4828254269fca5c8e9;p=chaz%2Fopenbox diff --git a/openbox/frame.c b/openbox/frame.c index 43b50722..ba452166 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -55,6 +55,7 @@ static void layout_title(ObFrame *self); static void set_theme_statics(ObFrame *self); static void free_theme_statics(ObFrame *self); static gboolean frame_animate_iconify(gpointer self); +static void frame_adjust_cursors(ObFrame *self); static Window createWindow(Window parent, Visual *visual, gulong mask, XSetWindowAttributes *attrib) @@ -329,7 +330,13 @@ void frame_adjust_area(ObFrame *self, gboolean moved, oldsize = self->size; if (resized) { + /* do this before changing the frame's status like max_horz max_vert */ + frame_adjust_cursors(self); + + self->functions = self->client->functions; self->decorations = self->client->decorations; + self->max_horz = self->client->max_horz; + self->max_vert = self->client->max_vert; if (self->decorations & OB_FRAME_DECOR_BORDER) { self->bwidth = ob_rr_theme->fbwidth; @@ -340,9 +347,6 @@ void frame_adjust_area(ObFrame *self, gboolean moved, } self->rbwidth = self->bwidth; - self->max_horz = self->client->max_horz; - self->max_vert = self->client->max_vert; - if (self->max_horz) { self->cbwidth_x = 0; self->width = self->client->area.width - self->bwidth * 2; @@ -370,7 +374,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, XMoveResizeWindow(ob_display, self->titletop, ob_rr_theme->grip_width + self->bwidth, 0, /* width + bwidth*2 - bwidth*2 - grips*2 */ - self->width + ob_rr_theme->grip_width * 2, + self->width - ob_rr_theme->grip_width * 2, self->bwidth); XMoveResizeWindow(ob_display, self->titletopleft, 0, 0, @@ -439,16 +443,17 @@ void frame_adjust_area(ObFrame *self, gboolean moved, XMoveResizeWindow(ob_display, self->topresize, ob_rr_theme->grip_width + self->bwidth, 0, - self->width - (ob_rr_theme->grip_width + - self->bwidth) * 2, + self->width - ob_rr_theme->grip_width *2, ob_rr_theme->paddingy + 1); - XMoveWindow(ob_display, self->tltresize, 0, 0); - XMoveWindow(ob_display, self->tllresize, 0, 0); + XMoveWindow(ob_display, self->tltresize, self->bwidth, 0); + XMoveWindow(ob_display, self->tllresize, self->bwidth, 0); XMoveWindow(ob_display, self->trtresize, - self->width - ob_rr_theme->grip_width, 0); + self->bwidth + self->width - + ob_rr_theme->grip_width, 0); XMoveWindow(ob_display, self->trrresize, - self->width - ob_rr_theme->paddingx - 1, 0); + self->bwidth + self->width - + ob_rr_theme->paddingx - 1, 0); XMapWindow(ob_display, self->topresize); XMapWindow(ob_display, self->tltresize); @@ -740,14 +745,17 @@ void frame_adjust_area(ObFrame *self, gboolean moved, if (resized && (self->decorations & OB_FRAME_DECOR_TITLEBAR)) XResizeWindow(ob_display, self->label, self->label_width, ob_rr_theme->label_height); +} - /* set up cursors */ - if (!fake && - (self->functions & OB_CLIENT_FUNC_RESIZE) != - (self->client->functions & OB_CLIENT_FUNC_RESIZE)) +static void frame_adjust_cursors(ObFrame *self) +{ + if ((self->functions & OB_CLIENT_FUNC_RESIZE) != + (self->client->functions & OB_CLIENT_FUNC_RESIZE) || + ((self->max_horz && self->max_vert) != + (self->client->max_horz && self->client->max_vert))) { - gboolean r = self->client->functions & OB_CLIENT_FUNC_RESIZE && - !(self->max_horz && self->max_vert); + gboolean r = (self->client->functions & OB_CLIENT_FUNC_RESIZE) && + !(self->client->max_horz && self->client->max_vert); XSetWindowAttributes a; a.cursor = ob_cursor(r ? OB_CURSOR_NORTH : OB_CURSOR_NONE); @@ -783,8 +791,6 @@ void frame_adjust_area(ObFrame *self, gboolean moved, XChangeWindowAttributes(ob_display, self->rgripright, CWCursor, &a); XChangeWindowAttributes(ob_display, self->rgriptop, CWCursor, &a); XChangeWindowAttributes(ob_display, self->rgripbottom, CWCursor, &a); - - self->functions = self->client->functions; } } @@ -1201,7 +1207,7 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y) is fully maximized, then treat it like they clicked in the button that is there */ if (self->max_horz && self->max_vert && - (win == self->title || + (win == self->title || win == self->titletop || win == self->titleleft || win == self->titletopleft || win == self->titleright || win == self->titletopright)) { @@ -1217,6 +1223,9 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y) /* title is a border width in from the edge */ if (win == self->title) fx += self->bwidth; + /* titletop is a bit to the right */ + else if (win == self->titletop) + fx += ob_rr_theme->grip_width + self->bwidth; /* titletopright is way to the right edge */ else if (win == self->titletopright) fx += self->area.width - (ob_rr_theme->grip_width + self->bwidth); @@ -1243,6 +1252,10 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y) return self->rightmost; } } + + /* there is no resizing maximized windows so make them the titlebar + context */ + return OB_FRAME_CONTEXT_TITLEBAR; } if (win == self->window) return OB_FRAME_CONTEXT_FRAME;