add another padding parameter in config file, update documentation and sample config file

git-svn-id: http://tint2.googlecode.com/svn/trunk@28 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr 2009-01-20 21:16:54 +00:00
parent 024e8fb1f3
commit e36c729d7b
24 changed files with 272 additions and 265 deletions

View file

@ -1,4 +1,8 @@
2009-01-20
- change config file format : add another padding parameter
- update documentation and sample config file
2009-01-19 2009-01-19
- patch from Robert Escriva, fixed tint2 on multi-monitor - patch from Robert Escriva, fixed tint2 on multi-monitor
- fixed bug between MULTI_MONITOR mode and 'task on all desktop' - fixed bug between MULTI_MONITOR mode and 'task on all desktop'
@ -38,7 +42,7 @@
user's background start with number 1, 2, ... user's background start with number 1, 2, ...
2008-09-22 2008-09-22
- better control on icon opacity - better control on icon opacity
icon opacity use the same value as text opacity icon opacity use the same value as text opacity
2008-09-21 2008-09-21
@ -48,23 +52,23 @@
2008-09-19 2008-09-19
- improve clock drawing on 2 lines - improve clock drawing on 2 lines
- new design : object oriented - new design : object oriented
clock inherit Area (with draw_background) clock inherit Area (with draw_background)
- rename parameter 'panel_mode' in 'taskbar_mode' - rename parameter 'panel_mode' in 'taskbar_mode'
2008-09-17 2008-09-17
- change name from tint to tint2 because debian has already a package named tint - change name from tint to tint2 because debian has already a package named tint
- new design : object oriented - new design : object oriented
tasks inherit Area tasks inherit Area
taskbars inherit Area taskbars inherit Area
2008-09-16 2008-09-16
- new design : object oriented - new design : object oriented
remove task_margin parameter, replaced by taskbar_padding remove task_margin parameter, replaced by taskbar_padding
fixed segfault with new layout fixed segfault with new layout
2008-09-04 2008-09-04
- new design : object oriented - new design : object oriented
all objects inherit from Area : panel, taskbar, task, clock all objects inherit from Area : panel, taskbar, task, clock
2008-09-02 licence changed to GPL V2 2008-09-02 licence changed to GPL V2
@ -106,7 +110,7 @@ released tint-0.6
- update documentation - update documentation
2008-07-04 2008-07-04
- changed in config file, panel_show_all_desktop - changed in config file, panel_show_all_desktop
replaced by panel_mode = single_desktop / multi_desktop / multi_monitor replaced by panel_mode = single_desktop / multi_desktop / multi_monitor
- with panel_mode = multi_monitor, tint show one taskbar by monitor - with panel_mode = multi_monitor, tint show one taskbar by monitor
@ -120,24 +124,24 @@ released tint-0.6
2008-06-30 patch from goo...@dougbarton.us 2008-06-30 patch from goo...@dougbarton.us
- tint wait for window manager on startup - tint wait for window manager on startup
2008-06-29 2008-06-29
- specify monitor with parameter 'panel_monitor' - specify monitor with parameter 'panel_monitor'
- panel_position is relative to your monitor - panel_position is relative to your monitor
panel_monitor = 1 panel_monitor = 1
panel_position = bottom center panel_position = bottom center
2008-06-24 2008-06-24
- fixed bug : show tint on all desktop with fluxbox - fixed bug : show tint on all desktop with fluxbox
2008-06-23 2008-06-23
- task_width = 0 to get full taskbar width - task_width = 0 to get full taskbar width
- added documentation in /doc - added documentation in /doc
2008-06-16 2008-06-16
- renamed parameter panel_margin to panel_padding - renamed parameter panel_margin to panel_padding
- added parameter panel_margin = vertical_margin horizontal_margin - added parameter panel_margin = vertical_margin horizontal_margin
2008-06-15 2008-06-15
- fixed bug : icon position changed when clock adjust width - fixed bug : icon position changed when clock adjust width
- removed boolean parameter panel_background and task_background - removed boolean parameter panel_background and task_background
replaced with opacity (alpha) = 0 replaced with opacity (alpha) = 0
@ -145,51 +149,51 @@ released tint-0.6
identical to task_border_width identical to task_border_width
- fixed bug : draw task below panel border - fixed bug : draw task below panel border
2008-06-11 2008-06-11
- removed the need of desktop margin. - removed the need of desktop margin.
tint specify margin to window magager (_NET_WM_STRUT) tint specify margin to window magager (_NET_WM_STRUT)
2008-06-10 2008-06-10
- fixed bug : time/date vertical and horizontal center - fixed bug : time/date vertical and horizontal center
2008-06-10 patch from benjaminfranzke 2008-06-10 patch from benjaminfranzke
- fixed bug : draw icon on 64bit system. - fixed bug : draw icon on 64bit system.
2008-06-08 2008-06-08
- fixed bug : in draw border and fill background - fixed bug : in draw border and fill background
2008-06-04 2008-06-04
- allow config file on the command line : tint -c ./tintrc2 - allow config file on the command line : tint -c ./tintrc2
- allow 2 value in config file : key = value1 value2 - allow 2 value in config file : key = value1 value2
- panel_margin can get 2 values : vertical_margin horizontal_margin - panel_margin can get 2 values : vertical_margin horizontal_margin
panel_margin = 8 4 panel_margin = 8 4
2008-05-30 2008-05-30
- put panel below other window - put panel below other window
- set locale LANG - set locale LANG
2008-05-28 2008-05-28
- clock_width adjust automatically - clock_width adjust automatically
- configure : time2_format see 'man strftime' - configure : time2_format see 'man strftime'
2008-05-27 2008-05-27
- configure : time1_format see 'man strftime' - configure : time1_format see 'man strftime'
- cleanup code : refresh_pos() - cleanup code : refresh_pos()
2008-05-26 2008-05-26
- catch time event in main loop - catch time event in main loop
- draw clock fixed format %H:%M - draw clock fixed format %H:%M
2008-05-24 2008-05-24
- removed boolean parameter task_icon - removed boolean parameter task_icon
task_icon_size = 0 replace task_icon = 0 task_icon_size = 0 replace task_icon = 0
- all colors parameters can get 2 values : color and opacity (alpha) - all colors parameters can get 2 values : color and opacity (alpha)
font_color = #ffffff 70 font_color = #ffffff 70
2008-05-23 2008-05-23
- cpu optimisation : limit call to visual_refresh() - cpu optimisation : limit call to visual_refresh()
2008-05-22 2008-05-22
- configure clock : clock_font, clock_font_color - configure clock : clock_font, clock_font_color
@ -197,7 +201,7 @@ released tint-0.6
2008-05-20 thil7 <lorthiois@bbsoft.fr> 2008-05-20 thil7 <lorthiois@bbsoft.fr>
released tint-0.5 released tint-0.5
2008-05-19 2008-05-19
- improve usability in mode 'show_all_desktop' - improve usability in mode 'show_all_desktop'
-> don't switch desktop when close a task of another desktop -> don't switch desktop when close a task of another desktop
-> allow to drag and drop task between desktop -> allow to drag and drop task between desktop
@ -218,7 +222,7 @@ released tint-0.5
2008-05-14 thil7 <lorthiois@bbsoft.fr> 2008-05-14 thil7 <lorthiois@bbsoft.fr>
released tint-0.4 released tint-0.4
2008-05-12 2008-05-12
- boolean option 'show_all_desktop' - boolean option 'show_all_desktop'
0 : tint panel show one taskbar (from current desktop) 0 : tint panel show one taskbar (from current desktop)
1 : tint panel show all taskbars (from all desktops) 1 : tint panel show all taskbars (from all desktops)
@ -235,7 +239,7 @@ released tint-0.4
2008-05-10 thil7 <lorthiois@bbsoft.fr> 2008-05-10 thil7 <lorthiois@bbsoft.fr>
released tint-0.3 released tint-0.3
2008-05-10 2008-05-10
- manage events : 'send to desktop' and 'send to all desktop' - manage events : 'send to desktop' and 'send to all desktop'
- bug solved : 'close' action now send _NET_CLOSE_WINDOW - bug solved : 'close' action now send _NET_CLOSE_WINDOW
so openoffice ask 'save document...' if needed so openoffice ask 'save document...' if needed
@ -250,27 +254,27 @@ released tint-0.3
2008-05-09 thil7 <lorthiois@bbsoft.fr> 2008-05-09 thil7 <lorthiois@bbsoft.fr>
released tint-0.2 released tint-0.2
2008-05-08 2008-05-08
- panel : add rounded and border (color and alpha) - panel : add rounded and border (color and alpha)
- remove option 'panel_tasks_centered' - remove option 'panel_tasks_centered'
- user can configure mouse event on task - user can configure mouse event on task
(none, toggle, iconify, shade, close, toggle_iconify) (none, toggle, iconify, shade, close, toggle_iconify)
2008-05-07 2008-05-07
- cpu optimisation : resize_tasks only when add/remove task, - cpu optimisation : resize_tasks only when add/remove task,
compute pos_y at startup compute pos_y at startup
2008-05-04 2008-05-04
- task width adjust when too many task - task width adjust when too many task
2008-05-01 2008-05-01
- task : add rounded and border (color and alpha) - task : add rounded and border (color and alpha)
- panel position (left, right, center) thank to ak47izatool - panel position (left, right, center) thank to ak47izatool
- cleanup code : vertical position (icon and text), - cleanup code : vertical position (icon and text),
better refresh after delete task, memory leak *font better refresh after delete task, memory leak *font
- panel : changed panel_margin and task_margin - panel : changed panel_margin and task_margin
2008-04-22 2008-04-22
- fork ttm projet from p://code.google.com/p/ttm/ (by Pål Staurland staura@gmail.com) - fork ttm projet from p://code.google.com/p/ttm/ (by Pål Staurland staura@gmail.com)
while the projet is no longer in developpement, have not changed the name of 'tint'. while the projet is no longer in developpement, have not changed the name of 'tint'.

