From 0fd95149be72a9a2cea2c228834391c651212b8c Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 10 Jun 2010 16:29:47 -0400 Subject: [PATCH] take the window's border width into account when drawing the window --- openbox/composite.c | 21 ++++++++++----------- openbox/event.c | 11 +++++++---- openbox/window.h | 3 ++- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/openbox/composite.c b/openbox/composite.c index 77df36c1..9398e1d2 100644 --- a/openbox/composite.c +++ b/openbox/composite.c @@ -351,7 +351,7 @@ static gboolean composite(gpointer data) // for (it = stacking_list; it; it = g_list_next(it)) { for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) { - gint d; + gint d, x, y, w, h; win = it->data; if (win->type == OB_WINDOW_CLASS_PROMPT) @@ -398,21 +398,20 @@ time_fix(&dif); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + x = win->area.x; + y = win->area.y; + w = win->area.width + win->border * 2; + h = win->area.height + win->border * 2; + glBegin(GL_QUADS); glTexCoord2f(0, 0); - glVertex3f(win->comp_area.x, win->comp_area.y, 0.0); + glVertex3f(x, y, 0.0); glTexCoord2f(0, 1); - glVertex3f(win->comp_area.x, - win->comp_area.y + win->comp_area.height, - 0.0); + glVertex3f(x, y + h, 0.0); glTexCoord2f(1, 1); - glVertex3f(win->comp_area.x + win->comp_area.width, - win->comp_area.y + win->comp_area.height, - 0.0); + glVertex3f(x + w, y + h, 0.0); glTexCoord2f(1, 0); - glVertex3f(win->comp_area.x + win->comp_area.width, - win->comp_area.y, - 0.0); + glVertex3f(x + w, y, 0.0); glEnd(); } glXSwapBuffers(obt_display, obcomp.overlay); diff --git a/openbox/event.c b/openbox/event.c index 5198ff72..5c7a1952 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -628,7 +628,8 @@ static void event_process(const XEvent *ec, gpointer data) { XCreateWindowEvent const *xe = &e->xcreatewindow; obwin->mapped = 0; - RECT_SET(obwin->comp_area, xe->x, xe->y, xe->width, xe->height); + RECT_SET(obwin->area, xe->x, xe->y, xe->width, xe->height); + obwin->border = xe->border_width; if (!obwin->texture) glGenTextures(1, &obwin->texture); } else if ((obwin && obwin->type != OB_WINDOW_CLASS_PROMPT) && @@ -641,13 +642,15 @@ static void event_process(const XEvent *ec, gpointer data) if (e->type == ConfigureNotify) { XConfigureEvent const *xe = &e->xconfigure; - if (obwin->comp_area.width != xe->width || - obwin->comp_area.height != xe->height) + if (obwin->area.width != xe->width || + obwin->area.height != xe->height || + obwin->border != xe->border_width) { pixchange = TRUE; } - RECT_SET(obwin->comp_area, xe->x, xe->y, + RECT_SET(obwin->area, xe->x, xe->y, xe->width, xe->height); + obwin->border = xe->border_width; } if (e->type == MapNotify) { diff --git a/openbox/window.h b/openbox/window.h index 27600c6b..a8876803 100644 --- a/openbox/window.h +++ b/openbox/window.h @@ -63,7 +63,8 @@ struct _ObWindow { Pixmap pixmap; GLXPixmap gpixmap; Damage damage; - Rect comp_area; + Rect area; + gint border; gboolean mapped; #endif }; -- 2.34.1