+2009-01-29
+- use panel_margin parameter even with full_width
+- multi_monitor mode : monitor number are ordered according to coordinate
+ so taskbar on the left show task in the left monitor
2009-01-20
- change config file format : add another padding parameter
clock->area.posy = panel.area.pix.border.width + panel.area.paddingy;
clock->area.height = panel.area.height - (2 * clock->area.posy);
+ clock->area.width = 0; // force posx and width detection
clock->area.redraw = 1;
gettimeofday(&clock->clock, 0);
void extract_values (const char *value, char **value1, char **value2, char **value3)
{
- char *b, *c;
+ char *b=0, *c=0;
if (*value1) free (*value1);
if (*value2) free (*value2);
if (*value3) free (*value3);
- if (b = strchr (value, ' ')) {
+ if ((b = strchr (value, ' '))) {
b[0] = '\0';
b++;
}
else {
- b = 0;
*value2 = 0;
*value3 = 0;
}
g_strstrip(*value1);
if (b) {
- if (c = strchr (b, ' ')) {
+ if ((c = strchr (b, ' '))) {
c[0] = '\0';
c++;
}
}
else if (strcmp (key, "panel_margin") == 0) {
extract_values(value, &value1, &value2, &value3);
- panel.marginx = atoi (value1);
+ panel.marginleft = panel.marginright = atoi (value1);
if (value2) panel.marginy = atoi (value2);
+ if (value3) panel.marginright = atoi (value3);
}
else if (strcmp (key, "panel_padding") == 0) {
extract_values(value, &value1, &value2, &value3);
if (panel.monitor > (server.nb_monitor-1)) {
panel.sleep_mode = 1;
- printf("tint2 sleep and wait monitor %d.\n", panel.monitor+1);
+ fprintf(stderr, "tint2 sleep and wait monitor %d.\n", panel.monitor+1);
}
else {
panel.sleep_mode = 0;
fprintf(stderr, "tint2 error : invalid monitor size.\n");
}
- if (!panel.area.width) panel.area.width = server.monitor[panel.monitor].width - 1;
+ if (!panel.area.width) panel.area.width = server.monitor[panel.monitor].width - 1 - panel.marginleft - panel.marginright;
// taskbar
g_taskbar.posy = panel.area.pix.border.width + panel.area.paddingy;
void save_config ()
{
fprintf(stderr, "tint2 warning : convert user's config file\n");
- panel.area.paddingx = panel.area.paddingy = panel.marginx;
- panel.marginx = panel.marginy = 0;
+ panel.area.paddingx = panel.area.paddingy = panel.marginleft;
+ panel.marginleft = panel.marginright = panel.marginy = 0;
if (panel.old_task_icon == 0) g_task.icon_size1 = 0;
if (panel.old_panel_background == 0) panel.area.pix.back.alpha = 0;
else if (panel.position & RIGHT) fputs(" right\n", fp);
else fputs(" center\n", fp);
fprintf(fp, "panel_size = %d %d\n", panel.area.width, panel.area.height);
- fprintf(fp, "panel_margin = %d %d\n", panel.marginx, panel.marginy);
+ fprintf(fp, "panel_margin = %d %d\n", panel.marginleft, panel.marginy);
fprintf(fp, "panel_padding = %d %d\n", panel.area.paddingx, panel.area.paddingy);
fprintf(fp, "font_shadow = %d\n", g_task.font_shadow);
Window win;
/* panel position determined here */
- if (panel.position & LEFT) server.posx = server.monitor[panel.monitor].x + panel.marginx;
+ if (panel.position & LEFT) server.posx = server.monitor[panel.monitor].x + panel.marginleft;
else {
- if (panel.position & RIGHT) server.posx = server.monitor[panel.monitor].x + server.monitor[panel.monitor].width - panel.area.width - panel.marginx;
+ if (panel.position & RIGHT) server.posx = server.monitor[panel.monitor].x + server.monitor[panel.monitor].width - panel.area.width - panel.marginright;
else server.posx = server.monitor[panel.monitor].x + ((server.monitor[panel.monitor].width - panel.area.width) / 2);
}
if (panel.position & TOP) server.posy = server.monitor[panel.monitor].y + panel.marginy;
}
+Pixmap get_root_pixmap ()
+{
+ Pixmap ret;
+ Window root = RootWindow(server.dsp, server.screen);
+
+ ret = None;
+ int act_format, c = 2 ;
+ u_long nitems ;
+ u_long bytes_after ;
+ u_char *prop ;
+ Atom dummy_id;
+
+ do {
+ if (XGetWindowProperty(server.dsp, root, server.atom._XROOTPMAP_ID, 0, 1,
+ False, XA_PIXMAP, &dummy_id, &act_format,
+ &nitems, &bytes_after, &prop) == Success) {
+ if (prop) {
+ ret = *((Pixmap *)prop);
+ XFree(prop);
+ break;
+ }
+ }
+ } while (--c > 0);
+
+ //if (ret == None) printf("pas de background\n");
+ return ret;
+}
+
+
void set_panel_background()
{
Pixmap wall = get_root_pixmap();
}
+
int refresh;
int monitor;
int position;
- int marginx, marginy;
+ int marginleft, marginright, marginy;
// --------------------------------------------------
// taskbar point to the first taskbar in panel.area.list. number of tasbar == nb_desktop x nb_monitor.
}
-Pixmap get_root_pixmap ()
+int compareMonitor(const void *monitor1, const void *monitor2)
{
- Pixmap ret;
- Window root = RootWindow(server.dsp, server.screen);
-
- ret = None;
- int act_format, c = 2 ;
- u_long nitems ;
- u_long bytes_after ;
- u_char *prop ;
- Atom dummy_id;
-
- do {
- if (XGetWindowProperty(server.dsp, root, server.atom._XROOTPMAP_ID, 0, 1,
- False, XA_PIXMAP, &dummy_id, &act_format,
- &nitems, &bytes_after, &prop) == Success) {
- if (prop) {
- ret = *((Pixmap *)prop);
- XFree(prop);
- break;
- }
- }
- } while (--c > 0);
-
- return ret;
-}
-
-
-/*
-Pixmap get_root_pixmap ()
-{
- // conky capture correctement le fond d'écran en xlib !!
- Pixmap root_pixmap;
- unsigned long *res;
-
- server.root_win = window_get_root();
+ Monitor *m1 = (Monitor*)monitor1;
+ Monitor *m2 = (Monitor*)monitor2;
- res = server_get_property (server.root_win, server.atom._XROOTPMAP_ID, XA_PIXMAP, 0);
- if (res) {
- root_pixmap = *((Drawable*) res);
- XFree(res);
- return root_pixmap;
- }
- else {
- printf("get_root_pixmap incorrect\n");
- // try _XSETROOT_ID
+ if (m1->x < m2->x) {
+ return -1;
}
- return 0;
+ else
+ if (m1->x > m2->x) {
+ return 1;
+ }
+ else
+ if (m1->width < m2->width) {
+ return 1;
+ }
+ else
+ if (m1->width > m2->width) {
+ return -1;
+ }
+ else {
+ return 0;
+ }
}
-*/
void get_monitors()
server.nb_monitor = 0;
server.monitor = 0;
+ int nb_monitor;
if (XineramaIsActive(server.dsp)) {
- XineramaScreenInfo *info = XineramaQueryScreens(server.dsp, &server.nb_monitor);
+ XineramaScreenInfo *info = XineramaQueryScreens(server.dsp, &nb_monitor);
if (info) {
int i;
- server.monitor = calloc(server.nb_monitor, sizeof(Monitor));
+ //printf("nb_monitors %d\n", nb_monitor);
+ server.nb_monitor = nb_monitor;
+ server.monitor = calloc(nb_monitor, sizeof(Monitor));
for (i = 0; i < server.nb_monitor; i++) {
server.monitor[i].x = info[i].x_org;
server.monitor[i].y = info[i].y_org;
server.monitor[i].height = info[i].height;
}
XFree(info);
+
+ // ordered monitor according to coordinate
+ qsort(server.monitor, server.nb_monitor, sizeof(Monitor), compareMonitor);
}
}
/**************************************************************************
-* server :
-* -
+* server :
+* -
*
* Check COPYING file for Copyright
*
void server_catch_error (Display *d, XErrorEvent *ev);
void server_init_atoms ();
void get_monitors();
-Pixmap get_root_pixmap();
#endif
data = server_get_property (tsk->win, server.atom._NET_WM_ICON, XA_CARDINAL, &num);
if (data) {
- printf("get_icon plein\n");
+ //printf("get_icon plein\n");
// ARGB
int w, h;
long *tmp_data;
XFree (data);
}
else {
- printf("get_icon vide\n");
- //XWMHints *hints;
- //hints = XGetWMHints(server.dsp, tkwin);
- //if (hints != NULL) {
- // XFree(hints);
- //}
- // XChangeProperty (display, windowH, XInternAtom (display, "_NET_WM_ICON", False), XA_CARDINAL, 32, PropModeReplace, (unsigned char*) data, dataSize);
- return;
+ //printf("get_icon vide\n");
+ XWMHints *hints = XGetWMHints(server.dsp, tsk->win);
+ if (hints) {
+ if (hints->flags & IconPixmapHint) {
+ }
+ XFree(hints);
+ }
}
}
# PANEL
#---------------------------------------------
panel_monitor = 1
-panel_position = top center
-panel_size = 900 30
-panel_margin = 15 2
+panel_position = bottom center
+panel_size = 0 30
+panel_margin = 15 2 15
panel_padding = 9 0
font_shadow = 0
panel_background_id = 1
#---------------------------------------------
rounded = 1
border_width = 0
-background_color = #282828 40
+background_color = #282828 60
border_color = #000000 0
rounded = 1
#---------------------------------------------
# TASKBAR
#---------------------------------------------
-taskbar_mode = multi_desktop
+taskbar_mode = multi_monitor
taskbar_padding = 0 0 0
taskbar_background_id = 2
time2_format = %A %d %B
time2_font = sans 7
clock_font_color = #ffffff 100
-clock_padding = 4 0
+clock_padding = 2 0
clock_background_id = 0
#---------------------------------------------
#---------------------------------------------
# BACKGROUND AND BORDER
#---------------------------------------------
-rounded = 5
+rounded = 10
border_width = 1
background_color = #ffffff 40
-border_color = #ffffff 70
+border_color = #ffffff 60
-rounded = 4
-border_width = 0
-background_color = #ffffff 0
-border_color = #d1d1d1 0
-
-rounded = 4
+rounded = 1
border_width = 0
background_color = #ffffff 30
-border_color = #d1d1d1 14
+border_color = #ffffff 15
+
+
#---------------------------------------------
# PANEL
#---------------------------------------------
panel_monitor = 1
-panel_position = top center
-panel_size = 1000 25
-panel_margin = 0 7
-panel_padding = 7 3 0
+panel_position = bottom center
+panel_size = 0 30
+panel_margin = 0 0
+panel_padding = 5 4
font_shadow = 0
-panel_background_id = 1
+panel_background_id = 0
#---------------------------------------------
# TASKBAR
#---------------------------------------------
-taskbar_mode = single_desktop
-taskbar_padding = 0 0 0
-taskbar_background_id = 0
+taskbar_mode = multi_desktop
+taskbar_padding = 8 0 0
+taskbar_background_id = 1
#---------------------------------------------
# TASKS
#---------------------------------------------
task_icon = 1
task_text = 1
-task_width = 150
+task_width = 160
task_centered = 1
task_padding = 2 1
-task_font = myriad pro 8
-task_font_color = #000000 70
+task_font = Dejavu sans 8
+task_font_color = #000000 60
task_active_font_color = #000000 100
-task_background_id = 2
-task_active_background_id = 3
+task_background_id = 0
+task_active_background_id = 2
#---------------------------------------------
# SYSTRAY
#---------------------------------------------
#systray_padding = 9 3
-#systray_background_id = 0
+#systray_icon_opacity = 50
+#systray_background_id = 1
#---------------------------------------------
# CLOCK
#---------------------------------------------
-time1_format = %H:%M
-time1_font = sans bold 12
+time1_format = %A %d %H:%M
+time1_font = Dejavu sans 10
#time2_format = %A %d %B
-#time2_font = sans bold 10
-clock_font_color = #000000 70
-clock_padding = 4 0
-clock_background_id = 0
+time2_font = sans 7
+clock_font_color = #000000 80
+clock_padding = 8 0
+clock_background_id = 1
#---------------------------------------------
# MOUSE ACTION ON TASK
# PANEL
#---------------------------------------------
panel_monitor = 1
-panel_position = top left
+panel_position = bottom left
panel_size = 0 30
panel_margin = 0 0
panel_padding = 9 2 7