X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fframe.c;h=d18a7aa4adb09ab32d711292dbeefb89945bac96;hb=5316bc6c3e3329dc620cfd15d472ed5d376100f8;hp=5383f7a379f5a7458de03628df8ae0023e311ce2;hpb=e227ac841e1fc7423c90fbd2c13ba379461a39c1;p=chaz%2Fopenbox diff --git a/openbox/frame.c b/openbox/frame.c index 5383f7a3..d18a7aa4 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -32,10 +32,9 @@ #define PLATE_EVENTMASK (SubstructureRedirectMask | ButtonPressMask | \ FocusChangeMask) #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \ - ButtonPressMask | ButtonReleaseMask | \ - VisibilityChangeMask) + ButtonPressMask | ButtonReleaseMask) #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \ - ButtonMotionMask | ExposureMask | \ + ButtonMotionMask | \ EnterWindowMask | LeaveWindowMask) #define FRAME_HANDLE_Y(f) (f->innersize.top + f->client->area.height + \ @@ -81,8 +80,6 @@ ObFrame *frame_new(ObClient *client) self = g_new0(ObFrame, 1); - self->obscured = TRUE; - visual = check_32bit_client(client); /* create the non-visible decor windows */ @@ -102,12 +99,15 @@ ObFrame *frame_new(ObClient *client) attrib.event_mask = FRAME_EVENTMASK; self->window = createWindow(RootWindow(ob_display, ob_screen), visual, mask, &attrib); + + attrib.event_mask = ELEMENT_EVENTMASK; + self->inner = createWindow(self->window, visual, mask, &attrib); + mask &= ~CWEventMask; - self->plate = createWindow(self->window, visual, mask, &attrib); + self->plate = createWindow(self->inner, visual, mask, &attrib); /* create the visible decor windows */ - mask = CWEventMask; if (visual) { /* client has a 32-bit visual */ mask |= CWColormap | CWBackPixel | CWBorderPixel; @@ -144,6 +144,7 @@ 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->lgrip); XMapWindow(ob_display, self->rgrip); XMapWindow(ob_display, self->label); @@ -238,28 +239,18 @@ void frame_show(ObFrame *self) self->visible = TRUE; XMapWindow(ob_display, self->client->window); XMapWindow(ob_display, self->window); - self->firstmap = TRUE; } } void frame_hide(ObFrame *self) { - if (self->visible || self->firstmap == FALSE) { - if (self->visible) { - self->visible = FALSE; - self->client->ignore_unmaps += 1; - /* we unmap the client itself so that we can get MapRequest - events, and because the ICCCM tells us to! */ - XUnmapWindow(ob_display, self->window); - XUnmapWindow(ob_display, self->client->window); - } else { - /* the frame wasn't visible, but the frame is being hidden now. - so we don't need to unmap the frame, but we do need to unmap - the client. */ - self->client->ignore_unmaps += 1; - XUnmapWindow(ob_display, self->client->window); - } - self->firstmap = TRUE; + if (self->visible) { + self->visible = FALSE; + self->client->ignore_unmaps += 1; + /* we unmap the client itself so that we can get MapRequest + events, and because the ICCCM tells us to! */ + XUnmapWindow(ob_display, self->window); + XUnmapWindow(ob_display, self->client->window); } } @@ -431,15 +422,22 @@ void frame_adjust_area(ObFrame *self, gboolean moved, } else XUnmapWindow(ob_display, self->handle); - /* move and resize the plate */ - XMoveResizeWindow(ob_display, self->plate, + /* move and resize the inner border window which contains the plate + */ + XMoveResizeWindow(ob_display, self->inner, self->innersize.left - self->cbwidth_x, self->innersize.top - self->cbwidth_y, - self->client->area.width + self->cbwidth_x * 2, - self->client->area.height + self->cbwidth_y * 2); - /* when the client has StaticGravity, it likes to move around. */ - XMoveWindow(ob_display, self->client->window, + self->client->area.width + + self->cbwidth_x * 2, + self->client->area.height + + self->cbwidth_y * 2); + + /* move the plate */ + XMoveWindow(ob_display, self->plate, self->cbwidth_x, self->cbwidth_y); + + /* when the client has StaticGravity, it likes to move around. */ + XMoveWindow(ob_display, self->client->window, 0, 0); } STRUT_SET(self->size, @@ -508,6 +506,14 @@ void frame_adjust_focus(ObFrame *self, gboolean hilite) { self->focused = hilite; framerender_frame(self); + XFlush(ob_display); +} + +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_title(ObFrame *self) @@ -549,6 +555,7 @@ void frame_grab_client(ObFrame *self, ObClient *client) /* set all the windows for the frame in the window_map */ g_hash_table_insert(window_map, &self->window, client); g_hash_table_insert(window_map, &self->plate, client); + g_hash_table_insert(window_map, &self->inner, client); g_hash_table_insert(window_map, &self->title, client); g_hash_table_insert(window_map, &self->label, client); g_hash_table_insert(window_map, &self->max, client); @@ -603,6 +610,7 @@ void frame_release_client(ObFrame *self, ObClient *client) /* 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->title); g_hash_table_remove(window_map, &self->label); g_hash_table_remove(window_map, &self->max); @@ -823,22 +831,23 @@ ObFrameContext frame_context(ObClient *client, Window win) return OB_FRAME_CONTEXT_CLIENT; } - if (win == self->window) return OB_FRAME_CONTEXT_FRAME; - if (win == self->title) return OB_FRAME_CONTEXT_TITLEBAR; - if (win == self->label) return OB_FRAME_CONTEXT_TITLEBAR; - if (win == self->handle) return OB_FRAME_CONTEXT_HANDLE; - if (win == self->lgrip) return OB_FRAME_CONTEXT_BLCORNER; - if (win == self->rgrip) return OB_FRAME_CONTEXT_BRCORNER; + if (win == self->window) return OB_FRAME_CONTEXT_FRAME; + if (win == self->inner) return OB_FRAME_CONTEXT_FRAME; + if (win == self->title) return OB_FRAME_CONTEXT_TITLEBAR; + if (win == self->label) return OB_FRAME_CONTEXT_TITLEBAR; + if (win == self->handle) return OB_FRAME_CONTEXT_HANDLE; + if (win == self->lgrip) return OB_FRAME_CONTEXT_BLCORNER; + if (win == self->rgrip) return OB_FRAME_CONTEXT_BRCORNER; if (win == self->tltresize) return OB_FRAME_CONTEXT_TLCORNER; if (win == self->tllresize) return OB_FRAME_CONTEXT_TLCORNER; if (win == self->trtresize) return OB_FRAME_CONTEXT_TRCORNER; if (win == self->trrresize) return OB_FRAME_CONTEXT_TRCORNER; - 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; - if (win == self->icon) return OB_FRAME_CONTEXT_ICON; - if (win == self->desk) return OB_FRAME_CONTEXT_ALLDESKTOPS; - if (win == self->shade) return OB_FRAME_CONTEXT_SHADE; + 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; + if (win == self->icon) return OB_FRAME_CONTEXT_ICON; + if (win == self->desk) return OB_FRAME_CONTEXT_ALLDESKTOPS; + if (win == self->shade) return OB_FRAME_CONTEXT_SHADE; return OB_FRAME_CONTEXT_NONE; } @@ -987,6 +996,7 @@ void frame_flash_start(ObFrame *self) G_USEC_PER_SEC * 0.6, flash_timeout, self, + g_direct_equal, flash_done); g_get_current_time(&self->flash_end); g_time_val_add(&self->flash_end, G_USEC_PER_SEC * 5);