5 #include "framerender.h"
6 #include "render/theme.h"
8 static void framerender_label(ObFrame
*self
, RrAppearance
*a
);
9 static void framerender_icon(ObFrame
*self
, RrAppearance
*a
);
10 static void framerender_max(ObFrame
*self
, RrAppearance
*a
);
11 static void framerender_iconify(ObFrame
*self
, RrAppearance
*a
);
12 static void framerender_desk(ObFrame
*self
, RrAppearance
*a
);
13 static void framerender_shade(ObFrame
*self
, RrAppearance
*a
);
14 static void framerender_close(ObFrame
*self
, RrAppearance
*a
);
16 void framerender_frame(ObFrame
*self
)
19 XSetWindowBorder(ob_display
, self
->plate
,
20 RrColorPixel(ob_rr_theme
->cb_focused_color
));
22 XSetWindowBorder(ob_display
, self
->plate
,
23 RrColorPixel(ob_rr_theme
->cb_unfocused_color
));
25 if (self
->client
->decorations
& Decor_Titlebar
) {
26 RrAppearance
*t
, *l
, *m
, *n
, *i
, *d
, *s
, *c
;
29 self
->a_focused_title
: self
->a_unfocused_title
);
31 self
->a_focused_label
: self
->a_unfocused_label
);
33 (self
->client
->max_vert
|| self
->client
->max_horz
?
34 ob_rr_theme
->a_focused_pressed_set_max
:
36 ob_rr_theme
->a_focused_pressed_max
:
37 ob_rr_theme
->a_focused_unpressed_max
)) :
38 (self
->client
->max_vert
|| self
->client
->max_horz
?
39 ob_rr_theme
->a_unfocused_pressed_set_max
:
41 ob_rr_theme
->a_unfocused_pressed_max
:
42 ob_rr_theme
->a_unfocused_unpressed_max
)));
45 (self
->iconify_press
?
46 ob_rr_theme
->a_focused_pressed_iconify
:
47 ob_rr_theme
->a_focused_unpressed_iconify
) :
48 (self
->iconify_press
?
49 ob_rr_theme
->a_unfocused_pressed_iconify
:
50 ob_rr_theme
->a_unfocused_unpressed_iconify
));
52 (self
->client
->desktop
== DESKTOP_ALL
?
53 ob_rr_theme
->a_focused_pressed_set_desk
:
55 ob_rr_theme
->a_focused_pressed_desk
:
56 ob_rr_theme
->a_focused_unpressed_desk
)) :
57 (self
->client
->desktop
== DESKTOP_ALL
?
58 ob_rr_theme
->a_unfocused_pressed_set_desk
:
60 ob_rr_theme
->a_unfocused_pressed_desk
:
61 ob_rr_theme
->a_unfocused_unpressed_desk
)));
63 (self
->client
->shaded
?
64 ob_rr_theme
->a_focused_pressed_set_shade
:
66 ob_rr_theme
->a_focused_pressed_shade
:
67 ob_rr_theme
->a_focused_unpressed_shade
)) :
68 (self
->client
->shaded
?
69 ob_rr_theme
->a_unfocused_pressed_set_shade
:
71 ob_rr_theme
->a_unfocused_pressed_shade
:
72 ob_rr_theme
->a_unfocused_unpressed_shade
)));
75 ob_rr_theme
->a_focused_pressed_close
:
76 ob_rr_theme
->a_focused_unpressed_close
) :
78 ob_rr_theme
->a_unfocused_pressed_close
:
79 ob_rr_theme
->a_unfocused_unpressed_close
));
81 RrPaint(t
, self
->title
, self
->width
, ob_rr_theme
->title_height
);
83 /* set parents for any parent relative guys */
84 l
->surface
.parent
= t
;
85 l
->surface
.parentx
= self
->label_x
;
86 l
->surface
.parenty
= ob_rr_theme
->bevel
;
88 m
->surface
.parent
= t
;
89 m
->surface
.parentx
= self
->max_x
;
90 m
->surface
.parenty
= ob_rr_theme
->bevel
+ 1;
92 n
->surface
.parent
= t
;
93 n
->surface
.parentx
= self
->icon_x
;
94 n
->surface
.parenty
= ob_rr_theme
->bevel
;
96 i
->surface
.parent
= t
;
97 i
->surface
.parentx
= self
->iconify_x
;
98 i
->surface
.parenty
= ob_rr_theme
->bevel
+ 1;
100 d
->surface
.parent
= t
;
101 d
->surface
.parentx
= self
->desk_x
;
102 d
->surface
.parenty
= ob_rr_theme
->bevel
+ 1;
104 s
->surface
.parent
= t
;
105 s
->surface
.parentx
= self
->shade_x
;
106 s
->surface
.parenty
= ob_rr_theme
->bevel
+ 1;
108 c
->surface
.parent
= t
;
109 c
->surface
.parentx
= self
->close_x
;
110 c
->surface
.parenty
= ob_rr_theme
->bevel
+ 1;
112 framerender_label(self
, l
);
113 framerender_max(self
, m
);
114 framerender_icon(self
, n
);
115 framerender_iconify(self
, i
);
116 framerender_desk(self
, d
);
117 framerender_shade(self
, s
);
118 framerender_close(self
, c
);
121 if (self
->client
->decorations
& Decor_Handle
) {
125 self
->a_focused_handle
: self
->a_unfocused_handle
);
127 RrPaint(h
, self
->handle
, self
->width
, ob_rr_theme
->handle_height
);
130 ob_rr_theme
->a_focused_grip
: ob_rr_theme
->a_unfocused_grip
);
132 if (g
->surface
.grad
== RR_SURFACE_PARENTREL
)
133 g
->surface
.parent
= h
;
135 g
->surface
.parentx
= 0;
136 g
->surface
.parenty
= 0;
138 RrPaint(g
, self
->lgrip
,
139 ob_rr_theme
->grip_width
, ob_rr_theme
->handle_height
);
141 g
->surface
.parentx
= self
->width
- ob_rr_theme
->grip_width
;
142 g
->surface
.parenty
= 0;
144 RrPaint(g
, self
->rgrip
,
145 ob_rr_theme
->grip_width
, ob_rr_theme
->handle_height
);
149 static void framerender_label(ObFrame
*self
, RrAppearance
*a
)
151 if (self
->label_x
< 0) return;
152 /* set the texture's text! */
153 a
->texture
[0].data
.text
.string
= self
->client
->title
;
154 RrPaint(a
, self
->label
, self
->label_width
, ob_rr_theme
->label_height
);
157 static void framerender_icon(ObFrame
*self
, RrAppearance
*a
)
159 if (self
->icon_x
< 0) return;
161 if (self
->client
->nicons
) {
162 ObClientIcon
*icon
= client_icon(self
->client
,
163 ob_rr_theme
->button_size
+ 2,
164 ob_rr_theme
->button_size
+ 2);
165 a
->texture
[0].type
= RR_TEXTURE_RGBA
;
166 a
->texture
[0].data
.rgba
.width
= icon
->width
;
167 a
->texture
[0].data
.rgba
.height
= icon
->height
;
168 a
->texture
[0].data
.rgba
.data
= icon
->data
;
170 a
->texture
[0].type
= RR_TEXTURE_NONE
;
172 RrPaint(a
, self
->icon
,
173 ob_rr_theme
->button_size
+ 2, ob_rr_theme
->button_size
+ 2);
176 static void framerender_max(ObFrame
*self
, RrAppearance
*a
)
178 if (self
->max_x
< 0) return;
179 RrPaint(a
, self
->max
, ob_rr_theme
->button_size
, ob_rr_theme
->button_size
);
182 static void framerender_iconify(ObFrame
*self
, RrAppearance
*a
)
184 if (self
->iconify_x
< 0) return;
185 RrPaint(a
, self
->iconify
,
186 ob_rr_theme
->button_size
, ob_rr_theme
->button_size
);
189 static void framerender_desk(ObFrame
*self
, RrAppearance
*a
)
191 if (self
->desk_x
< 0) return;
192 RrPaint(a
, self
->desk
, ob_rr_theme
->button_size
, ob_rr_theme
->button_size
);
195 static void framerender_shade(ObFrame
*self
, RrAppearance
*a
)
197 if (self
->shade_x
< 0) return;
198 RrPaint(a
, self
->shade
,
199 ob_rr_theme
->button_size
, ob_rr_theme
->button_size
);
202 static void framerender_close(ObFrame
*self
, RrAppearance
*a
)
204 if (self
->close_x
< 0) return;
205 RrPaint(a
, self
->close
,
206 ob_rr_theme
->button_size
, ob_rr_theme
->button_size
);