From 17105470c0695973ec3eaecc0d77efc13cbb32e6 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Mon, 4 Jun 2007 13:25:47 +0000 Subject: [PATCH] further haxxings on obrender usage, don't use rrtheme but set up appearances ourselves. --- rspanel.c | 59 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/rspanel.c b/rspanel.c index f1b3cf6..7b56275 100644 --- a/rspanel.c +++ b/rspanel.c @@ -83,7 +83,11 @@ int pager_size; #ifdef OBRENDER RrInstance *inst; -RrTheme *theme; +RrAppearance *background; +RrAppearance *focused_task; +RrAppearance *unfocused_task; +RrAppearance *normal_text; +RrAppearance *iconified_text; #endif #ifdef XFT @@ -487,7 +491,18 @@ Window gui_create_taskbar(void) return win; } - +#ifdef OBRENDER +static void set_default_appearance(RrAppearance *a) +{ + a->surface.grad = RR_SURFACE_SOLID; + a->surface.relief = RR_RELIEF_FLAT; + a->surface.bevel = RR_BEVEL_1; + a->surface.interlaced = FALSE; + a->surface.border = FALSE; + a->surface.primary = RrColorNew(a->inst, 0, 0, 0); + a->surface.secondary = RrColorNew(a->inst, 0, 0, 0); +} +#endif void gui_init(void) { XGCValues gcv; @@ -558,7 +573,26 @@ void gui_init(void) #endif #ifdef OBRENDER inst = RrInstanceNew(dd, scr_screen); - theme = RrThemeNew(inst, "Mikachu", TRUE, NULL, NULL, NULL, NULL, NULL); + set_default_appearance(background = RrAppearanceNew(inst, 0)); + set_default_appearance(focused_task = RrAppearanceNew(inst, 0)); + set_default_appearance(unfocused_task = RrAppearanceNew(inst, 0)); + set_default_appearance(normal_text = RrAppearanceNew(inst, 1)); + background->surface.grad = RR_SURFACE_SPLIT_VERTICAL; + background->surface.secondary = RrColorNew(inst, 90, 0, 150); + background->surface.primary = RrColorNew(inst, 90, 80, 150); + unfocused_task->surface.parent = background; + unfocused_task->surface.grad = RR_SURFACE_PARENTREL; + focused_task->surface.parent = background; + focused_task->surface.grad = RR_SURFACE_CROSS_DIAGONAL; + focused_task->surface.secondary = RrColorNew(inst, 50, 60, 110); + focused_task->surface.primary = RrColorNew(inst, 90, 120, 250); + normal_text->surface.grad = RR_SURFACE_PARENTREL; + normal_text->texture[0].type = RR_TEXTURE_TEXT; + normal_text->texture[0].data.text.font = RrFontOpenDefault(inst); + normal_text->texture[0].data.text.justify = RR_JUSTIFY_LEFT; + iconified_text = RrAppearanceCopy(normal_text); + normal_text->texture[0].data.text.color = RrColorNew(inst, 200, 200, 200); + iconified_text->texture[0].data.text.color = RrColorNew(inst, 0, 150, 0); #endif } @@ -588,18 +622,19 @@ void draw_box(int x, int width) #define PADDING 4 void gui_draw_task(task *tk) { - RrAppearance *a = tk->focused ? theme->a_focused_label : theme->a_unfocused_label; - RrAppearance *b = tk->focused ? theme->a_focused_title : theme->a_unfocused_title; + RrAppearance *a = (tk->iconified || tk->shaded) ? iconified_text : normal_text; + RrAppearance *b = tk->focused ? focused_task : unfocused_task; a->surface.parent = b; a->surface.parentx = PADDING; a->texture[0].data.text.string = tk->name; + b->surface.parentx = tk->pos_x; RrPaintPixmap(b, tk->width, WINHEIGHT); RrPaintPixmap(a, tk->width-2*PADDING, WINHEIGHT); #if PADDING - XCopyArea(dd, a->pixmap, b->pixmap, RrColorGC(b->surface.primary), 0, 0, tk->width-2*PADDING, WINHEIGHT, PADDING, 0); - XCopyArea(dd, b->pixmap, tb.win, RrColorGC(b->surface.primary), 0, 0, tk->width, WINHEIGHT, tk->pos_x, 0); + XCopyArea(dd, a->pixmap, b->pixmap, fore_gc, 0, 0, tk->width-2*PADDING, WINHEIGHT, PADDING, 0); + XCopyArea(dd, b->pixmap, tb.win, fore_gc, 0, 0, tk->width, WINHEIGHT, tk->pos_x, 0); #else - XCopyArea(dd, a->pixmap, tb.win, RrColorGC(b->surface.primary), 0, 0, tk->width, WINHEIGHT, tk->pos_x, 0); + XCopyArea(dd, a->pixmap, tb.win, fore_gc, 0, 0, tk->width, WINHEIGHT, tk->pos_x, 0); #endif XFreePixmap(dd, a->pixmap); @@ -850,9 +885,13 @@ void gui_draw_taskbar(void) pager_size = TEXTPAD; #endif - width = WINWIDTH - (pager_size + GRILL_WIDTH + GRILL_WIDTH); x = pager_size + 2; - + width = WINWIDTH - (pager_size + GRILL_WIDTH); +#ifdef OBRENDER +#warning only rerender if width changed! + RrPaintPixmap(background, width, WINHEIGHT); + XCopyArea(dd, background->pixmap, tb.win, fore_gc, 0, 0, width, WINHEIGHT, x, 0); +#endif if (tb.num_tasks == 0) goto clear; -- 2.39.2