/* create the visible decor windows */
- client_simple_create_window (client, &self->backback, self->window);
- client_simple_create_window (client, &self->backfront, self->window);
+ client_simple_create_window(client, &self->backback, self->window);
+ client_simple_create_window(client, &self->backfront, self->window);
/* set spesific data */
mask = CWEventMask;
attrib.event_mask = ELEMENT_EVENTMASK;
-
- client_create_window (client, &self->innerleft, self->window, mask, attrib);
- client_create_window (client, &self->innertop, self->window, mask, attrib);
- client_create_window (client, &self->innerright, self->window, mask, attrib);
- client_create_window (client, &self->innerbottom, self->window, mask, attrib);
-
- client_create_window (client, &self->innerblb, self->innerbottom, mask, attrib);
- client_create_window (client, &self->innerbrb, self->innerbottom, mask, attrib);
- client_create_window (client, &self->innerbll, self->innerleft, mask, attrib);
- client_create_window (client, &self->innerbrr, self->innerright, mask, attrib);
-
- client_create_window (client, &self->title, self->window, mask, attrib);
- client_create_window (client, &self->titleleft, self->window, mask, attrib);
- client_create_window (client, &self->titletop, self->window, mask, attrib);
- client_create_window (client, &self->titletopleft, self->window, mask, attrib);
- client_create_window (client, &self->titletopright, self->window, mask, attrib);
- client_create_window (client, &self->titleright, self->window, mask, attrib);
- client_create_window (client, &self->titlebottom, self->window, mask, attrib);
-
- client_create_window (client, &self->topresize, self->title, mask, attrib);
- client_create_window (client, &self->tltresize, self->title, mask, attrib);
- client_create_window (client, &self->tllresize, self->title, mask, attrib);
- client_create_window (client, &self->trtresize, self->title, mask, attrib);
- client_create_window (client, &self->trrresize, self->title, mask, attrib);
-
- client_create_window (client, &self->left, self->window, mask, attrib);
- client_create_window (client, &self->right, self->window, mask, attrib);
-
- client_create_window (client, &self->label, self->title, mask, attrib);
- client_create_window (client, &self->max, self->title, mask, attrib);
- client_create_window (client, &self->close, self->title, mask, attrib);
- client_create_window (client, &self->desk, self->title, mask, attrib);
- client_create_window (client, &self->shade, self->title, mask, attrib);
- client_create_window (client, &self->icon, self->title, mask, attrib);
- client_create_window (client, &self->iconify, self->title, mask, attrib);
-
- client_create_window (client, &self->handle, self->window, mask, attrib);
-
- client_create_window (client, &self->lgrip, self->handle, mask, attrib);
- client_create_window (client, &self->rgrip, self->handle, mask, attrib);
-
- client_create_window (client, &self->handleleft, self->handle, mask, attrib);
- client_create_window (client, &self->handleright, self->handle, mask, attrib);
-
- client_create_window (client, &self->handletop, self->window, mask, attrib);
- client_create_window (client, &self->handlebottom, self->window, mask, attrib);
- client_create_window (client, &self->lgripleft, self->window, mask, attrib);
- client_create_window (client, &self->lgriptop, self->window, mask, attrib);
- client_create_window (client, &self->lgripbottom, self->window, mask, attrib);
- client_create_window (client, &self->rgripright, self->window, mask, attrib);
- client_create_window (client, &self->rgriptop, self->window, mask, attrib);
- client_create_window (client, &self->rgripbottom, self->window, mask, attrib);
+
+ client_create_window(client, &self->innerleft, self->window, mask, attrib);
+ client_create_window(client, &self->innertop, self->window, mask, attrib);
+ client_create_window(client, &self->innerright, self->window, mask, attrib);
+ client_create_window(client, &self->innerbottom, self->window, mask, attrib);
+
+ client_create_window(client, &self->innerblb, self->innerbottom, mask,
+ attrib);
+ client_create_window(client, &self->innerbrb, self->innerbottom, mask,
+ attrib);
+ client_create_window(client, &self->innerbll, self->innerleft, mask, attrib);
+ client_create_window(client, &self->innerbrr, self->innerright, mask,
+ attrib);
+
+ client_create_window(client, &self->title, self->window, mask, attrib);
+ client_create_window(client, &self->titleleft, self->window, mask, attrib);
+ client_create_window(client, &self->titletop, self->window, mask, attrib);
+ client_create_window(client, &self->titletopleft, self->window, mask,
+ attrib);
+ client_create_window(client, &self->titletopright, self->window, mask,
+ attrib);
+ client_create_window(client, &self->titleright, self->window, mask, attrib);
+ client_create_window(client, &self->titlebottom, self->window, mask, attrib);
+
+ client_create_window(client, &self->topresize, self->title, mask, attrib);
+ client_create_window(client, &self->tltresize, self->title, mask, attrib);
+ client_create_window(client, &self->tllresize, self->title, mask, attrib);
+ client_create_window(client, &self->trtresize, self->title, mask, attrib);
+ client_create_window(client, &self->trrresize, self->title, mask, attrib);
+
+ client_create_window(client, &self->left, self->window, mask, attrib);
+ client_create_window(client, &self->right, self->window, mask, attrib);
+
+ client_create_window(client, &self->label, self->title, mask, attrib);
+ client_create_window(client, &self->max, self->title, mask, attrib);
+ client_create_window(client, &self->close, self->title, mask, attrib);
+ client_create_window(client, &self->desk, self->title, mask, attrib);
+ client_create_window(client, &self->shade, self->title, mask, attrib);
+ client_create_window(client, &self->icon, self->title, mask, attrib);
+ client_create_window(client, &self->iconify, self->title, mask, attrib);
+
+ client_create_window(client, &self->handle, self->window, mask, attrib);
+
+ client_create_window(client, &self->lgrip, self->handle, mask, attrib);
+ client_create_window(client, &self->rgrip, self->handle, mask, attrib);
+
+ client_create_window(client, &self->handleleft, self->handle, mask, attrib);
+ client_create_window(client, &self->handleright, self->handle, mask, attrib);
+
+ client_create_window(client, &self->handletop, self->window, mask, attrib);
+ client_create_window(client, &self->handlebottom, self->window, mask,
+ attrib);
+ client_create_window(client, &self->lgripleft, self->window, mask, attrib);
+ client_create_window(client, &self->lgriptop, self->window, mask, attrib);
+ client_create_window(client, &self->lgripbottom, self->window, mask, attrib);
+ client_create_window(client, &self->rgripright, self->window, mask, attrib);
+ client_create_window(client, &self->rgriptop, self->window, mask, attrib);
+ client_create_window(client, &self->rgripbottom, self->window, mask, attrib);
self->stitle = g_strdup("");
self->focused = FALSE;
{
xrect[0].x = 0;
xrect[0].y = 0;
- xrect[0].width = self->area.width;
+ xrect[0].width = self->window_area.width;
xrect[0].height = self->size.top;
++num;
}
{
xrect[1].x = 0;
xrect[1].y = FRAME_HANDLE_Y(self);
- xrect[1].width = self->area.width;
+ xrect[1].width = self->window_area.width;
xrect[1].height = theme_config.handle_height +
self->bwidth * 2;
++num;
g_hash_table_remove(window_map, &self->rgripright);
g_hash_table_remove(window_map, &self->rgriptop);
g_hash_table_remove(window_map, &self->rgripbottom);
-
}
fx += theme_config.grip_width + self->bwidth;
/* titletopright is way to the right edge */
else if (win == self->titletopright)
- fx += self->area.width - (theme_config.grip_width + self->bwidth);
+ fx += self->window_area.width - (theme_config.grip_width
+ + self->bwidth);
/* titleright is even more way to the right edge */
else if (win == self->titleright)
- fx += self->area.width - self->bwidth;
+ fx += self->window_area.width - self->bwidth;
/* figure out if we're over the area that should be considered a
button */
if (self->leftmost != OB_FRAME_CONTEXT_NONE)
return self->leftmost;
}
- else if (fx >= (self->area.width - (self->bwidth
+ else if (fx >= (self->window_area.width - (self->bwidth
+ theme_config.paddingx + 1 + theme_config.button_size))) {
if (self->rightmost != OB_FRAME_CONTEXT_NONE)
return self->rightmost;
void frame_get_window_area(gpointer self, Rect * r)
{
- /* *r = (OBDEFAULTFRAME(self)->area) ??? */
- memcpy(r, &(OBDEFAULTFRAME(self)->area), sizeof(Rect));
+ /* *r = (OBDEFAULTFRAME(self)->area) ??? */
+ memcpy(r, &(OBDEFAULTFRAME(self)->window_area), sizeof(Rect));
}
void frame_set_client_area(gpointer self, Rect r)
{
- OBDEFAULTFRAME(self)->client_area = r;
+ //OBDEFAULTFRAME(self)->client_area = r;
+}
+
+void frame_compute_layout (ObDefaultFrame * self)
+{
+ if (self->decorations & OB_FRAME_DECOR_BORDER || config_theme_keepborder) {
+ self->bwidth = theme_config.fbwidth;
+ }
+ else {
+ self->bwidth = 0;
+ }
+
+ if (self->decorations & OB_FRAME_DECOR_BORDER) {
+ self->cbwidth_l = theme_config.cbwidthx;
+ self->cbwidth_r = theme_config.cbwidthx;
+ self->cbwidth_t = theme_config.cbwidthy;
+ self->cbwidth_b = theme_config.cbwidthy;
+ }
+ else {
+ self->cbwidth_l = 0;
+ self->cbwidth_t = 0;
+ self->cbwidth_r = 0;
+ self->cbwidth_b = 0;
+ }
+
+ if (self->max_horz) {
+ self->cbwidth_l = 0;
+ self->cbwidth_r = 0;
+ self->width = self->client_area.width;
+ if (self->max_vert)
+ self->cbwidth_b = 0;
+ }
+ else {
+ self->width = self->client_area.width + self->cbwidth_l
+ + self->cbwidth_r;
+ }
+
+ /* some elements are sized based of the width, so don't let them have
+ negative values */
+ self->width = MAX(self->width, (theme_config.grip_width + self->bwidth) * 2
+ + 1);
+
+ /* set boders */
+ STRUT_SET(self->size, self->cbwidth_l
+ + (!self->max_horz ? self->bwidth : 0), self->cbwidth_t
+ + self->bwidth, self->cbwidth_r + (!self->max_horz ? self->bwidth
+ : 0), self->cbwidth_b
+ + (!self->max_horz || !self->max_vert ? self->bwidth : 0));
+
+ /* ajust it */
+ if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
+ self->size.top += theme_config.title_height + self->bwidth;
+ if (self->decorations & OB_FRAME_DECOR_HANDLE && theme_config.handle_height
+ > 0) {
+ self->size.bottom += theme_config.handle_height + self->bwidth;
+ }
+
+ /* shading can change without being moved or resized */
+ RECT_SET_SIZE(self->window_area, self->client_area.width + self->size.left
+ + self->size.right, (self->shaded ? theme_config.title_height
+ + self->bwidth * 2 : self->client_area.height + self->size.top
+ + self->size.bottom));
+
+}
+
+void frame_fake_update_layout(gpointer _self, Rect area)
+{
+ ObDefaultFrame * self = (ObDefaultFrame *) _self;
+ if ((area.height != self->client_area.height)
+ || (area.width != self->client_area.width))
+ {
+ self->need_update = TRUE;
+ frame_compute_layout(self);
+ }
}
-void frame_update_layout(gpointer _self, Rect area, gboolean is_resize, gboolean is_fake)
+void frame_render(gpointer _self, Rect area)
{
ObDefaultFrame * self = (ObDefaultFrame *) _self;
Strut oldsize;
+ oldsize = self->size;
+
+ if ((area.height != self->client_area.height)
+ || (area.width != self->client_area.width))
+ {
+ self->need_update = TRUE;
+ }
+ /* we don't move anything */
+ gboolean is_move = area.x != self->client_area.x || area.y
+ != self->client_area.y;
+
+ self->client_area = area;
+ self->window_area = self->client_area;
+
+ /* do this before changing the frame's status like max_horz max_vert */
+ frame_adjust_cursors(self);
+
+ /* if we move or resize */
+ if (TRUE) {
+ frame_compute_layout(self);
+
+ /* position/size and map/unmap all the windows */
+ gint innercornerheight = theme_config.grip_width - self->size.bottom;
+
+ if (self->cbwidth_l) {
+ XMoveResizeWindow(obp_display, self->innerleft, self->size.left
+ - self->cbwidth_l, self->size.top, self->cbwidth_l,
+ self->client_area.height);
+
+ XMapWindow(obp_display, self->innerleft);
+ }
+ else
+ XUnmapWindow(obp_display, self->innerleft);
+
+ if (self->cbwidth_l && innercornerheight > 0) {
+ XMoveResizeWindow(obp_display, self->innerbll, 0,
+ self->client_area.height - (theme_config.grip_width
+ - self->size.bottom), self->cbwidth_l,
+ theme_config.grip_width - self->size.bottom);
+
+ XMapWindow(obp_display, self->innerbll);
+ }
+ else
+ XUnmapWindow(obp_display, self->innerbll);
+
+ if (self->cbwidth_r) {
+ XMoveResizeWindow(obp_display, self->innerright, self->size.left
+ + self->client_area.width, self->size.top, self->cbwidth_r,
+ self->client_area.height);
+
+ XMapWindow(obp_display, self->innerright);
+ }
+ else
+ XUnmapWindow(obp_display, self->innerright);
+
+ if (self->cbwidth_r && innercornerheight > 0) {
+ XMoveResizeWindow(obp_display, self->innerbrr, 0,
+ self->client_area.height - (theme_config.grip_width
+ - self->size.bottom), self->cbwidth_r,
+ theme_config.grip_width - self->size.bottom);
+
+ XMapWindow(obp_display, self->innerbrr);
+ }
+ else
+ XUnmapWindow(obp_display, self->innerbrr);
+
+ if (self->cbwidth_t) {
+ XMoveResizeWindow(
+ obp_display,
+ self->innertop,
+ self->size.left - self->cbwidth_l,
+ self->size.top - self->cbwidth_t,
+ self->client_area.width + self->cbwidth_l + self->cbwidth_r,
+ self->cbwidth_t);
+
+ XMapWindow(obp_display, self->innertop);
+ }
+ else
+ XUnmapWindow(obp_display, self->innertop);
+
+ if (self->cbwidth_b) {
+ XMoveResizeWindow(obp_display, self->innerbottom, self->size.left
+ - self->cbwidth_l, self->size.top
+ + self->client_area.height, self->client_area.width
+ + self->cbwidth_l + self->cbwidth_r, self->cbwidth_b);
+
+ XMoveResizeWindow(obp_display, self->innerblb, 0, 0,
+ theme_config.grip_width + self->bwidth, self->cbwidth_b);
+ XMoveResizeWindow(obp_display, self->innerbrb,
+ self->client_area.width + self->cbwidth_l + self->cbwidth_r
+ - (theme_config.grip_width + self->bwidth), 0,
+ theme_config.grip_width + self->bwidth, self->cbwidth_b);
+
+ XMapWindow(obp_display, self->innerbottom);
+ XMapWindow(obp_display, self->innerblb);
+ XMapWindow(obp_display, self->innerbrb);
+ }
+ else {
+ XUnmapWindow(obp_display, self->innerbottom);
+ XUnmapWindow(obp_display, self->innerblb);
+ XUnmapWindow(obp_display, self->innerbrb);
+ }
+
+ if (self->bwidth) {
+ gint titlesides;
+
+ /* height of titleleft and titleright */
+ titlesides = (!self->max_horz ? theme_config.grip_width : 0);
+
+ XMoveResizeWindow(obp_display, self->titletop,
+ theme_config.grip_width + self->bwidth, 0,
+ /* width + bwidth*2 - bwidth*2 - grips*2 */
+ self->width - theme_config.grip_width * 2, self->bwidth);
+ XMoveResizeWindow(obp_display, self->titletopleft, 0, 0,
+ theme_config.grip_width + self->bwidth, self->bwidth);
+ XMoveResizeWindow(obp_display, self->titletopright,
+ self->client_area.width + self->size.left
+ + self->size.right - theme_config.grip_width
+ - self->bwidth, 0, theme_config.grip_width
+ + self->bwidth, self->bwidth);
+
+ if (titlesides > 0) {
+ XMoveResizeWindow(obp_display, self->titleleft, 0,
+ self->bwidth, self->bwidth, titlesides);
+ XMoveResizeWindow(obp_display, self->titleright,
+ self->client_area.width + self->size.left
+ + self->size.right - self->bwidth,
+ self->bwidth, self->bwidth, titlesides);
+
+ XMapWindow(obp_display, self->titleleft);
+ XMapWindow(obp_display, self->titleright);
+ }
+ else {
+ XUnmapWindow(obp_display, self->titleleft);
+ XUnmapWindow(obp_display, self->titleright);
+ }
+
+ XMapWindow(obp_display, self->titletop);
+ XMapWindow(obp_display, self->titletopleft);
+ XMapWindow(obp_display, self->titletopright);
+
+ if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
+ XMoveResizeWindow(obp_display, self->titlebottom,
+ (self->max_horz ? 0 : self->bwidth),
+ theme_config.title_height + self->bwidth, self->width,
+ self->bwidth);
+
+ XMapWindow(obp_display, self->titlebottom);
+ }
+ else
+ XUnmapWindow(obp_display, self->titlebottom);
+ }
+ else {
+ XUnmapWindow(obp_display, self->titlebottom);
+
+ XUnmapWindow(obp_display, self->titletop);
+ XUnmapWindow(obp_display, self->titletopleft);
+ XUnmapWindow(obp_display, self->titletopright);
+ XUnmapWindow(obp_display, self->titleleft);
+ XUnmapWindow(obp_display, self->titleright);
+ }
+
+ if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
+ XMoveResizeWindow(obp_display, self->title, (self->max_horz ? 0
+ : self->bwidth), self->bwidth, self->width,
+ theme_config.title_height);
+
+ XMapWindow(obp_display, self->title);
+
+ if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+ XMoveResizeWindow(obp_display, self->topresize,
+ theme_config.grip_width, 0, self->width
+ - theme_config.grip_width *2,
+ theme_config.paddingy + 1);
+
+ XMoveWindow(obp_display, self->tltresize, 0, 0);
+ XMoveWindow(obp_display, self->tllresize, 0, 0);
+ XMoveWindow(obp_display, self->trtresize, self->width
+ - theme_config.grip_width, 0);
+ XMoveWindow(obp_display, self->trrresize, self->width
+ - theme_config.paddingx - 1, 0);
+
+ XMapWindow(obp_display, self->topresize);
+ XMapWindow(obp_display, self->tltresize);
+ XMapWindow(obp_display, self->tllresize);
+ XMapWindow(obp_display, self->trtresize);
+ XMapWindow(obp_display, self->trrresize);
+ }
+ else {
+ XUnmapWindow(obp_display, self->topresize);
+ XUnmapWindow(obp_display, self->tltresize);
+ XUnmapWindow(obp_display, self->tllresize);
+ XUnmapWindow(obp_display, self->trtresize);
+ XUnmapWindow(obp_display, self->trrresize);
+ }
+ }
+ else
+ XUnmapWindow(obp_display, self->title);
+
+ if ((self->decorations & OB_FRAME_DECOR_TITLEBAR))
+ /* layout the title bar elements */
+ layout_title(self);
+
+ gint sidebwidth = self->max_horz ? 0 : self->bwidth;
+
+ if (self->bwidth && self->size.bottom) {
+ XMoveResizeWindow(obp_display, self->handlebottom,
+ theme_config.grip_width + self->bwidth + sidebwidth,
+ self->size.top + self->client_area.height
+ + self->size.bottom - self->bwidth, self->width
+ - (theme_config.grip_width + sidebwidth) * 2,
+ self->bwidth);
+
+ if (sidebwidth) {
+ XMoveResizeWindow(obp_display, self->lgripleft, 0,
+ self->size.top + self->client_area.height
+ + self->size.bottom
+ - (!self->max_horz ? theme_config.grip_width
+ : self->size.bottom - self->cbwidth_b),
+ self->bwidth,
+ (!self->max_horz ? theme_config.grip_width
+ : self->size.bottom - self->cbwidth_b));
+ XMoveResizeWindow(obp_display, self->rgripright,
+ self->size.left + self->client_area.width
+ + self->size.right - self->bwidth,
+ self->size.top + self->client_area.height
+ + self->size.bottom
+ - (!self->max_horz ? theme_config.grip_width
+ : self->size.bottom - self->cbwidth_b),
+ self->bwidth,
+ (!self->max_horz ? theme_config.grip_width
+ : self->size.bottom - self->cbwidth_b));
+
+ XMapWindow(obp_display, self->lgripleft);
+ XMapWindow(obp_display, self->rgripright);
+ }
+ else {
+ XUnmapWindow(obp_display, self->lgripleft);
+ XUnmapWindow(obp_display, self->rgripright);
+ }
+
+ XMoveResizeWindow(obp_display, self->lgripbottom, sidebwidth,
+ self->size.top + self->client_area.height
+ + self->size.bottom - self->bwidth,
+ theme_config.grip_width + self->bwidth, self->bwidth);
+ XMoveResizeWindow(obp_display, self->rgripbottom, self->size.left
+ + self->client_area.width + self->size.right - self->bwidth
+ - sidebwidth - theme_config.grip_width, self->size.top
+ + self->client_area.height + self->size.bottom
+ - self->bwidth, theme_config.grip_width + self->bwidth,
+ self->bwidth);
+
+ XMapWindow(obp_display, self->handlebottom);
+ XMapWindow(obp_display, self->lgripbottom);
+ XMapWindow(obp_display, self->rgripbottom);
+
+ if (self->decorations & OB_FRAME_DECOR_HANDLE
+ && theme_config.handle_height > 0) {
+ XMoveResizeWindow(obp_display, self->handletop,
+ theme_config.grip_width + self->bwidth + sidebwidth,
+ FRAME_HANDLE_Y(self), self->width - (theme_config.grip_width
+ + sidebwidth) * 2, self->bwidth);
+ XMapWindow(obp_display, self->handletop);
+
+ if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+ XMoveResizeWindow(obp_display, self->handleleft,
+ theme_config.grip_width, 0, self->bwidth,
+ theme_config.handle_height);
+ XMoveResizeWindow(obp_display, self->handleright,
+ self->width - theme_config.grip_width
+ - self->bwidth, 0, self->bwidth,
+ theme_config.handle_height);
+
+ XMoveResizeWindow(obp_display, self->lgriptop, sidebwidth,
+ FRAME_HANDLE_Y(self), theme_config.grip_width + self->bwidth,
+ self->bwidth);
+ XMoveResizeWindow(obp_display, self->rgriptop,
+ self->size.left + self->client_area.width
+ + self->size.right - self->bwidth
+ - sidebwidth - theme_config.grip_width,
+ FRAME_HANDLE_Y(self), theme_config.grip_width
+ + self->bwidth, self->bwidth);
+
+ XMapWindow(obp_display, self->handleleft);
+ XMapWindow(obp_display, self->handleright);
+ XMapWindow(obp_display, self->lgriptop);
+ XMapWindow(obp_display, self->rgriptop);
+ }
+ else {
+ XUnmapWindow(obp_display, self->handleleft);
+ XUnmapWindow(obp_display, self->handleright);
+ XUnmapWindow(obp_display, self->lgriptop);
+ XUnmapWindow(obp_display, self->rgriptop);
+ }
+ }
+ else {
+ XUnmapWindow(obp_display, self->handleleft);
+ XUnmapWindow(obp_display, self->handleright);
+ XUnmapWindow(obp_display, self->lgriptop);
+ XUnmapWindow(obp_display, self->rgriptop);
+
+ XUnmapWindow(obp_display, self->handletop);
+ }
+ }
+ else {
+ XUnmapWindow(obp_display, self->handleleft);
+ XUnmapWindow(obp_display, self->handleright);
+ XUnmapWindow(obp_display, self->lgriptop);
+ XUnmapWindow(obp_display, self->rgriptop);
+
+ XUnmapWindow(obp_display, self->handletop);
+
+ XUnmapWindow(obp_display, self->handlebottom);
+ XUnmapWindow(obp_display, self->lgripleft);
+ XUnmapWindow(obp_display, self->rgripright);
+ XUnmapWindow(obp_display, self->lgripbottom);
+ XUnmapWindow(obp_display, self->rgripbottom);
+ }
+
+ if (self->decorations & OB_FRAME_DECOR_HANDLE
+ && theme_config.handle_height > 0) {
+ XMoveResizeWindow(obp_display, self->handle, sidebwidth,
+ FRAME_HANDLE_Y(self) + self->bwidth, self->width,
+ theme_config.handle_height);
+ XMapWindow(obp_display, self->handle);
+
+ if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+ XMoveResizeWindow(obp_display, self->lgrip, 0, 0,
+ theme_config.grip_width, theme_config.handle_height);
+ XMoveResizeWindow(obp_display, self->rgrip, self->width
+ - theme_config.grip_width, 0, theme_config.grip_width,
+ theme_config.handle_height);
+
+ XMapWindow(obp_display, self->lgrip);
+ XMapWindow(obp_display, self->rgrip);
+ }
+ else {
+ XUnmapWindow(obp_display, self->lgrip);
+ XUnmapWindow(obp_display, self->rgrip);
+ }
+ }
+ else {
+ XUnmapWindow(obp_display, self->lgrip);
+ XUnmapWindow(obp_display, self->rgrip);
+
+ XUnmapWindow(obp_display, self->handle);
+ }
+
+ if (self->bwidth && !self->max_horz && (self->client_area.height
+ + self->size.top + self->size.bottom) > theme_config.grip_width
+ * 2) {
+ XMoveResizeWindow(obp_display, self->left, 0, self->bwidth
+ + theme_config.grip_width, self->bwidth,
+ self->client_area.height + self->size.top
+ + self->size.bottom - theme_config.grip_width * 2);
+
+ XMapWindow(obp_display, self->left);
+ }
+ else
+ XUnmapWindow(obp_display, self->left);
+
+ if (self->bwidth && !self->max_horz && (self->client_area.height
+ + self->size.top + self->size.bottom) > theme_config.grip_width
+ * 2) {
+ XMoveResizeWindow(obp_display, self->right, self->client_area.width
+ + self->cbwidth_l + self->cbwidth_r + self->bwidth,
+ self->bwidth + theme_config.grip_width, self->bwidth,
+ self->client_area.height + self->size.top
+ + self->size.bottom - theme_config.grip_width * 2);
+
+ XMapWindow(obp_display, self->right);
+ }
+ else
+ XUnmapWindow(obp_display, self->right);
+
+ XMoveResizeWindow(obp_display, self->backback, self->size.left,
+ self->size.top, self->client_area.width,
+ self->client_area.height);
+ /* move and resize the top level frame.
+ shading can change without being moved or resized.
+ but don't do this during an iconify animation. it will be
+ reflected afterwards.
+ */
+ /*XResizeWindow(obp_display, self->window, self->window_area.width,
+ self->window_area.height);*/
+
+ frame_update_skin(self);
+ frame_adjust_shape(self);
+
+ if (!STRUT_EQUAL(self->size, oldsize)) {
+ gulong vals[4];
+ vals[0] = self->size.left;
+ vals[1] = self->size.right;
+ vals[2] = self->size.top;
+ vals[3] = self->size.bottom;
+ OBT_PROP_SETA32(self->client->w_client, NET_FRAME_EXTENTS,
+ CARDINAL, vals, 4);
+ OBT_PROP_SETA32(self->client->w_client, KDE_NET_WM_FRAME_STRUT,
+ CARDINAL, vals, 4);
+ }
+
+ if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
+ XResizeWindow(obp_display, self->label, self->label_width,
+ theme_config.label_height);
+
+ self->need_update = FALSE;
+ }
+}
+
+void frame_update_layout(gpointer _self, Rect area, gboolean is_resize,
+ gboolean is_fake)
+{
+ ObDefaultFrame * self = (ObDefaultFrame *) _self;
+ Strut oldsize;
oldsize = self->size;
self->client_area = area;
- self->area = self->client_area;
+ self->window_area = self->client_area;
/* do this before changing the frame's status like max_horz max_vert */
frame_adjust_cursors(self);
- if (self->decorations & OB_FRAME_DECOR_BORDER
- || (config_theme_keepborder)) {
+ if (self->decorations & OB_FRAME_DECOR_BORDER || (config_theme_keepborder)) {
self->bwidth = theme_config.fbwidth;
}
else {
}
/* shading can change without being moved or resized */
- RECT_SET_SIZE(self->area, self->client_area.width + self->size.left
+ RECT_SET_SIZE(self->window_area, self->client_area.width + self->size.left
+ self->size.right, (self->shaded ? theme_config.title_height
+ self->bwidth * 2 : self->client_area.height + self->size.top
+ self->size.bottom));
if ((is_resize) && !is_fake) {
/* find the new coordinates, done after setting the frame.size, for
frame_client_gravity. */
- self->area.x = self->client_area.x;
- self->area.y = self->client_area.y;
- frame_client_gravity(OBDEFAULTFRAME(_self)->client, &self->area.x, &self->area.y);
+ self->window_area.x = self->client_area.x;
+ self->window_area.y = self->client_area.y;
+ frame_client_gravity(OBDEFAULTFRAME(_self)->client, &self->window_area.x, &self->window_area.y);
}
if (!is_fake) {
but don't do this during an iconify animation. it will be
reflected afterwards.
*/
- XMoveResizeWindow(obp_display, self->window, self->area.x,
- self->area.y, self->area.width, self->area.height);
+ XMoveResizeWindow(obp_display, self->window, self->window_area.x,
+ self->window_area.y, self->window_area.width,
+ self->window_area.height);
if (is_resize) {
//frame_update_skin(self);
}
else {
x = right;
- lc = config_title_layout
- + strlen(config_title_layout)-1;
+ lc = config_title_layout + strlen(config_title_layout)-1;
firstcon = &self->rightmost;
}
}
}
-ObFrameEngine engine = {
- 0, /* gpointer handler */
- "libdefault.la", /* gchar * filename */
- "Default", /* gchar * name */
- init, //gint (*init) (Display * display, gint screen);
+ObFrameEngine engine = { 0, /* gpointer handler */
+"libdefault.la", /* gchar * filename */
+"Default", /* gchar * name */
+init, //gint (*init) (Display * display, gint screen);
0, /* */
frame_new, //gpointer (*frame_new) (struct _ObClient *c);
frame_free, //void (*frame_free) (gpointer self);
frame_get_window_area, /* */
frame_set_client_area, /* */
/* Draw the frame */
+ frame_fake_update_layout, /* */
+ frame_render, /* */
frame_update_layout, /* */
frame_update_skin, /* */
frame_set_hover_flag, /* */
XChangeSaveSet(obt_display, window, SetModeInsert);
/* create decorations */
- client_simple_create_window (self, &self->w_frame, RootWindow(obt_display, ob_screen));
+ client_simple_create_window(self, &self->w_frame, RootWindow(obt_display, ob_screen));
+
self->frame = frame_engine.frame_new(self, self->w_client, self->w_frame);
/* reparent the client to the frame */
XReparentWindow(obt_display, self->w_client, self->w_frame, 0, 0);
-
+
/*
When reparenting the client window, it is usually not mapped yet, since
this occurs from a MapRequest. However, in the case where Openbox is
req's) the ButtonPress is to catch clicks on the client border */
XSelectInput(obt_display, self->w_frame, FRAME_EVENTMASK);
- frame_engine.frame_grab(self->frame, window_map);
+ //frame_engine.frame_grab(self->frame, window_map);
/* we've grabbed everything and set everything that we need to at mapping
time now */
frame_engine.frame_set_is_focus(self->frame, FALSE);
frame_engine.frame_set_decorations(self->frame, self->decorations);
frame_engine.frame_update_title(self->frame, self->title);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, TRUE);
- //frame_engine->frame_update_skin (self->frame);
+ frame_engine.frame_fake_update_layout(self->frame, self->area);
/* where the frame was placed is where the window was originally */
place = self->area;
self->frame = frame_engine.frame_new(self, self->w_client, self->w_frame);
frame_engine.frame_set_decorations(self->frame, self->decorations);
frame_engine.frame_update_title(self->frame, self->title);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+ frame_engine.frame_render(self->frame, self->area);
/* if this occurs while we are focus cycling, the indicator needs to
match the changes */
if (focus_cycle_target == self)
focus_cycle_draw_indicator(self);
- frame_engine.frame_update_skin(self->frame);
+ //frame_engine.frame_update_skin(self->frame);
Strut size;
frame_engine.frame_get_size(self->frame, &size);
if (self->frame) {
/* update title render */
frame_engine.frame_update_title(self->frame, self->title);
- frame_engine.frame_update_skin(self->frame);
+ //frame_engine.frame_update_skin(self->frame);
}
/* update the icon title */
if (self->undecorated)
netstate[num++] = OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED);
OBT_PROP_SETA32(self->w_client, NET_WM_STATE, ATOM, netstate, num);
-
+/*
if (self->frame) {
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+ frame_engine.frame_render(self->frame, self->area);*/
/* if this occurs while we are focus cycling, the indicator needs to
match the changes */
- if (focus_cycle_target == self)
+ /* if (focus_cycle_target == self)
focus_cycle_draw_indicator(self);
- }
+ }*/
}
ObClient *client_search_focus_tree(ObClient *self)
/* save the area, and make it where it should be for the premax stuff */
oldarea = self->area;
RECT_SET(self->area, x, y, w, h);
- frame_engine.frame_set_client_area(self->frame, self->area);
+ frame_engine.frame_fake_update_layout (self->frame, self->area);
/* apply the states. these are in a carefully crafted order.. */
*/
self->area = oldarea;
frame_engine.frame_set_decorations(self->frame, self->decorations);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+ frame_engine.frame_render(self->frame, self->area);
/* when the client has StaticGravity, it likes to move around.
also this correctly positions the client when it maps.
this also needs to be run when the frame's decorations sizes change!
*/
+ client_move_frame (self);
Strut size;
frame_engine.frame_get_size(self->frame, &size);
XMoveResizeWindow(obt_display, self->w_client, size.left, size.top,
gint *logicalw, gint *logicalh, gboolean user)
{
Rect desired = { *x, *y, *w, *h };
+ Strut extends_size;
+
+ frame_engine.frame_get_size(self->frame, &extends_size);
+
+ /* Here we get the desired frame rect from the desired size of client */
frame_rect_to_frame(self, &desired);
/* make the frame recalculate its dimentions n shit without changing
anything visible for real, this way the constraints below can work with
the updated frame dimensions. */
- frame_engine.frame_set_decorations(self->frame, self->decorations);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, TRUE);
+ //frame_engine.frame_set_decorations(self->frame, self->decorations);
+ //frame_engine.frame_fake_update_layout(self->frame, self->area);
/* gets the frame's position */
frame_client_gravity(self, x, y);
/* set the size and position if fullscreen */
if (self->fullscreen) {
+
Rect *a;
guint i;
a = screen_area(self->desktop, i,
(self->max_horz && self->max_vert ? NULL : &desired));
- Strut size;
- frame_engine.frame_get_size(self->frame, &size);
/* set the size and position if maximized */
if (self->max_horz) {
*x = a->x;
- *w = a->width - size.left - size.right;
+ *w = a->width - extends_size.left - extends_size.right;
}
if (self->max_vert) {
*y = a->y;
- *h = a->height - size.top - size.bottom;
+ *h = a->height - extends_size.top - extends_size.bottom;
}
user = FALSE; /* ignore if the client can't be moved/resized when it
gint logicalw, logicalh;
Strut size;
- frame_engine.frame_get_size(self->frame, &size);
Rect area;
- frame_engine.frame_get_window_area(self->frame, &area);
/* find the new x, y, width, and height (and logical size) */
client_try_configure(self, &x, &y, &w, &h, &logicalw, &logicalh, user);
frame_engine.frame_get_window_area(self->frame, &oldframe);
RECT_SET(self->area, x, y, w, h);
- frame_engine.frame_set_client_area(self->frame, self->area);
-
/* for app-requested resizes, always resize if 'resized' is true.
for user-requested ones, only resize if final is true, or when
resizing in redraw mode */
/* if the client is enlarging, then resize the client before the frame */
if (send_resize_client && (w > oldw || h > oldh)) {
- frame_engine.frame_set_decorations(self->frame, self->decorations);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
- /* if this occurs while we are focus cycling, the indicator needs to
- match the changes */
- if (focus_cycle_target == self)
- focus_cycle_draw_indicator(self);
+ frame_engine.frame_get_size(self->frame, &size);
+ XMoveResizeWindow(obt_display, self->w_client,
+ size.left, size.top,
+ MAX(w, oldw), MAX(h, oldh));
}
+
/* find the frame's dimensions and move/resize it */
fmoved = moved;
fresized = resized;
would change what window gets the event */
mouse_replay_pointer();
- frame_engine.frame_set_decorations(self->frame, self->decorations);
- frame_engine.frame_update_layout(self->frame, self->area, TRUE, FALSE);
+ frame_engine.frame_render(self->frame, self->area);
+ client_move_frame (self);
/* if this occurs while we are focus cycling, the indicator needs to
match the changes */
gint oldry = self->root_pos.y;
/* we have reset the client to 0 border width, so don't include
it in these coords */
+ frame_engine.frame_get_size (self->frame, &size);
+ frame_engine.frame_get_window_area (self->frame, &area);
POINT_SET(self->root_pos, area.x + size.left - self->border_width,
area.y + size.top - self->border_width);
if (self->root_pos.x != oldrx || self->root_pos.y != oldry)
in the direction that is growing
*/
if (send_resize_client && (w <= oldw || h <= oldh)) {
- frame_engine.frame_set_decorations(self->frame, self->decorations);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
- /* if this occurs while we are focus cycling, the indicator needs to
- match the changes */
- if (focus_cycle_target == self)
- focus_cycle_draw_indicator(self);
- }
-
- if (user && final) {
- /* when the client has StaticGravity, it likes to move around.
- also this correctly positions the client when it maps.
- this also needs to be run when the frame's decorations sizes change!
- */
- Strut size;
frame_engine.frame_get_size(self->frame, &size);
- XMoveResizeWindow(obt_display, self->w_client, size.left, size.top,
- self->area.width, self->area.height);
- frame_engine.frame_update_skin(self->frame);
+ XMoveResizeWindow(obt_display, self->w_client,
+ size.left, size.top, w, h);
}
XFlush(obt_display);
/* if it moved between monitors, then this can affect the stacking
layer of this window or others - for fullscreen windows */
- Rect current_frame;
- frame_engine.frame_get_window_area(self->frame, ¤t_frame);
- if (screen_find_monitor(¤t_frame) != screen_find_monitor(&oldframe)) {
+ frame_engine.frame_get_window_area(self->frame, &area);
+ if (screen_find_monitor(&area) != screen_find_monitor(&oldframe)) {
client_calc_layer(self);
}
}
client_change_wm_state(self); /* the window is being hidden/shown */
/* resize the frame to just the titlebar */
frame_engine.frame_set_is_shaded(self->frame, self->shaded);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+ frame_engine.frame_render(self->frame, self->area);
/* if this occurs while we are focus cycling, the indicator needs to
match the changes */
if (focus_cycle_target == self)
OBT_PROP_SET32(self->w_client, NET_WM_DESKTOP, CARDINAL, target);
/* the frame can display the current desktop state */
frame_engine.frame_set_decorations(self->frame, self->decorations);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+ frame_engine.frame_render(self->frame, self->area);
/* if this occurs while we are focus cycling, the indicator needs to
match the changes */
if (focus_cycle_target == self)
void client_show_frame(ObClient * self)
{
frame_engine.frame_set_is_visible(self->frame, TRUE);
- frame_engine.frame_update_layout(self->frame, self->area, FALSE, FALSE);
+ frame_engine.frame_render(self->frame, self->area);
+ client_move_frame(self);
/* if this occurs while we are focus cycling, the indicator needs to
match the changes */
if (focus_cycle_target == self)
focus_cycle_draw_indicator(self);
- frame_engine.frame_update_skin(self->frame);
+ //frame_engine.frame_update_skin(self->frame);
/* Grab the server to make sure that the frame window is mapped before
the client gets its MapNotify, i.e. to make sure the client is
_visible_ when it gets MapNotify. */
self->flash_on = !self->flash_on;
if (!self->focused) {
frame_engine.frame_set_is_focus(self->frame, self->flash_on);
- frame_engine.frame_update_skin(self->frame);
+ //frame_engine.frame_update_skin(self->frame);
self->focused = FALSE;
}
return TRUE; /* go again */
ObClient * self = (ObClient *) data;
if (self->focused != self->flash_on) {
frame_engine.frame_set_is_focus(self->frame, self->focused);
- frame_engine.frame_update_skin(self->frame);
+ //frame_engine.frame_update_skin(self->frame);
}
}
-
void client_simple_create_window(ObClient * self, Window * dst, Window parent)
{
gulong mask = 0;
/* Register the frame */
g_hash_table_insert(window_map, dst, self);
}
+
+void client_update_extends_attributes (ObClient * self)
+{
+ Strut size;
+ frame_engine.frame_get_size (self->frame, &size);
+ //if (!STRUT_EQUAL(self->size, oldsize)) {
+ gulong vals[4];
+ vals[0] = size.left;
+ vals[1] = size.right;
+ vals[2] = size.top;
+ vals[3] = size.bottom;
+ OBT_PROP_SETA32(self->w_client, NET_FRAME_EXTENTS,
+ CARDINAL, vals, 4);
+ OBT_PROP_SETA32(self->w_client, KDE_NET_WM_FRAME_STRUT,
+ CARDINAL, vals, 4);
+ //}
+}
+
+void client_move_frame(ObClient * self)
+{
+ Rect area;
+ frame_engine.frame_get_window_area(self->frame, &area);
+ area.x = self->area.x;
+ area.y = self->area.y;
+ frame_client_gravity(self, &area.x, &area.y);
+ XMoveResizeWindow(obt_display, self->w_frame, area.x, area.y,
+ area.width, area.height);
+}