X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fframerender.c;h=01dc75b10408fa803bb5a8cb44d6e2f887e7a2aa;hb=b1f5555218ecaa3827450125dc47b4bf0d404ee4;hp=a149b1bbf3f35efdae4b61b2ad9c9da52fe90787;hpb=573aaf7edeab41ee8f50400b0ecb952a5527d067;p=chaz%2Fopenbox diff --git a/openbox/framerender.c b/openbox/framerender.c index a149b1bb..01dc75b1 100644 --- a/openbox/framerender.c +++ b/openbox/framerender.c @@ -4,109 +4,109 @@ #include "framerender.h" #include "render/theme.h" -static void framerender_label(Frame *self, Appearance *a); -static void framerender_icon(Frame *self, Appearance *a); -static void framerender_max(Frame *self, Appearance *a); -static void framerender_iconify(Frame *self, Appearance *a); -static void framerender_desk(Frame *self, Appearance *a); -static void framerender_shade(Frame *self, Appearance *a); -static void framerender_close(Frame *self, Appearance *a); +static void framerender_label(Frame *self, RrAppearance *a); +static void framerender_icon(Frame *self, RrAppearance *a); +static void framerender_max(Frame *self, RrAppearance *a); +static void framerender_iconify(Frame *self, RrAppearance *a); +static void framerender_desk(Frame *self, RrAppearance *a); +static void framerender_shade(Frame *self, RrAppearance *a); +static void framerender_close(Frame *self, RrAppearance *a); void framerender_frame(Frame *self) { - if (client_focused(self->client)) { + if (self->focused) XSetWindowBorder(ob_display, self->plate, - theme_cb_focused_color->pixel); - } else { + ob_rr_theme->cb_focused_color->pixel); + else XSetWindowBorder(ob_display, self->plate, - theme_cb_unfocused_color->pixel); - } + ob_rr_theme->cb_unfocused_color->pixel); if (self->client->decorations & Decor_Titlebar) { - Appearance *t, *l, *m, *n, *i, *d, *s, *c; + RrAppearance *t, *l, *m, *n, *i, *d, *s, *c; - t = (client_focused(self->client) ? + t = (self->focused ? self->a_focused_title : self->a_unfocused_title); - l = (client_focused(self->client) ? + l = (self->focused ? self->a_focused_label : self->a_unfocused_label); - m = (client_focused(self->client) ? + m = (self->focused ? (self->client->max_vert || self->client->max_horz ? - theme_a_focused_pressed_set_max : + ob_rr_theme->a_focused_pressed_set_max : (self->max_press ? - theme_a_focused_pressed_max : theme_a_focused_unpressed_max)) : + ob_rr_theme->a_focused_pressed_max : + ob_rr_theme->a_focused_unpressed_max)) : (self->client->max_vert || self->client->max_horz ? - theme_a_unfocused_pressed_set_max : + ob_rr_theme->a_unfocused_pressed_set_max : (self->max_press ? - theme_a_unfocused_pressed_max : - theme_a_unfocused_unpressed_max))); + ob_rr_theme->a_unfocused_pressed_max : + ob_rr_theme->a_unfocused_unpressed_max))); n = self->a_icon; - i = (client_focused(self->client) ? + i = (self->focused ? (self->iconify_press ? - theme_a_focused_pressed_iconify : - theme_a_focused_unpressed_iconify) : + ob_rr_theme->a_focused_pressed_iconify : + ob_rr_theme->a_focused_unpressed_iconify) : (self->iconify_press ? - theme_a_unfocused_pressed_iconify : - theme_a_unfocused_unpressed_iconify)); - d = (client_focused(self->client) ? + ob_rr_theme->a_unfocused_pressed_iconify : + ob_rr_theme->a_unfocused_unpressed_iconify)); + d = (self->focused ? (self->client->desktop == DESKTOP_ALL ? - theme_a_focused_pressed_set_desk : + ob_rr_theme->a_focused_pressed_set_desk : (self->desk_press ? - theme_a_focused_pressed_desk : - theme_a_focused_unpressed_desk)) : + ob_rr_theme->a_focused_pressed_desk : + ob_rr_theme->a_focused_unpressed_desk)) : (self->client->desktop == DESKTOP_ALL ? - theme_a_unfocused_pressed_set_desk : + ob_rr_theme->a_unfocused_pressed_set_desk : (self->desk_press ? - theme_a_unfocused_pressed_desk : - theme_a_unfocused_unpressed_desk))); - s = (client_focused(self->client) ? + ob_rr_theme->a_unfocused_pressed_desk : + ob_rr_theme->a_unfocused_unpressed_desk))); + s = (self->focused ? (self->client->shaded ? - theme_a_focused_pressed_set_shade : + ob_rr_theme->a_focused_pressed_set_shade : (self->shade_press ? - theme_a_focused_pressed_shade : - theme_a_focused_unpressed_shade)) : + ob_rr_theme->a_focused_pressed_shade : + ob_rr_theme->a_focused_unpressed_shade)) : (self->client->shaded ? - theme_a_unfocused_pressed_set_shade : + ob_rr_theme->a_unfocused_pressed_set_shade : (self->shade_press ? - theme_a_unfocused_pressed_shade : - theme_a_unfocused_unpressed_shade))); - c = (client_focused(self->client) ? + ob_rr_theme->a_unfocused_pressed_shade : + ob_rr_theme->a_unfocused_unpressed_shade))); + c = (self->focused ? (self->close_press ? - theme_a_focused_pressed_close : - theme_a_focused_unpressed_close) : + ob_rr_theme->a_focused_pressed_close : + ob_rr_theme->a_focused_unpressed_close) : (self->close_press ? - theme_a_unfocused_pressed_close : - theme_a_unfocused_unpressed_close)); + ob_rr_theme->a_unfocused_pressed_close : + ob_rr_theme->a_unfocused_unpressed_close)); - paint(self->title, t); + RrPaint(t, self->title, self->width, ob_rr_theme->title_height); /* set parents for any parent relative guys */ - l->surface.data.planar.parent = t; - l->surface.data.planar.parentx = self->label_x; - l->surface.data.planar.parenty = theme_bevel; + l->surface.parent = t; + l->surface.parentx = self->label_x; + l->surface.parenty = ob_rr_theme->bevel; - m->surface.data.planar.parent = t; - m->surface.data.planar.parentx = self->max_x; - m->surface.data.planar.parenty = theme_bevel + 1; + m->surface.parent = t; + m->surface.parentx = self->max_x; + m->surface.parenty = ob_rr_theme->bevel + 1; - n->surface.data.planar.parent = t; - n->surface.data.planar.parentx = self->icon_x; - n->surface.data.planar.parenty = theme_bevel + 1; + n->surface.parent = t; + n->surface.parentx = self->icon_x; + n->surface.parenty = ob_rr_theme->bevel; - i->surface.data.planar.parent = t; - i->surface.data.planar.parentx = self->iconify_x; - i->surface.data.planar.parenty = theme_bevel + 1; + i->surface.parent = t; + i->surface.parentx = self->iconify_x; + i->surface.parenty = ob_rr_theme->bevel + 1; - d->surface.data.planar.parent = t; - d->surface.data.planar.parentx = self->desk_x; - d->surface.data.planar.parenty = theme_bevel + 1; + d->surface.parent = t; + d->surface.parentx = self->desk_x; + d->surface.parenty = ob_rr_theme->bevel + 1; - s->surface.data.planar.parent = t; - s->surface.data.planar.parentx = self->shade_x; - s->surface.data.planar.parenty = theme_bevel + 1; + s->surface.parent = t; + s->surface.parentx = self->shade_x; + s->surface.parenty = ob_rr_theme->bevel + 1; - c->surface.data.planar.parent = t; - c->surface.data.planar.parentx = self->close_x; - c->surface.data.planar.parenty = theme_bevel + 1; + c->surface.parent = t; + c->surface.parentx = self->close_x; + c->surface.parenty = ob_rr_theme->bevel + 1; framerender_label(self, l); framerender_max(self, m); @@ -118,135 +118,89 @@ void framerender_frame(Frame *self) } if (self->client->decorations & Decor_Handle) { - Appearance *h, *g; + RrAppearance *h, *g; - h = (client_focused(self->client) ? + h = (self->focused ? self->a_focused_handle : self->a_unfocused_handle); - g = (client_focused(self->client) ? - theme_a_focused_grip : theme_a_unfocused_grip); - if (g->surface.data.planar.grad == Background_ParentRelative) { - g->surface.data.planar.parent = h; - paint(self->handle, h); - } else - paint(self->handle, h); + RrPaint(h, self->handle, self->width, ob_rr_theme->handle_height); + + g = (self->focused ? + ob_rr_theme->a_focused_grip : ob_rr_theme->a_unfocused_grip); + + if (g->surface.grad == RR_SURFACE_PARENTREL) + g->surface.parent = h; - g->surface.data.planar.parentx = 0; - g->surface.data.planar.parenty = 0; + g->surface.parentx = 0; + g->surface.parenty = 0; - paint(self->lgrip, g); + RrPaint(g, self->lgrip, + ob_rr_theme->grip_width, ob_rr_theme->handle_height); - g->surface.data.planar.parentx = self->width - theme_grip_width; - g->surface.data.planar.parenty = 0; + g->surface.parentx = self->width - ob_rr_theme->grip_width; + g->surface.parenty = 0; - paint(self->rgrip, g); + RrPaint(g, self->rgrip, + ob_rr_theme->grip_width, ob_rr_theme->handle_height); } } -static void framerender_label(Frame *self, Appearance *a) +static void framerender_label(Frame *self, RrAppearance *a) { if (self->label_x < 0) return; - - /* set the texture's text! */ a->texture[0].data.text.string = self->client->title; - RECT_SET(a->texture[0].position, 0, 0, - self->label_width, theme_label_height); - - paint(self->label, a); + RrPaint(a, self->label, self->label_width, ob_rr_theme->label_height); } -static void framerender_icon(Frame *self, Appearance *a) +static void framerender_icon(Frame *self, RrAppearance *a) { if (self->icon_x < 0) return; if (self->client->nicons) { Icon *icon = client_icon(self->client, - theme_button_size + 2, theme_button_size + 2); - a->texture[0].type = RGBA; + ob_rr_theme->button_size + 2, + ob_rr_theme->button_size + 2); + a->texture[0].type = RR_TEXTURE_RGBA; a->texture[0].data.rgba.width = icon->width; a->texture[0].data.rgba.height = icon->height; a->texture[0].data.rgba.data = icon->data; - RECT_SET(self->a_icon->texture[0].position, 0, 0, - theme_button_size + 2, theme_button_size + 2); } else - a->texture[0].type = NoTexture; + a->texture[0].type = RR_TEXTURE_NONE; - paint(self->icon, a); + RrPaint(a, self->icon, + ob_rr_theme->button_size + 2, ob_rr_theme->button_size + 2); } -static void framerender_max(Frame *self, Appearance *a) +static void framerender_max(Frame *self, RrAppearance *a) { if (self->max_x < 0) return; - - RECT_SET(a->texture[0].position, 0, 0, - theme_button_size, theme_button_size); - paint(self->max, a); + RrPaint(a, self->max, ob_rr_theme->button_size, ob_rr_theme->button_size); } -static void framerender_iconify(Frame *self, Appearance *a) +static void framerender_iconify(Frame *self, RrAppearance *a) { if (self->iconify_x < 0) return; - - RECT_SET(a->texture[0].position, 0, 0, - theme_button_size, theme_button_size); - paint(self->iconify, a); + RrPaint(a, self->iconify, + ob_rr_theme->button_size, ob_rr_theme->button_size); } -static void framerender_desk(Frame *self, Appearance *a) +static void framerender_desk(Frame *self, RrAppearance *a) { if (self->desk_x < 0) return; - - RECT_SET(a->texture[0].position, 0, 0, - theme_button_size, theme_button_size); - paint(self->desk, a); + RrPaint(a, self->desk, ob_rr_theme->button_size, ob_rr_theme->button_size); } -static void framerender_shade(Frame *self, Appearance *a) +static void framerender_shade(Frame *self, RrAppearance *a) { if (self->shade_x < 0) return; - - RECT_SET(a->texture[0].position, 0, 0, - theme_button_size, theme_button_size); - paint(self->shade, a); + RrPaint(a, self->shade, + ob_rr_theme->button_size, ob_rr_theme->button_size); } -static void framerender_close(Frame *self, Appearance *a) +static void framerender_close(Frame *self, RrAppearance *a) { if (self->close_x < 0) return; - - RECT_SET(a->texture[0].position, 0, 0, - theme_button_size, theme_button_size); - paint(self->close, a); -} - -void framerender_popup_label(Window win, Size *sz, char *text) -{ - Appearance *a; - - a = theme_app_hilite_label; - a->texture[0].data.text.string = text; - RECT_SET(a->area, 0, 0, sz->width, sz->height); - a->texture[0].position = a->area; - a->texture[0].position.x += theme_bevel; - a->texture[0].position.y += theme_bevel; - a->texture[0].position.width -= theme_bevel * 2; - a->texture[0].position.height -= theme_bevel * 2; - - XSetWindowBorderWidth(ob_display, win, theme_bwidth); - XSetWindowBorder(ob_display, win, theme_b_color->pixel); - - paint(win, a); -} - -void framerender_size_popup_label(char *text, Size *sz) -{ - Appearance *a; - - a = theme_app_hilite_label; - a->texture[0].data.text.string = text; - - appearance_minsize(a, &sz->width, &sz->height); - sz->width += theme_bevel * 2; - sz->height += theme_bevel * 2; + RrPaint(a, self->close, + ob_rr_theme->button_size, ob_rr_theme->button_size); }