X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fframe.c;h=3e90c3e2ccffd46768fda18d281fda541767fa4e;hb=1afc4180d72d335d93cb9ad8ec9a0dc4d5ae003b;hp=decebbce85581d2819b8f1416c79dbbc0b722ac7;hpb=7d943a950e39d4d93113c0efc7b41916f6b8c66d;p=chaz%2Fopenbox diff --git a/openbox/frame.c b/openbox/frame.c index decebbce..3e90c3e2 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -16,14 +16,6 @@ static void layout_title(ObFrame *self); -void frame_startup() -{ -} - -void frame_shutdown() -{ -} - static Window createWindow(Window parent, unsigned long mask, XSetWindowAttributes *attrib) { @@ -48,7 +40,8 @@ ObFrame *frame_new() mask = CWOverrideRedirect | CWEventMask; attrib.event_mask = FRAME_EVENTMASK; attrib.override_redirect = TRUE; - self->window = createWindow(ob_root, mask, &attrib); + self->window = createWindow(RootWindow(ob_display, ob_screen), + mask, &attrib); mask = 0; self->plate = createWindow(self->window, mask, &attrib); @@ -170,7 +163,7 @@ void frame_adjust_shape(ObFrame *self) ShapeBounding, ShapeSet); num = 0; - if (self->decorations & Decor_Titlebar) { + if (self->decorations & OB_FRAME_DECOR_TITLEBAR) { xrect[0].x = -ob_rr_theme->bevel; xrect[0].y = -ob_rr_theme->bevel; xrect[0].width = self->width + self->bwidth * 2; @@ -179,7 +172,7 @@ void frame_adjust_shape(ObFrame *self) ++num; } - if (self->decorations & Decor_Handle) { + if (self->decorations & OB_FRAME_DECOR_HANDLE) { xrect[1].x = -ob_rr_theme->bevel; xrect[1].y = FRAME_HANDLE_Y(self); xrect[1].width = self->width + self->bwidth * 2; @@ -199,7 +192,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized) { if (resized) { self->decorations = self->client->decorations; - if (self->decorations & Decor_Border) { + if (self->decorations & OB_FRAME_DECOR_BORDER) { self->bwidth = ob_rr_theme->bwidth; self->cbwidth = ob_rr_theme->cbwidth; } else { @@ -229,7 +222,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized) self->max_x = -1; self->close_x = -1; - if (self->decorations & Decor_Titlebar) { + if (self->decorations & OB_FRAME_DECOR_TITLEBAR) { XMoveResizeWindow(ob_display, self->title, -self->bwidth, -self->bwidth, self->width, ob_rr_theme->title_height); @@ -241,19 +234,27 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized) } else XUnmapWindow(ob_display, self->title); - if (self->decorations & Decor_Handle) { + if (self->decorations & OB_FRAME_DECOR_HANDLE) { XMoveResizeWindow(ob_display, self->handle, -self->bwidth, FRAME_HANDLE_Y(self), self->width, ob_rr_theme->handle_height); - XMoveWindow(ob_display, self->lgrip, - -self->bwidth, -self->bwidth); - XMoveWindow(ob_display, self->rgrip, - -self->bwidth + self->width - - ob_rr_theme->grip_width, -self->bwidth); self->innersize.bottom += ob_rr_theme->handle_height + self->bwidth; XMapWindow(ob_display, self->handle); + if (self->decorations & OB_FRAME_DECOR_GRIPS) { + XMoveWindow(ob_display, self->lgrip, + -self->bwidth, -self->bwidth); + XMoveWindow(ob_display, self->rgrip, + -self->bwidth + self->width - + ob_rr_theme->grip_width, -self->bwidth); + XMapWindow(ob_display, self->lgrip); + XMapWindow(ob_display, self->rgrip); + } else { + XUnmapWindow(ob_display, self->lgrip); + XUnmapWindow(ob_display, self->rgrip); + } + /* XXX make a subwindow with these dimentions? ob_rr_theme->grip_width + self->bwidth, 0, self->width - (ob_rr_theme->grip_width + self->bwidth) * 2, @@ -348,7 +349,7 @@ void frame_grab_client(ObFrame *self, ObClient *client) member set the root window, and one set to the client, but both get handled and need to be ignored. */ - if (ob_state == OB_STATE_STARTING) + if (ob_state() == OB_STATE_STARTING) client->ignore_unmaps += 2; /* select the event mask on the client's parent (to receive config/map @@ -395,7 +396,8 @@ void frame_release_client(ObFrame *self, ObClient *client) } else { /* according to the ICCCM - if the client doesn't reparent itself, then we will reparent the window to root for them */ - XReparentWindow(ob_display, client->window, ob_root, + XReparentWindow(ob_display, client->window, + RootWindow(ob_display, ob_screen), client->area.x, client->area.y); } @@ -431,28 +433,24 @@ static void layout_title(ObFrame *self) for (lc = ob_rr_theme->title_layout; *lc != '\0'; ++lc) { switch (*lc) { case 'N': - if (!(self->decorations & Decor_Icon)) break; if (n) { *lc = ' '; break; } /* rm duplicates */ n = TRUE; self->label_width -= (ob_rr_theme->button_size + 2 + ob_rr_theme->bevel + 1); break; case 'D': - if (!(self->decorations & Decor_AllDesktops)) break; if (d) { *lc = ' '; break; } /* rm duplicates */ d = TRUE; self->label_width -= (ob_rr_theme->button_size + ob_rr_theme->bevel + 1); break; case 'S': - if (!(self->decorations & Decor_Shade)) break; if (s) { *lc = ' '; break; } /* rm duplicates */ s = TRUE; self->label_width -= (ob_rr_theme->button_size + ob_rr_theme->bevel + 1); break; case 'I': - if (!(self->decorations & Decor_Iconify)) break; if (i) { *lc = ' '; break; } /* rm duplicates */ i = TRUE; self->label_width -= (ob_rr_theme->button_size + @@ -463,14 +461,12 @@ static void layout_title(ObFrame *self) l = TRUE; break; case 'M': - if (!(self->decorations & Decor_Maximize)) break; if (m) { *lc = ' '; break; } /* rm duplicates */ m = TRUE; self->label_width -= (ob_rr_theme->button_size + ob_rr_theme->bevel + 1); break; case 'C': - if (!(self->decorations & Decor_Close)) break; if (c) { *lc = ' '; break; } /* rm duplicates */ c = TRUE; self->label_width -= (ob_rr_theme->button_size + @@ -582,7 +578,7 @@ ObFrameContext frame_context(ObClient *client, Window win) { ObFrame *self; - if (win == ob_root) return OB_FRAME_CONTEXT_ROOT; + if (win == RootWindow(ob_display, ob_screen)) return OB_FRAME_CONTEXT_ROOT; if (client == NULL) return OB_FRAME_CONTEXT_NONE; if (win == client->window) return OB_FRAME_CONTEXT_CLIENT;