Disable systray composited rendering if disable_transparency = 1

This commit is contained in:
o9000 2015-06-07 11:44:43 +02:00
parent b235f77f39
commit fbcfa54061
2 changed files with 148 additions and 145 deletions

View file

@ -41,8 +41,6 @@ GSList *icons;
#define SYSTEM_TRAY_BEGIN_MESSAGE 1 #define SYSTEM_TRAY_BEGIN_MESSAGE 1
#define SYSTEM_TRAY_CANCEL_MESSAGE 2 #define SYSTEM_TRAY_CANCEL_MESSAGE 2
#define FORCE_COMPOSITED_RENDERING 1
// selection window // selection window
Window net_sel_win = None; Window net_sel_win = None;
@ -53,6 +51,7 @@ int systray_enabled;
int systray_max_icon_size; int systray_max_icon_size;
int systray_monitor; int systray_monitor;
int chrono; int chrono;
int systray_composited;
// background pixmap if we render ourselves the icons // background pixmap if we render ourselves the icons
static Pixmap render_background; static Pixmap render_background;
@ -86,16 +85,19 @@ void cleanup_systray()
void init_systray() void init_systray()
{ {
start_net();
if (!systray_enabled) if (!systray_enabled)
return; return;
if (!server.visual32 && (systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0)) { systray_composited = !server.disable_transparency && server.visual32;
printf("No 32 bit visual for your X implementation. 'systray_asb = 100 0 0' will be forced\n"); printf("Systray composited rendering %s\n", systray_composited ? "on" : "off");
if (!systray_composited) {
printf("systray_asb forced to 100 0 0\n");
systray.alpha = 100; systray.alpha = 100;
systray.brightness = systray.saturation = 0; systray.brightness = systray.saturation = 0;
} }
start_net();
} }
@ -123,7 +125,7 @@ void init_systray_panel(void *p)
void draw_systray(void *obj, cairo_t *c) void draw_systray(void *obj, cairo_t *c)
{ {
if (FORCE_COMPOSITED_RENDERING || server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) { if (systray_composited) {
if (render_background) XFreePixmap(server.dsp, render_background); if (render_background) XFreePixmap(server.dsp, render_background);
render_background = XCreatePixmap(server.dsp, server.root_win, systray.area.width, systray.area.height, server.depth); render_background = XCreatePixmap(server.dsp, server.root_win, systray.area.width, systray.area.height, server.depth);
XCopyArea(server.dsp, systray.area.pix, render_background, server.gc, 0, 0, systray.area.width, systray.area.height, 0, 0); XCopyArea(server.dsp, systray.area.pix, render_background, server.gc, 0, 0, systray.area.width, systray.area.height, 0, 0);
@ -202,7 +204,7 @@ void on_change_systray (void *obj)
traywin->y = posy; traywin->y = posy;
traywin->x = posx; traywin->x = posx;
// printf("systray %d : pos %d, %d\n", traywin->tray_id, posx, posy); // printf("systray %d %d : pos %d, %d\n", traywin->id, traywin->tray_id, posx, posy);
traywin->width = sysbar->icon_size; traywin->width = sysbar->icon_size;
traywin->height = sysbar->icon_size; traywin->height = sysbar->icon_size;
if (panel_horizontal) { if (panel_horizontal) {
@ -223,9 +225,10 @@ void on_change_systray (void *obj)
} }
// position and size the icon window // position and size the icon window
XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, sysbar->icon_size, sysbar->icon_size); XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, traywin->width, traywin->height);
XResizeWindow(server.dsp, traywin->tray_id, sysbar->icon_size, sysbar->icon_size); XMoveResizeWindow(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height);
} }
refresh_systray = 1;
} }
@ -277,7 +280,7 @@ void start_net()
long orient = 0; long orient = 0;
XChangeProperty(server.dsp, net_sel_win, server.atom._NET_SYSTEM_TRAY_ORIENTATION, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &orient, 1); XChangeProperty(server.dsp, net_sel_win, server.atom._NET_SYSTEM_TRAY_ORIENTATION, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &orient, 1);
VisualID vid; VisualID vid;
if (server.visual32 && (FORCE_COMPOSITED_RENDERING || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0)) if (systray_composited)
vid = XVisualIDFromVisual(server.visual32); vid = XVisualIDFromVisual(server.visual32);
else else
vid = XVisualIDFromVisual(server.visual); vid = XVisualIDFromVisual(server.visual);
@ -427,7 +430,7 @@ gboolean add_icon(Window id)
Visual* visual = server.visual; Visual* visual = server.visual;
//printf("icon with depth: %d, width %d, height %d\n", attr.depth, attr.width, attr.height); //printf("icon with depth: %d, width %d, height %d\n", attr.depth, attr.width, attr.height);
//printf("icon with depth: %d\n", attr.depth); //printf("icon with depth: %d\n", attr.depth);
if (attr.depth != server.depth || FORCE_COMPOSITED_RENDERING || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) { if (systray_composited || attr.depth != server.depth) {
visual = attr.visual; visual = attr.visual;
set_attr.colormap = attr.colormap; set_attr.colormap = attr.colormap;
set_attr.background_pixel = 0; set_attr.background_pixel = 0;
@ -438,8 +441,7 @@ gboolean add_icon(Window id)
set_attr.background_pixmap = ParentRelative; set_attr.background_pixmap = ParentRelative;
mask = CWBackPixmap; mask = CWBackPixmap;
} }
Window parent_window; Window parent_window = XCreateWindow(server.dsp, panel->main_win, 0, 0, 30, 30, 0, attr.depth, InputOutput, visual, mask, &set_attr);
parent_window = XCreateWindow(server.dsp, panel->main_win, 0, 0, 30, 30, 0, attr.depth, InputOutput, visual, mask, &set_attr);
old = XSetErrorHandler(window_error_handler); old = XSetErrorHandler(window_error_handler);
XReparentWindow(server.dsp, id, parent_window, 0, 0); XReparentWindow(server.dsp, id, parent_window, 0, 0);
// watch for the icon trying to resize itself / closing again! // watch for the icon trying to resize itself / closing again!
@ -512,7 +514,7 @@ gboolean add_icon(Window id)
systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows); systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows);
//printf("add_icon id %lx, %d\n", id, g_slist_length(systray.list_icons)); //printf("add_icon id %lx, %d\n", id, g_slist_length(systray.list_icons));
if (FORCE_COMPOSITED_RENDERING || server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) { if (systray_composited) {
traywin->damage = XDamageCreate(server.dsp, traywin->id, XDamageReportRawRectangles); traywin->damage = XDamageCreate(server.dsp, traywin->id, XDamageReportRawRectangles);
XCompositeRedirectWindow(server.dsp, traywin->id, CompositeRedirectManual); XCompositeRedirectWindow(server.dsp, traywin->id, CompositeRedirectManual);
} }
@ -712,7 +714,7 @@ void systray_render_icon_now(void* t)
void systray_render_icon(TrayWindow* traywin) void systray_render_icon(TrayWindow* traywin)
{ {
if (FORCE_COMPOSITED_RENDERING || server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) { if (systray_composited) {
if (!traywin->render_timeout) if (!traywin->render_timeout)
systray_render_icon_now(traywin); systray_render_icon_now(traywin);
} }

View file

@ -834,8 +834,9 @@ void event_configure_notify (Window win)
if (traywin->tray_id == win) { if (traywin->tray_id == win) {
//printf("move tray %d\n", traywin->x); //printf("move tray %d\n", traywin->x);
XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, traywin->width, traywin->height); XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, traywin->width, traywin->height);
XResizeWindow(server.dsp, traywin->tray_id, traywin->width, traywin->height); XMoveResizeWindow(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height);
panel_refresh = 1; panel_refresh = 1;
refresh_systray = 1;
return; return;
} }
} }