X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fsystray%2Fsystraybar.c;h=ef1578fcf2791514fc868e474e2c87640ddfe5c6;hb=5679142e44a103a6fe1e62365fe991d273e41049;hp=927f9cb5e9e98cf4d48a721678a49b58262d50a4;hpb=2e6b12080e5187b0e0db377cd4df22405119e5b8;p=chaz%2Ftint2 diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index 927f9cb..ef1578f 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -37,7 +37,7 @@ GSList *icons; #define SYSTEM_TRAY_CANCEL_MESSAGE 2 // selection window -Window net_sel_win = None; +Window net_sel_win = None, hint_win = None; // freedesktop specification doesn't allow multi systray Systraybar systray; @@ -66,6 +66,8 @@ void init_systray() systray.area.posx = panel->area.width - panel->area.paddingxlr - panel->area.pix.border.width - systray.area.width; if (panel->clock.area.on_screen) systray.area.posx -= (panel->clock.area.width + panel->area.paddingx); + if (panel->battery.area.on_screen) + systray.area.posx -= (panel->battery.area.width + panel->area.paddingx); systray.area.redraw = 1; } @@ -97,16 +99,18 @@ void draw_systray(void *obj, cairo_t *c, int active) GSList *l; int icon_size; - printf("draw_systray %d %d\n", systray.area.posx, systray.area.width); + //printf("draw_systray %d %d\n", systray.area.posx, systray.area.width); icon_size = sysbar->area.height - (2 * sysbar->area.pix.border.width) - (2 * sysbar->area.paddingy); for (l = systray.list_icons; l ; l = l->next) { traywin = (TrayWindow*)l->data; // watch for the icon trying to resize itself! - XSelectInput(server.dsp, traywin->id, StructureNotifyMask); + XSelectInput(server.dsp, traywin->id, StructureNotifyMask|ResizeRedirectMask); // position and size the icon window XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, icon_size, icon_size); + // ceci intervertie les fonds : le premier icone prend le fond du dernier + // le dernier prend le fond de l'avant dernier, ... // resize our window so that the new window can fit in it //fix_geometry(); @@ -120,6 +124,7 @@ void draw_systray(void *obj, cairo_t *c, int active) // show the window XMapRaised(server.dsp, traywin->id); } + XSetWindowBackgroundPixmap (server.dsp, panel->main_win, systray.area.pix.pmap); } @@ -141,6 +146,8 @@ void resize_systray(void *obj) systray.area.posx = panel->area.width - panel->area.pix.border.width - panel->area.paddingxlr - systray.area.width; if (panel->clock.area.on_screen) systray.area.posx -= (panel->clock.area.width + panel->area.paddingx); + if (panel->battery.area.on_screen) + systray.area.posx -= (panel->battery.area.width + panel->area.paddingx); systray.area.redraw = 1; @@ -158,6 +165,29 @@ void resize_systray(void *obj) printf("resize_systray %d %d\n", systray.area.posx, systray.area.width); } +/* +void create_hint_win() +{ + XWMHints hints; + XClassHint classhints; + Panel *panel = systray.area.panel; + + hint_win = XCreateSimpleWindow(server.dsp, server.root_win, 0, 0, 1, 1, 0, 0, 0); + + hints.flags = StateHint | WindowGroupHint | IconWindowHint; + hints.initial_state = WithdrawnState; + hints.window_group = hint_win; + hints.icon_window = panel->main_win; + + classhints.res_name = "docker"; + classhints.res_class = "Docker"; + + XSetWMProperties(server.dsp, hint_win, NULL, NULL, NULL, 0, + NULL, &hints, &classhints); + + XMapWindow(server.dsp, hint_win); +} +*/ int init_net() { @@ -166,6 +196,8 @@ int init_net() return 0; } + //create_hint_win(); + // init systray protocol net_sel_win = XCreateSimpleWindow(server.dsp, server.root_win, -1, -1, 1, 1, 0, 0, 0); @@ -203,6 +235,7 @@ void cleanup_net() } } + /* void fix_geometry() {