X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Frender.c;h=51c3a9beb4a8134b7e0466dae6692da10e552c5a;hb=3dfe9f4ebeb7abd8446c52db0232b9f610a78846;hp=ac5e00235c171e7274c91e4f98c7221f75fc1784;hpb=3232247b0c36cf1b5b5e11c8cb03c8e0c457abdd;p=chaz%2Fopenbox diff --git a/render/render.c b/render/render.c index ac5e0023..51c3a9be 100644 --- a/render/render.c +++ b/render/render.c @@ -4,6 +4,7 @@ #include "render.h" #include "gradient.h" #include "font.h" +#include "mask.h" #include "../kernel/openbox.h" int render_depth; @@ -53,7 +54,7 @@ void render_startup(void) } } -void x_paint(Window win, Appearance *l, int w, int h) +void x_paint(Window win, Appearance *l, int x, int y, int w, int h) { int i; XImage *im; @@ -65,7 +66,7 @@ void x_paint(Window win, Appearance *l, int w, int h) // printf("painting window %ld\n", win); oldp = l->pixmap; /* save to free after changing the visible pixmap */ - l->pixmap = XCreatePixmap(ob_display, ob_root, w, h, render_depth); + l->pixmap = XCreatePixmap(ob_display, ob_root, x+w, y+h, render_depth); g_assert(l->pixmap != None); if (l->xftdraw != NULL) @@ -79,20 +80,13 @@ void x_paint(Window win, Appearance *l, int w, int h) l->surface.data.planar.pixel_data = g_new(pixel32, w * h); if (l->surface.data.planar.grad == Background_Solid) - gradient_solid(l, w, h); + gradient_solid(l, x, y, w, h); else gradient_render(&l->surface, w, h); - for (i = 0; i < l->textures; i++) { - switch (l->texture[i].type) { - case Text: - if (l->xftdraw == NULL) { - l->xftdraw = XftDrawCreate(ob_display, l->pixmap, - render_visual, render_colormap); - } - font_draw(l->xftdraw, &l->texture[i].data.text); - break; - } - } -//reduce depth + +/*reduce depth here... + also, this is not the right place for this code, it's only here so + text rendering shows up for now. +*/ if (l->surface.data.planar.grad != Background_Solid) { im = XCreateImage(ob_display, render_visual, render_depth, ZPixmap, 0, NULL, w, h, 32, 0); @@ -100,10 +94,27 @@ void x_paint(Window win, Appearance *l, int w, int h) im->byte_order = endian; im->data = l->surface.data.planar.pixel_data; XPutImage(ob_display, l->pixmap, DefaultGC(ob_display, ob_screen), - im, 0, 0, 0, 0, w, h); + im, 0, 0, x, y, w, h); im->data = NULL; XDestroyImage(im); } + + for (i = 0; i < l->textures; i++) { + switch (l->texture[i].type) { + case Text: + if (l->xftdraw == NULL) { + l->xftdraw = XftDrawCreate(ob_display, l->pixmap, + render_visual, render_colormap); + } + font_draw(l->xftdraw, &l->texture[i].data.text, x, y, w, h); + break; + case Bitmask: + if (l->texture[i].data.mask.color->gc == None) + color_allocate_gc(l->texture[i].data.mask.color); + mask_draw(l->pixmap, &l->texture[i].data.mask, w, h); + break; + } + } XSetWindowBackgroundPixmap(ob_display, win, l->pixmap); XClearWindow(ob_display, win); if (oldp != None) XFreePixmap(ob_display, oldp);