#define PLATE_EVENTMASK (SubstructureRedirectMask | ButtonPressMask)
#define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask)
+#define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \
+ ButtonMotionMask | ExposureMask | \
+ EnterWindowMask | LeaveWindowMask)
/* style settings - geometry */
int s_bevel;
a_unfocused_title = appearance_new(Surface_Planar, 0);
a_focused_label = appearance_new(Surface_Planar, 1);
a_unfocused_label = appearance_new(Surface_Planar, 1);
- a_icon = appearance_new(Surface_Planar, 0);//1);
+ a_icon = appearance_new(Surface_Planar, 0);/*1);*/
a_focused_handle = appearance_new(Surface_Planar, 0);
a_unfocused_handle = appearance_new(Surface_Planar, 0);
self->frame.plate = createWindow(self->frame.window, mask, &attrib);
mask = CWEventMask;
- attrib.event_mask = (ButtonPressMask | ButtonReleaseMask |
- ButtonMotionMask | ExposureMask);
+ attrib.event_mask = ELEMENT_EVENTMASK;
self->title = createWindow(self->frame.window, mask, &attrib);
self->label = createWindow(self->title, mask, &attrib);
self->max = createWindow(self->title, mask, &attrib);
#endif
}
-void frame_adjust_size(ObFrame *self)
+void frame_adjust_area(ObFrame *self)
{
if (self->frame.client->decorations & Decor_Border) {
self->bwidth = s_bwidth;
XMapWindow(ob_display, self->handle);
} else
XUnmapWindow(ob_display, self->handle);
-
- XResizeWindow(ob_display, self->frame.window, self->width,
- (self->frame.client->shaded ? TITLE_HEIGHT :
- self->innersize.top + self->innersize.bottom +
- self->frame.client->area.height));
+
+ /* find the new coordinates */
+ self->frame.area.x = self->frame.client->area.x;
+ self->frame.area.y = self->frame.client->area.y;
+ frame_client_gravity((Frame*)self,
+ &self->frame.area.x, &self->frame.area.y);
+ /* move and resize the top level frame */
+ XMoveResizeWindow(ob_display, self->frame.window,
+ self->frame.area.x, self->frame.area.y,
+ self->width,
+ (self->frame.client->shaded ? TITLE_HEIGHT :
+ self->innersize.top + self->innersize.bottom +
+ self->frame.client->area.height));
/* do this in two steps because clients whose gravity is set to
'Static' don't end up getting moved at all with an XMoveResizeWindow */
frame_adjust_shape(self);
}
-void frame_adjust_position(ObFrame *self)
-{
- self->frame.area.x = self->frame.client->area.x;
- self->frame.area.y = self->frame.client->area.y;
- frame_client_gravity((Frame*)self,
- &self->frame.area.x, &self->frame.area.y);
- XMoveWindow(ob_display, self->frame.window,
- self->frame.area.x, self->frame.area.y);
-}
-
void frame_adjust_state(ObFrame *self)
{
render_max(self);
/* map the client so it maps when the frame does */
XMapWindow(ob_display, client->window);
- frame_adjust_size(self);
- frame_adjust_position(self);
+ frame_adjust_area(self);
/* set all the windows for the frame in the client_map */
g_hash_table_insert(client_map, (gpointer)self->frame.window, client);
static void render(ObFrame *self)
{
- if (self->frame.client->focused) {
+ if (client_focused(self->frame.client)) {
XSetWindowBorder(ob_display, self->frame.plate,
s_cb_focused_color->pixel);
} else {
}
if (self->frame.client->decorations & Decor_Titlebar) {
- paint(self->title, (self->frame.client->focused ?
+ paint(self->title, (client_focused(self->frame.client) ?
self->a_focused_title :
self->a_unfocused_title),
0, 0, self->width, TITLE_HEIGHT);
}
if (self->frame.client->decorations & Decor_Handle) {
- paint(self->handle, (self->frame.client->focused ?
+ paint(self->handle, (client_focused(self->frame.client) ?
self->a_focused_handle :
self->a_unfocused_handle),
GRIP_WIDTH + self->bwidth, 0,
HANDLE_WIDTH(self), s_handle_height);
- paint(self->lgrip, (self->frame.client->focused ?
+ paint(self->lgrip, (client_focused(self->frame.client) ?
a_focused_grip :
a_unfocused_grip),
0, 0, GRIP_WIDTH, s_handle_height);
- paint(self->rgrip, (self->frame.client->focused ?
+ paint(self->rgrip, (client_focused(self->frame.client) ?
a_focused_grip :
a_unfocused_grip),
0, 0, GRIP_WIDTH, s_handle_height);
if (self->label_x < 0) return;
- a = (self->frame.client->focused ?
+ a = (client_focused(self->frame.client) ?
self->a_focused_label : self->a_unfocused_label);
/* set the texture's text! */
if (self->max_x < 0) return;
- paint(self->max, (self->frame.client->focused ?
+ paint(self->max, (client_focused(self->frame.client) ?
(press ?
a_focused_pressed_max :
a_focused_unpressed_max) :
{
if (self->iconify_x < 0) return;
- paint(self->iconify, (self->frame.client->focused ?
+ paint(self->iconify, (client_focused(self->frame.client) ?
(self->iconify_press ?
a_focused_pressed_iconify :
a_focused_unpressed_iconify) :
if (self->desk_x < 0) return;
- paint(self->desk, (self->frame.client->focused ?
+ paint(self->desk, (client_focused(self->frame.client) ?
(press ?
a_focused_pressed_desk :
a_focused_unpressed_desk) :
{
if (self->close_x < 0) return;
- paint(self->close, (self->frame.client->focused ?
+ paint(self->close, (client_focused(self->frame.client) ?
(self->close_press ?
a_focused_pressed_close :
a_focused_unpressed_close) :