all repos — tint2 @ 7478765723e4eb23bf77eab1d00732b8d2af3713

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

*add* more real_transparency things added... whole panel works now, but systray still has problems :(



git-svn-id: http://tint2.googlecode.com/svn/trunk@306 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
Andreas.Fink85 Andreas.Fink85@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

7478765723e4eb23bf77eab1d00732b8d2af3713

parent

c65ad3628da77dff686522d57293c55cdb9884ce

5 files changed, 47 insertions(+), 13 deletions(-)

jump to
M src/panel.csrc/panel.c

@@ -160,6 +160,13 @@ // old panel

XMoveResizeWindow(server.dsp, p->main_win, p->posx, p->posy, p->area.width, p->area.height); } + if (!server.gc) { + XGCValues gcv; + if (real_transparency) + server.gc = XCreateGC(server.dsp, p->main_win, 0, &gcv); + else + server.gc = XCreateGC (server.dsp, server.root_win, (unsigned long)0, &gcv); + } //printf("panel %d : %d, %d, %d, %d\n", i, p->posx, p->posy, p->area.width, p->area.height); set_panel_properties(p); set_panel_background(p);

@@ -479,10 +486,22 @@

void set_panel_background(Panel *p) { - get_root_pixmap(); - if (p->area.pix.pmap) XFreePixmap (server.dsp, p->area.pix.pmap); p->area.pix.pmap = XCreatePixmap (server.dsp, server.root_win, p->area.width, p->area.height, server.depth); + + if (real_transparency) { + cairo_surface_t *tmp = cairo_xlib_surface_create (server.dsp, p->area.pix.pmap, server.visual, p->area.width, p->area.height); + cairo_t *cr = cairo_create(tmp); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_rectangle(cr, 0, 0, p->area.width, p->area.height); + cairo_set_source_rgba(cr, 1, 1, 1, 0); + cairo_paint (cr); + cairo_destroy (cr); + cairo_surface_destroy (tmp); + return; + } + + get_root_pixmap(); // copy background (server.root_pmap) in panel.area.pix.pmap Window dummy;
M src/server.csrc/server.c

@@ -32,6 +32,7 @@ void server_catch_error (Display *d, XErrorEvent *ev){}

static char *name_trayer = 0; +int real_transparency = 0; void server_init_atoms () {

@@ -97,6 +98,8 @@ void cleanup_server()

{ if (name_trayer) free(name_trayer); XFreeColormap(server.dsp, server.colormap); + free(server.monitor); + XFreeGC(server.dsp, server.gc); }

@@ -304,7 +307,6 @@

void server_init_visual() { - int real_transparency = 0; XVisualInfo *xvi; XVisualInfo templ = { .screen=server.screen, .depth=32, .class=TrueColor }; int nvi;

@@ -325,8 +327,8 @@ }

XFree (xvi); if (visual && real_transparency) { - printf("real transparency on... depth: %d\n", server.depth); server.depth = 32; + printf("real transparency on... depth: %d\n", server.depth); server.colormap = XCreateColormap(server.dsp, server.root_win, visual, AllocNone); server.visual = visual; }
M src/server.hsrc/server.h

@@ -13,7 +13,7 @@ #include <X11/Xlib.h>

#include <X11/Xatom.h> #include <X11/extensions/Xinerama.h> - +extern int real_transparency; typedef struct Global_atom { Atom _XROOTPMAP_ID;

@@ -112,6 +112,7 @@ void server_refresh_main_pixmap ();

void server_catch_error (Display *d, XErrorEvent *ev); void server_init_atoms (); void server_init_visual(); +void cleanup_server(); // detect root background void get_root_pixmap();
M src/tint.csrc/tint.c

@@ -102,8 +102,6 @@ server_init_atoms ();

server.screen = DefaultScreen (server.dsp); server.root_win = RootWindow(server.dsp, server.screen); server.desktop = server_get_current_desktop (); - XGCValues gcv; - server.gc = XCreateGC (server.dsp, server.root_win, (unsigned long)0, &gcv); server_init_visual(); XSetErrorHandler ((XErrorHandler) server_catch_error);

@@ -151,8 +149,7 @@ }

if (config_path) g_free(config_path); if (snapshot_path) g_free(snapshot_path); - if (server.monitor) free(server.monitor); - XFreeGC(server.dsp, server.gc); + cleanup_server(); XCloseDisplay(server.dsp); }
M src/util/area.csrc/util/area.c

@@ -29,6 +29,10 @@ #include "area.h"

#include "server.h" #include "panel.h" +// QUESTION: Why do we need Pixmaps for drawing? Can't we draw directly in the Window??? +// Parent could pass a cairo_surface_t to the children, and children use it, for drawing... + + // 1) resize child // 2) resize parent // 3) redraw parent

@@ -55,9 +59,9 @@ draw(a, 1);

} // draw current Area - Pixmap *pmap = (a->is_active == 0) ? (&a->pix.pmap) : (&a->pix_active.pmap); - if (*pmap == 0) printf("empty area posx %d, width %d\n", a->posx, a->width); - XCopyArea (server.dsp, *pmap, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy); + Pixmap pmap = (a->is_active == 0) ? (a->pix.pmap) : (a->pix_active.pmap); + if (pmap == 0) printf("empty area posx %d, width %d\n", a->posx, a->width); + XCopyArea (server.dsp, pmap, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy); // and then refresh child object GSList *l;

@@ -104,7 +108,18 @@ if (*pmap) XFreePixmap (server.dsp, *pmap);

*pmap = XCreatePixmap (server.dsp, server.root_win, a->width, a->height, server.depth); // add layer of root pixmap - XCopyArea (server.dsp, ((Panel *)a->panel)->temp_pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0); + if (real_transparency) { + cairo_surface_t *tmp = cairo_xlib_surface_create (server.dsp, *pmap, server.visual, a->width, a->height); + cairo_t *cr = cairo_create(tmp); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_rectangle(cr, 0, 0, a->width, a->height); + cairo_set_source_rgba(cr, 1, 1, 1, 0); + cairo_paint (cr); + cairo_destroy (cr); + cairo_surface_destroy (tmp); + } + else + XCopyArea (server.dsp, ((Panel *)a->panel)->temp_pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0); cairo_surface_t *cs; cairo_t *c;