stop using a border for the outer frame window. step 1 of borderless-ness. now transparent windows dont look so terrible, yay

This commit is contained in:
Dana Jansens 2007-05-20 04:44:00 +00:00
parent 2dada607c5
commit cf5c75420a
3 changed files with 31 additions and 44 deletions

View file

@ -46,8 +46,7 @@
#define FRAME_ANIMATE_ICONIFY_TIME 150000 /* .15 seconds */ #define FRAME_ANIMATE_ICONIFY_TIME 150000 /* .15 seconds */
#define FRAME_ANIMATE_ICONIFY_STEP_TIME (G_USEC_PER_SEC / 60) /* 60 Hz */ #define FRAME_ANIMATE_ICONIFY_STEP_TIME (G_USEC_PER_SEC / 60) /* 60 Hz */
#define FRAME_HANDLE_Y(f) (f->innersize.top + f->client->area.height + \ #define FRAME_HANDLE_Y(f) (f->size.top + f->client->area.height + f->cbwidth_y)
f->cbwidth_y)
static void flash_done(gpointer data); static void flash_done(gpointer data);
static gboolean flash_timeout(gpointer data); static gboolean flash_timeout(gpointer data);
@ -290,14 +289,14 @@ void frame_adjust_shape(ObFrame *self)
if (!self->client->shaped) { if (!self->client->shaped) {
/* clear the shape on the frame window */ /* clear the shape on the frame window */
XShapeCombineMask(ob_display, self->window, ShapeBounding, XShapeCombineMask(ob_display, self->window, ShapeBounding,
self->innersize.left, self->size.left,
self->innersize.top, self->size.top,
None, ShapeSet); None, ShapeSet);
} else { } else {
/* make the frame's shape match the clients */ /* make the frame's shape match the clients */
XShapeCombineShape(ob_display, self->window, ShapeBounding, XShapeCombineShape(ob_display, self->window, ShapeBounding,
self->innersize.left, self->size.left,
self->innersize.top, self->size.top,
self->client->window, self->client->window,
ShapeBounding, ShapeSet); ShapeBounding, ShapeSet);
@ -350,33 +349,30 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
if (self->max_horz) if (self->max_horz)
self->bwidth = self->cbwidth_x = 0; self->bwidth = self->cbwidth_x = 0;
STRUT_SET(self->innersize,
self->cbwidth_x,
self->cbwidth_y,
self->cbwidth_x,
self->cbwidth_y);
self->width = self->client->area.width + self->cbwidth_x * 2 - self->width = self->client->area.width + self->cbwidth_x * 2 -
(self->max_horz ? self->rbwidth * 2 : 0); (self->max_horz ? self->rbwidth * 2 : 0);
self->width = MAX(self->width, 1); /* no lower than 1 */ self->width = MAX(self->width, 1); /* no lower than 1 */
STRUT_SET(self->size,
self->cbwidth_x + self->bwidth,
self->cbwidth_y + self->bwidth,
self->cbwidth_x + self->bwidth,
self->cbwidth_y + self->bwidth);
/* set border widths */ /* set border widths */
if (!fake) { if (!fake) {
XSetWindowBorderWidth(ob_display, self->window, self->bwidth);
XSetWindowBorderWidth(ob_display, self->inner, self->bwidth);
XSetWindowBorderWidth(ob_display, self->title, self->rbwidth); XSetWindowBorderWidth(ob_display, self->title, self->rbwidth);
XSetWindowBorderWidth(ob_display, self->handle, self->rbwidth); XSetWindowBorderWidth(ob_display, self->handle, self->rbwidth);
XSetWindowBorderWidth(ob_display, self->lgrip, self->rbwidth); XSetWindowBorderWidth(ob_display, self->lgrip, self->rbwidth);
XSetWindowBorderWidth(ob_display, self->rgrip, self->rbwidth); XSetWindowBorderWidth(ob_display, self->rgrip, self->rbwidth);
XSetWindowBorderWidth(ob_display, self->leftresize, self->bwidth);
XSetWindowBorderWidth(ob_display, self->rightresize, self->bwidth);
} }
if (self->decorations & OB_FRAME_DECOR_TITLEBAR) if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
self->innersize.top += ob_rr_theme->title_height + self->rbwidth + self->size.top += ob_rr_theme->title_height + self->rbwidth +
(self->rbwidth - self->bwidth); (self->rbwidth - self->bwidth);
if (self->decorations & OB_FRAME_DECOR_HANDLE && if (self->decorations & OB_FRAME_DECOR_HANDLE &&
ob_rr_theme->handle_height > 0) ob_rr_theme->handle_height > 0)
self->innersize.bottom += ob_rr_theme->handle_height + self->size.bottom += ob_rr_theme->handle_height +
self->rbwidth + (self->rbwidth - self->bwidth); self->rbwidth + (self->rbwidth - self->bwidth);
/* position/size and map/unmap all the windows */ /* position/size and map/unmap all the windows */
@ -384,7 +380,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
if (!fake) { if (!fake) {
if (self->decorations & OB_FRAME_DECOR_TITLEBAR) { if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
XMoveResizeWindow(ob_display, self->title, XMoveResizeWindow(ob_display, self->title,
-self->bwidth, -self->bwidth, 0, 0,
self->width, ob_rr_theme->title_height); self->width, ob_rr_theme->title_height);
XMapWindow(ob_display, self->title); XMapWindow(ob_display, self->title);
@ -434,7 +430,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
handle_height = 1; handle_height = 1;
XMoveResizeWindow(ob_display, self->handle, XMoveResizeWindow(ob_display, self->handle,
-self->bwidth, FRAME_HANDLE_Y(self), 0, FRAME_HANDLE_Y(self),
self->width, handle_height); self->width, handle_height);
XMapWindow(ob_display, self->handle); XMapWindow(ob_display, self->handle);
@ -455,16 +451,16 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
if (self->decorations & OB_FRAME_DECOR_GRIPS) { if (self->decorations & OB_FRAME_DECOR_GRIPS) {
XMoveResizeWindow(ob_display, self->leftresize, XMoveResizeWindow(ob_display, self->leftresize,
-(ob_rr_theme->fbwidth * 2) - 1,
0, 0,
1, 0,
self->bwidth,
self->client->area.height + self->client->area.height +
self->cbwidth_y * 2); self->cbwidth_y * 2);
XMoveResizeWindow(ob_display, self->rightresize, XMoveResizeWindow(ob_display, self->rightresize,
self->client->area.width + self->client->area.width +
self->cbwidth_x * 2, self->cbwidth_x * 2 + self->bwidth,
0, 0,
1, self->bwidth,
self->client->area.height + self->client->area.height +
self->cbwidth_y * 2); self->cbwidth_y * 2);
@ -478,28 +474,20 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
/* move and resize the inner border window which contains the plate /* move and resize the inner border window which contains the plate
*/ */
XMoveResizeWindow(ob_display, self->inner, XMoveResizeWindow(ob_display, self->inner,
self->innersize.left - self->cbwidth_x - 0,
self->bwidth, self->size.top - self->cbwidth_y,
self->innersize.top - self->cbwidth_y -
self->bwidth,
self->client->area.width + self->client->area.width +
self->cbwidth_x * 2, self->cbwidth_x * 2 + self->bwidth * 2,
self->client->area.height + self->client->area.height +
self->cbwidth_y * 2); self->cbwidth_y * 2);
/* move the plate */ /* move the plate */
XMoveWindow(ob_display, self->plate, XMoveWindow(ob_display, self->plate,
self->cbwidth_x, self->cbwidth_y); self->bwidth + self->cbwidth_x, self->cbwidth_y);
/* when the client has StaticGravity, it likes to move around. */ /* when the client has StaticGravity, it likes to move around. */
XMoveWindow(ob_display, self->client->window, 0, 0); XMoveWindow(ob_display, self->client->window, 0, 0);
} }
STRUT_SET(self->size,
self->innersize.left + self->bwidth,
self->innersize.top + self->bwidth,
self->innersize.right + self->bwidth,
self->innersize.bottom + self->bwidth);
} }
/* shading can change without being moved or resized */ /* shading can change without being moved or resized */
@ -530,9 +518,10 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
reflected afterwards. reflected afterwards.
*/ */
XMoveResizeWindow(ob_display, self->window, XMoveResizeWindow(ob_display, self->window,
self->area.x, self->area.y, self->area.x,
self->area.width - self->bwidth * 2, self->area.y,
self->area.height - self->bwidth * 2); self->area.width,
self->area.height);
if (resized) { if (resized) {
framerender_frame(self); framerender_frame(self);
@ -1192,7 +1181,7 @@ static gboolean frame_animate_iconify(gpointer p)
x = iconx; x = iconx;
y = icony; y = icony;
w = iconw; w = iconw;
h = self->innersize.top; /* just the titlebar */ h = self->size.top; /* just the titlebar */
} }
if (time > 0) { if (time > 0) {
@ -1209,7 +1198,7 @@ static gboolean frame_animate_iconify(gpointer p)
x = x - (dx * elapsed) / FRAME_ANIMATE_ICONIFY_TIME; x = x - (dx * elapsed) / FRAME_ANIMATE_ICONIFY_TIME;
y = y - (dy * elapsed) / FRAME_ANIMATE_ICONIFY_TIME; y = y - (dy * elapsed) / FRAME_ANIMATE_ICONIFY_TIME;
w = w - (dw * elapsed) / FRAME_ANIMATE_ICONIFY_TIME; w = w - (dw * elapsed) / FRAME_ANIMATE_ICONIFY_TIME;
h = self->innersize.top; /* just the titlebar */ h = self->size.top; /* just the titlebar */
} }
if (time == 0) if (time == 0)

View file

@ -117,8 +117,6 @@ struct _ObFrame
RrAppearance *a_unfocused_handle; RrAppearance *a_unfocused_handle;
RrAppearance *a_focused_handle; RrAppearance *a_focused_handle;
Strut innersize;
GSList *clients; GSList *clients;
gint icon_on; /* if the window icon button is on */ gint icon_on; /* if the window icon button is on */

View file

@ -51,8 +51,8 @@ void framerender_frame(ObFrame *self)
XSetWindowBorder(ob_display, self->handle, px); XSetWindowBorder(ob_display, self->handle, px);
XSetWindowBorder(ob_display, self->rgrip, px); XSetWindowBorder(ob_display, self->rgrip, px);
XSetWindowBorder(ob_display, self->lgrip, px); XSetWindowBorder(ob_display, self->lgrip, px);
XSetWindowBorder(ob_display, self->leftresize, px); XSetWindowBackground(ob_display, self->leftresize, px);
XSetWindowBorder(ob_display, self->rightresize, px); XSetWindowBackground(ob_display, self->rightresize, px);
} }
if (self->decorations & OB_FRAME_DECOR_TITLEBAR) { if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {