basic systray with some bugs, update tintrc sample file
git-svn-id: http://tint2.googlecode.com/svn/trunk@64 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
2121a32916
commit
67f875338b
23 changed files with 365 additions and 118 deletions
|
@ -1,5 +1,10 @@
|
||||||
|
2009-03-01
|
||||||
|
- cleanup code
|
||||||
|
- basic systray with some bugs
|
||||||
|
- update documentation and tintrc sample for systray
|
||||||
|
|
||||||
2009-02-27
|
2009-02-27
|
||||||
- fixed issue 49 : better Makefile
|
- fixed issue 49 : patch from Daniel Moerner
|
||||||
- some systray code (doesn't work)
|
- some systray code (doesn't work)
|
||||||
- cleanup code
|
- cleanup code
|
||||||
|
|
||||||
|
@ -7,7 +12,7 @@
|
||||||
- fixed issue 48 : tint2 does't create config file on first start
|
- fixed issue 48 : tint2 does't create config file on first start
|
||||||
|
|
||||||
2009-02-14
|
2009-02-14
|
||||||
- fxed issue 45 : segfault without clock
|
- fixed issue 45 : segfault without clock
|
||||||
|
|
||||||
2009-02-13
|
2009-02-13
|
||||||
- improved object oriented layout
|
- improved object oriented layout
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -53,11 +53,11 @@ void init_clock()
|
||||||
|
|
||||||
clock->area.parent = panel;
|
clock->area.parent = panel;
|
||||||
clock->area.panel = panel;
|
clock->area.panel = panel;
|
||||||
if (!clock->area.visible) return;
|
clock->area._draw_foreground = draw_clock;
|
||||||
|
|
||||||
clock->area._draw_foreground = draw_foreground_clock;
|
|
||||||
clock->area._resize = resize_clock;
|
clock->area._resize = resize_clock;
|
||||||
|
|
||||||
|
if (!clock->area.on_screen) continue;
|
||||||
|
|
||||||
if (strchr(time1_format, 'S') == NULL) time_precision = 60;
|
if (strchr(time1_format, 'S') == NULL) time_precision = 60;
|
||||||
else time_precision = 1;
|
else time_precision = 1;
|
||||||
|
|
||||||
|
@ -89,12 +89,12 @@ void init_clock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void draw_foreground_clock (void *obj, cairo_t *c, int active)
|
void draw_clock (void *obj, cairo_t *c, int active)
|
||||||
{
|
{
|
||||||
Clock *clock = obj;
|
Clock *clock = obj;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
|
|
||||||
//printf(" draw_foreground_clock : %s en (%d, %d)\n", buf_time, clock->area.posx, clock->area.width);
|
//printf(" draw_clock : %s en (%d, %d)\n", buf_time, clock->area.posx, clock->area.width);
|
||||||
layout = pango_cairo_create_layout (c);
|
layout = pango_cairo_create_layout (c);
|
||||||
|
|
||||||
// draw layout
|
// draw layout
|
||||||
|
|
|
@ -35,7 +35,7 @@ extern PangoFontDescription *time2_font_desc;
|
||||||
// initialize clock : y position, precision, ...
|
// initialize clock : y position, precision, ...
|
||||||
void init_clock();
|
void init_clock();
|
||||||
|
|
||||||
void draw_foreground_clock (void *obj, cairo_t *c, int active);
|
void draw_clock (void *obj, cairo_t *c, int active);
|
||||||
|
|
||||||
void resize_clock (void *obj);
|
void resize_clock (void *obj);
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ void add_entry (char *key, char *value)
|
||||||
if (time1_format) g_free(time1_format);
|
if (time1_format) g_free(time1_format);
|
||||||
if (strlen(value) > 0) time1_format = strdup (value);
|
if (strlen(value) > 0) time1_format = strdup (value);
|
||||||
else time1_format = 0;
|
else time1_format = 0;
|
||||||
panel_config->clock.area.visible = 1;
|
panel_config->clock.area.on_screen = 1;
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "time2_format") == 0) {
|
else if (strcmp (key, "time2_format") == 0) {
|
||||||
if (time2_format) g_free(time2_format);
|
if (time2_format) g_free(time2_format);
|
||||||
|
@ -417,7 +417,7 @@ void add_entry (char *key, char *value)
|
||||||
systray.area.paddingxlr = systray.area.paddingx = atoi (value1);
|
systray.area.paddingxlr = systray.area.paddingx = atoi (value1);
|
||||||
if (value2) systray.area.paddingy = atoi (value2);
|
if (value2) systray.area.paddingy = atoi (value2);
|
||||||
if (value3) systray.area.paddingx = atoi (value3);
|
if (value3) systray.area.paddingx = atoi (value3);
|
||||||
systray.area.visible = 1;
|
systray.area.on_screen = 1;
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "systray_background_id") == 0) {
|
else if (strcmp (key, "systray_background_id") == 0) {
|
||||||
int id = atoi (value);
|
int id = atoi (value);
|
||||||
|
|
15
src/panel.c
15
src/panel.c
|
@ -61,7 +61,7 @@ void init_panel()
|
||||||
|
|
||||||
p->area.parent = p;
|
p->area.parent = p;
|
||||||
p->area.panel = p;
|
p->area.panel = p;
|
||||||
p->area.visible = 1;
|
p->area.on_screen = 1;
|
||||||
p->area.resize = 1;
|
p->area.resize = 1;
|
||||||
p->area._resize = resize_panel;
|
p->area._resize = resize_panel;
|
||||||
p->g_taskbar.parent = p;
|
p->g_taskbar.parent = p;
|
||||||
|
@ -69,9 +69,9 @@ void init_panel()
|
||||||
p->g_task.area.panel = p;
|
p->g_task.area.panel = p;
|
||||||
|
|
||||||
// add childs
|
// add childs
|
||||||
if (p->clock.area.visible)
|
if (p->clock.area.on_screen)
|
||||||
p->area.list = g_slist_append(p->area.list, &p->clock);
|
p->area.list = g_slist_append(p->area.list, &p->clock);
|
||||||
if (systray.area.visible && i == 0) {
|
if (systray.area.on_screen && i == 0) {
|
||||||
// systray only on first panel
|
// systray only on first panel
|
||||||
p->area.list = g_slist_append(p->area.list, &systray);
|
p->area.list = g_slist_append(p->area.list, &systray);
|
||||||
}
|
}
|
||||||
|
@ -177,9 +177,10 @@ void resize_panel(void *obj)
|
||||||
else taskbar_on_screen = 1;
|
else taskbar_on_screen = 1;
|
||||||
|
|
||||||
taskbar_width = panel->area.width - (2 * panel->area.paddingxlr) - (2 * panel->area.pix.border.width);
|
taskbar_width = panel->area.width - (2 * panel->area.paddingxlr) - (2 * panel->area.pix.border.width);
|
||||||
if (panel->clock.area.visible && panel->clock.area.width)
|
if (panel->clock.area.on_screen && panel->clock.area.width)
|
||||||
taskbar_width -= (panel->clock.area.width + panel->area.paddingx);
|
taskbar_width -= (panel->clock.area.width + panel->area.paddingx);
|
||||||
if (systray.area.visible && systray.area.width)
|
// TODO : systray only on first panel. search better implementation !
|
||||||
|
if (systray.area.on_screen && systray.area.width && panel == &panel1[0])
|
||||||
taskbar_width -= (systray.area.width + panel->area.paddingx);
|
taskbar_width -= (systray.area.width + panel->area.paddingx);
|
||||||
|
|
||||||
taskbar_width = (taskbar_width - ((taskbar_on_screen-1) * panel->area.paddingx)) / taskbar_on_screen;
|
taskbar_width = (taskbar_width - ((taskbar_on_screen-1) * panel->area.paddingx)) / taskbar_on_screen;
|
||||||
|
@ -222,10 +223,10 @@ void visible_object()
|
||||||
taskbar = &panel->taskbar[j];
|
taskbar = &panel->taskbar[j];
|
||||||
if (panel_mode != MULTI_DESKTOP && taskbar->desktop != server.desktop) {
|
if (panel_mode != MULTI_DESKTOP && taskbar->desktop != server.desktop) {
|
||||||
// (SINGLE_DESKTOP or SINGLE_MONITOR) and not current desktop
|
// (SINGLE_DESKTOP or SINGLE_MONITOR) and not current desktop
|
||||||
taskbar->area.visible = 0;
|
taskbar->area.on_screen = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
taskbar->area.visible = 1;
|
taskbar->area.on_screen = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,19 +50,20 @@ void init_systray()
|
||||||
Panel *panel = &panel1[0];
|
Panel *panel = &panel1[0];
|
||||||
systray.area.parent = panel;
|
systray.area.parent = panel;
|
||||||
systray.area.panel = panel;
|
systray.area.panel = panel;
|
||||||
|
systray.area._draw_foreground = draw_systray;
|
||||||
systray.area._resize = resize_systray;
|
systray.area._resize = resize_systray;
|
||||||
|
|
||||||
if (systray.area.visible) {
|
if (systray.area.on_screen) {
|
||||||
if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != None) {
|
if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != None) {
|
||||||
fprintf(stderr, "tint2 : another systray is running\n");
|
fprintf(stderr, "tint2 : another systray is running\n");
|
||||||
systray.area.visible = 0;
|
systray.area.on_screen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systray.area.visible)
|
if (systray.area.on_screen)
|
||||||
systray.area.visible = net_init();
|
systray.area.on_screen = net_init();
|
||||||
|
|
||||||
if (!systray.area.visible)
|
if (!systray.area.on_screen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// configure systray
|
// configure systray
|
||||||
|
@ -72,7 +73,7 @@ void init_systray()
|
||||||
systray.area.width = 0;
|
systray.area.width = 0;
|
||||||
|
|
||||||
systray.area.posx = panel->area.width - panel->area.paddingxlr - panel->area.pix.border.width - systray.area.width;
|
systray.area.posx = panel->area.width - panel->area.paddingxlr - panel->area.pix.border.width - systray.area.width;
|
||||||
if (panel->clock.area.visible)
|
if (panel->clock.area.on_screen)
|
||||||
systray.area.posx -= (panel->clock.area.width + panel->area.paddingx);
|
systray.area.posx -= (panel->clock.area.width + panel->area.paddingx);
|
||||||
|
|
||||||
systray.area.redraw = 1;
|
systray.area.redraw = 1;
|
||||||
|
@ -94,6 +95,76 @@ void cleanup_systray()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw_systray(void *obj, cairo_t *c, int active)
|
||||||
|
{
|
||||||
|
Systraybar *sysbar = obj;
|
||||||
|
Panel *panel = sysbar->area.panel;
|
||||||
|
TrayWindow *traywin;
|
||||||
|
GSList *l;
|
||||||
|
int icon_size;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
printf("draw_systray %d %d\n", systray.area.posx, systray.area.width);
|
||||||
|
// watch for the icon trying to resize itself!
|
||||||
|
XSelectInput(server.dsp, traywin->id, StructureNotifyMask);
|
||||||
|
|
||||||
|
// position and size the icon window
|
||||||
|
XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, icon_size, icon_size);
|
||||||
|
|
||||||
|
// resize our window so that the new window can fit in it
|
||||||
|
//fix_geometry();
|
||||||
|
|
||||||
|
// flush before clearing, otherwise the clear isn't effective.
|
||||||
|
XFlush(server.dsp);
|
||||||
|
// make sure the new child will get the right stuff in its background
|
||||||
|
// for ParentRelative.
|
||||||
|
XClearWindow(server.dsp, panel->main_win);
|
||||||
|
|
||||||
|
// show the window
|
||||||
|
XMapRaised(server.dsp, traywin->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void resize_systray(void *obj)
|
||||||
|
{
|
||||||
|
Systraybar *sysbar = obj;
|
||||||
|
Panel *panel = sysbar->area.panel;
|
||||||
|
TrayWindow *traywin;
|
||||||
|
GSList *l;
|
||||||
|
int count, posx, posy;
|
||||||
|
int icon_size;
|
||||||
|
|
||||||
|
icon_size = sysbar->area.height - (2 * sysbar->area.pix.border.width) - (2 * sysbar->area.paddingy);
|
||||||
|
count = g_slist_length(systray.list_icons);
|
||||||
|
|
||||||
|
if (!count) systray.area.width = 0;
|
||||||
|
else systray.area.width = (2 * systray.area.pix.border.width) + (2 * systray.area.paddingxlr) + (icon_size * count) + ((count-1) * systray.area.paddingx);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
systray.area.redraw = 1;
|
||||||
|
|
||||||
|
posy = panel->area.pix.border.width + panel->area.paddingy + systray.area.pix.border.width + systray.area.paddingy;
|
||||||
|
posx = systray.area.posx + systray.area.pix.border.width + systray.area.paddingxlr;
|
||||||
|
for (l = systray.list_icons; l ; l = l->next) {
|
||||||
|
traywin = (TrayWindow*)l->data;
|
||||||
|
|
||||||
|
traywin->y = posy;
|
||||||
|
traywin->x = posx;
|
||||||
|
posx += (icon_size + systray.area.paddingx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// resize other objects on panel
|
||||||
|
printf("resize_systray %d %d\n", systray.area.posx, systray.area.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int net_init()
|
int net_init()
|
||||||
{
|
{
|
||||||
// init systray protocol
|
// init systray protocol
|
||||||
|
@ -125,28 +196,7 @@ int net_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void resize_systray (void *obj)
|
//Window win, root;
|
||||||
{
|
|
||||||
Systraybar *sysbar = obj;
|
|
||||||
Panel *panel = sysbar->area.panel;
|
|
||||||
int count = g_slist_length(systray.list_icons);
|
|
||||||
|
|
||||||
if (!count) systray.area.width = 0;
|
|
||||||
else systray.area.width = 30 * count;
|
|
||||||
|
|
||||||
systray.area.posx = panel->area.width - panel->area.paddingxlr - panel->area.pix.border.width - systray.area.width;
|
|
||||||
if (panel->clock.area.visible)
|
|
||||||
systray.area.posx -= (panel->clock.area.width + panel->area.paddingx);
|
|
||||||
|
|
||||||
systray.area.redraw = 1;
|
|
||||||
|
|
||||||
// resize other objects on panel
|
|
||||||
printf("resize_systray %d %d\n", systray.area.posx, systray.area.width);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Window win, root;
|
|
||||||
int width, height;
|
int width, height;
|
||||||
int border;
|
int border;
|
||||||
int icon_size;
|
int icon_size;
|
||||||
|
@ -155,6 +205,7 @@ int icon_size;
|
||||||
void fix_geometry()
|
void fix_geometry()
|
||||||
{
|
{
|
||||||
GSList *it;
|
GSList *it;
|
||||||
|
Panel *panel = systray.area.panel;
|
||||||
|
|
||||||
// find the proper width and height
|
// find the proper width and height
|
||||||
width = 0;
|
width = 0;
|
||||||
|
@ -163,7 +214,7 @@ void fix_geometry()
|
||||||
width += icon_size;
|
width += icon_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
XResizeWindow(server.dsp, win, width + border * 2, height + border * 2);
|
XResizeWindow(server.dsp, panel->main_win, width + border * 2, height + border * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,10 +235,11 @@ int window_error_handler(Display *d, XErrorEvent *e)
|
||||||
gboolean icon_swallow(TrayWindow *traywin)
|
gboolean icon_swallow(TrayWindow *traywin)
|
||||||
{
|
{
|
||||||
XErrorHandler old;
|
XErrorHandler old;
|
||||||
|
Panel *panel = systray.area.panel;
|
||||||
|
|
||||||
error = FALSE;
|
error = FALSE;
|
||||||
old = XSetErrorHandler(window_error_handler);
|
old = XSetErrorHandler(window_error_handler);
|
||||||
XReparentWindow(server.dsp, traywin->id, win, 0, 0);
|
XReparentWindow(server.dsp, traywin->id, panel->main_win, 0, 0);
|
||||||
XSync(server.dsp, False);
|
XSync(server.dsp, False);
|
||||||
XSetErrorHandler(old);
|
XSetErrorHandler(old);
|
||||||
|
|
||||||
|
@ -203,22 +255,27 @@ gboolean icon_add(Window id)
|
||||||
traywin = g_new0(TrayWindow, 1);
|
traywin = g_new0(TrayWindow, 1);
|
||||||
traywin->id = id;
|
traywin->id = id;
|
||||||
|
|
||||||
systray.list_icons = g_slist_append(systray.list_icons, traywin);
|
systray.list_icons = g_slist_prepend(systray.list_icons, traywin);
|
||||||
printf("ajout d'un icone %d (%lx)\n", g_slist_length(systray.list_icons), id);
|
printf("ajout d'un icone %d (%lx)\n", g_slist_length(systray.list_icons), id);
|
||||||
systray.area.resize = 1;
|
systray.area.resize = 1;
|
||||||
|
systray.area.redraw = 1;
|
||||||
|
|
||||||
// changed in systray force resize on panel
|
// changed in systray force resize on panel
|
||||||
Panel *panel = systray.area.panel;
|
Panel *panel = systray.area.panel;
|
||||||
panel->area.resize = 1;
|
panel->area.resize = 1;
|
||||||
panel_refresh = 1;
|
panel_refresh = 1;
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
if (!icon_swallow(traywin)) {
|
if (!icon_swallow(traywin)) {
|
||||||
printf("not icon_swallow\n");
|
printf("not icon_swallow\n");
|
||||||
g_free(traywin);
|
g_free(traywin);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
printf("icon_swallow\n");
|
||||||
|
//return TRUE;
|
||||||
|
|
||||||
|
// => calcul x, y, width, height dans resize
|
||||||
|
/*
|
||||||
// find the positon for the systray app window
|
// find the positon for the systray app window
|
||||||
int count = g_slist_length(icons);
|
int count = g_slist_length(icons);
|
||||||
traywin->x = border + ((width % icon_size) / 2) +
|
traywin->x = border + ((width % icon_size) / 2) +
|
||||||
|
@ -228,24 +285,7 @@ gboolean icon_add(Window id)
|
||||||
|
|
||||||
// add the new icon to the list
|
// add the new icon to the list
|
||||||
icons = g_slist_append(icons, traywin);
|
icons = g_slist_append(icons, traywin);
|
||||||
|
*/
|
||||||
// watch for the icon trying to resize itself!
|
|
||||||
//XSelectInput(server.dsp, traywin->id, StructureNotifyMask);
|
|
||||||
|
|
||||||
// position and size the icon window
|
|
||||||
XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, icon_size, icon_size);
|
|
||||||
|
|
||||||
// resize our window so that the new window can fit in it
|
|
||||||
fix_geometry();
|
|
||||||
|
|
||||||
// flush before clearing, otherwise the clear isn't effective.
|
|
||||||
XFlush(server.dsp);
|
|
||||||
// make sure the new child will get the right stuff in its background
|
|
||||||
// for ParentRelative.
|
|
||||||
XClearWindow(server.dsp, win);
|
|
||||||
|
|
||||||
// show the window
|
|
||||||
XMapRaised(server.dsp, traywin->id);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -292,31 +332,28 @@ void net_message(XClientMessageEvent *e)
|
||||||
opcode = e->data.l[1];
|
opcode = e->data.l[1];
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case SYSTEM_TRAY_REQUEST_DOCK:
|
case SYSTEM_TRAY_REQUEST_DOCK:
|
||||||
panel_refresh = 1;
|
id = e->data.l[2];
|
||||||
id = e->data.l[2];
|
if (id) icon_add(id);
|
||||||
if (id && icon_add(id)) {
|
break;
|
||||||
XSelectInput(server.dsp, id, StructureNotifyMask);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_TRAY_BEGIN_MESSAGE:
|
case SYSTEM_TRAY_BEGIN_MESSAGE:
|
||||||
//g_printerr("Message From Dockapp\n");
|
printf("message from dockapp\n");
|
||||||
id = e->window;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_TRAY_CANCEL_MESSAGE:
|
|
||||||
//g_printerr("Message Cancelled\n");
|
|
||||||
id = e->window;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (opcode == server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA) {
|
|
||||||
printf("message from dockapp:\n %s\n", e->data.b);
|
|
||||||
id = e->window;
|
id = e->window;
|
||||||
}
|
break;
|
||||||
// unknown message type. not in the spec
|
|
||||||
break;
|
case SYSTEM_TRAY_CANCEL_MESSAGE:
|
||||||
|
printf("message cancelled\n");
|
||||||
|
id = e->window;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (opcode == server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA) {
|
||||||
|
printf("message from dockapp:\n %s\n", e->data.b);
|
||||||
|
id = e->window;
|
||||||
|
}
|
||||||
|
// unknown message type. not in the spec
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
#ifndef SYSTRAYBAR_H
|
#ifndef SYSTRAYBAR_H
|
||||||
#define SYSTRAYBAR_H
|
#define SYSTRAYBAR_H
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include "common.h"
|
||||||
#include <X11/Xutil.h>
|
|
||||||
#include <X11/Xatom.h>
|
|
||||||
#include "area.h"
|
#include "area.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +41,9 @@ int net_init();
|
||||||
void net_message(XClientMessageEvent *e);
|
void net_message(XClientMessageEvent *e);
|
||||||
void icon_remove(TrayWindow *traywin);
|
void icon_remove(TrayWindow *traywin);
|
||||||
|
|
||||||
void resize_systray (void *obj);
|
void draw_systray(void *obj, cairo_t *c, int active);
|
||||||
|
|
||||||
|
void resize_systray(void *obj);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -283,7 +283,7 @@ void draw_task_icon (Task *tsk, int text_width, int active)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void draw_foreground_task (void *obj, cairo_t *c, int active)
|
void draw_task (void *obj, cairo_t *c, int active)
|
||||||
{
|
{
|
||||||
Task *tsk = obj;
|
Task *tsk = obj;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
|
|
|
@ -53,7 +53,7 @@ typedef struct {
|
||||||
void add_task (Window win);
|
void add_task (Window win);
|
||||||
void remove_task (Task *tsk);
|
void remove_task (Task *tsk);
|
||||||
|
|
||||||
void draw_foreground_task (void *obj, cairo_t *c, int active);
|
void draw_task (void *obj, cairo_t *c, int active);
|
||||||
|
|
||||||
void get_icon (Task *tsk);
|
void get_icon (Task *tsk);
|
||||||
void get_title(Task *tsk);
|
void get_title(Task *tsk);
|
||||||
|
|
|
@ -52,15 +52,15 @@ void init_taskbar()
|
||||||
panel->g_taskbar.posy = panel->area.pix.border.width + panel->area.paddingy;
|
panel->g_taskbar.posy = panel->area.pix.border.width + panel->area.paddingy;
|
||||||
panel->g_taskbar.height = panel->area.height - (2 * panel->g_taskbar.posy);
|
panel->g_taskbar.height = panel->area.height - (2 * panel->g_taskbar.posy);
|
||||||
panel->g_taskbar.redraw = 1;
|
panel->g_taskbar.redraw = 1;
|
||||||
panel->g_taskbar.visible = 1;
|
panel->g_taskbar.on_screen = 1;
|
||||||
|
|
||||||
// task
|
// task
|
||||||
panel->g_task.area._draw_foreground = draw_foreground_task;
|
panel->g_task.area._draw_foreground = draw_task;
|
||||||
panel->g_task.area.posy = panel->g_taskbar.posy + panel->g_taskbar.pix.border.width + panel->g_taskbar.paddingy;
|
panel->g_task.area.posy = panel->g_taskbar.posy + panel->g_taskbar.pix.border.width + panel->g_taskbar.paddingy;
|
||||||
panel->g_task.area.height = panel->area.height - (2 * panel->g_task.area.posy);
|
panel->g_task.area.height = panel->area.height - (2 * panel->g_task.area.posy);
|
||||||
panel->g_task.area.use_active = 1;
|
panel->g_task.area.use_active = 1;
|
||||||
panel->g_task.area.redraw = 1;
|
panel->g_task.area.redraw = 1;
|
||||||
panel->g_task.area.visible = 1;
|
panel->g_task.area.on_screen = 1;
|
||||||
|
|
||||||
if (panel->g_task.area.pix.border.rounded > panel->g_task.area.height/2) {
|
if (panel->g_task.area.pix.border.rounded > panel->g_task.area.height/2) {
|
||||||
panel->g_task.area.pix.border.rounded = panel->g_task.area.height/2;
|
panel->g_task.area.pix.border.rounded = panel->g_task.area.height/2;
|
||||||
|
|
43
src/tint.c
43
src/tint.c
|
@ -140,7 +140,7 @@ void event_button_press (XEvent *e)
|
||||||
int y = e->xbutton.y;
|
int y = e->xbutton.y;
|
||||||
for (l0 = panel->area.list; l0 ; l0 = l0->next) {
|
for (l0 = panel->area.list; l0 ; l0 = l0->next) {
|
||||||
tskbar = l0->data;
|
tskbar = l0->data;
|
||||||
if (!tskbar->area.visible) continue;
|
if (!tskbar->area.on_screen) continue;
|
||||||
if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
|
if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ void event_button_release (XEvent *e)
|
||||||
GSList *l0;
|
GSList *l0;
|
||||||
for (l0 = panel->area.list; l0 ; l0 = l0->next) {
|
for (l0 = panel->area.list; l0 ; l0 = l0->next) {
|
||||||
tskbar = l0->data;
|
tskbar = l0->data;
|
||||||
if (!tskbar->area.visible) continue;
|
if (!tskbar->area.on_screen) continue;
|
||||||
if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
|
if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
|
||||||
goto suite;
|
goto suite;
|
||||||
}
|
}
|
||||||
|
@ -403,6 +403,37 @@ void event_property_notify (XEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void event_expose (XEvent *e)
|
||||||
|
{
|
||||||
|
Panel *panel;
|
||||||
|
|
||||||
|
panel = get_panel(e->xany.window);
|
||||||
|
if (!panel) return;
|
||||||
|
/*
|
||||||
|
if (systray.area.on_screen) {
|
||||||
|
// force trayer refresh
|
||||||
|
//XClearWindow(tray_data.dpy, ti->mid_parent);
|
||||||
|
//x11_send_visibility(tray_data.dpy, dst, VisibilityFullyObscured);
|
||||||
|
//x11_send_visibility(tray_data.dpy, dst, VisibilityUnobscured);
|
||||||
|
|
||||||
|
GSList *l;
|
||||||
|
TrayWindow *traywin;
|
||||||
|
for (l = systray.list_icons; l ; l = l->next) {
|
||||||
|
traywin = (TrayWindow*)l->data;
|
||||||
|
// send Expose event
|
||||||
|
XClearArea(server.dsp, traywin->id, 0, 0, systray.area.width, systray.area.height, True);
|
||||||
|
//printf("expose %lx\n", traywin->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//x11_refresh_window(tray_data.dpy, ti->wid, ti->l.wnd_sz.x, ti->l.wnd_sz.y, True);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
panel_refresh = 1;
|
||||||
|
//XCopyArea (server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void event_configure_notify (Window win)
|
void event_configure_notify (Window win)
|
||||||
{
|
{
|
||||||
if (panel_mode != SINGLE_MONITOR) return;
|
if (panel_mode != SINGLE_MONITOR) return;
|
||||||
|
@ -498,17 +529,15 @@ load_config:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
event_button_release (&e);
|
event_button_release(&e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Expose:
|
case Expose:
|
||||||
panel = get_panel(e.xany.window);
|
event_expose(&e);
|
||||||
if (!panel) break;
|
|
||||||
XCopyArea (server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
event_property_notify (&e);
|
event_property_notify(&e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
|
|
BIN
src/tint2
BIN
src/tint2
Binary file not shown.
|
@ -35,10 +35,13 @@
|
||||||
// 4) redraw child
|
// 4) redraw child
|
||||||
void refresh (Area *a)
|
void refresh (Area *a)
|
||||||
{
|
{
|
||||||
if (!a->visible) return;
|
// don't draw and resize hide objects
|
||||||
|
if (!a->on_screen) return;
|
||||||
|
|
||||||
size(a);
|
size(a);
|
||||||
|
|
||||||
|
// don't draw transparent objects (without foreground and without background)
|
||||||
|
|
||||||
if (a->redraw) {
|
if (a->redraw) {
|
||||||
a->redraw = 0;
|
a->redraw = 0;
|
||||||
//printf("draw area posx %d, width %d\n", a->posx, a->width);
|
//printf("draw area posx %d, width %d\n", a->posx, a->width);
|
||||||
|
@ -49,6 +52,7 @@ void refresh (Area *a)
|
||||||
|
|
||||||
// draw current Area
|
// draw current Area
|
||||||
Pixmap *pmap = (a->is_active == 0) ? (&a->pix.pmap) : (&a->pix_active.pmap);
|
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);
|
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
|
// and then refresh child object
|
||||||
|
|
|
@ -60,7 +60,7 @@ typedef struct {
|
||||||
// list of child : Area object
|
// list of child : Area object
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
int visible;
|
int on_screen;
|
||||||
// need compute position and width
|
// need compute position and width
|
||||||
int resize;
|
int resize;
|
||||||
// need redraw Pixmap
|
// need redraw Pixmap
|
||||||
|
|
7
tintrc01
7
tintrc01
|
@ -52,6 +52,11 @@ task_active_font_color = #ffffff 85
|
||||||
task_background_id = 3
|
task_background_id = 3
|
||||||
task_active_background_id = 2
|
task_active_background_id = 2
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# SYSTRAYBAR
|
||||||
|
#---------------------------------------------
|
||||||
|
systray_padding = 0 3 3
|
||||||
|
systray_background_id = 0
|
||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
# CLOCK
|
# CLOCK
|
||||||
|
@ -61,7 +66,7 @@ time1_font = sans 8
|
||||||
time2_format = %A %d %B
|
time2_format = %A %d %B
|
||||||
time2_font = sans 6
|
time2_font = sans 6
|
||||||
clock_font_color = #ffffff 76
|
clock_font_color = #ffffff 76
|
||||||
clock_padding = 4 0
|
clock_padding = 1 0
|
||||||
clock_background_id = 0
|
clock_background_id = 0
|
||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
|
|
6
tintrc02
6
tintrc02
|
@ -57,8 +57,8 @@ task_active_background_id = 3
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
# SYSTRAYBAR
|
# SYSTRAYBAR
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
systray_padding = 4 2 2
|
systray_padding = 0 2 2
|
||||||
systray_background_id = 2
|
systray_background_id = 0
|
||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
# CLOCK
|
# CLOCK
|
||||||
|
@ -68,7 +68,7 @@ time1_font = sans 7
|
||||||
time2_format = %A %d %B
|
time2_format = %A %d %B
|
||||||
time2_font = sans 7
|
time2_font = sans 7
|
||||||
clock_font_color = #ffffff 100
|
clock_font_color = #ffffff 100
|
||||||
clock_padding = 2 0
|
clock_padding = 1 0
|
||||||
clock_background_id = 0
|
clock_background_id = 0
|
||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
|
|
6
tintrc03
6
tintrc03
|
@ -48,6 +48,12 @@ task_active_font_color = #000000 100
|
||||||
task_background_id = 0
|
task_background_id = 0
|
||||||
task_active_background_id = 2
|
task_active_background_id = 2
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# SYSTRAYBAR
|
||||||
|
#---------------------------------------------
|
||||||
|
#systray_padding = 0 2 2
|
||||||
|
systray_background_id = 0
|
||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
# CLOCK
|
# CLOCK
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
|
|
14
tintrc04
14
tintrc04
|
@ -19,10 +19,10 @@ border_color = #d1d1d1 40
|
||||||
# PANEL
|
# PANEL
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
panel_monitor = all
|
panel_monitor = all
|
||||||
panel_position = bottom left
|
panel_position = bottom center
|
||||||
panel_size = 99% 27
|
panel_size = 97% 26
|
||||||
panel_margin = 0 0
|
panel_margin = 0 0
|
||||||
panel_padding = 5 3 5
|
panel_padding = 0 2 5
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
panel_background_id = 0
|
panel_background_id = 0
|
||||||
|
|
||||||
|
@ -47,10 +47,16 @@ task_active_font_color = #ffffff 90
|
||||||
task_background_id = 1
|
task_background_id = 1
|
||||||
task_active_background_id = 2
|
task_active_background_id = 2
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# SYSTRAYBAR
|
||||||
|
#---------------------------------------------
|
||||||
|
systray_padding = 5 3 5
|
||||||
|
systray_background_id = 1
|
||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
# CLOCK
|
# CLOCK
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
time1_format = %a %d %H:%M
|
#time1_format = %a %d %H:%M
|
||||||
time1_font = sans bold 7.5
|
time1_font = sans bold 7.5
|
||||||
#time2_format = %A %d %B
|
#time2_format = %A %d %B
|
||||||
time2_font = sans bold 7.5
|
time2_font = sans bold 7.5
|
||||||
|
|
74
tintrc05
Normal file
74
tintrc05
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
#---------------------------------------------
|
||||||
|
# TINT2 CONFIG FILE
|
||||||
|
#---------------------------------------------
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# BACKGROUND AND BORDER
|
||||||
|
#---------------------------------------------
|
||||||
|
rounded = 1
|
||||||
|
border_width = 0
|
||||||
|
background_color = #282828 100
|
||||||
|
border_color = #000000 0
|
||||||
|
|
||||||
|
rounded = 1
|
||||||
|
border_width = 0
|
||||||
|
background_color = #cccccc 20
|
||||||
|
border_color = #cccccc 40
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# PANEL
|
||||||
|
#---------------------------------------------
|
||||||
|
panel_monitor = all
|
||||||
|
panel_position = bottom center
|
||||||
|
panel_size = 95% 22
|
||||||
|
panel_margin = 0 0
|
||||||
|
panel_padding = 7 0
|
||||||
|
font_shadow = 0
|
||||||
|
panel_background_id = 1
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# TASKBAR
|
||||||
|
#---------------------------------------------
|
||||||
|
taskbar_mode = single_desktop
|
||||||
|
taskbar_padding = 0 0 0
|
||||||
|
taskbar_background_id = 0
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# TASKS
|
||||||
|
#---------------------------------------------
|
||||||
|
task_icon = 0
|
||||||
|
task_text = 1
|
||||||
|
task_width = 160
|
||||||
|
task_centered = 1
|
||||||
|
task_padding = 5 0
|
||||||
|
task_font = sans 9
|
||||||
|
task_font_color = #ffffff 60
|
||||||
|
task_active_font_color = #ffffff 100
|
||||||
|
task_background_id = 0
|
||||||
|
task_active_background_id = 2
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# SYSTRAYBAR
|
||||||
|
#---------------------------------------------
|
||||||
|
systray_padding = 0 3 4
|
||||||
|
systray_background_id = 0
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# CLOCK
|
||||||
|
#---------------------------------------------
|
||||||
|
time1_format = %H:%M
|
||||||
|
time1_font = sans 13
|
||||||
|
#time2_format = %A %d %B
|
||||||
|
time2_font = sans 7
|
||||||
|
clock_font_color = #ffffff 90
|
||||||
|
clock_padding = 1 0
|
||||||
|
clock_background_id = 0
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# MOUSE ACTION ON TASK
|
||||||
|
#---------------------------------------------
|
||||||
|
mouse_middle = none
|
||||||
|
mouse_right = close
|
||||||
|
mouse_scroll_up = toggle
|
||||||
|
mouse_scroll_down = iconify
|
||||||
|
|
10
tintrc06
10
tintrc06
|
@ -53,12 +53,18 @@ task_active_font_color = #ffffff 85
|
||||||
task_background_id = 0
|
task_background_id = 0
|
||||||
task_active_background_id = 2
|
task_active_background_id = 2
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# SYSTRAYBAR
|
||||||
|
#---------------------------------------------
|
||||||
|
systray_padding = 9 3 5
|
||||||
|
systray_background_id = 1
|
||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
# CLOCK
|
# CLOCK
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
time1_format = %H:%M
|
#time1_format = %H:%M
|
||||||
time1_font = sans bold 8
|
time1_font = sans bold 8
|
||||||
time2_format = %A %d %B
|
#time2_format = %A %d %B
|
||||||
time2_font = sans 7
|
time2_font = sans 7
|
||||||
clock_font_color = #ffffff 65
|
clock_font_color = #ffffff 65
|
||||||
clock_padding = 6 0
|
clock_padding = 6 0
|
||||||
|
|
74
tintrc07
Normal file
74
tintrc07
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
#---------------------------------------------
|
||||||
|
# TINT2 CONFIG FILE
|
||||||
|
#---------------------------------------------
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# BACKGROUND AND BORDER
|
||||||
|
#---------------------------------------------
|
||||||
|
rounded = 4
|
||||||
|
border_width = 1
|
||||||
|
background_color = #000000 40
|
||||||
|
border_color = #d1d1d1 34
|
||||||
|
|
||||||
|
rounded = 3
|
||||||
|
border_width = 0
|
||||||
|
background_color = #000000 40
|
||||||
|
border_color = #d1d1d1 40
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# PANEL
|
||||||
|
#---------------------------------------------
|
||||||
|
panel_monitor = all
|
||||||
|
panel_position = bottom center
|
||||||
|
panel_size = 97% 30
|
||||||
|
panel_margin = 0 0
|
||||||
|
panel_padding = 0 2 7
|
||||||
|
font_shadow = 0
|
||||||
|
panel_background_id = 0
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# TASKBAR
|
||||||
|
#---------------------------------------------
|
||||||
|
taskbar_mode = multi_desktop
|
||||||
|
taskbar_padding = 0 0 0
|
||||||
|
taskbar_background_id = 1
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# TASKS
|
||||||
|
#---------------------------------------------
|
||||||
|
task_icon = 0
|
||||||
|
task_text = 1
|
||||||
|
task_width = 160
|
||||||
|
task_centered = 1
|
||||||
|
task_padding = 4 3
|
||||||
|
task_font = sans bold 7.5
|
||||||
|
task_font_color = #ffffff 60
|
||||||
|
task_active_font_color = #ffffff 90
|
||||||
|
task_background_id = 0
|
||||||
|
task_active_background_id = 2
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# SYSTRAYBAR
|
||||||
|
#---------------------------------------------
|
||||||
|
systray_padding = 6 3 4
|
||||||
|
systray_background_id = 1
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# CLOCK
|
||||||
|
#---------------------------------------------
|
||||||
|
time1_format = %H:%M
|
||||||
|
time1_font = sans bold 7
|
||||||
|
time2_format = %A %d %B
|
||||||
|
time2_font = sans 7
|
||||||
|
clock_font_color = #ffffff 60
|
||||||
|
clock_padding = 2 0
|
||||||
|
clock_background_id = 1
|
||||||
|
|
||||||
|
#---------------------------------------------
|
||||||
|
# MOUSE ACTION ON TASK
|
||||||
|
#---------------------------------------------
|
||||||
|
mouse_middle = none
|
||||||
|
mouse_right = close
|
||||||
|
mouse_scroll_up = toggle
|
||||||
|
mouse_scroll_down = iconify
|
||||||
|
|
Loading…
Reference in a new issue