From 2aa0a6b01ba718217e2b10107abbcd4236ba5a8f Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 28 May 2007 22:30:59 +0000 Subject: [PATCH] get rid of the plate window --- openbox/client.c | 18 ++++++------------ openbox/event.c | 2 +- openbox/frame.c | 42 ++++++++---------------------------------- openbox/frame.h | 2 -- openbox/mouse.c | 2 +- 5 files changed, 16 insertions(+), 50 deletions(-) diff --git a/openbox/client.c b/openbox/client.c index 9bed2506..84cd01c0 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -361,7 +361,6 @@ void client_manage(Window window) /* adjust the frame to the client's size before showing or placing the window */ frame_adjust_area(self->frame, FALSE, TRUE, FALSE); - frame_adjust_client_area(self->frame); /* where the frame was placed is where the window was originally */ placex = self->area.x; @@ -570,7 +569,7 @@ void client_manage(Window window) g_free(settings); ob_debug("Managed window 0x%lx plate 0x%x (%s)\n", - window, self->frame->plate, self->class); + window, self->frame->window, self->class); return; } @@ -621,7 +620,7 @@ void client_unmanage(ObClient *self) GSList *it; ob_debug("Unmanaging window: 0x%x plate 0x%x (%s) (%s)\n", - self->window, self->frame->plate, + self->window, self->frame->window, self->class, self->title ? self->title : ""); g_assert(self != NULL); @@ -2857,16 +2856,14 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b, /* if the client is enlarging, then resize the client before the frame */ if (send_resize_client && (w > oldw || h > oldh)) { XWindowChanges changes; - changes.x = -self->border_width; - changes.y = -self->border_width; + changes.x = self->frame->size.left - self->border_width; + changes.y = self->frame->size.top -self->border_width; changes.width = MAX(w, oldw); changes.height = MAX(h, oldh); changes.border_width = self->border_width; XConfigureWindow(ob_display, self->window, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &changes); - /* resize the plate to show the client padding color underneath */ - frame_adjust_client_area(self->frame); } /* find the frame's dimensions and move/resize it */ @@ -2918,13 +2915,10 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b, /* if the client is shrinking, then resize the frame before the client */ if (send_resize_client && (w <= oldw && h <= oldh)) { - /* resize the plate to show the client padding color underneath */ - frame_adjust_client_area(self->frame); - if (send_resize_client) { XWindowChanges changes; - changes.x = -self->border_width; - changes.y = -self->border_width; + changes.x = self->frame->size.left - self->border_width; + changes.y = self->frame->size.top -self->border_width; changes.width = w; changes.height = h; changes.border_width = self->border_width; diff --git a/openbox/event.c b/openbox/event.c index fbd326e9..2ea7d304 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1171,7 +1171,7 @@ static void event_handle_client(ObClient *client, XEvent *e) break; case ReparentNotify: /* this is when the client is first taken captive in the frame */ - if (e->xreparent.parent == client->frame->plate) break; + if (e->xreparent.parent == client->frame->window) break; /* This event is quite rare and is usually handled in unmapHandler. diff --git a/openbox/frame.c b/openbox/frame.c index 51de9321..687ecbbe 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -31,9 +31,9 @@ #include "screen.h" #include "render/theme.h" -#define PLATE_EVENTMASK (SubstructureRedirectMask | FocusChangeMask) #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \ - ButtonPressMask | ButtonReleaseMask) + ButtonPressMask | ButtonReleaseMask | \ + SubstructureRedirectMask | FocusChangeMask) #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \ ButtonMotionMask | PointerMotionMask | \ EnterWindowMask | LeaveWindowMask) @@ -95,7 +95,7 @@ ObFrame *frame_new(ObClient *client) /* create the non-visible decor windows */ - mask = CWEventMask; + mask = 0; if (visual) { /* client has a 32-bit visual */ mask |= CWColormap | CWBackPixel | CWBorderPixel; @@ -107,13 +107,9 @@ ObFrame *frame_new(ObClient *client) attrib.background_pixel = BlackPixel(ob_display, ob_screen); attrib.border_pixel = BlackPixel(ob_display, ob_screen); } - attrib.event_mask = FRAME_EVENTMASK; self->window = createWindow(RootWindow(ob_display, ob_screen), visual, mask, &attrib); - mask &= ~CWEventMask; - self->plate = createWindow(self->window, visual, mask, &attrib); - /* create the visible decor windows */ mask = CWEventMask; @@ -172,7 +168,6 @@ ObFrame *frame_new(ObClient *client) self->focused = FALSE; /* the other stuff is shown based on decor settings */ - XMapWindow(ob_display, self->plate); XMapWindow(ob_display, self->label); self->max_press = self->close_press = self->desk_press = @@ -710,14 +705,10 @@ void frame_adjust_area(ObFrame *self, gboolean moved, } else XUnmapWindow(ob_display, self->right); - /* move the plate */ - XMoveWindow(ob_display, self->plate, - self->size.left, self->size.top); - /* when the client has StaticGravity, it likes to move around. */ XMoveWindow(ob_display, self->client->window, - -self->client->border_width, - -self->client->border_width); + self->size.left - self->client->border_width, + self->size.top - self->client->border_width); } } @@ -836,13 +827,6 @@ static void frame_adjust_cursors(ObFrame *self) } } -void frame_adjust_client_area(ObFrame *self) -{ - /* resize the plate */ - XResizeWindow(ob_display, self->plate, - self->client->area.width, self->client->area.height); -} - void frame_adjust_state(ObFrame *self) { framerender_frame(self); @@ -873,8 +857,7 @@ void frame_grab_client(ObFrame *self) */ /* reparent the client to the frame */ - XReparentWindow(ob_display, self->client->window, self->plate, - -self->client->border_width, -self->client->border_width); + XReparentWindow(ob_display, self->client->window, self->window, 0, 0); /* When reparenting the client window, it is usually not mapped yet, since @@ -887,11 +870,10 @@ void frame_grab_client(ObFrame *self) /* select the event mask on the client's parent (to receive config/map req's) the ButtonPress is to catch clicks on the client border */ - XSelectInput(ob_display, self->plate, PLATE_EVENTMASK); + XSelectInput(ob_display, self->window, FRAME_EVENTMASK); /* 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->innerleft, self->client); g_hash_table_insert(window_map, &self->innertop, self->client); g_hash_table_insert(window_map, &self->innerright, self->client); @@ -952,7 +934,7 @@ void frame_release_client(ObFrame *self) Reparent events that are generated by us are just discarded here. They are of no consequence to us anyhow. */ - if (ev.xreparent.parent != self->plate) { + if (ev.xreparent.parent != self->window) { reparent = FALSE; XPutBackEvent(ob_display, &ev); break; @@ -970,7 +952,6 @@ 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->innerleft); g_hash_table_remove(window_map, &self->innertop); g_hash_table_remove(window_map, &self->innerright); @@ -1250,13 +1231,6 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y) } self = client->frame; - if (win == self->plate) { - /* conceptually, this is the desktop, as far as users are - concerned */ - if (client->type == OB_CLIENT_TYPE_DESKTOP) - return OB_FRAME_CONTEXT_DESKTOP; - return OB_FRAME_CONTEXT_CLIENT; - } /* when the user clicks in the corners of the titlebar and the client is fully maximized, then treat it like they clicked in the diff --git a/openbox/frame.h b/openbox/frame.h index 05474857..97a9e3ff 100644 --- a/openbox/frame.h +++ b/openbox/frame.h @@ -77,7 +77,6 @@ struct _ObFrame struct _ObClient *client; Window window; - Window plate; Strut size; Rect area; @@ -203,7 +202,6 @@ void frame_adjust_theme(ObFrame *self); void frame_adjust_shape(ObFrame *self); void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized, gboolean fake); -void frame_adjust_client_area(ObFrame *self); void frame_adjust_state(ObFrame *self); void frame_adjust_focus(ObFrame *self, gboolean hilite); void frame_adjust_title(ObFrame *self); diff --git a/openbox/mouse.c b/openbox/mouse.c index 850fb337..f74063ed 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -119,7 +119,7 @@ void mouse_grab_for_client(ObClient *client, gboolean grab) mode = GrabModeAsync; mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; } else if (CLIENT_CONTEXT(i, client)) { - win = client->frame->plate; + win = client->window; mode = GrabModeSync; /* this is handled in event */ mask = ButtonPressMask; /* can't catch more than this with Sync mode the release event is -- 2.44.0