From: Derek Foreman Date: Thu, 10 Jun 2010 02:59:53 +0000 (-0400) Subject: add "mapped" and "area" to obwin so the composite can get sizes right and properly... X-Git-Tag: cgl~62 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=96e50d0c075b71c1c6cda085e773667c1c27ffdd;p=dana%2Fopenbox.git add "mapped" and "area" to obwin so the composite can get sizes right and properly handle internal windows --- diff --git a/openbox/composite.c b/openbox/composite.c index 7675a42c..af24f2f2 100644 --- a/openbox/composite.c +++ b/openbox/composite.c @@ -60,7 +60,6 @@ static void get_best_fbcon(GLXFBConfig *in, int count, int depth, GLXFBConfig *o int i, value, has_alpha; for (i = 0; i < count; i++) { - vi = glXGetVisualFromFBConfig(obt_display, in[i]); if (vi == NULL) continue; @@ -229,7 +228,7 @@ void composite_startup(gboolean reconfig) memset(&obcomp.PixmapConfig, 0, sizeof(obcomp.PixmapConfig)); - for (i = 0; i < MAX_DEPTH + 1; i++) { + for (i = 1; i < MAX_DEPTH + 1; i++) { get_best_fbcon(fbcs, count, i, &obcomp.PixmapConfig[i]); } @@ -291,13 +290,18 @@ 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)) { win = it->data; - if (win->type != OB_WINDOW_CLASS_CLIENT) + if (win->type == OB_WINDOW_CLASS_PROMPT) continue; - client = WINDOW_AS_CLIENT(win); - if (client->desktop != screen_desktop) + if (!win->mapped) continue; + if (win->type == OB_WINDOW_CLASS_CLIENT) { + client = WINDOW_AS_CLIENT(win); + if (client->desktop != screen_desktop) + continue; + } + if (win->depth == 32) attribs[1] = GLX_TEXTURE_FORMAT_RGBA_EXT; else @@ -325,13 +329,13 @@ time_fix(&dif); glBegin(GL_QUADS); glTexCoord2f(0, 0); - glVertex3f(client->frame->area.x, client->frame->area.y, 0.0); + glVertex3f(win->comp_area.x, win->comp_area.y, 0.0); glTexCoord2f(0, 1); - glVertex3f(client->frame->area.x, client->frame->area.y + client->frame->area.height, 0.0); + glVertex3f(win->comp_area.x, win->comp_area.y + win->comp_area.height, 0.0); glTexCoord2f(1, 1); - glVertex3f(client->frame->area.x + client->frame->area.width, client->frame->area.y + client->frame->area.height, 0.0); + glVertex3f(win->comp_area.x + win->comp_area.width, win->comp_area.y + win->comp_area.height, 0.0); glTexCoord2f(1, 0); - glVertex3f(client->frame->area.x + client->frame->area.width, client->frame->area.y, 0.0); + glVertex3f(win->comp_area.x + win->comp_area.width, win->comp_area.y, 0.0); glEnd(); } glXSwapBuffers(obt_display, obcomp.overlay); diff --git a/openbox/event.c b/openbox/event.c index 871d0e84..115e2880 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -43,7 +43,7 @@ #include "obt/xqueue.h" #include "obt/prop.h" #include "obt/keyboard.h" - +#include "geom.h" #include #include #include @@ -622,19 +622,49 @@ static void event_process(const XEvent *ec, gpointer data) frame_adjust_focus(client->frame, FALSE); } #ifdef USE_COMPOSITING - else if ((e->type == ConfigureNotify || e->type == MapNotify) + else if ((e->type == CreateNotify) && obwin + && obwin->type != OB_WINDOW_CLASS_PROMPT) { + XCreateWindowEvent const *xe = &e->xcreatewindow; + if (xe->window == window_top(obwin)) { + obwin->mapped = 0; + RECT_SET(obwin->comp_area, xe->x, xe->y, xe->width, xe->height); + } + } else if ((e->type == ConfigureNotify || e->type == MapNotify) && obwin && obwin->type != OB_WINDOW_CLASS_PROMPT) { - if (obwin->pixmap != None) { - XFreePixmap(obt_display, obwin->pixmap); - obwin->pixmap = None; + gboolean pixchange = FALSE; + + if (e->type == ConfigureNotify) { + XConfigureEvent const *xe = &e->xconfigure; + if (xe->window == window_top(obwin)) { + if ((obwin->comp_area.width != xe->width) + || (obwin->comp_area.height != xe->height)) + pixchange = TRUE; + RECT_SET(obwin->comp_area, xe->x, xe->y, xe->width, xe->height); + } } - if (obwin->gpixmap != None) { - glXDestroyGLXPixmap(obt_display, obwin->gpixmap); - obwin->gpixmap = None; + + if (e->type == MapNotify) { + XMapEvent const *xe = &e->xmap; + if (xe->window == window_top(obwin)) { + pixchange = TRUE; + obwin->mapped = TRUE; + } } -//XXX actually need to check if this was just a move and not re-make the pmap! -//printf("win %d has pixmap %d\n", window_top(obwin), obwin->pixmap); + if (pixchange) { + if (obwin->pixmap != None) { + XFreePixmap(obt_display, obwin->pixmap); + obwin->pixmap = None; + } + if (obwin->gpixmap != None) { + glXDestroyGLXPixmap(obt_display, obwin->gpixmap); + obwin->gpixmap = None; + } + } + } else if ((e->type == UnmapNotify) && obwin + && obwin->type != OB_WINDOW_CLASS_PROMPT) { + if (e->xunmap.window == window_top(obwin)) + obwin->mapped = FALSE; } #endif else if (client) diff --git a/openbox/window.h b/openbox/window.h index 74b9c082..df373322 100644 --- a/openbox/window.h +++ b/openbox/window.h @@ -20,6 +20,7 @@ #define __window_h #include "stacking.h" +#include "geom.h" #include #include @@ -51,6 +52,8 @@ struct _ObWindow { GLXPixmap gpixmap; Damage damage; int depth; + Rect comp_area; + gboolean mapped; #endif };