]> icculus.org git repositories - dana/openbox.git/blob - openbox/framerender.c
smaller again :>
[dana/openbox.git] / openbox / framerender.c
1 #include "frame.h"
2 #include "openbox.h"
3 #include "screen.h"
4 #include "framerender.h"
5 #include "render2/theme.h"
6
7 void framerender_frame(Frame *self)
8 {
9     /* XXX plate, client border */
10
11     if (self->client->decorations & Decor_Titlebar) {
12         struct RrSurface *t, *l, *p, *m, *n, *i, *d, *s, *c;
13
14         t = (self->focused ?
15              ob_theme->title_f : ob_theme->title);
16         l = (self->focused ?
17              ob_theme->label_f : ob_theme->label);
18         p = (self->focused ?
19              ob_theme->plate_f : ob_theme->plate);
20         m = (self->focused ?
21              (self->client->max_vert || self->client->max_horz ?
22               ob_theme->max_p_f : (self->max_press ?
23                                    ob_theme->max_p_f : ob_theme->max_f)) :
24              (self->client->max_vert || self->client->max_horz ?
25               ob_theme->max_p : (self->max_press ?
26                                  ob_theme->max_p : ob_theme->max)));
27         n = ob_theme->icon;
28         i = (self->focused ?
29              (self->iconify_press ?
30               ob_theme->iconify_p_f : ob_theme->iconify_f) :
31              (self->iconify_press ?
32               ob_theme->iconify_p : ob_theme->iconify));
33         d = (self->focused ?
34              (self->client->desktop == DESKTOP_ALL ?
35               ob_theme->desk_p_f : (self->desk_press ?
36                                     ob_theme->desk_p_f : ob_theme->desk_f)) :
37              (self->client->desktop == DESKTOP_ALL ?
38               ob_theme->desk_p : (self->desk_press ?
39                                   ob_theme->desk_p : ob_theme->desk)));
40         s = (self->focused ?
41              (self->client->shaded ?
42               ob_theme->shade_p_f : (self->shade_press ?
43                                      ob_theme->shade_p_f : ob_theme->shade_f)):
44              (self->client->shaded ?
45               ob_theme->shade_p : (self->shade_press ?
46                                    ob_theme->shade_p : ob_theme->shade)));
47         c = (self->focused ?
48              (self->close_press ?
49               ob_theme->close_p_f : ob_theme->close_f) :
50              (self->close_press ?
51               ob_theme->close_p : ob_theme->close));
52
53         RrSurfaceCopy(self->s_title, t);
54         RrSurfaceCopy(self->s_label, l);
55         RrSurfaceCopy(self->s_plate, p);
56
57         RrTextureSetText(self->s_label, 0, ob_theme->title_font,
58                          ob_theme->title_justify,
59                          (self->focused ?
60                           &ob_theme->title_color_f : &ob_theme->title_color),
61                          self->client->title);
62
63         if (self->max_x >= 0)
64             RrSurfaceCopy(self->s_max, m);
65         if (self->icon_x >= 0) {
66             Icon *icon;
67
68             RrSurfaceCopy(self->s_icon, n);
69
70             icon = client_icon(self->client,
71                              RrThemeButtonSize(ob_theme) + 2,
72                              RrThemeButtonSize(ob_theme) + 2);
73             if (icon)
74                 RrTextureSetRGBA(self->s_icon, 0,
75                                  icon->data,
76                                  0, 0, icon->width, icon->height);
77             else
78                 RrTextureSetNone(self->s_icon, 0);
79         }
80         if (self->iconify_x >= 0)
81             RrSurfaceCopy(self->s_iconify, i);
82         if (self->desk_x >= 0)
83             RrSurfaceCopy(self->s_desk, d);
84         if (self->shade_x >= 0)
85             RrSurfaceCopy(self->s_shade, s);
86         if (self->close_x >= 0)
87             RrSurfaceCopy(self->s_close, c);
88     }
89
90     if (self->client->decorations & Decor_Handle) {
91         struct RrSurface *h, *g;
92
93         h = (self->focused ?
94              ob_theme->handle_f : ob_theme->handle);
95         g = (self->focused ?
96              ob_theme->grip_f : ob_theme->grip);
97
98         RrSurfaceCopy(self->s_handle, h);
99         RrSurfaceCopy(self->s_lgrip, g);
100         RrSurfaceCopy(self->s_rgrip, g);
101     }
102 }