Binary file not shown.

Binary file not shown.

View file

@ -2,7 +2,7 @@ CFLAGS= -O2
CC = gcc CC = gcc
FLAGS=-W -Wall -g `pkg-config --cflags --libs cairo pangocairo x11 xinerama imlib2 glib-2.0` FLAGS=-W -Wall -g `pkg-config --cflags --libs cairo pangocairo x11 xinerama imlib2 glib-2.0`
PROGNAME=tint2 PROGNAME=tint2
FILES=tint.c server.c panel.c config.c taskbar/task.c taskbar/taskbar.c clock/clock.c systray/docker.c systray/icons.c systray/kde.c systray/net.c systray/xproperty.c util/window.c util/area.c FILES=tint.c server.c panel.c config.c taskbar/task.c taskbar/taskbar.c clock/clock.c systray/systraybar.c systray/docker.c systray/icons.c systray/kde.c systray/net.c systray/xproperty.c util/window.c util/area.c
ifndef DESTDIR ifndef DESTDIR
ifndef PREFIX ifndef PREFIX

View file

@ -94,13 +94,13 @@ redraw:
} }
if (time_width > date_width) new_width = time_width; if (time_width > date_width) new_width = time_width;
else new_width = date_width; else new_width = date_width;
new_width += (2*clock->area.paddingx) + (2*clock->area.pix.border.width); new_width += (2*clock->area.paddingxlr) + (2*clock->area.pix.border.width);
if (new_width > clock->area.width || (new_width != clock->area.width && date_width > time_width)) { if (new_width > clock->area.width || (new_width != clock->area.width && date_width > time_width)) {
//printf("clock_width %d, new_width %d\n", clock->area.width, new_width); //printf("clock_width %d, new_width %d\n", clock->area.width, new_width);
// resize clock // resize clock
clock->area.width = new_width; clock->area.width = new_width;
panel.clock.area.posx = panel.area.width - panel.clock.area.width - panel.area.paddingx - panel.area.pix.border.width; panel.clock.area.posx = panel.area.width - panel.clock.area.width - panel.area.paddingxlr - panel.area.pix.border.width;
g_object_unref (layout); g_object_unref (layout);
resize_taskbar(); resize_taskbar();

View file

@ -1,5 +1,7 @@
/************************************************************************** /**************************************************************************
* clock : * Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr)
*
* clock :
* - draw clock, adjust width * - draw clock, adjust width
* *
**************************************************************************/ **************************************************************************/

View file

@ -103,23 +103,43 @@ void copy_file(const char *pathSrc, const char *pathDest)
} }
void extract_values (const char *value, char **value1, char **value2) void extract_values (const char *value, char **value1, char **value2, char **value3)
{ {
char *b; char *b, *c;
if (*value1) free (*value1); if (*value1) free (*value1);
if (*value2) free (*value2); if (*value2) free (*value2);
if (*value3) free (*value3);
if ((b = strchr (value, ' '))) { if (b = strchr (value, ' ')) {
b[0] = '\0'; b[0] = '\0';
b++; b++;
*value2 = strdup (b); }
g_strstrip(*value2); else {
} b = 0;
else *value2 = 0; *value2 = 0;
*value3 = 0;
}
*value1 = strdup (value);
g_strstrip(*value1);
*value1 = strdup (value); if (b) {
g_strstrip(*value1); if (c = strchr (b, ' ')) {
c[0] = '\0';
c++;
}
else {
c = 0;
*value3 = 0;
}
*value2 = strdup (b);
g_strstrip(*value2);
}
if (c) {
*value3 = strdup (c);
g_strstrip(*value3);
}
} }
@ -194,7 +214,7 @@ void get_action (char *event, int *action)
void add_entry (char *key, char *value) void add_entry (char *key, char *value)
{ {
char *value1=0, *value2=0; char *value1=0, *value2=0, *value3=0;
/* Background and border */ /* Background and border */
if (strcmp (key, "rounded") == 0) { if (strcmp (key, "rounded") == 0) {
@ -209,14 +229,14 @@ void add_entry (char *key, char *value)
} }
else if (strcmp (key, "background_color") == 0) { else if (strcmp (key, "background_color") == 0) {
Area *a = g_slist_last(list_back)->data; Area *a = g_slist_last(list_back)->data;
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
get_color (value1, a->pix.back.color); get_color (value1, a->pix.back.color);
if (value2) a->pix.back.alpha = (atoi (value2) / 100.0); if (value2) a->pix.back.alpha = (atoi (value2) / 100.0);
else a->pix.back.alpha = 0.5; else a->pix.back.alpha = 0.5;
} }
else if (strcmp (key, "border_color") == 0) { else if (strcmp (key, "border_color") == 0) {
Area *a = g_slist_last(list_back)->data; Area *a = g_slist_last(list_back)->data;
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
get_color (value1, a->pix.border.color); get_color (value1, a->pix.border.color);
if (value2) a->pix.border.alpha = (atoi (value2) / 100.0); if (value2) a->pix.border.alpha = (atoi (value2) / 100.0);
else a->pix.border.alpha = 0.5; else a->pix.border.alpha = 0.5;
@ -228,22 +248,23 @@ void add_entry (char *key, char *value)
if (panel.monitor > 0) panel.monitor -= 1; if (panel.monitor > 0) panel.monitor -= 1;
} }
else if (strcmp (key, "panel_size") == 0) { else if (strcmp (key, "panel_size") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
panel.area.width = atoi (value1); panel.area.width = atoi (value1);
if (value2) panel.area.height = atoi (value2); if (value2) panel.area.height = atoi (value2);
} }
else if (strcmp (key, "panel_margin") == 0) { else if (strcmp (key, "panel_margin") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
panel.marginx = atoi (value1); panel.marginx = atoi (value1);
if (value2) panel.marginy = atoi (value2); if (value2) panel.marginy = atoi (value2);
} }
else if (strcmp (key, "panel_padding") == 0) { else if (strcmp (key, "panel_padding") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
panel.area.paddingx = atoi (value1); panel.area.paddingxlr = panel.area.paddingx = atoi (value1);
if (value2) panel.area.paddingy = atoi (value2); if (value2) panel.area.paddingy = atoi (value2);
if (value3) panel.area.paddingx = atoi (value3);
} }
else if (strcmp (key, "panel_position") == 0) { else if (strcmp (key, "panel_position") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
if (strcmp (value1, "top") == 0) panel.position = TOP; if (strcmp (value1, "top") == 0) panel.position = TOP;
else panel.position = BOTTOM; else panel.position = BOTTOM;
@ -285,15 +306,16 @@ void add_entry (char *key, char *value)
panel.clock.time2_font_desc = pango_font_description_from_string (value); panel.clock.time2_font_desc = pango_font_description_from_string (value);
} }
else if (strcmp (key, "clock_font_color") == 0) { else if (strcmp (key, "clock_font_color") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
get_color (value1, panel.clock.font.color); get_color (value1, panel.clock.font.color);
if (value2) panel.clock.font.alpha = (atoi (value2) / 100.0); if (value2) panel.clock.font.alpha = (atoi (value2) / 100.0);
else panel.clock.font.alpha = 0.1; else panel.clock.font.alpha = 0.1;
} }
else if (strcmp (key, "clock_padding") == 0) { else if (strcmp (key, "clock_padding") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
panel.clock.area.paddingx = atoi (value1); panel.clock.area.paddingxlr = panel.clock.area.paddingx = atoi (value1);
if (value2) panel.clock.area.paddingy = atoi (value2); if (value2) panel.clock.area.paddingy = atoi (value2);
if (value3) panel.clock.area.paddingx = atoi (value3);
} }
else if (strcmp (key, "clock_background_id") == 0) { else if (strcmp (key, "clock_background_id") == 0) {
int id = atoi (value); int id = atoi (value);
@ -309,9 +331,10 @@ void add_entry (char *key, char *value)
else panel.mode = SINGLE_DESKTOP; else panel.mode = SINGLE_DESKTOP;
} }
else if (strcmp (key, "taskbar_padding") == 0) { else if (strcmp (key, "taskbar_padding") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
g_taskbar.paddingx = atoi (value1); g_taskbar.paddingxlr = g_taskbar.paddingx = atoi (value1);
if (value2) g_taskbar.paddingy = atoi (value2); if (value2) g_taskbar.paddingy = atoi (value2);
if (value3) g_taskbar.paddingx = atoi (value3);
} }
else if (strcmp (key, "taskbar_background_id") == 0) { else if (strcmp (key, "taskbar_background_id") == 0) {
int id = atoi (value); int id = atoi (value);
@ -330,24 +353,23 @@ void add_entry (char *key, char *value)
else if (strcmp (key, "task_width") == 0) else if (strcmp (key, "task_width") == 0)
g_task.maximum_width = atoi (value); g_task.maximum_width = atoi (value);
else if (strcmp (key, "task_padding") == 0) { else if (strcmp (key, "task_padding") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
g_task.area.paddingx = atoi (value1); g_task.area.paddingxlr = g_task.area.paddingx = atoi (value1);
if (value2) { if (value2) g_task.area.paddingy = atoi (value2);
g_task.area.paddingy = atoi (value2); if (value3) g_task.area.paddingx = atoi (value3);
}
} }
else if (strcmp (key, "task_font") == 0) { else if (strcmp (key, "task_font") == 0) {
if (g_task.font_desc) pango_font_description_free(g_task.font_desc); if (g_task.font_desc) pango_font_description_free(g_task.font_desc);
g_task.font_desc = pango_font_description_from_string (value); g_task.font_desc = pango_font_description_from_string (value);
} }
else if (strcmp (key, "task_font_color") == 0) { else if (strcmp (key, "task_font_color") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
get_color (value1, g_task.font.color); get_color (value1, g_task.font.color);
if (value2) g_task.font.alpha = (atoi (value2) / 100.0); if (value2) g_task.font.alpha = (atoi (value2) / 100.0);
else g_task.font.alpha = 0.1; else g_task.font.alpha = 0.1;
} }
else if (strcmp (key, "task_active_font_color") == 0) { else if (strcmp (key, "task_active_font_color") == 0) {
extract_values(value, &value1, &value2); extract_values(value, &value1, &value2, &value3);
get_color (value1, g_task.font_active.color); get_color (value1, g_task.font_active.color);
if (value2) g_task.font_active.alpha = (atoi (value2) / 100.0); if (value2) g_task.font_active.alpha = (atoi (value2) / 100.0);
else g_task.font_active.alpha = 0.1; else g_task.font_active.alpha = 0.1;
@ -427,6 +449,7 @@ void add_entry (char *key, char *value)
if (value1) free (value1); if (value1) free (value1);
if (value2) free (value2); if (value2) free (value2);
if (value3) free (value3);
} }
@ -556,7 +579,7 @@ void config_finish ()
g_task.text_posy = (g_task.area.height - height) / 2.0; g_task.text_posy = (g_task.area.height - height) / 2.0;
// add task_icon_size // add task_icon_size
g_task.text_posx = g_task.area.paddingx + g_task.area.pix.border.width; g_task.text_posx = g_task.area.paddingxlr + g_task.area.pix.border.width;
if (g_task.icon) { if (g_task.icon) {
g_task.icon_size1 = g_task.area.height - (2 * g_task.area.paddingy); g_task.icon_size1 = g_task.area.height - (2 * g_task.area.paddingy);
g_task.text_posx += g_task.icon_size1; g_task.text_posx += g_task.icon_size1;

View file

@ -45,7 +45,7 @@ void visual_refresh ()
refresh (l->data); refresh (l->data);
// main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right. // main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right.
XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingx, 0, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, 0); XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingxlr, 0, panel.area.width-(2*panel.area.paddingxlr), panel.area.height, 0, 0);
XFlush (server.dsp); XFlush (server.dsp);
panel.refresh = 0; panel.refresh = 0;
} }
@ -129,7 +129,7 @@ void window_draw_panel ()
// XCreateWindow(display, parent, x, y, w, h, border, depth, class, visual, mask, attrib) // XCreateWindow(display, parent, x, y, w, h, border, depth, class, visual, mask, attrib)
// main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right. // main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right.
if (window.main_win) XDestroyWindow(server.dsp, window.main_win); if (window.main_win) XDestroyWindow(server.dsp, window.main_win);
win = XCreateWindow (server.dsp, server.root_win, server.posx+panel.area.paddingx, server.posy, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att); win = XCreateWindow (server.dsp, server.root_win, server.posx+panel.area.paddingxlr, server.posy, panel.area.width-(2*panel.area.paddingxlr), panel.area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att);
set_panel_properties (win); set_panel_properties (win);
window.main_win = win; window.main_win = win;

View file

@ -1,8 +1,10 @@
/************************************************************************** /**************************************************************************
* panel : * Copyright (C) 2008 Pål Staurland (staura@gmail.com)
* Modified (C) 2008/2009 thierry lorthiois (lorthiois@bbsoft.fr)
*
* panel :
* - draw panel and all objects according to panel_layout * - draw panel and all objects according to panel_layout
* *
* Check COPYING file for Copyright
* *
**************************************************************************/ **************************************************************************/
@ -16,6 +18,7 @@
#include "clock.h" #include "clock.h"
#include "task.h" #include "task.h"
#include "taskbar.h" #include "taskbar.h"
#include "systraybar.h"
//panel mode //panel mode
@ -54,13 +57,14 @@ typedef struct {
int nb_monitor; int nb_monitor;
Task *task_active; Task *task_active;
Task *task_drag; Task *task_drag;
// -------------------------------------------------- // --------------------------------------------------
// clock // clock
Clock clock; Clock clock;
// -------------------------------------------------- // --------------------------------------------------
// systray // systray
Systraybar systraybar;
// -------------------------------------------------- // --------------------------------------------------
// mouse events // mouse events

80
src/systray/systraybar.c Normal file
View file

@ -0,0 +1,80 @@
/**************************************************************************
* Tint2 : systraybar
*
* Copyright (C) 2009 thierry lorthiois (lorthiois@bbsoft.fr)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**************************************************************************/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <Imlib2.h>
#include "systraybar.h"
#include "server.h"
#include "window.h"
#include "panel.h"
int resize_systray (Systraybar *sysbar)
{
return 0;
}
/*
// initialise taskbar posx and width
void resize_taskbar()
{
int taskbar_width, modulo_width, taskbar_on_screen;
if (panel.mode == MULTI_DESKTOP) taskbar_on_screen = panel.nb_desktop;
else taskbar_on_screen = panel.nb_monitor;
taskbar_width = panel.area.width - (2 * panel.area.paddingx) - (2 * panel.area.pix.border.width);
if (panel.clock.time1_format)
taskbar_width -= (panel.clock.area.width + panel.area.paddingx);
taskbar_width = (taskbar_width - ((taskbar_on_screen-1) * panel.area.paddingx)) / taskbar_on_screen;
if (taskbar_on_screen > 1)
modulo_width = (taskbar_width - ((taskbar_on_screen-1) * panel.area.paddingx)) % taskbar_on_screen;
else
modulo_width = 0;
int i, nb, modulo=0, posx=0;
nb = panel.nb_desktop * panel.nb_monitor;
for (i=0 ; i < nb ; i++) {
if ((i % taskbar_on_screen) == 0) {
posx = panel.area.pix.border.width + panel.area.paddingx;
modulo = modulo_width;
}
else posx += taskbar_width + panel.area.paddingx;
panel.taskbar[i].area.posx = posx;
panel.taskbar[i].area.width = taskbar_width;
if (modulo) {
panel.taskbar[i].area.width++;
modulo--;
}
resize_tasks(&panel.taskbar[i]);
}
}
*/

32
src/systray/systraybar.h Normal file
View file

@ -0,0 +1,32 @@
/**************************************************************************
* Copyright (C) 2009 thierry lorthiois (lorthiois@bbsoft.fr)
*
* systraybar
*
**************************************************************************/
#ifndef SYSTRAYBAR_H
#define SYSTRAYBAR_H
#include "area.h"
typedef struct {
// always start with area
Area area;
} Systraybar;
// --------------------------------------------------
// global taskbar parameter
Area g_systraybar;
// return 1 if task_width changed
int resize_systray (Systraybar *sysbar);
#endif

View file

@ -63,7 +63,7 @@ deb:
get_icon(new_tsk); get_icon(new_tsk);
get_title(new_tsk); get_title(new_tsk);
memcpy(&new_tsk->area, &g_task.area, sizeof(Area)); memcpy(&new_tsk->area, &g_task.area, sizeof(Area));
//printf("task %s : desktop %d, monitor %d\n", new_tsk->title, desktop, monitor); //printf("task %s : desktop %d, monitor %d\n", new_tsk->title, desktop, monitor);
XSelectInput (server.dsp, new_tsk->win, PropertyChangeMask|StructureNotifyMask); XSelectInput (server.dsp, new_tsk->win, PropertyChangeMask|StructureNotifyMask);
@ -85,14 +85,14 @@ deb:
void remove_task (Task *tsk) void remove_task (Task *tsk)
{ {
if (!tsk) return; if (!tsk) return;
Task *tsk2 = tsk; Task *tsk2 = tsk;
Taskbar *tskbar; Taskbar *tskbar;
Window win = tsk->win; Window win = tsk->win;
int desktop = 0, all_desktop = tsk->all_desktop; int desktop = 0, all_desktop = tsk->all_desktop;
int monitor = ((Taskbar*)tsk->area.parent)->monitor; int monitor = ((Taskbar*)tsk->area.parent)->monitor;
deb: deb:
if (all_desktop) { if (all_desktop) {
tskbar = &panel.taskbar[index(desktop, monitor)]; tskbar = &panel.taskbar[index(desktop, monitor)];
GSList *l0; GSList *l0;
@ -103,28 +103,28 @@ deb:
break; break;
} }
} }
else else
tskbar = (Taskbar*)tsk->area.parent; tskbar = (Taskbar*)tsk->area.parent;
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2); tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2);
resize_tasks (tskbar); resize_tasks (tskbar);
set_redraw (&tskbar->area); set_redraw (&tskbar->area);
//printf("remove_task %d %s\n", index(tskbar->desktop, tskbar->monitor), tsk->title); //printf("remove_task %d %s\n", index(tskbar->desktop, tskbar->monitor), tsk->title);
if (tsk2 == panel.task_active) if (tsk2 == panel.task_active)
panel.task_active = 0; panel.task_active = 0;
if (tsk2 == panel.task_drag) if (tsk2 == panel.task_drag)
panel.task_drag = 0; panel.task_drag = 0;
if (tsk2->title) if (tsk2->title)
free (tsk2->title); free (tsk2->title);
if (tsk2->icon_data) if (tsk2->icon_data)
free (tsk2->icon_data); free (tsk2->icon_data);
XFreePixmap (server.dsp, tsk2->area.pix.pmap); XFreePixmap (server.dsp, tsk2->area.pix.pmap);
XFreePixmap (server.dsp, tsk2->area.pix_active.pmap); XFreePixmap (server.dsp, tsk2->area.pix_active.pmap);
free(tsk2); free(tsk2);
if (all_desktop) { if (all_desktop) {
desktop++; desktop++;
if (desktop < server.nb_desktop) if (desktop < server.nb_desktop)
@ -214,7 +214,7 @@ void draw_task_icon (Task *tsk, int text_width, int active)
else else
pos_x = (tsk->area.width - g_task.icon_size1) / 2; pos_x = (tsk->area.width - g_task.icon_size1) / 2;
} }
else pos_x = g_task.area.paddingx + g_task.area.pix.border.width; else pos_x = g_task.area.paddingxlr + g_task.area.pix.border.width;
/* Render */ /* Render */
Imlib_Image icon; Imlib_Image icon;

View file

@ -34,8 +34,6 @@ typedef struct {
// --------------------------------------------------
// task parameter
typedef struct { typedef struct {
// always start with area // always start with area
Area area; Area area;

View file

@ -43,7 +43,7 @@ Task *task_get_task (Window win)
for (i=0 ; i < nb ; i++) { for (i=0 ; i < nb ; i++) {
for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) { for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) {
tsk = l0->data; tsk = l0->data;
if (win == tsk->win) if (win == tsk->win)
return tsk; return tsk;
} }
} }
@ -109,7 +109,8 @@ int resize_tasks (Taskbar *taskbar)
task_count = g_slist_length(taskbar->area.list); task_count = g_slist_length(taskbar->area.list);
if (!task_count) pixel_width = g_task.maximum_width; if (!task_count) pixel_width = g_task.maximum_width;
else { else {
taskbar_width = taskbar->area.width - (2 * g_taskbar.pix.border.width) - ((task_count+1) * g_taskbar.paddingx); taskbar_width = taskbar->area.width - (2 * g_taskbar.pix.border.width) - (2 * g_taskbar.paddingxlr);
if (task_count>1) taskbar_width -= ((task_count-1) * g_taskbar.paddingx);
pixel_width = taskbar_width / task_count; pixel_width = taskbar_width / task_count;
if (pixel_width > g_task.maximum_width) pixel_width = g_task.maximum_width; if (pixel_width > g_task.maximum_width) pixel_width = g_task.maximum_width;
@ -127,7 +128,7 @@ int resize_tasks (Taskbar *taskbar)
} }
// change pos_x and width for all tasks // change pos_x and width for all tasks
x = taskbar->area.posx + taskbar->area.pix.border.width + taskbar->area.paddingx; x = taskbar->area.posx + taskbar->area.pix.border.width + taskbar->area.paddingxlr;
for (l = taskbar->area.list; l ; l = l->next) { for (l = taskbar->area.list; l ; l = l->next) {
tsk = l->data; tsk = l->data;
tsk->area.posx = x; tsk->area.posx = x;
@ -151,7 +152,7 @@ void resize_taskbar()
if (panel.mode == MULTI_DESKTOP) taskbar_on_screen = panel.nb_desktop; if (panel.mode == MULTI_DESKTOP) taskbar_on_screen = panel.nb_desktop;
else taskbar_on_screen = panel.nb_monitor; else taskbar_on_screen = panel.nb_monitor;
taskbar_width = panel.area.width - (2 * panel.area.paddingx) - (2 * panel.area.pix.border.width); taskbar_width = panel.area.width - (2 * panel.area.paddingxlr) - (2 * panel.area.pix.border.width);
if (panel.clock.time1_format) if (panel.clock.time1_format)
taskbar_width -= (panel.clock.area.width + panel.area.paddingx); taskbar_width -= (panel.clock.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;
@ -165,7 +166,7 @@ void resize_taskbar()
nb = panel.nb_desktop * panel.nb_monitor; nb = panel.nb_desktop * panel.nb_monitor;
for (i=0 ; i < nb ; i++) { for (i=0 ; i < nb ; i++) {
if ((i % taskbar_on_screen) == 0) { if ((i % taskbar_on_screen) == 0) {
posx = panel.area.pix.border.width + panel.area.paddingx; posx = panel.area.pix.border.width + panel.area.paddingxlr;
modulo = modulo_width; modulo = modulo_width;
} }
else posx += taskbar_width + panel.area.paddingx; else posx += taskbar_width + panel.area.paddingx;

View file

@ -1,3 +1,9 @@
/**************************************************************************
* Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr)
*
* taskbar
*
**************************************************************************/
#ifndef TASKBAR_H #ifndef TASKBAR_H
#define TASKBAR_H #define TASKBAR_H
@ -5,15 +11,13 @@
#include "task.h" #include "task.h"
// --------------------------------------------------
// taskbar parameter
typedef struct { typedef struct {
// always start with area // always start with area
Area area; Area area;
int desktop; int desktop;
int monitor; int monitor;
// task parameters // task parameters
int task_width; int task_width;
int task_modulo; int task_modulo;

View file

@ -471,7 +471,7 @@ load_config:
case Expose: case Expose:
XCopyArea (server.dsp, panel.area.pix.pmap, server.root_win, server.gc_root, 0, 0, panel.area.width, panel.area.height, server.posx, server.posy); XCopyArea (server.dsp, panel.area.pix.pmap, server.root_win, server.gc_root, 0, 0, panel.area.width, panel.area.height, server.posx, server.posy);
XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingx, 0, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, 0); XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingxlr, 0, panel.area.width-(2*panel.area.paddingxlr), panel.area.height, 0, 0);
break; break;
case PropertyNotify: case PropertyNotify:

BIN
src/tint2

Binary file not shown.

View file

@ -75,7 +75,9 @@ typedef struct {
// need redraw Pixmap // need redraw Pixmap
int redraw; int redraw;
int use_active, is_active; int use_active, is_active;
int paddingx, paddingy; // paddingxlr = horizontal padding left/right
// paddingx = horizontal padding between childs
int paddingxlr, paddingx, paddingy;
// parent Area // parent Area
void *parent; void *parent;

View file

@ -46,7 +46,7 @@ task_text = 1
task_width = 130 task_width = 130
task_centered = 1 task_centered = 1
task_padding = 4 2 task_padding = 4 2
task_font = sans 7 task_font = sans 8
task_font_color = #ffffff 65 task_font_color = #ffffff 65
task_active_font_color = #ffffff 85 task_active_font_color = #ffffff 85
task_background_id = 2 task_background_id = 2

View file

@ -8,44 +8,49 @@
rounded = 1 rounded = 1
border_width = 0 border_width = 0
background_color = #282828 40 background_color = #282828 40
border_color = #000000 40 border_color = #000000 0
rounded = 1 rounded = 1
border_width = 1 border_width = 1
background_color = #282828 0 background_color = #cccccc 0
border_color = #cccccc 30
rounded = 1
border_width = 0
background_color = #cccccc 20
border_color = #cccccc 40 border_color = #cccccc 40
#--------------------------------------------- #---------------------------------------------
# PANEL # PANEL
#--------------------------------------------- #---------------------------------------------
panel_monitor = 1 panel_monitor = 1
panel_position = bottom left panel_position = top left
panel_size = 0 27 panel_size = 0 27
panel_margin = 0 0 panel_margin = 0 0
panel_padding = 4 0 panel_padding = 7 3 7
font_shadow = 0 font_shadow = 0
panel_background_id = 1 panel_background_id = 1
#--------------------------------------------- #---------------------------------------------
# TASKBAR # TASKBAR
#--------------------------------------------- #---------------------------------------------
taskbar_mode = multi_monitor taskbar_mode = multi_desktop
taskbar_padding = 4 0 taskbar_padding = 0 0 0
taskbar_background_id = 0 taskbar_background_id = 2
#--------------------------------------------- #---------------------------------------------
# TASKS # TASKS
#--------------------------------------------- #---------------------------------------------
task_icon = 1 task_icon = 1
task_text = 0 task_text = 0
task_width = 30 task_width = 35
task_centered = 1 task_centered = 1
task_padding = 2 5 task_padding = 2 1
task_font = sans 8 task_font = sans 8
task_font_color = #ffffff 60 task_font_color = #ffffff 60
task_active_font_color = #ffffff 100 task_active_font_color = #ffffff 100
task_background_id = 0 task_background_id = 0
task_active_background_id = 2 task_active_background_id = 3
#--------------------------------------------- #---------------------------------------------
# SYSTRAY # SYSTRAY

View file

@ -24,18 +24,18 @@ border_color = #d1d1d1 14
# PANEL # PANEL
#--------------------------------------------- #---------------------------------------------
panel_monitor = 1 panel_monitor = 1
panel_position = bottom center panel_position = top center
panel_size = 1000 25 panel_size = 1000 25
panel_margin = 0 7 panel_margin = 0 7
panel_padding = 6 0 panel_padding = 7 3 0
font_shadow = 0 font_shadow = 0
panel_background_id = 1 panel_background_id = 1
#--------------------------------------------- #---------------------------------------------
# TASKBAR # TASKBAR
#--------------------------------------------- #---------------------------------------------
taskbar_mode = multi_desktop taskbar_mode = single_desktop
taskbar_padding = 2 3 taskbar_padding = 0 0 0
taskbar_background_id = 0 taskbar_background_id = 0
#--------------------------------------------- #---------------------------------------------
@ -45,7 +45,7 @@ task_icon = 1
task_text = 1 task_text = 1
task_width = 150 task_width = 150
task_centered = 1 task_centered = 1
task_padding = 3 2 task_padding = 2 1
task_font = myriad pro 8 task_font = myriad pro 8
task_font_color = #000000 70 task_font_color = #000000 70
task_active_font_color = #000000 100 task_active_font_color = #000000 100
@ -66,7 +66,7 @@ time1_font = sans bold 12
#time2_format = %A %d %B #time2_format = %A %d %B
#time2_font = sans bold 10 #time2_font = sans bold 10
clock_font_color = #000000 70 clock_font_color = #000000 70
clock_padding = 6 0 clock_padding = 4 0
clock_background_id = 0 clock_background_id = 0
#--------------------------------------------- #---------------------------------------------

View file

@ -1,74 +0,0 @@
#---------------------------------------------
# TINT CONFIG FILE
#---------------------------------------------
#---------------------------------------------
# BACKGROUND AND BORDER
#---------------------------------------------
rounded = 3
border_width = 1
background_color = #3c3020 90
border_color = #3c3020 90
rounded = 3
border_width = 1
background_color = #3c3020 90
border_color = #ffffff 30
#---------------------------------------------
# PANEL
#---------------------------------------------
panel_monitor = 1
panel_position = bottom center
panel_size = 900 30
panel_margin = 0 0
panel_padding = 10 2
font_shadow = 0
panel_background_id = 0
#---------------------------------------------
# TASKBAR
#---------------------------------------------
taskbar_mode = single_desktop
taskbar_padding = 9 0
taskbar_background_id = 0
#---------------------------------------------
# TASKS
#---------------------------------------------
task_icon = 0
task_text = 1
task_width = 190
task_centered = 1
task_padding = 2 0
task_font = sans 8.4
task_font_color = #ececec 50
task_active_font_color = #ffffff 90
task_background_id = 1
task_active_background_id = 2
#---------------------------------------------
# SYSTRAY
#---------------------------------------------
#systray_padding = 9 3
#systray_background_id = 0
#---------------------------------------------
# CLOCK
#---------------------------------------------
time1_format = %H:%M
time1_font = sans bold 8
time2_format = %A %d %B
time2_font = sans 7
clock_font_color = #ececec 50
clock_padding = 4 0
clock_background_id = 1
#---------------------------------------------
# MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
mouse_scroll_down = iconify

View file

@ -1,74 +0,0 @@
#---------------------------------------------
# TINT CONFIG FILE
#---------------------------------------------
#---------------------------------------------
# BACKGROUND AND BORDER
#---------------------------------------------
rounded = 3
border_width = 1
background_color = #3c3020 90
border_color = #3c3020 90
rounded = 3
border_width = 1
background_color = #3c3020 90
border_color = #ffffff 30
#---------------------------------------------
# PANEL
#---------------------------------------------
panel_monitor = 1
panel_position = bottom center
panel_size = 900 30
panel_margin = 0 0
panel_padding = 10 2
font_shadow = 0
panel_background_id = 0
#---------------------------------------------
# TASKBAR
#---------------------------------------------
taskbar_mode = single_desktop
taskbar_padding = 9 0
taskbar_background_id = 0
#---------------------------------------------
# TASKS
#---------------------------------------------
task_icon = 0
task_text = 1
task_width = 190
task_centered = 1
task_padding = 2 0
task_font = sans 8.4
task_font_color = #ececec 50
task_active_font_color = #ffffff 90
task_background_id = 1
task_active_background_id = 2
#---------------------------------------------
# SYSTRAY
#---------------------------------------------
#systray_padding = 9 3
#systray_background_id = 0
#---------------------------------------------
# CLOCK
#---------------------------------------------
time1_format = %H:%M
time1_font = sans bold 8
time2_format = %A %d %B
time2_font = sans 7
clock_font_color = #ececec 50
clock_padding = 4 0
clock_background_id = 1
#---------------------------------------------
# MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
mouse_scroll_down = iconify

View file

@ -25,10 +25,10 @@ border_color = #ffffff 0
# PANEL # PANEL
#--------------------------------------------- #---------------------------------------------
panel_monitor = 1 panel_monitor = 1
panel_position = bottom left panel_position = top left
panel_size = 0 30 panel_size = 0 30
panel_margin = 0 0 panel_margin = 0 0
panel_padding = 11 2 panel_padding = 9 2 7
font_shadow = 0 font_shadow = 0
panel_background_id = 0 panel_background_id = 0
@ -36,7 +36,7 @@ panel_background_id = 0
# TASKBAR # TASKBAR
#--------------------------------------------- #---------------------------------------------
taskbar_mode = multi_desktop taskbar_mode = multi_desktop
taskbar_padding = 3 3 taskbar_padding = 3 3 0
taskbar_background_id = 1 taskbar_background_id = 1
#--------------------------------------------- #---------------------------------------------
@ -67,7 +67,7 @@ time1_format = %A %d %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 59 clock_font_color = #ffffff 65
clock_padding = 6 0 clock_padding = 6 0
clock_background_id = 1 clock_background_id = 1