From: Dana Jansens Date: Mon, 28 May 2007 22:18:32 +0000 (+0000) Subject: get rid of the "inner" window X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=a1511e465550501dee66c0474d3e3867b97fd1fb;p=chaz%2Fopenbox get rid of the "inner" window --- diff --git a/openbox/frame.c b/openbox/frame.c index 609ba4e4..51de9321 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -37,11 +37,6 @@ #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \ ButtonMotionMask | PointerMotionMask | \ EnterWindowMask | LeaveWindowMask) -/* The inner window does not need enter/leave events. - If it does get them, then it needs its own context for enter events - because sloppy focus will focus the window when you enter the inner window - from the frame. */ -#define INNER_EVENTMASK (ButtonPressMask) #define FRAME_ANIMATE_ICONIFY_TIME 150000 /* .15 seconds */ #define FRAME_ANIMATE_ICONIFY_STEP_TIME (G_USEC_PER_SEC / 60) /* 60 Hz */ @@ -116,11 +111,8 @@ ObFrame *frame_new(ObClient *client) self->window = createWindow(RootWindow(ob_display, ob_screen), visual, mask, &attrib); - attrib.event_mask = INNER_EVENTMASK; - self->inner = createWindow(self->window, visual, mask, &attrib); - mask &= ~CWEventMask; - self->plate = createWindow(self->inner, visual, mask, &attrib); + self->plate = createWindow(self->window, visual, mask, &attrib); /* create the visible decor windows */ @@ -148,6 +140,11 @@ ObFrame *frame_new(ObClient *client) self->left = createWindow(self->window, NULL, mask, &attrib); self->right = createWindow(self->window, NULL, mask, &attrib); + self->innerleft = createWindow(self->window, NULL, mask, &attrib); + self->innertop = createWindow(self->window, NULL, mask, &attrib); + self->innerright = createWindow(self->window, NULL, mask, &attrib); + self->innerbottom = createWindow(self->window, NULL, mask, &attrib); + self->label = createWindow(self->title, NULL, mask, &attrib); self->max = createWindow(self->title, NULL, mask, &attrib); self->close = createWindow(self->title, NULL, mask, &attrib); @@ -176,7 +173,6 @@ ObFrame *frame_new(ObClient *client) /* the other stuff is shown based on decor settings */ XMapWindow(ob_display, self->plate); - XMapWindow(ob_display, self->inner); XMapWindow(ob_display, self->label); self->max_press = self->close_press = self->desk_press = @@ -375,6 +371,42 @@ void frame_adjust_area(ObFrame *self, gboolean moved, /* position/size and map/unmap all the windows */ if (!fake) { + if (self->cbwidth_x) { + XMoveResizeWindow(ob_display, self->innerleft, + self->size.left - self->cbwidth_x, + self->size.top, + self->cbwidth_x, self->client->area.height); + XMoveResizeWindow(ob_display, self->innerright, + self->size.left + self->client->area.width, + self->size.top, + self->cbwidth_x, self->client->area.height); + + XMapWindow(ob_display, self->innerleft); + XMapWindow(ob_display, self->innerright); + } else { + XUnmapWindow(ob_display, self->innerleft); + XUnmapWindow(ob_display, self->innerright); + } + + if (self->cbwidth_y) { + XMoveResizeWindow(ob_display, self->innertop, + self->size.left - self->cbwidth_x, + self->size.top - self->cbwidth_y, + self->client->area.width + + self->cbwidth_x * 2, self->cbwidth_y); + XMoveResizeWindow(ob_display, self->innerbottom, + self->size.left - self->cbwidth_x, + self->size.top + self->client->area.height, + self->client->area.width + + self->cbwidth_x * 2, self->cbwidth_y); + + XMapWindow(ob_display, self->innertop); + XMapWindow(ob_display, self->innerbottom); + } else { + XUnmapWindow(ob_display, self->innertop); + XUnmapWindow(ob_display, self->innerbottom); + } + if (self->bwidth) { gint titlesides; @@ -678,21 +710,9 @@ void frame_adjust_area(ObFrame *self, gboolean moved, } else XUnmapWindow(ob_display, self->right); - /* move and resize the inner border window which contains the plate - */ - XMoveResizeWindow(ob_display, self->inner, - 0, - self->size.top - self->cbwidth_y, - self->client->area.width + - self->cbwidth_x * 2 + - (!self->max_horz ? self->bwidth * 2 : 0), - self->client->area.height + - self->cbwidth_y * 2); - /* move the plate */ XMoveWindow(ob_display, self->plate, - (!self->max_horz ? self->bwidth : 0) + self->cbwidth_x, - self->cbwidth_y); + self->size.left, self->size.top); /* when the client has StaticGravity, it likes to move around. */ XMoveWindow(ob_display, self->client->window, @@ -782,6 +802,7 @@ static void frame_adjust_cursors(ObFrame *self) XChangeWindowAttributes(ob_display, self->handle, CWCursor, &a); XChangeWindowAttributes(ob_display, self->handletop, CWCursor, &a); XChangeWindowAttributes(ob_display, self->handlebottom, CWCursor, &a); + XChangeWindowAttributes(ob_display, self->innerbottom, CWCursor, &a); /* these ones don't */ a.cursor = ob_cursor(r ? OB_CURSOR_NORTHWEST : OB_CURSOR_NONE); @@ -796,8 +817,10 @@ static void frame_adjust_cursors(ObFrame *self) XChangeWindowAttributes(ob_display, self->titleright, CWCursor, &a); a.cursor = ob_cursor(r ? OB_CURSOR_WEST : OB_CURSOR_NONE); XChangeWindowAttributes(ob_display, self->left, CWCursor, &a); + XChangeWindowAttributes(ob_display, self->innerleft, CWCursor, &a); a.cursor = ob_cursor(r ? OB_CURSOR_EAST : OB_CURSOR_NONE); XChangeWindowAttributes(ob_display, self->right, CWCursor, &a); + XChangeWindowAttributes(ob_display, self->innerright, CWCursor, &a); a.cursor = ob_cursor(r ? OB_CURSOR_SOUTHWEST : OB_CURSOR_NONE); XChangeWindowAttributes(ob_display, self->lgrip, CWCursor, &a); XChangeWindowAttributes(ob_display, self->handleleft, CWCursor, &a); @@ -869,7 +892,10 @@ void frame_grab_client(ObFrame *self) /* set all the windows for the frame in the window_map */ g_hash_table_insert(window_map, &self->window, self->client); g_hash_table_insert(window_map, &self->plate, self->client); - g_hash_table_insert(window_map, &self->inner, self->client); + g_hash_table_insert(window_map, &self->innerleft, self->client); + g_hash_table_insert(window_map, &self->innertop, self->client); + g_hash_table_insert(window_map, &self->innerright, self->client); + g_hash_table_insert(window_map, &self->innerbottom, self->client); g_hash_table_insert(window_map, &self->title, self->client); g_hash_table_insert(window_map, &self->label, self->client); g_hash_table_insert(window_map, &self->max, self->client); @@ -945,7 +971,10 @@ void frame_release_client(ObFrame *self) /* remove all the windows for the frame from the window_map */ g_hash_table_remove(window_map, &self->window); g_hash_table_remove(window_map, &self->plate); - g_hash_table_remove(window_map, &self->inner); + g_hash_table_remove(window_map, &self->innerleft); + g_hash_table_remove(window_map, &self->innertop); + g_hash_table_remove(window_map, &self->innerright); + g_hash_table_remove(window_map, &self->innerbottom); g_hash_table_remove(window_map, &self->title); g_hash_table_remove(window_map, &self->label); g_hash_table_remove(window_map, &self->max); @@ -1221,7 +1250,7 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y) } self = client->frame; - if (win == self->inner || win == self->plate) { + if (win == self->plate) { /* conceptually, this is the desktop, as far as users are concerned */ if (client->type == OB_CLIENT_TYPE_DESKTOP) @@ -1304,6 +1333,7 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y) if (win == self->rgriptop) return OB_FRAME_CONTEXT_BLCORNER; if (win == self->rgripbottom) return OB_FRAME_CONTEXT_BLCORNER; if (win == self->title) return OB_FRAME_CONTEXT_TITLEBAR; + if (win == self->titlebottom) return OB_FRAME_CONTEXT_TITLEBAR; if (win == self->titleleft) return OB_FRAME_CONTEXT_TLCORNER; if (win == self->titletopleft) return OB_FRAME_CONTEXT_TLCORNER; if (win == self->titleright) return OB_FRAME_CONTEXT_TRCORNER; @@ -1316,6 +1346,10 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y) if (win == self->trrresize) return OB_FRAME_CONTEXT_TRCORNER; if (win == self->left) return OB_FRAME_CONTEXT_LEFT; if (win == self->right) return OB_FRAME_CONTEXT_RIGHT; + if (win == self->innertop) return OB_FRAME_CONTEXT_TITLEBAR; + if (win == self->innerleft) return OB_FRAME_CONTEXT_LEFT; + if (win == self->innerbottom) return OB_FRAME_CONTEXT_BOTTOM; + if (win == self->innerright) return OB_FRAME_CONTEXT_RIGHT; if (win == self->max) return OB_FRAME_CONTEXT_MAXIMIZE; if (win == self->iconify) return OB_FRAME_CONTEXT_ICONIFY; if (win == self->close) return OB_FRAME_CONTEXT_CLOSE; diff --git a/openbox/frame.h b/openbox/frame.h index 0d3cf0e7..05474857 100644 --- a/openbox/frame.h +++ b/openbox/frame.h @@ -86,7 +86,6 @@ struct _ObFrame guint functions; guint decorations; - Window inner; /*!< The window for drawing the inner client border */ Window title; Window label; Window max; @@ -118,6 +117,10 @@ struct _ObFrame Window rgriptop; Window rgripright; Window rgripbottom; + Window innerleft; /*!< For drawing the inner client border */ + Window innertop; /*!< For drawing the inner client border */ + Window innerright; /*!< For drawing the inner client border */ + Window innerbottom; /*!< For drawing the inner client border */ /* These are resize handles inside the titlebar */ Window topresize; diff --git a/openbox/framerender.c b/openbox/framerender.c index 4f5d0858..3a5267a7 100644 --- a/openbox/framerender.c +++ b/openbox/framerender.c @@ -40,8 +40,15 @@ void framerender_frame(ObFrame *self) px = (self->focused ? RrColorPixel(ob_rr_theme->cb_focused_color) : RrColorPixel(ob_rr_theme->cb_unfocused_color)); - XSetWindowBackground(ob_display, self->inner, px); - XClearWindow(ob_display, self->inner); + + XSetWindowBackground(ob_display, self->innerleft, px); + XClearWindow(ob_display, self->innerleft); + XSetWindowBackground(ob_display, self->innertop, px); + XClearWindow(ob_display, self->innertop); + XSetWindowBackground(ob_display, self->innerright, px); + XClearWindow(ob_display, self->innerright); + XSetWindowBackground(ob_display, self->innerbottom, px); + XClearWindow(ob_display, self->innerbottom); px = (self->focused ? RrColorPixel(ob_rr_theme->frame_focused_border_color) :