big change : panel_monitor = all will draw one panel per monitor, panel_size accept percentage or pixel, update documentation, taskbar_mode = single_monitor show tasks of current monitor
git-svn-id: http://tint2.googlecode.com/svn/trunk@32 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
5b4d782ca2
commit
7393ceaf20
27 changed files with 1011 additions and 882 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,4 +1,13 @@
|
|||
2009-02-05
|
||||
2009-02-07
|
||||
- better multi-monitor capability :
|
||||
-> panel_monitor = all : tint2 draw one panel per monitor
|
||||
-> panel_size = 90% 30 : panel_size accept percentage or pixel
|
||||
- change notation : MULTI_MONITOR changed to SINGLE_MONITOR
|
||||
in SINGLE_MONITOR mode, tint2 draw one taskbar with tasks from current monitor
|
||||
- removed sleep mode (replaced by panel_monitor = all)
|
||||
- update documentation and sample config file
|
||||
|
||||
2009-02-03
|
||||
- better fixed for Robert Escriva problem : set_panel_properties -> Reserved space
|
||||
- fixed issue 13 with background detection
|
||||
- fixed bug with disconnected monitor (in multi monitor mode)
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -25,45 +25,55 @@
|
|||
|
||||
#include "window.h"
|
||||
#include "server.h"
|
||||
#include "taskbar.h"
|
||||
#include "panel.h"
|
||||
#include "area.h"
|
||||
#include "clock.h"
|
||||
#include "panel.h"
|
||||
|
||||
|
||||
char *time1_format = 0;
|
||||
char *time2_format = 0;
|
||||
struct timeval time_clock;
|
||||
int time_precision;
|
||||
PangoFontDescription *time1_font_desc;
|
||||
PangoFontDescription *time2_font_desc;
|
||||
|
||||
|
||||
void init_clock(Clock *clock, int panel_height)
|
||||
void init_clock(Clock *clock, Area *parent)
|
||||
{
|
||||
Panel *panel = (Panel *)parent;
|
||||
char buf_time[40];
|
||||
char buf_date[40];
|
||||
int time_height, time_height_ink, date_height, date_height_ink;
|
||||
|
||||
clock->area.parent = parent;
|
||||
clock->area.panel = panel;
|
||||
clock->area.draw_foreground = draw_foreground_clock;
|
||||
if (!time1_format) return;
|
||||
|
||||
if (strchr(time1_format, 'S') == NULL) time_precision = 60;
|
||||
else time_precision = 1;
|
||||
|
||||
clock->area.posy = panel.area.pix.border.width + panel.area.paddingy;
|
||||
clock->area.height = panel.area.height - (2 * clock->area.posy);
|
||||
// update clock to force update (-time_precision)
|
||||
struct timeval stv;
|
||||
gettimeofday(&stv, 0);
|
||||
time_clock.tv_sec = stv.tv_sec - time_precision;
|
||||
time_clock.tv_sec -= time_clock.tv_sec % time_precision;
|
||||
|
||||
clock->area.posy = parent->pix.border.width + parent->paddingy;
|
||||
clock->area.height = parent->height - (2 * clock->area.posy);
|
||||
clock->area.width = 0; // force posx and width detection
|
||||
clock->area.redraw = 1;
|
||||
|
||||
gettimeofday(&time_clock, 0);
|
||||
time_clock.tv_sec -= time_clock.tv_sec % time_precision;
|
||||
|
||||
strftime(buf_time, sizeof(buf_time), time1_format, localtime(&time_clock.tv_sec));
|
||||
if (time2_format)
|
||||
strftime(buf_date, sizeof(buf_date), time2_format, localtime(&time_clock.tv_sec));
|
||||
|
||||
get_text_size(clock->time1_font_desc, &time_height_ink, &time_height, panel_height, buf_time, strlen(buf_time));
|
||||
get_text_size(time1_font_desc, &time_height_ink, &time_height, parent->height, buf_time, strlen(buf_time));
|
||||
clock->time1_posy = (clock->area.height - time_height) / 2;
|
||||
|
||||
if (time2_format) {
|
||||
get_text_size(clock->time2_font_desc, &date_height_ink, &date_height, panel_height, buf_date, strlen(buf_date));
|
||||
get_text_size(time2_font_desc, &date_height_ink, &date_height, parent->height, buf_date, strlen(buf_date));
|
||||
|
||||
clock->time1_posy -= ((date_height_ink + 2) / 2);
|
||||
clock->time2_posy = clock->time1_posy + time_height + 2 - (time_height - time_height_ink)/2 - (date_height - date_height_ink)/2;
|
||||
|
@ -73,6 +83,7 @@ void init_clock(Clock *clock, int panel_height)
|
|||
|
||||
void draw_foreground_clock (void *obj, cairo_t *c, int active)
|
||||
{
|
||||
Area *parent = ((Area*)obj)->parent;
|
||||
Clock *clock = obj;
|
||||
PangoLayout *layout;
|
||||
char buf_time[40];
|
||||
|
@ -89,12 +100,12 @@ redraw:
|
|||
layout = pango_cairo_create_layout (c);
|
||||
|
||||
// check width
|
||||
pango_layout_set_font_description (layout, clock->time1_font_desc);
|
||||
pango_layout_set_font_description (layout, time1_font_desc);
|
||||
pango_layout_set_indent(layout, 0);
|
||||
pango_layout_set_text (layout, buf_time, strlen(buf_time));
|
||||
pango_layout_get_pixel_size (layout, &time_width, NULL);
|
||||
if (time2_format) {
|
||||
pango_layout_set_font_description (layout, clock->time2_font_desc);
|
||||
pango_layout_set_font_description (layout, time2_font_desc);
|
||||
pango_layout_set_indent(layout, 0);
|
||||
pango_layout_set_text (layout, buf_date, strlen(buf_date));
|
||||
pango_layout_get_pixel_size (layout, &date_width, NULL);
|
||||
|
@ -107,15 +118,15 @@ redraw:
|
|||
//printf("clock_width %d, new_width %d\n", clock->area.width, new_width);
|
||||
// resize clock
|
||||
clock->area.width = new_width;
|
||||
panel.clock.area.posx = panel.area.width - panel.clock.area.width - panel.area.paddingxlr - panel.area.pix.border.width;
|
||||
clock->area.posx = parent->width - clock->area.width - parent->paddingxlr - parent->pix.border.width;
|
||||
|
||||
g_object_unref (layout);
|
||||
resize_taskbar();
|
||||
resize_taskbar(parent);
|
||||
goto redraw;
|
||||
}
|
||||
|
||||
// draw layout
|
||||
pango_layout_set_font_description (layout, clock->time1_font_desc);
|
||||
pango_layout_set_font_description (layout, time1_font_desc);
|
||||
pango_layout_set_width (layout, clock->area.width * PANGO_SCALE);
|
||||
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||
pango_layout_set_text (layout, buf_time, strlen(buf_time));
|
||||
|
@ -127,7 +138,7 @@ redraw:
|
|||
pango_cairo_show_layout (c, layout);
|
||||
|
||||
if (time2_format) {
|
||||
pango_layout_set_font_description (layout, clock->time2_font_desc);
|
||||
pango_layout_set_font_description (layout, time2_font_desc);
|
||||
pango_layout_set_indent(layout, 0);
|
||||
pango_layout_set_text (layout, buf_date, strlen(buf_date));
|
||||
pango_layout_set_width (layout, clock->area.width * PANGO_SCALE);
|
||||
|
|
|
@ -19,20 +19,21 @@ typedef struct Clock {
|
|||
Area area;
|
||||
|
||||
config_color font;
|
||||
PangoFontDescription *time1_font_desc;
|
||||
PangoFontDescription *time2_font_desc;
|
||||
int time1_posy;
|
||||
int time2_posy;
|
||||
} Clock;
|
||||
|
||||
|
||||
extern char *time1_format;
|
||||
extern char *time2_format;
|
||||
extern struct timeval time_clock;
|
||||
extern int time_precision;
|
||||
extern PangoFontDescription *time1_font_desc;
|
||||
extern PangoFontDescription *time2_font_desc;
|
||||
|
||||
|
||||
// initialize clock : y position, precision, ...
|
||||
void init_clock(Clock *clock, int panel_height);
|
||||
void init_clock(Clock *clock, Area *parent);
|
||||
|
||||
void draw_foreground_clock (void *obj, cairo_t *c, int active);
|
||||
|
||||
|
|
442
src/config.c
442
src/config.c
|
@ -43,45 +43,47 @@
|
|||
#include "config.h"
|
||||
#include "window.h"
|
||||
|
||||
// --------------------------------------------------
|
||||
// backward compatibility
|
||||
static int old_config_file = 0;
|
||||
static int old_task_icon;
|
||||
static int old_panel_background;
|
||||
static int old_task_background;
|
||||
static char *old_task_font = 0;
|
||||
|
||||
void cleanup_taskbar()
|
||||
// temporary panel
|
||||
static Panel *panel_config = 0;
|
||||
|
||||
// temporary list of background
|
||||
static GSList *list_back;
|
||||
|
||||
|
||||
void init_config()
|
||||
{
|
||||
GSList *l0;
|
||||
Task *tsk;
|
||||
cleanup_panel();
|
||||
|
||||
int i, nb;
|
||||
nb = panel.nb_desktop * panel.nb_monitor;
|
||||
for (i=0 ; i < nb ; i++) {
|
||||
l0 = panel.taskbar[i].area.list;
|
||||
while (l0) {
|
||||
tsk = l0->data;
|
||||
l0 = l0->next;
|
||||
// careful : remove_task change l0->next
|
||||
remove_task (tsk);
|
||||
}
|
||||
// get monitor and desktop config
|
||||
get_monitors_and_desktops();
|
||||
|
||||
free_area (&panel.taskbar[i].area);
|
||||
}
|
||||
// append full transparency background
|
||||
list_back = g_slist_append(0, calloc(1, sizeof(Area)));
|
||||
|
||||
free(panel.taskbar);
|
||||
panel.taskbar = 0;
|
||||
|
||||
free_area(&panel.area);
|
||||
panel_config = calloc(1, sizeof(Panel));
|
||||
}
|
||||
|
||||
|
||||
void cleanup ()
|
||||
void cleanup_config()
|
||||
{
|
||||
if (panel.old_task_font) free(panel.old_task_font);
|
||||
if (g_task.font_desc) pango_font_description_free(g_task.font_desc);
|
||||
if (panel.clock.time1_font_desc) pango_font_description_free(panel.clock.time1_font_desc);
|
||||
if (panel.clock.time2_font_desc) pango_font_description_free(panel.clock.time2_font_desc);
|
||||
if (panel.taskbar) cleanup_taskbar();
|
||||
if (time1_format) g_free(time1_format);
|
||||
if (time2_format) g_free(time2_format);
|
||||
if (server.monitor) free(server.monitor);
|
||||
XFreeGC(server.dsp, server.gc);
|
||||
XCloseDisplay(server.dsp);
|
||||
if (old_task_font) free(old_task_font);
|
||||
if (panel_config) free(panel_config);
|
||||
|
||||
// cleanup background list
|
||||
GSList *l0;
|
||||
for (l0 = list_back; l0 ; l0 = l0->next) {
|
||||
free(l0->data);
|
||||
}
|
||||
g_slist_free(list_back);
|
||||
list_back = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -244,47 +246,61 @@ void add_entry (char *key, char *value)
|
|||
|
||||
/* Panel */
|
||||
else if (strcmp (key, "panel_monitor") == 0) {
|
||||
panel.monitor = atoi (value);
|
||||
if (panel.monitor > 0) panel.monitor -= 1;
|
||||
if (strcmp (value, "all") == 0) panel_config->monitor = -1;
|
||||
else {
|
||||
panel_config->monitor = atoi (value);
|
||||
if (panel_config->monitor > 0) panel_config->monitor -= 1;
|
||||
}
|
||||
}
|
||||
else if (strcmp (key, "panel_size") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
panel.area.width = atoi (value1);
|
||||
if (value2) panel.area.height = atoi (value2);
|
||||
|
||||
char *b;
|
||||
if ((b = strchr (value1, '%'))) {
|
||||
b[0] = '\0';
|
||||
panel_config->pourcentx = 1;
|
||||
}
|
||||
panel_config->initial_width = atof(value1);
|
||||
if (value2) {
|
||||
if ((b = strchr (value2, '%'))) {
|
||||
b[0] = '\0';
|
||||
panel_config->pourcenty = 1;
|
||||
}
|
||||
panel_config->initial_height = atof(value2);
|
||||
}
|
||||
}
|
||||
else if (strcmp (key, "panel_margin") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
panel.marginleft = panel.marginright = atoi (value1);
|
||||
if (value2) panel.marginy = atoi (value2);
|
||||
if (value3) panel.marginright = atoi (value3);
|
||||
panel_config->marginx = atoi (value1);
|
||||
if (value2) panel_config->marginy = atoi (value2);
|
||||
}
|
||||
else if (strcmp (key, "panel_padding") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
panel.area.paddingxlr = panel.area.paddingx = atoi (value1);
|
||||
if (value2) panel.area.paddingy = atoi (value2);
|
||||
if (value3) panel.area.paddingx = atoi (value3);
|
||||
panel_config->area.paddingxlr = panel_config->area.paddingx = atoi (value1);
|
||||
if (value2) panel_config->area.paddingy = atoi (value2);
|
||||
if (value3) panel_config->area.paddingx = atoi (value3);
|
||||
}
|
||||
else if (strcmp (key, "panel_position") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
if (strcmp (value1, "top") == 0) panel.position = TOP;
|
||||
else panel.position = BOTTOM;
|
||||
if (strcmp (value1, "top") == 0) panel_position = TOP;
|
||||
else panel_position = BOTTOM;
|
||||
|
||||
if (!value2) panel.position = CENTER;
|
||||
if (!value2) panel_position = CENTER;
|
||||
else {
|
||||
if (strcmp (value2, "left") == 0) panel.position |= LEFT;
|
||||
if (strcmp (value2, "left") == 0) panel_position |= LEFT;
|
||||
else {
|
||||
if (strcmp (value2, "right") == 0) panel.position |= RIGHT;
|
||||
else panel.position |= CENTER;
|
||||
if (strcmp (value2, "right") == 0) panel_position |= RIGHT;
|
||||
else panel_position |= CENTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp (key, "font_shadow") == 0)
|
||||
g_task.font_shadow = atoi (value);
|
||||
panel_config->g_task.font_shadow = atoi (value);
|
||||
else if (strcmp (key, "panel_background_id") == 0) {
|
||||
int id = atoi (value);
|
||||
Area *a = g_slist_nth_data(list_back, id);
|
||||
memcpy(&panel.area.pix.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&panel.area.pix.border, &a->pix.border, sizeof(Border));
|
||||
memcpy(&panel_config->area.pix.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&panel_config->area.pix.border, &a->pix.border, sizeof(Border));
|
||||
}
|
||||
|
||||
/* Clock */
|
||||
|
@ -299,148 +315,148 @@ void add_entry (char *key, char *value)
|
|||
else time2_format = 0;
|
||||
}
|
||||
else if (strcmp (key, "time1_font") == 0) {
|
||||
if (panel.clock.time1_font_desc) pango_font_description_free(panel.clock.time1_font_desc);
|
||||
panel.clock.time1_font_desc = pango_font_description_from_string (value);
|
||||
if (time1_font_desc) pango_font_description_free(time1_font_desc);
|
||||
time1_font_desc = pango_font_description_from_string (value);
|
||||
}
|
||||
else if (strcmp (key, "time2_font") == 0) {
|
||||
if (panel.clock.time2_font_desc) pango_font_description_free(panel.clock.time2_font_desc);
|
||||
panel.clock.time2_font_desc = pango_font_description_from_string (value);
|
||||
if (time2_font_desc) pango_font_description_free(time2_font_desc);
|
||||
time2_font_desc = pango_font_description_from_string (value);
|
||||
}
|
||||
else if (strcmp (key, "clock_font_color") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
get_color (value1, panel.clock.font.color);
|
||||
if (value2) panel.clock.font.alpha = (atoi (value2) / 100.0);
|
||||
else panel.clock.font.alpha = 0.1;
|
||||
get_color (value1, panel_config->clock.font.color);
|
||||
if (value2) panel_config->clock.font.alpha = (atoi (value2) / 100.0);
|
||||
else panel_config->clock.font.alpha = 0.5;
|
||||
}
|
||||
else if (strcmp (key, "clock_padding") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
panel.clock.area.paddingxlr = panel.clock.area.paddingx = atoi (value1);
|
||||
if (value2) panel.clock.area.paddingy = atoi (value2);
|
||||
if (value3) panel.clock.area.paddingx = atoi (value3);
|
||||
panel_config->clock.area.paddingxlr = panel_config->clock.area.paddingx = atoi (value1);
|
||||
if (value2) panel_config->clock.area.paddingy = atoi (value2);
|
||||
if (value3) panel_config->clock.area.paddingx = atoi (value3);
|
||||
}
|
||||
else if (strcmp (key, "clock_background_id") == 0) {
|
||||
int id = atoi (value);
|
||||
Area *a = g_slist_nth_data(list_back, id);
|
||||
memcpy(&panel.clock.area.pix.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&panel.clock.area.pix.border, &a->pix.border, sizeof(Border));
|
||||
memcpy(&panel_config->clock.area.pix.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&panel_config->clock.area.pix.border, &a->pix.border, sizeof(Border));
|
||||
}
|
||||
|
||||
/* Taskbar */
|
||||
else if (strcmp (key, "taskbar_mode") == 0) {
|
||||
if (strcmp (value, "multi_desktop") == 0) panel.mode = MULTI_DESKTOP;
|
||||
else if (strcmp (value, "multi_monitor") == 0) panel.mode = MULTI_MONITOR;
|
||||
else panel.mode = SINGLE_DESKTOP;
|
||||
if (strcmp (value, "multi_desktop") == 0) panel_mode = MULTI_DESKTOP;
|
||||
else if (strcmp (value, "single_desktop") == 0) panel_mode = SINGLE_DESKTOP;
|
||||
else panel_mode = SINGLE_MONITOR;
|
||||
}
|
||||
else if (strcmp (key, "taskbar_padding") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
g_taskbar.paddingxlr = g_taskbar.paddingx = atoi (value1);
|
||||
if (value2) g_taskbar.paddingy = atoi (value2);
|
||||
if (value3) g_taskbar.paddingx = atoi (value3);
|
||||
panel_config->g_taskbar.paddingxlr = panel_config->g_taskbar.paddingx = atoi (value1);
|
||||
if (value2) panel_config->g_taskbar.paddingy = atoi (value2);
|
||||
if (value3) panel_config->g_taskbar.paddingx = atoi (value3);
|
||||
}
|
||||
else if (strcmp (key, "taskbar_background_id") == 0) {
|
||||
int id = atoi (value);
|
||||
Area *a = g_slist_nth_data(list_back, id);
|
||||
memcpy(&g_taskbar.pix.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&g_taskbar.pix.border, &a->pix.border, sizeof(Border));
|
||||
memcpy(&panel_config->g_taskbar.pix.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&panel_config->g_taskbar.pix.border, &a->pix.border, sizeof(Border));
|
||||
}
|
||||
|
||||
/* Task */
|
||||
else if (strcmp (key, "task_text") == 0)
|
||||
g_task.text = atoi (value);
|
||||
panel_config->g_task.text = atoi (value);
|
||||
else if (strcmp (key, "task_icon") == 0)
|
||||
g_task.icon = atoi (value);
|
||||
panel_config->g_task.icon = atoi (value);
|
||||
else if (strcmp (key, "task_centered") == 0)
|
||||
g_task.centered = atoi (value);
|
||||
panel_config->g_task.centered = atoi (value);
|
||||
else if (strcmp (key, "task_width") == 0)
|
||||
g_task.maximum_width = atoi (value);
|
||||
panel_config->g_task.maximum_width = atoi (value);
|
||||
else if (strcmp (key, "task_padding") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
g_task.area.paddingxlr = g_task.area.paddingx = atoi (value1);
|
||||
if (value2) g_task.area.paddingy = atoi (value2);
|
||||
if (value3) g_task.area.paddingx = atoi (value3);
|
||||
panel_config->g_task.area.paddingxlr = panel_config->g_task.area.paddingx = atoi (value1);
|
||||
if (value2) panel_config->g_task.area.paddingy = atoi (value2);
|
||||
if (value3) panel_config->g_task.area.paddingx = atoi (value3);
|
||||
}
|
||||
else if (strcmp (key, "task_font") == 0) {
|
||||
if (g_task.font_desc) pango_font_description_free(g_task.font_desc);
|
||||
g_task.font_desc = pango_font_description_from_string (value);
|
||||
if (panel_config->g_task.font_desc) pango_font_description_free(panel_config->g_task.font_desc);
|
||||
panel_config->g_task.font_desc = pango_font_description_from_string (value);
|
||||
}
|
||||
else if (strcmp (key, "task_font_color") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
get_color (value1, g_task.font.color);
|
||||
if (value2) g_task.font.alpha = (atoi (value2) / 100.0);
|
||||
else g_task.font.alpha = 0.1;
|
||||
get_color (value1, panel_config->g_task.font.color);
|
||||
if (value2) panel_config->g_task.font.alpha = (atoi (value2) / 100.0);
|
||||
else panel_config->g_task.font.alpha = 0.1;
|
||||
}
|
||||
else if (strcmp (key, "task_active_font_color") == 0) {
|
||||
extract_values(value, &value1, &value2, &value3);
|
||||
get_color (value1, g_task.font_active.color);
|
||||
if (value2) g_task.font_active.alpha = (atoi (value2) / 100.0);
|
||||
else g_task.font_active.alpha = 0.1;
|
||||
get_color (value1, panel_config->g_task.font_active.color);
|
||||
if (value2) panel_config->g_task.font_active.alpha = (atoi (value2) / 100.0);
|
||||
else panel_config->g_task.font_active.alpha = 0.1;
|
||||
}
|
||||
else if (strcmp (key, "task_background_id") == 0) {
|
||||
int id = atoi (value);
|
||||
Area *a = g_slist_nth_data(list_back, id);
|
||||
memcpy(&g_task.area.pix.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&g_task.area.pix.border, &a->pix.border, sizeof(Border));
|
||||
memcpy(&panel_config->g_task.area.pix.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&panel_config->g_task.area.pix.border, &a->pix.border, sizeof(Border));
|
||||
}
|
||||
else if (strcmp (key, "task_active_background_id") == 0) {
|
||||
int id = atoi (value);
|
||||
Area *a = g_slist_nth_data(list_back, id);
|
||||
memcpy(&g_task.area.pix_active.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&g_task.area.pix_active.border, &a->pix.border, sizeof(Border));
|
||||
memcpy(&panel_config->g_task.area.pix_active.back, &a->pix.back, sizeof(Color));
|
||||
memcpy(&panel_config->g_task.area.pix_active.border, &a->pix.border, sizeof(Border));
|
||||
}
|
||||
|
||||
/* Mouse actions */
|
||||
else if (strcmp (key, "mouse_middle") == 0)
|
||||
get_action (value, &panel.mouse_middle);
|
||||
get_action (value, &mouse_middle);
|
||||
else if (strcmp (key, "mouse_right") == 0)
|
||||
get_action (value, &panel.mouse_right);
|
||||
get_action (value, &mouse_right);
|
||||
else if (strcmp (key, "mouse_scroll_up") == 0)
|
||||
get_action (value, &panel.mouse_scroll_up);
|
||||
get_action (value, &mouse_scroll_up);
|
||||
else if (strcmp (key, "mouse_scroll_down") == 0)
|
||||
get_action (value, &panel.mouse_scroll_down);
|
||||
get_action (value, &mouse_scroll_down);
|
||||
|
||||
|
||||
/* Read old config for backward compatibility */
|
||||
else if (strcmp (key, "font") == 0) {
|
||||
panel.old_config_file = 1;
|
||||
if (g_task.font_desc) pango_font_description_free(g_task.font_desc);
|
||||
g_task.font_desc = pango_font_description_from_string (value);
|
||||
if (panel.old_task_font) free(panel.old_task_font);
|
||||
panel.old_task_font = strdup (value);
|
||||
old_config_file = 1;
|
||||
if (panel_config->g_task.font_desc) pango_font_description_free(panel_config->g_task.font_desc);
|
||||
panel_config->g_task.font_desc = pango_font_description_from_string (value);
|
||||
if (old_task_font) free(old_task_font);
|
||||
old_task_font = strdup (value);
|
||||
}
|
||||
else if (strcmp (key, "font_color") == 0)
|
||||
get_color (value, g_task.font.color);
|
||||
get_color (value, panel_config->g_task.font.color);
|
||||
else if (strcmp (key, "font_alpha") == 0)
|
||||
g_task.font.alpha = (atoi (value) / 100.0);
|
||||
panel_config->g_task.font.alpha = (atoi (value) / 100.0);
|
||||
else if (strcmp (key, "font_active_color") == 0)
|
||||
get_color (value, g_task.font_active.color);
|
||||
get_color (value, panel_config->g_task.font_active.color);
|
||||
else if (strcmp (key, "font_active_alpha") == 0)
|
||||
g_task.font_active.alpha = (atoi (value) / 100.0);
|
||||
panel_config->g_task.font_active.alpha = (atoi (value) / 100.0);
|
||||
else if (strcmp (key, "panel_show_all_desktop") == 0) {
|
||||
if (atoi (value) == 0) panel.mode = SINGLE_DESKTOP;
|
||||
else panel.mode = MULTI_DESKTOP;
|
||||
if (atoi (value) == 0) panel_mode = SINGLE_DESKTOP;
|
||||
else panel_mode = MULTI_DESKTOP;
|
||||
}
|
||||
else if (strcmp (key, "panel_width") == 0)
|
||||
panel.area.width = atoi (value);
|
||||
panel_config->area.width = atoi (value);
|
||||
else if (strcmp (key, "panel_height") == 0)
|
||||
panel.area.height = atoi (value);
|
||||
panel_config->area.height = atoi (value);
|
||||
else if (strcmp (key, "panel_background") == 0)
|
||||
panel.old_panel_background = atoi (value);
|
||||
old_panel_background = atoi (value);
|
||||
else if (strcmp (key, "panel_background_alpha") == 0)
|
||||
panel.area.pix.back.alpha = (atoi (value) / 100.0);
|
||||
panel_config->area.pix.back.alpha = (atoi (value) / 100.0);
|
||||
else if (strcmp (key, "panel_border_alpha") == 0)
|
||||
panel.area.pix.border.alpha = (atoi (value) / 100.0);
|
||||
panel_config->area.pix.border.alpha = (atoi (value) / 100.0);
|
||||
else if (strcmp (key, "task_icon") == 0)
|
||||
panel.old_task_icon = atoi (value);
|
||||
old_task_icon = atoi (value);
|
||||
else if (strcmp (key, "task_background") == 0)
|
||||
panel.old_task_background = atoi (value);
|
||||
old_task_background = atoi (value);
|
||||
else if (strcmp (key, "task_background_alpha") == 0)
|
||||
g_task.area.pix.back.alpha = (atoi (value) / 100.0);
|
||||
panel_config->g_task.area.pix.back.alpha = (atoi (value) / 100.0);
|
||||
else if (strcmp (key, "task_active_background_alpha") == 0)
|
||||
g_task.area.pix_active.back.alpha = (atoi (value) / 100.0);
|
||||
panel_config->g_task.area.pix_active.back.alpha = (atoi (value) / 100.0);
|
||||
else if (strcmp (key, "task_border_alpha") == 0)
|
||||
g_task.area.pix.border.alpha = (atoi (value) / 100.0);
|
||||
panel_config->g_task.area.pix.border.alpha = (atoi (value) / 100.0);
|
||||
else if (strcmp (key, "task_active_border_alpha") == 0)
|
||||
g_task.area.pix_active.border.alpha = (atoi (value) / 100.0);
|
||||
panel_config->g_task.area.pix_active.border.alpha = (atoi (value) / 100.0);
|
||||
// disabled parameters
|
||||
else if (strcmp (key, "task_active_border_width") == 0) ;
|
||||
else if (strcmp (key, "task_active_rounded") == 0) ;
|
||||
|
@ -483,121 +499,46 @@ int parse_line (const char *line)
|
|||
}
|
||||
|
||||
|
||||
void config_taskbar()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (g_task.area.pix.border.rounded > g_task.area.height/2) {
|
||||
g_task.area.pix.border.rounded = g_task.area.height/2;
|
||||
g_task.area.pix_active.border.rounded = g_task.area.pix.border.rounded;
|
||||
}
|
||||
|
||||
for (i=0 ; i < 15 ; i++) {
|
||||
server.nb_desktop = server_get_number_of_desktop ();
|
||||
if (server.nb_desktop > 0) break;
|
||||
sleep(1);
|
||||
}
|
||||
if (server.nb_desktop == 0) {
|
||||
server.nb_desktop = 1;
|
||||
fprintf(stderr, "tint2 warning : cannot found number of desktop.\n");
|
||||
}
|
||||
|
||||
if (panel.taskbar) cleanup_taskbar();
|
||||
|
||||
panel.nb_desktop = server.nb_desktop;
|
||||
if (panel.mode == MULTI_MONITOR) panel.nb_monitor = server.nb_monitor;
|
||||
else panel.nb_monitor = 1;
|
||||
panel.taskbar = calloc(panel.nb_desktop * panel.nb_monitor, sizeof(Taskbar));
|
||||
g_slist_free(panel.area.list);
|
||||
panel.area.list = 0;
|
||||
|
||||
Taskbar *tskbar;
|
||||
for (i=0 ; i < panel.nb_desktop ; i++) {
|
||||
for (j=0 ; j < panel.nb_monitor ; j++) {
|
||||
tskbar = &panel.taskbar[index(i,j)];
|
||||
memcpy(&tskbar->area, &g_taskbar, sizeof(Area));
|
||||
tskbar->desktop = i;
|
||||
tskbar->monitor = j;
|
||||
|
||||
// TODO: redefinir panel.area.list en fonction des objets visibles
|
||||
panel.area.list = g_slist_append(panel.area.list, tskbar);
|
||||
}
|
||||
}
|
||||
if (time1_format)
|
||||
panel.area.list = g_slist_append(panel.area.list, &panel.clock);
|
||||
|
||||
//printf("taskbar (desktop x monitor) : (%d x %d)\n", panel.nb_desktop, panel.nb_monitor);
|
||||
resize_taskbar();
|
||||
task_refresh_tasklist ();
|
||||
panel.refresh = 1;
|
||||
}
|
||||
|
||||
|
||||
void config_finish ()
|
||||
{
|
||||
int height_ink, height;
|
||||
if (old_config_file) save_config();
|
||||
|
||||
if (panel.old_config_file) save_config();
|
||||
|
||||
// get monitor's configuration
|
||||
get_monitors();
|
||||
|
||||
if (panel.monitor > (server.nb_monitor-1)) {
|
||||
panel.sleep_mode = 1;
|
||||
fprintf(stderr, "tint2 sleep and wait monitor %d.\n", panel.monitor+1);
|
||||
if (panel_config->monitor > (server.nb_monitor-1)) {
|
||||
fprintf(stderr, "tint2 exit : monitor %d not found.\n", panel_config->monitor+1);
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
panel.sleep_mode = 0;
|
||||
//printf("tint2 wake up on monitor %d\n", panel.monitor+1);
|
||||
if (!server.monitor[panel.monitor].width || !server.monitor[panel.monitor].height)
|
||||
if (!server.monitor[panel_config->monitor].width || !server.monitor[panel_config->monitor].height)
|
||||
fprintf(stderr, "tint2 error : invalid monitor size.\n");
|
||||
}
|
||||
|
||||
// use panel.marginleft and panel.marginright even in full width mode
|
||||
if (!panel.area.width) panel.area.width = server.monitor[panel.monitor].width - panel.marginleft - panel.marginright;
|
||||
// alloc panels
|
||||
int i;
|
||||
if (panel_config->monitor >= 0) {
|
||||
nb_panel = 1;
|
||||
panel1 = calloc(nb_panel, sizeof(Panel));
|
||||
memcpy(panel1, panel_config, sizeof(Panel));
|
||||
}
|
||||
else {
|
||||
// multi monitor
|
||||
nb_panel = server.nb_monitor;
|
||||
panel1 = calloc(nb_panel, sizeof(Panel));
|
||||
|
||||
// taskbar
|
||||
g_taskbar.posy = panel.area.pix.border.width + panel.area.paddingy;
|
||||
g_taskbar.height = panel.area.height - (2 * g_taskbar.posy);
|
||||
g_taskbar.redraw = 1;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
memcpy(&panel1[i], panel_config, sizeof(Panel));
|
||||
panel1[i].monitor = i;
|
||||
}
|
||||
}
|
||||
|
||||
// task
|
||||
g_task.area.posy = g_taskbar.posy + g_taskbar.pix.border.width + g_taskbar.paddingy;
|
||||
g_task.area.height = panel.area.height - (2 * g_task.area.posy);
|
||||
g_task.area.use_active = 1;
|
||||
g_task.area.redraw = 1;
|
||||
|
||||
if (!g_task.maximum_width)
|
||||
g_task.maximum_width = server.monitor[panel.monitor].width;
|
||||
|
||||
if (panel.area.pix.border.rounded > panel.area.height/2)
|
||||
panel.area.pix.border.rounded = panel.area.height/2;
|
||||
|
||||
// clock
|
||||
init_clock(&panel.clock, panel.area.height);
|
||||
|
||||
// compute vertical position : text and icon
|
||||
get_text_size(g_task.font_desc, &height_ink, &height, panel.area.height, "TAjpg", 5);
|
||||
g_task.text_posy = (g_task.area.height - height) / 2.0;
|
||||
|
||||
// add task_icon_size
|
||||
g_task.text_posx = g_task.area.paddingxlr + g_task.area.pix.border.width;
|
||||
if (g_task.icon) {
|
||||
g_task.icon_size1 = g_task.area.height - (2 * g_task.area.paddingy);
|
||||
g_task.text_posx += g_task.icon_size1;
|
||||
g_task.icon_posy = (g_task.area.height - g_task.icon_size1) / 2;
|
||||
}
|
||||
|
||||
config_taskbar();
|
||||
init_panel();
|
||||
init_taskbar();
|
||||
visible_object();
|
||||
|
||||
// cleanup background list
|
||||
GSList *l0;
|
||||
for (l0 = list_back; l0 ; l0 = l0->next) {
|
||||
free(l0->data);
|
||||
}
|
||||
g_slist_free(list_back);
|
||||
list_back = NULL;
|
||||
task_refresh_tasklist();
|
||||
panel_refresh = 1;
|
||||
// XFlush (server.dsp);
|
||||
|
||||
cleanup_config();
|
||||
}
|
||||
|
||||
|
||||
|
@ -655,13 +596,14 @@ int config_read_file (const char *path)
|
|||
|
||||
void save_config ()
|
||||
{
|
||||
/*
|
||||
fprintf(stderr, "tint2 warning : convert user's config file\n");
|
||||
panel.area.paddingx = panel.area.paddingy = panel.marginleft;
|
||||
panel.marginleft = panel.marginright = panel.marginy = 0;
|
||||
panel.area.paddingx = panel.area.paddingy = panel.marginx;
|
||||
panel.marginx = 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;
|
||||
if (panel.old_task_background == 0) {
|
||||
if (old_task_icon == 0) g_task.icon_size1 = 0;
|
||||
if (old_panel_background == 0) panel.area.pix.back.alpha = 0;
|
||||
if (old_task_background == 0) {
|
||||
g_task.area.pix.back.alpha = 0;
|
||||
g_task.area.pix_active.back.alpha = 0;
|
||||
}
|
||||
|
@ -683,16 +625,16 @@ void save_config ()
|
|||
fputs("#---------------------------------------------\n", fp);
|
||||
fputs("# PANEL\n", fp);
|
||||
fputs("#---------------------------------------------\n", fp);
|
||||
if (panel.mode == SINGLE_DESKTOP) fputs("panel_mode = single_desktop\n", fp);
|
||||
if (panel_mode == SINGLE_DESKTOP) fputs("panel_mode = single_desktop\n", fp);
|
||||
else fputs("panel_mode = multi_desktop\n", fp);
|
||||
fputs("panel_monitor = 1\n", fp);
|
||||
if (panel.position & BOTTOM) fputs("panel_position = bottom", fp);
|
||||
if (panel_position & BOTTOM) fputs("panel_position = bottom", fp);
|
||||
else fputs("panel_position = top", fp);
|
||||
if (panel.position & LEFT) fputs(" left\n", fp);
|
||||
else if (panel.position & RIGHT) fputs(" right\n", fp);
|
||||
if (panel_position & LEFT) fputs(" left\n", fp);
|
||||
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.marginleft, panel.marginy);
|
||||
fprintf(fp, "panel_margin = %d %d\n", panel.marginx, 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);
|
||||
|
||||
|
@ -711,7 +653,7 @@ void save_config ()
|
|||
fprintf(fp, "task_width = %d\n", g_task.maximum_width);
|
||||
fprintf(fp, "task_padding = %d\n", g_task.area.paddingx);
|
||||
fprintf(fp, "task_icon = %d\n", g_task.icon);
|
||||
fprintf(fp, "task_font = %s\n", panel.old_task_font);
|
||||
fprintf(fp, "task_font = %s\n", old_task_font);
|
||||
fprintf(fp, "task_font_color = #%02x%02x%02x %d\n", (int)(g_task.font.color[0]*255), (int)(g_task.font.color[1]*255), (int)(g_task.font.color[2]*255), (int)(g_task.font.alpha*100));
|
||||
fprintf(fp, "task_active_font_color = #%02x%02x%02x %d\n", (int)(g_task.font_active.color[0]*255), (int)(g_task.font_active.color[1]*255), (int)(g_task.font_active.color[2]*255), (int)(g_task.font_active.alpha*100));
|
||||
|
||||
|
@ -737,37 +679,37 @@ void save_config ()
|
|||
fputs("\n#---------------------------------------------\n", fp);
|
||||
fputs("# MOUSE ACTION ON TASK\n", fp);
|
||||
fputs("#---------------------------------------------\n", fp);
|
||||
if (panel.mouse_middle == NONE) fputs("mouse_middle = none\n", fp);
|
||||
else if (panel.mouse_middle == CLOSE) fputs("mouse_middle = close\n", fp);
|
||||
else if (panel.mouse_middle == TOGGLE) fputs("mouse_middle = toggle\n", fp);
|
||||
else if (panel.mouse_middle == ICONIFY) fputs("mouse_middle = iconify\n", fp);
|
||||
else if (panel.mouse_middle == SHADE) fputs("mouse_middle = shade\n", fp);
|
||||
if (mouse_middle == NONE) fputs("mouse_middle = none\n", fp);
|
||||
else if (mouse_middle == CLOSE) fputs("mouse_middle = close\n", fp);
|
||||
else if (mouse_middle == TOGGLE) fputs("mouse_middle = toggle\n", fp);
|
||||
else if (mouse_middle == ICONIFY) fputs("mouse_middle = iconify\n", fp);
|
||||
else if (mouse_middle == SHADE) fputs("mouse_middle = shade\n", fp);
|
||||
else fputs("mouse_middle = toggle_iconify\n", fp);
|
||||
|
||||
if (panel.mouse_right == NONE) fputs("mouse_right = none\n", fp);
|
||||
else if (panel.mouse_right == CLOSE) fputs("mouse_right = close\n", fp);
|
||||
else if (panel.mouse_right == TOGGLE) fputs("mouse_right = toggle\n", fp);
|
||||
else if (panel.mouse_right == ICONIFY) fputs("mouse_right = iconify\n", fp);
|
||||
else if (panel.mouse_right == SHADE) fputs("mouse_right = shade\n", fp);
|
||||
if (mouse_right == NONE) fputs("mouse_right = none\n", fp);
|
||||
else if (mouse_right == CLOSE) fputs("mouse_right = close\n", fp);
|
||||
else if (mouse_right == TOGGLE) fputs("mouse_right = toggle\n", fp);
|
||||
else if (mouse_right == ICONIFY) fputs("mouse_right = iconify\n", fp);
|
||||
else if (mouse_right == SHADE) fputs("mouse_right = shade\n", fp);
|
||||
else fputs("mouse_right = toggle_iconify\n", fp);
|
||||
|
||||
if (panel.mouse_scroll_up == NONE) fputs("mouse_scroll_up = none\n", fp);
|
||||
else if (panel.mouse_scroll_up == CLOSE) fputs("mouse_scroll_up = close\n", fp);
|
||||
else if (panel.mouse_scroll_up == TOGGLE) fputs("mouse_scroll_up = toggle\n", fp);
|
||||
else if (panel.mouse_scroll_up == ICONIFY) fputs("mouse_scroll_up = iconify\n", fp);
|
||||
else if (panel.mouse_scroll_up == SHADE) fputs("mouse_scroll_up = shade\n", fp);
|
||||
if (mouse_scroll_up == NONE) fputs("mouse_scroll_up = none\n", fp);
|
||||
else if (mouse_scroll_up == CLOSE) fputs("mouse_scroll_up = close\n", fp);
|
||||
else if (mouse_scroll_up == TOGGLE) fputs("mouse_scroll_up = toggle\n", fp);
|
||||
else if (mouse_scroll_up == ICONIFY) fputs("mouse_scroll_up = iconify\n", fp);
|
||||
else if (mouse_scroll_up == SHADE) fputs("mouse_scroll_up = shade\n", fp);
|
||||
else fputs("mouse_scroll_up = toggle_iconify\n", fp);
|
||||
|
||||
if (panel.mouse_scroll_down == NONE) fputs("mouse_scroll_down = none\n", fp);
|
||||
else if (panel.mouse_scroll_down == CLOSE) fputs("mouse_scroll_down = close\n", fp);
|
||||
else if (panel.mouse_scroll_down == TOGGLE) fputs("mouse_scroll_down = toggle\n", fp);
|
||||
else if (panel.mouse_scroll_down == ICONIFY) fputs("mouse_scroll_down = iconify\n", fp);
|
||||
else if (panel.mouse_scroll_down == SHADE) fputs("mouse_scroll_down = shade\n", fp);
|
||||
if (mouse_scroll_down == NONE) fputs("mouse_scroll_down = none\n", fp);
|
||||
else if (mouse_scroll_down == CLOSE) fputs("mouse_scroll_down = close\n", fp);
|
||||
else if (mouse_scroll_down == TOGGLE) fputs("mouse_scroll_down = toggle\n", fp);
|
||||
else if (mouse_scroll_down == ICONIFY) fputs("mouse_scroll_down = iconify\n", fp);
|
||||
else if (mouse_scroll_down == SHADE) fputs("mouse_scroll_down = shade\n", fp);
|
||||
else fputs("mouse_scroll_down = toggle_iconify\n", fp);
|
||||
|
||||
fputs("\n\n", fp);
|
||||
fclose (fp);
|
||||
|
||||
panel.old_config_file = 0;
|
||||
*/
|
||||
old_config_file = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,16 +9,12 @@
|
|||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
// list of background
|
||||
GSList *list_back;
|
||||
|
||||
|
||||
void init_config();
|
||||
void cleanup_config();
|
||||
int config_read_file (const char *path);
|
||||
int config_read ();
|
||||
void config_taskbar();
|
||||
void config_finish ();
|
||||
void cleanup_taskbar();
|
||||
void cleanup ();
|
||||
void save_config ();
|
||||
|
||||
#endif
|
||||
|
|
323
src/panel.c
323
src/panel.c
|
@ -17,6 +17,7 @@
|
|||
**************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
@ -30,222 +31,276 @@
|
|||
#include "panel.h"
|
||||
|
||||
|
||||
void visual_refresh ()
|
||||
int signal_pending;
|
||||
// --------------------------------------------------
|
||||
// mouse events
|
||||
int mouse_middle;
|
||||
int mouse_right;
|
||||
int mouse_scroll_up;
|
||||
int mouse_scroll_down;
|
||||
|
||||
int panel_mode;
|
||||
int panel_position;
|
||||
int panel_refresh;
|
||||
|
||||
Task *task_active = 0;
|
||||
Task *task_drag = 0;
|
||||
|
||||
Panel *panel1 = 0;
|
||||
int nb_panel;
|
||||
|
||||
|
||||
|
||||
void init_panel()
|
||||
{
|
||||
if (server.pmap) XFreePixmap (server.dsp, server.pmap);
|
||||
server.pmap = XCreatePixmap (server.dsp, server.root_win, panel.area.width, panel.area.height, server.depth);
|
||||
int i;
|
||||
Panel *p;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
p = &panel1[i];
|
||||
|
||||
XCopyArea (server.dsp, panel.area.pix.pmap, server.pmap, server.gc, 0, 0, panel.area.width, panel.area.height, 0, 0);
|
||||
p->area.parent = 0;
|
||||
p->area.panel = p;
|
||||
p->g_taskbar.parent = p;
|
||||
p->g_taskbar.panel = p;
|
||||
p->g_task.area.panel = p;
|
||||
|
||||
// draw child object
|
||||
GSList *l = panel.area.list;
|
||||
for (; l ; l = l->next)
|
||||
refresh (l->data);
|
||||
if (p->pourcentx)
|
||||
p->area.width = (float)server.monitor[p->monitor].width * p->initial_width / 100;
|
||||
else
|
||||
p->area.width = p->initial_width;
|
||||
if (p->pourcenty)
|
||||
p->area.height = (float)server.monitor[p->monitor].height * p->initial_height / 100;
|
||||
else
|
||||
p->area.height = p->initial_height;
|
||||
|
||||
// main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right.
|
||||
// this feature is disabled !
|
||||
//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);
|
||||
// full width mode
|
||||
if (!p->area.width)
|
||||
p->area.width = server.monitor[p->monitor].width;
|
||||
|
||||
XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, 0, 0, panel.area.width, panel.area.height, 0, 0);
|
||||
XFlush (server.dsp);
|
||||
panel.refresh = 0;
|
||||
if (p->area.pix.border.rounded > p->area.height/2)
|
||||
p->area.pix.border.rounded = p->area.height/2;
|
||||
|
||||
/* panel position determined here */
|
||||
if (panel_position & LEFT) {
|
||||
p->posx = server.monitor[p->monitor].x + p->marginx;
|
||||
}
|
||||
else {
|
||||
if (panel_position & RIGHT) {
|
||||
p->posx = server.monitor[p->monitor].x + server.monitor[p->monitor].width - p->area.width - p->marginx;
|
||||
}
|
||||
else {
|
||||
p->posx = server.monitor[p->monitor].x + ((server.monitor[p->monitor].width - p->area.width) / 2);
|
||||
}
|
||||
}
|
||||
if (panel_position & TOP) {
|
||||
p->posy = server.monitor[p->monitor].y + p->marginy;
|
||||
}
|
||||
else {
|
||||
p->posy = server.monitor[p->monitor].y + server.monitor[p->monitor].height - p->area.height - p->marginy;
|
||||
}
|
||||
|
||||
// Catch some events
|
||||
XSetWindowAttributes att = { ParentRelative, 0L, 0, 0L, 0, 0, Always, 0L, 0L, False, ExposureMask|ButtonPressMask|ButtonReleaseMask, NoEventMask, False, 0, 0 };
|
||||
|
||||
// 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.
|
||||
if (p->main_win) XDestroyWindow(server.dsp, p->main_win);
|
||||
//win = XCreateWindow (server.dsp, server.root_win, p->posx+p->area.paddingxlr, p->posy, p->area.width-(2*p->area.paddingxlr), p->area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att);
|
||||
p->main_win = XCreateWindow(server.dsp, server.root_win, p->posx, p->posy, p->area.width, p->area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att);
|
||||
|
||||
set_panel_properties(p);
|
||||
set_panel_background(p);
|
||||
|
||||
XMapWindow (server.dsp, p->main_win);
|
||||
|
||||
init_clock(&p->clock, &p->area);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_panel_properties (Window win)
|
||||
void cleanup_panel()
|
||||
{
|
||||
XStoreName (server.dsp, win, "tint2");
|
||||
if (!panel1) return;
|
||||
|
||||
cleanup_taskbar();
|
||||
|
||||
int i;
|
||||
Panel *p;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
p = &panel1[i];
|
||||
|
||||
free_area(&p->area);
|
||||
free_area(&p->g_task.area);
|
||||
free_area(&p->g_taskbar);
|
||||
free_area(&p->clock.area);
|
||||
if (p->root_pmap) XFreePixmap(server.dsp, p->root_pmap);
|
||||
if (p->main_win) XDestroyWindow(server.dsp, p->main_win);
|
||||
}
|
||||
|
||||
// font allocated once
|
||||
if (panel1[0].g_task.font_desc) pango_font_description_free(panel1[0].g_task.font_desc);
|
||||
|
||||
if (panel1) free(panel1);
|
||||
panel1 = 0;
|
||||
}
|
||||
|
||||
|
||||
void visual_refresh (Panel *p)
|
||||
{
|
||||
if (p->root_pmap) XFreePixmap(server.dsp, p->root_pmap);
|
||||
p->root_pmap = XCreatePixmap(server.dsp, server.root_win, p->area.width, p->area.height, server.depth);
|
||||
|
||||
XCopyArea (server.dsp, p->area.pix.pmap, p->root_pmap, server.gc, 0, 0, p->area.width, p->area.height, 0, 0);
|
||||
|
||||
// draw child object
|
||||
GSList *l = p->area.list;
|
||||
for (; l ; l = l->next)
|
||||
refresh (l->data);
|
||||
|
||||
XCopyArea(server.dsp, p->root_pmap, p->main_win, server.gc, 0, 0, p->area.width, p->area.height, 0, 0);
|
||||
|
||||
// main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right.
|
||||
// this feature is disabled !
|
||||
//XCopyArea (server.dsp, server.pmap, p->main_win, server.gc, p->area.paddingxlr, 0, p->area.width-(2*p->area.paddingxlr), p->area.height, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
void set_panel_properties(Panel *p)
|
||||
{
|
||||
XStoreName (server.dsp, p->main_win, "tint2");
|
||||
|
||||
// TODO: check if the name is really needed for a panel/taskbar ?
|
||||
gsize len;
|
||||
gchar *name = g_locale_to_utf8("tint2", -1, NULL, &len, NULL);
|
||||
if (name != NULL) {
|
||||
XChangeProperty(server.dsp, win, server.atom._NET_WM_NAME, server.atom.UTF8_STRING, 8, PropModeReplace, (unsigned char *) name, (int) len);
|
||||
XChangeProperty(server.dsp, p->main_win, server.atom._NET_WM_NAME, server.atom.UTF8_STRING, 8, PropModeReplace, (unsigned char *) name, (int) len);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
// Dock
|
||||
long val = server.atom._NET_WM_WINDOW_TYPE_DOCK;
|
||||
XChangeProperty (server.dsp, win, server.atom._NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char *) &val, 1);
|
||||
XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char *) &val, 1);
|
||||
|
||||
// Reserved space
|
||||
long struts [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (panel.position & TOP) {
|
||||
struts[2] = panel.area.height + panel.marginy;
|
||||
struts[8] = server.posx;
|
||||
// panel.area.width - 1 allowed full screen on monitor 2
|
||||
struts[9] = server.posx + panel.area.width - 1;
|
||||
if (panel_position & TOP) {
|
||||
struts[2] = p->area.height + p->marginy;
|
||||
struts[8] = p->posx;
|
||||
// p->area.width - 1 allowed full screen on monitor 2
|
||||
struts[9] = p->posx + p->area.width - 1;
|
||||
}
|
||||
else {
|
||||
struts[3] = panel.area.height + panel.marginy;
|
||||
struts[10] = server.posx;
|
||||
// panel.area.width - 1 allowed full screen on monitor 2
|
||||
struts[11] = server.posx + panel.area.width - 1;
|
||||
struts[3] = p->area.height + p->marginy;
|
||||
struts[10] = p->posx;
|
||||
// p->area.width - 1 allowed full screen on monitor 2
|
||||
struts[11] = p->posx + p->area.width - 1;
|
||||
}
|
||||
// Old specification : fluxbox need _NET_WM_STRUT.
|
||||
XChangeProperty (server.dsp, win, server.atom._NET_WM_STRUT, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &struts, 4);
|
||||
XChangeProperty (server.dsp, win, server.atom._NET_WM_STRUT_PARTIAL, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &struts, 12);
|
||||
XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STRUT, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &struts, 4);
|
||||
XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STRUT_PARTIAL, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &struts, 12);
|
||||
|
||||
// Sticky and below other window
|
||||
val = 0xFFFFFFFF;
|
||||
XChangeProperty (server.dsp, win, server.atom._NET_WM_DESKTOP, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1);
|
||||
XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_DESKTOP, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1);
|
||||
Atom state[4];
|
||||
state[0] = server.atom._NET_WM_STATE_SKIP_PAGER;
|
||||
state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR;
|
||||
state[2] = server.atom._NET_WM_STATE_STICKY;
|
||||
state[3] = server.atom._NET_WM_STATE_BELOW;
|
||||
XChangeProperty (server.dsp, win, server.atom._NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *) state, 4);
|
||||
XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *) state, 4);
|
||||
|
||||
// Fixed position
|
||||
XSizeHints size_hints;
|
||||
size_hints.flags = PPosition;
|
||||
XChangeProperty (server.dsp, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *) &size_hints, sizeof (XSizeHints) / 4);
|
||||
XChangeProperty (server.dsp, p->main_win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *) &size_hints, sizeof (XSizeHints) / 4);
|
||||
|
||||
// Unfocusable
|
||||
XWMHints wmhints;
|
||||
wmhints.flags = InputHint;
|
||||
wmhints.input = False;
|
||||
XChangeProperty (server.dsp, win, XA_WM_HINTS, XA_WM_HINTS, 32, PropModeReplace, (unsigned char *) &wmhints, sizeof (XWMHints) / 4);
|
||||
XChangeProperty (server.dsp, p->main_win, XA_WM_HINTS, XA_WM_HINTS, 32, PropModeReplace, (unsigned char *) &wmhints, sizeof (XWMHints) / 4);
|
||||
|
||||
// Undecorated
|
||||
long prop[5] = { 2, 0, 0, 0, 0 };
|
||||
XChangeProperty(server.dsp, win, server.atom._MOTIF_WM_HINTS, server.atom._MOTIF_WM_HINTS, 32, PropModeReplace, (unsigned char *) prop, 5);
|
||||
}
|
||||
|
||||
|
||||
void window_draw_panel ()
|
||||
{
|
||||
/* panel position determined here */
|
||||
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.marginright;
|
||||
server.posx = server.monitor[panel.monitor].x + server.monitor[panel.monitor].width - panel.area.width;
|
||||
}
|
||||
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;
|
||||
}
|
||||
else {
|
||||
server.posy = server.monitor[panel.monitor].y + server.monitor[panel.monitor].height - panel.area.height - panel.marginy;
|
||||
}
|
||||
|
||||
// Catch some events
|
||||
XSetWindowAttributes att = { ParentRelative, 0L, 0, 0L, 0, 0, Always, 0L, 0L, False, ExposureMask|ButtonPressMask|ButtonReleaseMask, NoEventMask, False, 0, 0 };
|
||||
|
||||
// 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.
|
||||
Window win;
|
||||
if (window.main_win) XDestroyWindow(server.dsp, window.main_win);
|
||||
//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);
|
||||
win = XCreateWindow (server.dsp, server.root_win, server.posx, server.posy, panel.area.width, panel.area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att);
|
||||
|
||||
set_panel_properties (win);
|
||||
window.main_win = win;
|
||||
|
||||
set_panel_background();
|
||||
|
||||
XMapWindow (server.dsp, win);
|
||||
XFlush (server.dsp);
|
||||
XChangeProperty(server.dsp, p->main_win, server.atom._MOTIF_WM_HINTS, server.atom._MOTIF_WM_HINTS, 32, PropModeReplace, (unsigned char *) prop, 5);
|
||||
}
|
||||
|
||||
|
||||
void visible_object()
|
||||
{
|
||||
if (panel.area.list) {
|
||||
g_slist_free(panel.area.list);
|
||||
panel.area.list = 0;
|
||||
}
|
||||
|
||||
// list of visible objects
|
||||
// start with clock because draw(clock) can resize others object
|
||||
if (time1_format)
|
||||
panel.area.list = g_slist_append(panel.area.list, &panel.clock);
|
||||
|
||||
Panel *panel;
|
||||
int i, j;
|
||||
Taskbar *taskbar;
|
||||
for (i=0 ; i < panel.nb_desktop ; i++) {
|
||||
for (j=0 ; j < panel.nb_monitor ; j++) {
|
||||
taskbar = &panel.taskbar[index(i,j)];
|
||||
if (panel.mode != MULTI_DESKTOP && taskbar->desktop != server.desktop) continue;
|
||||
|
||||
panel.area.list = g_slist_append(panel.area.list, taskbar);
|
||||
}
|
||||
}
|
||||
set_redraw(&panel.area);
|
||||
panel.refresh = 1;
|
||||
}
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
panel = &panel1[i];
|
||||
|
||||
|
||||
void get_root_pixmap()
|
||||
{
|
||||
Pixmap ret = None;
|
||||
|
||||
unsigned long *res;
|
||||
int c = 2;
|
||||
|
||||
do {
|
||||
res = server_get_property (server.root_win, server.atom._XROOTPMAP_ID, XA_PIXMAP, 0);
|
||||
if (res) {
|
||||
ret = *((Pixmap*)res);
|
||||
XFree(res);
|
||||
break;
|
||||
if (panel->area.list) {
|
||||
g_slist_free(panel->area.list);
|
||||
panel->area.list = 0;
|
||||
}
|
||||
} while (--c > 0);
|
||||
server.root_pmap = ret;
|
||||
|
||||
if (server.root_pmap != None) {
|
||||
XGCValues gcv;
|
||||
gcv.ts_x_origin = 0;
|
||||
gcv.ts_y_origin = 0;
|
||||
gcv.fill_style = FillTiled;
|
||||
uint mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle | GCTile;
|
||||
// list of visible objects
|
||||
// start with clock because draw(clock) can resize others object
|
||||
if (time1_format)
|
||||
panel->area.list = g_slist_append(panel->area.list, &panel->clock);
|
||||
|
||||
gcv.tile = server.root_pmap;
|
||||
XChangeGC(server.dsp, server.gc, mask, &gcv);
|
||||
//fprintf(stderr, "pixmap background detected\n");
|
||||
Taskbar *taskbar;
|
||||
for (j=0 ; j < panel->nb_desktop ; j++) {
|
||||
taskbar = &panel->taskbar[j];
|
||||
if (panel_mode != MULTI_DESKTOP && taskbar->desktop != server.desktop) {
|
||||
// (SINGLE_DESKTOP or SINGLE_MONITOR) and not current desktop
|
||||
continue;
|
||||
}
|
||||
|
||||
panel->area.list = g_slist_append(panel->area.list, taskbar);
|
||||
}
|
||||
set_redraw(&panel->area);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "pixmap background detection failed\n");
|
||||
panel_refresh = 1;
|
||||
}
|
||||
|
||||
|
||||
void set_panel_background()
|
||||
void set_panel_background(Panel *p)
|
||||
{
|
||||
get_root_pixmap();
|
||||
|
||||
if (panel.area.pix.pmap) XFreePixmap (server.dsp, panel.area.pix.pmap);
|
||||
panel.area.pix.pmap = XCreatePixmap (server.dsp, server.root_win, panel.area.width, panel.area.height, server.depth);
|
||||
if (p->area.pix.pmap) XFreePixmap (server.dsp, p->area.pix.pmap);
|
||||
p->area.pix.pmap = XCreatePixmap (server.dsp, server.root_win, p->area.width, p->area.height, server.depth);
|
||||
|
||||
// copy background (server.root_pmap) in panel
|
||||
Window dummy;
|
||||
int x, y ;
|
||||
XTranslateCoordinates(server.dsp, window.main_win, server.root_win, 0, 0, &x, &y, &dummy);
|
||||
int x, y;
|
||||
XTranslateCoordinates(server.dsp, p->main_win, server.root_win, 0, 0, &x, &y, &dummy);
|
||||
XSetTSOrigin(server.dsp, server.gc, -x, -y) ;
|
||||
XFillRectangle(server.dsp, panel.area.pix.pmap, server.gc, 0, 0, panel.area.width, panel.area.height);
|
||||
XFillRectangle(server.dsp, p->area.pix.pmap, server.gc, 0, 0, p->area.width, p->area.height);
|
||||
|
||||
// draw background panel
|
||||
cairo_surface_t *cs;
|
||||
cairo_t *c;
|
||||
cs = cairo_xlib_surface_create (server.dsp, panel.area.pix.pmap, server.visual, panel.area.width, panel.area.height);
|
||||
cs = cairo_xlib_surface_create (server.dsp, p->area.pix.pmap, server.visual, p->area.width, p->area.height);
|
||||
c = cairo_create (cs);
|
||||
|
||||
draw_background (&panel.area, c, 0);
|
||||
draw_background(&p->area, c, 0);
|
||||
|
||||
cairo_destroy (c);
|
||||
cairo_surface_destroy (cs);
|
||||
|
||||
// redraw panel
|
||||
set_redraw (&panel.area);
|
||||
set_redraw (&p->area);
|
||||
|
||||
// copy background panel on desktop window
|
||||
//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, p->area.pix.pmap, server.root_win, server.gc_root, 0, 0, p->area.width, p->area.height, p->posx, p->posy);
|
||||
}
|
||||
|
||||
|
||||
Panel *get_panel(Window win)
|
||||
{
|
||||
int i;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
if (panel1[i].main_win == win) {
|
||||
return &panel1[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
80
src/panel.h
80
src/panel.h
|
@ -21,42 +21,55 @@
|
|||
#include "systraybar.h"
|
||||
|
||||
|
||||
//panel mode
|
||||
enum { SINGLE_DESKTOP=0, MULTI_DESKTOP, MULTI_MONITOR };
|
||||
|
||||
//panel alignment
|
||||
extern int signal_pending;
|
||||
// --------------------------------------------------
|
||||
// mouse events
|
||||
extern int mouse_middle;
|
||||
extern int mouse_right;
|
||||
extern int mouse_scroll_up;
|
||||
extern int mouse_scroll_down;
|
||||
|
||||
//panel mode
|
||||
enum { SINGLE_DESKTOP=0, MULTI_DESKTOP, SINGLE_MONITOR };
|
||||
extern int panel_mode;
|
||||
|
||||
//panel position
|
||||
enum { LEFT=0x01, RIGHT=0x02, CENTER=0X04, TOP=0X08, BOTTOM=0x10 };
|
||||
extern int panel_position;
|
||||
|
||||
extern int panel_refresh;
|
||||
|
||||
extern Task *task_active;
|
||||
extern Task *task_drag;
|
||||
|
||||
|
||||
typedef struct {
|
||||
// always start with area
|
||||
Area area;
|
||||
|
||||
// --------------------------------------------------
|
||||
// backward compatibility
|
||||
int old_config_file;
|
||||
int old_task_icon;
|
||||
int old_panel_background;
|
||||
int old_task_background;
|
||||
char *old_task_font;
|
||||
|
||||
// --------------------------------------------------
|
||||
// panel
|
||||
int signal_pending;
|
||||
int sleep_mode;
|
||||
int refresh;
|
||||
Window main_win;
|
||||
Pixmap root_pmap;
|
||||
// position relative to root window
|
||||
int posx, posy;
|
||||
int marginx, marginy;
|
||||
float initial_width, initial_height;
|
||||
int pourcentx, pourcenty;
|
||||
// location of the panel (monitor number)
|
||||
int monitor;
|
||||
int position;
|
||||
int marginleft, marginright, marginy;
|
||||
|
||||
// --------------------------------------------------
|
||||
// taskbar point to the first taskbar in panel.area.list. number of tasbar == nb_desktop x nb_monitor.
|
||||
// task annd taskbar parameter per panel
|
||||
Area g_taskbar;
|
||||
Global_task g_task;
|
||||
|
||||
// --------------------------------------------------
|
||||
// taskbar point to the first taskbar in panel.area.list.
|
||||
// number of tasbar == nb_desktop
|
||||
Taskbar *taskbar;
|
||||
int mode;
|
||||
int nb_desktop;
|
||||
int nb_monitor;
|
||||
Task *task_active;
|
||||
Task *task_drag;
|
||||
int nb_desktop;
|
||||
|
||||
// --------------------------------------------------
|
||||
// clock
|
||||
|
@ -65,28 +78,23 @@ typedef struct {
|
|||
// --------------------------------------------------
|
||||
// systray
|
||||
Systraybar systraybar;
|
||||
|
||||
// --------------------------------------------------
|
||||
// mouse events
|
||||
int mouse_middle;
|
||||
int mouse_right;
|
||||
int mouse_scroll_up;
|
||||
int mouse_scroll_down;
|
||||
} Panel;
|
||||
|
||||
|
||||
Panel panel;
|
||||
extern Panel *panel1;
|
||||
extern int nb_panel;
|
||||
|
||||
|
||||
void visual_refresh ();
|
||||
void set_panel_properties (Window win);
|
||||
void window_draw_panel ();
|
||||
void init_panel();
|
||||
void cleanup_panel();
|
||||
void visual_refresh(Panel *p);
|
||||
void set_panel_properties(Panel *p);
|
||||
void visible_object();
|
||||
|
||||
// draw background panel
|
||||
void set_panel_background();
|
||||
void set_panel_background(Panel *p);
|
||||
|
||||
// detect server.root_pmap
|
||||
void get_root_pixmap();
|
||||
Panel *get_panel(Window win);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
54
src/server.c
54
src/server.c
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "server.h"
|
||||
#include "panel.h"
|
||||
#include "task.h"
|
||||
#include "window.h"
|
||||
|
||||
|
@ -135,6 +135,38 @@ void *server_get_property (Window win, Atom at, Atom type, int *num_results)
|
|||
}
|
||||
|
||||
|
||||
void get_root_pixmap()
|
||||
{
|
||||
Pixmap ret = None;
|
||||
|
||||
unsigned long *res;
|
||||
int c = 2;
|
||||
|
||||
do {
|
||||
res = server_get_property (server.root_win, server.atom._XROOTPMAP_ID, XA_PIXMAP, 0);
|
||||
if (res) {
|
||||
ret = *((Pixmap*)res);
|
||||
XFree(res);
|
||||
break;
|
||||
}
|
||||
} while (--c > 0);
|
||||
server.root_pmap = ret;
|
||||
|
||||
if (server.root_pmap == None)
|
||||
fprintf(stderr, "pixmap background detection failed\n");
|
||||
else {
|
||||
XGCValues gcv;
|
||||
gcv.ts_x_origin = 0;
|
||||
gcv.ts_y_origin = 0;
|
||||
gcv.fill_style = FillTiled;
|
||||
uint mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle | GCTile;
|
||||
|
||||
gcv.tile = server.root_pmap;
|
||||
XChangeGC(server.dsp, server.gc, mask, &gcv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int compareMonitor(const void *monitor1, const void *monitor2)
|
||||
{
|
||||
Monitor *m1 = (Monitor*)monitor1;
|
||||
|
@ -161,8 +193,10 @@ int compareMonitor(const void *monitor1, const void *monitor2)
|
|||
}
|
||||
|
||||
|
||||
void get_monitors()
|
||||
void get_monitors_and_desktops()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (server.monitor) free(server.monitor);
|
||||
server.nb_monitor = 0;
|
||||
server.monitor = 0;
|
||||
|
@ -172,8 +206,9 @@ void get_monitors()
|
|||
XineramaScreenInfo *info = XineramaQueryScreens(server.dsp, &nb_monitor);
|
||||
|
||||
if (info) {
|
||||
int i = 0, nb=0, j;
|
||||
int nb=0, j;
|
||||
|
||||
i = 0;
|
||||
server.monitor = calloc(nb_monitor, sizeof(Monitor));
|
||||
while (i < nb_monitor) {
|
||||
for (j = 0; j < i; j++) {
|
||||
|
@ -190,7 +225,6 @@ void get_monitors()
|
|||
}
|
||||
}
|
||||
|
||||
//fprintf(stderr, "monitor %d added\n", i);
|
||||
server.monitor[nb].x = info[i].x_org;
|
||||
server.monitor[nb].y = info[i].y_org;
|
||||
server.monitor[nb].width = info[i].width;
|
||||
|
@ -214,6 +248,18 @@ next:
|
|||
server.monitor[0].width = DisplayWidth (server.dsp, server.screen);
|
||||
server.monitor[0].height = DisplayHeight (server.dsp, server.screen);
|
||||
}
|
||||
|
||||
// detect number of desktops
|
||||
for (i=0 ; i < 15 ; i++) {
|
||||
server.nb_desktop = server_get_number_of_desktop ();
|
||||
if (server.nb_desktop > 0) break;
|
||||
sleep(1);
|
||||
}
|
||||
if (server.nb_desktop == 0) {
|
||||
server.nb_desktop = 1;
|
||||
fprintf(stderr, "tint2 warning : cannot found number of desktop.\n");
|
||||
}
|
||||
fprintf(stderr, "nb monitor %d, nb desktop %d\n", server.nb_monitor, server.nb_desktop);
|
||||
}
|
||||
|
||||
|
||||
|
|
11
src/server.h
11
src/server.h
|
@ -70,6 +70,7 @@ typedef struct
|
|||
{
|
||||
Display *dsp;
|
||||
Window root_win;
|
||||
// current desktop
|
||||
int desktop;
|
||||
int screen;
|
||||
int depth;
|
||||
|
@ -79,8 +80,6 @@ typedef struct
|
|||
Monitor *monitor;
|
||||
int got_root_win;
|
||||
Visual *visual;
|
||||
int posx, posy;
|
||||
Pixmap pmap;
|
||||
// root background
|
||||
Pixmap root_pmap;
|
||||
GC gc;
|
||||
|
@ -100,9 +99,11 @@ void server_refresh_main_pixmap ();
|
|||
void server_catch_error (Display *d, XErrorEvent *ev);
|
||||
void server_init_atoms ();
|
||||
|
||||
// detect monitors
|
||||
// doesn't count monitor included into another one
|
||||
void get_monitors();
|
||||
// detect root background
|
||||
void get_root_pixmap();
|
||||
|
||||
// detect monitors and desktops
|
||||
void get_monitors_and_desktops();
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "systraybar.h"
|
||||
#include "server.h"
|
||||
#include "window.h"
|
||||
#include "panel.h"
|
||||
|
||||
|
||||
|
||||
|
@ -37,44 +36,5 @@ 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]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -36,49 +36,53 @@
|
|||
|
||||
void add_task (Window win)
|
||||
{
|
||||
Task *new_tsk;
|
||||
int desktop, monitor, all_desktop;
|
||||
|
||||
if (!win) return;
|
||||
if (window_is_hidden (win) || win == window.main_win) return;
|
||||
if (window_is_hidden(win)) return;
|
||||
|
||||
desktop = window_get_desktop (win);
|
||||
if (desktop == 0xFFFFFFFF) {
|
||||
desktop = 0;
|
||||
all_desktop = 1;
|
||||
}
|
||||
else
|
||||
all_desktop = 0;
|
||||
int monitor;
|
||||
|
||||
if (panel.mode == MULTI_MONITOR) monitor = window_get_monitor (win);
|
||||
Task new_tsk;
|
||||
new_tsk.win = win;
|
||||
new_tsk.area.panel = &panel1[0];
|
||||
new_tsk.desktop = window_get_desktop (win);
|
||||
if (panel_mode == SINGLE_MONITOR) monitor = window_get_monitor (win);
|
||||
else monitor = 0;
|
||||
|
||||
deb:
|
||||
new_tsk = malloc(sizeof(Task));
|
||||
new_tsk->win = win;
|
||||
new_tsk->all_desktop = all_desktop;
|
||||
new_tsk->title = 0;
|
||||
new_tsk->icon_data = 0;
|
||||
|
||||
get_icon(new_tsk);
|
||||
get_title(new_tsk);
|
||||
memcpy(&new_tsk->area, &g_task.area, sizeof(Area));
|
||||
// allocate only one title and one icon
|
||||
// even with task_on_all_desktop and with task_on_all_panel
|
||||
new_tsk.title = 0;
|
||||
new_tsk.icon_data = 0;
|
||||
get_title(&new_tsk);
|
||||
get_icon(&new_tsk);
|
||||
|
||||
//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);
|
||||
|
||||
Taskbar *tskbar = &panel.taskbar[index(desktop, monitor)];
|
||||
new_tsk->area.parent = tskbar;
|
||||
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk);
|
||||
Taskbar *tskbar;
|
||||
Task *new_tsk2;
|
||||
int i, j;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
if (new_tsk.desktop != ALLDESKTOP && new_tsk.desktop != j) continue;
|
||||
if (panel_mode == SINGLE_MONITOR && panel1[i].monitor != monitor) continue;
|
||||
|
||||
if (resize_tasks (tskbar))
|
||||
set_redraw (&tskbar->area);
|
||||
tskbar = &panel1[i].taskbar[j];
|
||||
new_tsk2 = malloc(sizeof(Task));
|
||||
memcpy(&new_tsk2->area, &panel1[i].g_task.area, sizeof(Area));
|
||||
new_tsk2->area.parent = tskbar;
|
||||
new_tsk2->win = new_tsk.win;
|
||||
new_tsk2->desktop = new_tsk.desktop;
|
||||
new_tsk2->title = new_tsk.title;
|
||||
new_tsk2->icon_data = new_tsk.icon_data;
|
||||
new_tsk2->icon_width = new_tsk.icon_width;
|
||||
new_tsk2->icon_height = new_tsk.icon_height;
|
||||
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk2);
|
||||
|
||||
if (all_desktop) {
|
||||
desktop++;
|
||||
if (desktop < server.nb_desktop)
|
||||
goto deb;
|
||||
}
|
||||
//printf("add_task panel %d, desktop %d, task %s\n", i, j, new_tsk2->title);
|
||||
if (resize_tasks (tskbar))
|
||||
set_redraw (&tskbar->area);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,59 +90,58 @@ void remove_task (Task *tsk)
|
|||
{
|
||||
if (!tsk) return;
|
||||
|
||||
Task *tsk2 = tsk;
|
||||
Taskbar *tskbar;
|
||||
Window win = tsk->win;
|
||||
int desktop = 0, all_desktop = tsk->all_desktop;
|
||||
int monitor = ((Taskbar*)tsk->area.parent)->monitor;
|
||||
|
||||
deb:
|
||||
if (all_desktop) {
|
||||
tskbar = &panel.taskbar[index(desktop, monitor)];
|
||||
GSList *l0;
|
||||
for (l0 = tskbar->area.list; l0 ; ) {
|
||||
tsk2 = l0->data;
|
||||
l0 = l0->next;
|
||||
if (win == tsk2->win)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
tskbar = (Taskbar*)tsk->area.parent;
|
||||
// free title and icon just for the first task
|
||||
// even with task_on_all_desktop and with task_on_all_panel
|
||||
//printf("remove_task %s %d\n", tsk->title, tsk->desktop);
|
||||
//printf("remove_task %s \n", tsk->title);
|
||||
if (tsk->title)
|
||||
free (tsk->title);
|
||||
if (tsk->icon_data)
|
||||
free (tsk->icon_data);
|
||||
|
||||
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2);
|
||||
resize_tasks (tskbar);
|
||||
set_redraw (&tskbar->area);
|
||||
//printf("remove_task %d %s\n", index(tskbar->desktop, tskbar->monitor), tsk->title);
|
||||
int i, j;
|
||||
Task *tsk2;
|
||||
Taskbar *tskbar;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
//if (tsk->desktop != ALLDESKTOP && tsk->desktop != j) continue;
|
||||
if (!panel1[i].taskbar) continue;
|
||||
|
||||
if (tsk2 == panel.task_active)
|
||||
panel.task_active = 0;
|
||||
if (tsk2 == panel.task_drag)
|
||||
panel.task_drag = 0;
|
||||
GSList *l0;
|
||||
tskbar = &panel1[i].taskbar[j];
|
||||
for (l0 = tskbar->area.list; l0 ; ) {
|
||||
tsk2 = l0->data;
|
||||
l0 = l0->next;
|
||||
if (win == tsk2->win) {
|
||||
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2);
|
||||
resize_tasks (tskbar);
|
||||
set_redraw (&tskbar->area);
|
||||
|
||||
if (tsk2->title)
|
||||
free (tsk2->title);
|
||||
if (tsk2->icon_data)
|
||||
free (tsk2->icon_data);
|
||||
if (tsk2 == task_active)
|
||||
task_active = 0;
|
||||
if (tsk2 == task_drag)
|
||||
task_drag = 0;
|
||||
|
||||
XFreePixmap (server.dsp, tsk2->area.pix.pmap);
|
||||
XFreePixmap (server.dsp, tsk2->area.pix_active.pmap);
|
||||
free(tsk2);
|
||||
XFreePixmap (server.dsp, tsk2->area.pix.pmap);
|
||||
XFreePixmap (server.dsp, tsk2->area.pix_active.pmap);
|
||||
free(tsk2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (all_desktop) {
|
||||
desktop++;
|
||||
if (desktop < server.nb_desktop)
|
||||
goto deb;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void get_title(Task *tsk)
|
||||
{
|
||||
if (!g_task.text) return;
|
||||
|
||||
Panel *panel = tsk->area.panel;
|
||||
char *title, *name;
|
||||
|
||||
if (!panel->g_task.text) return;
|
||||
|
||||
name = server_get_property (tsk->win, server.atom._NET_WM_VISIBLE_NAME, server.atom.UTF8_STRING, 0);
|
||||
if (!name || !strlen(name)) {
|
||||
name = server_get_property (tsk->win, server.atom._NET_WM_NAME, server.atom.UTF8_STRING, 0);
|
||||
|
@ -153,11 +156,12 @@ void get_title(Task *tsk)
|
|||
|
||||
// add space before title
|
||||
title = malloc(strlen(name)+2);
|
||||
if (g_task.icon) strcpy(title, " ");
|
||||
if (panel->g_task.icon) strcpy(title, " ");
|
||||
else title[0] = 0;
|
||||
strcat(title, name);
|
||||
if (name) XFree (name);
|
||||
|
||||
tsk->area.redraw = 1;
|
||||
if (tsk->title)
|
||||
free(tsk->title);
|
||||
tsk->title = title;
|
||||
|
@ -166,18 +170,24 @@ void get_title(Task *tsk)
|
|||
|
||||
void get_icon (Task *tsk)
|
||||
{
|
||||
if (!g_task.icon) return;
|
||||
Panel *panel = tsk->area.panel;
|
||||
if (!panel->g_task.icon) return;
|
||||
|
||||
if (tsk->icon_data) {
|
||||
free (tsk->icon_data);
|
||||
tsk->icon_data = 0;
|
||||
}
|
||||
tsk->area.redraw = 1;
|
||||
|
||||
long *data;
|
||||
int num;
|
||||
|
||||
data = server_get_property (tsk->win, server.atom._NET_WM_ICON, XA_CARDINAL, &num);
|
||||
if (data) {
|
||||
//printf("get_icon plein\n");
|
||||
// ARGB
|
||||
int w, h;
|
||||
long *tmp_data;
|
||||
tmp_data = get_best_icon (data, get_icon_count (data, num), num, &w, &h, g_task.icon_size1);
|
||||
tmp_data = get_best_icon (data, get_icon_count (data, num), num, &w, &h, panel->g_task.icon_size1);
|
||||
|
||||
tsk->icon_width = w;
|
||||
tsk->icon_height = h;
|
||||
|
@ -200,20 +210,20 @@ void get_icon (Task *tsk)
|
|||
|
||||
void draw_task_icon (Task *tsk, int text_width, int active)
|
||||
{
|
||||
if (tsk->icon_data == 0) get_icon (tsk);
|
||||
if (tsk->icon_data == 0) return;
|
||||
|
||||
Pixmap *pmap = (active == 0) ? (&tsk->area.pix.pmap) : (&tsk->area.pix_active.pmap);
|
||||
|
||||
/* Find pos */
|
||||
int pos_x;
|
||||
if (g_task.centered) {
|
||||
if (g_task.text)
|
||||
pos_x = (tsk->area.width - text_width - g_task.icon_size1) / 2;
|
||||
Panel *panel = (Panel*)tsk->area.panel;
|
||||
if (panel->g_task.centered) {
|
||||
if (panel->g_task.text)
|
||||
pos_x = (tsk->area.width - text_width - panel->g_task.icon_size1) / 2;
|
||||
else
|
||||
pos_x = (tsk->area.width - g_task.icon_size1) / 2;
|
||||
pos_x = (tsk->area.width - panel->g_task.icon_size1) / 2;
|
||||
}
|
||||
else pos_x = g_task.area.paddingxlr + g_task.area.pix.border.width;
|
||||
else pos_x = panel->g_task.area.paddingxlr + panel->g_task.area.pix.border.width;
|
||||
|
||||
/* Render */
|
||||
Imlib_Image icon;
|
||||
|
@ -242,13 +252,13 @@ void draw_task_icon (Task *tsk, int text_width, int active)
|
|||
imlib_get_color_modifier_tables (red, green, blue, alpha);
|
||||
|
||||
int i, opacity;
|
||||
opacity = (active == 0) ? (255*g_task.font.alpha) : (255*g_task.font_active.alpha);
|
||||
opacity = (active == 0) ? (255*panel->g_task.font.alpha) : (255*panel->g_task.font_active.alpha);
|
||||
for (i = 127; i < 256; i++) alpha[i] = opacity;
|
||||
|
||||
imlib_set_color_modifier_tables (red, green, blue, alpha);
|
||||
|
||||
//imlib_render_image_on_drawable (pos_x, pos_y);
|
||||
imlib_render_image_on_drawable_at_size (pos_x, g_task.icon_posy, g_task.icon_size1, g_task.icon_size1);
|
||||
imlib_render_image_on_drawable_at_size (pos_x, panel->g_task.icon_posy, panel->g_task.icon_size1, panel->g_task.icon_size1);
|
||||
|
||||
imlib_free_color_modifier ();
|
||||
imlib_free_image ();
|
||||
|
@ -262,11 +272,12 @@ void draw_foreground_task (void *obj, cairo_t *c, int active)
|
|||
PangoLayout *layout;
|
||||
config_color *config_text;
|
||||
int width, height;
|
||||
Panel *panel = (Panel*)tsk->area.panel;
|
||||
|
||||
if (g_task.text) {
|
||||
if (panel->g_task.text) {
|
||||
/* Layout */
|
||||
layout = pango_cairo_create_layout (c);
|
||||
pango_layout_set_font_description (layout, g_task.font_desc);
|
||||
pango_layout_set_font_description (layout, panel->g_task.font_desc);
|
||||
pango_layout_set_text (layout, tsk->title, -1);
|
||||
|
||||
/* Drawing width and Cut text */
|
||||
|
@ -274,30 +285,30 @@ void draw_foreground_task (void *obj, cairo_t *c, int active)
|
|||
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
|
||||
|
||||
/* Center text */
|
||||
if (g_task.centered) pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||
if (panel->g_task.centered) pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||
else pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT);
|
||||
|
||||
pango_layout_get_pixel_size (layout, &width, &height);
|
||||
|
||||
if (active) config_text = &g_task.font_active;
|
||||
else config_text = &g_task.font;
|
||||
if (active) config_text = &panel->g_task.font_active;
|
||||
else config_text = &panel->g_task.font;
|
||||
|
||||
cairo_set_source_rgba (c, config_text->color[0], config_text->color[1], config_text->color[2], config_text->alpha);
|
||||
|
||||
pango_cairo_update_layout (c, layout);
|
||||
cairo_move_to (c, g_task.text_posx, g_task.text_posy);
|
||||
cairo_move_to (c, panel->g_task.text_posx, panel->g_task.text_posy);
|
||||
pango_cairo_show_layout (c, layout);
|
||||
|
||||
if (g_task.font_shadow) {
|
||||
if (panel->g_task.font_shadow) {
|
||||
cairo_set_source_rgba (c, 0.0, 0.0, 0.0, 0.5);
|
||||
pango_cairo_update_layout (c, layout);
|
||||
cairo_move_to (c, g_task.text_posx + 1, g_task.text_posy + 1);
|
||||
cairo_move_to (c, panel->g_task.text_posx + 1, panel->g_task.text_posy + 1);
|
||||
pango_cairo_show_layout (c, layout);
|
||||
}
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
if (g_task.icon) {
|
||||
if (panel->g_task.icon) {
|
||||
// icon use same opacity as text
|
||||
draw_task_icon (tsk, width, active);
|
||||
}
|
||||
|
|
|
@ -19,14 +19,15 @@ typedef struct {
|
|||
|
||||
int text;
|
||||
int icon;
|
||||
int icon_size1;
|
||||
int centered;
|
||||
int maximum_width;
|
||||
int font_shadow;
|
||||
// icon position
|
||||
|
||||
int icon_posy;
|
||||
int icon_size1;
|
||||
int maximum_width;
|
||||
// starting position for text ~ task_padding + task_border + icon_size
|
||||
double text_posx, text_posy;
|
||||
|
||||
int font_shadow;
|
||||
PangoFontDescription *font_desc;
|
||||
config_color font;
|
||||
config_color font_active;
|
||||
|
@ -40,16 +41,14 @@ typedef struct {
|
|||
|
||||
// TODO: group task with list of windows here
|
||||
Window win;
|
||||
int desktop;
|
||||
long *icon_data;
|
||||
int icon_width;
|
||||
int icon_height;
|
||||
char *title;
|
||||
int all_desktop;
|
||||
} Task;
|
||||
|
||||
|
||||
Global_task g_task;
|
||||
|
||||
|
||||
void add_task (Window win);
|
||||
void remove_task (Task *tsk);
|
||||
|
@ -59,5 +58,6 @@ void draw_foreground_task (void *obj, cairo_t *c, int active);
|
|||
void get_icon (Task *tsk);
|
||||
void get_title(Task *tsk);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <glib.h>
|
||||
#include <Imlib2.h>
|
||||
|
||||
#include "task.h"
|
||||
#include "taskbar.h"
|
||||
#include "server.h"
|
||||
#include "window.h"
|
||||
|
@ -33,19 +34,106 @@
|
|||
|
||||
|
||||
|
||||
void init_taskbar()
|
||||
{
|
||||
Panel *panel;
|
||||
int i, j;
|
||||
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
panel = &panel1[i];
|
||||
|
||||
// taskbar
|
||||
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.redraw = 1;
|
||||
|
||||
// task
|
||||
panel->g_task.area.draw_foreground = draw_foreground_task;
|
||||
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.use_active = 1;
|
||||
panel->g_task.area.redraw = 1;
|
||||
|
||||
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_active.border.rounded = panel->g_task.area.pix.border.rounded;
|
||||
}
|
||||
|
||||
// compute vertical position : text and icon
|
||||
int height_ink, height;
|
||||
get_text_size(panel->g_task.font_desc, &height_ink, &height, panel->area.height, "TAjpg", 5);
|
||||
|
||||
if (!panel->g_task.maximum_width)
|
||||
panel->g_task.maximum_width = server.monitor[panel->monitor].width;
|
||||
|
||||
// add task_icon_size
|
||||
panel->g_task.text_posx = panel->g_task.area.paddingxlr + panel->g_task.area.pix.border.width;
|
||||
panel->g_task.text_posy = (panel->g_task.area.height - height) / 2.0;
|
||||
if (panel->g_task.icon) {
|
||||
panel->g_task.icon_size1 = panel->g_task.area.height - (2 * panel->g_task.area.paddingy);
|
||||
panel->g_task.text_posx += panel->g_task.icon_size1;
|
||||
panel->g_task.icon_posy = (panel->g_task.area.height - panel->g_task.icon_size1) / 2;
|
||||
}
|
||||
//printf("monitor %d, task_maximum_width %d\n", panel->monitor, panel->g_task.maximum_width);
|
||||
|
||||
Taskbar *tskbar;
|
||||
panel->nb_desktop = server.nb_desktop;
|
||||
panel->taskbar = calloc(panel->nb_desktop, sizeof(Taskbar));
|
||||
for (j=0 ; j < panel->nb_desktop ; j++) {
|
||||
tskbar = &panel->taskbar[j];
|
||||
memcpy(&tskbar->area, &panel->g_taskbar, sizeof(Area));
|
||||
tskbar->desktop = j;
|
||||
}
|
||||
|
||||
resize_taskbar(panel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void cleanup_taskbar()
|
||||
{
|
||||
Panel *panel;
|
||||
int i, j;
|
||||
GSList *l0;
|
||||
Task *tsk;
|
||||
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
panel = &panel1[i];
|
||||
if (!panel->taskbar) continue;
|
||||
|
||||
for (j=0 ; j < panel->nb_desktop ; j++) {
|
||||
l0 = panel->taskbar[j].area.list;
|
||||
while (l0) {
|
||||
tsk = l0->data;
|
||||
l0 = l0->next;
|
||||
// careful : remove_task change l0->next
|
||||
remove_task (tsk);
|
||||
}
|
||||
|
||||
free_area (&panel->taskbar[j].area);
|
||||
}
|
||||
|
||||
free(panel->taskbar);
|
||||
panel->taskbar = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Task *task_get_task (Window win)
|
||||
{
|
||||
Task *tsk;
|
||||
GSList *l0;
|
||||
int i, nb;
|
||||
int i, j;
|
||||
|
||||
nb = panel.nb_desktop * panel.nb_monitor;
|
||||
for (i=0 ; i < nb ; i++) {
|
||||
for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) {
|
||||
tsk = l0->data;
|
||||
if (win == tsk->win)
|
||||
return tsk;
|
||||
}
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
|
||||
tsk = l0->data;
|
||||
if (win == tsk->win)
|
||||
return tsk;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -54,7 +142,7 @@ Task *task_get_task (Window win)
|
|||
void task_refresh_tasklist ()
|
||||
{
|
||||
Window *win, active_win;
|
||||
int num_results, i, j, nb;
|
||||
int num_results, i, j, k;
|
||||
GSList *l0;
|
||||
Task *tsk;
|
||||
|
||||
|
@ -64,29 +152,30 @@ void task_refresh_tasklist ()
|
|||
|
||||
// Remove any old and set active win
|
||||
active_win = window_get_active ();
|
||||
if (panel.task_active) {
|
||||
panel.task_active->area.is_active = 0;
|
||||
panel.task_active = 0;
|
||||
if (task_active) {
|
||||
task_active->area.is_active = 0;
|
||||
task_active = 0;
|
||||
}
|
||||
|
||||
nb = panel.nb_desktop * panel.nb_monitor;
|
||||
for (i=0 ; i < nb ; i++) {
|
||||
l0 = panel.taskbar[i].area.list;
|
||||
while (l0) {
|
||||
tsk = l0->data;
|
||||
l0 = l0->next;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
l0 = panel1[i].taskbar[j].area.list;
|
||||
while (l0) {
|
||||
tsk = l0->data;
|
||||
l0 = l0->next;
|
||||
|
||||
if (tsk->win == active_win) {
|
||||
tsk->area.is_active = 1;
|
||||
panel.task_active = tsk;
|
||||
if (tsk->win == active_win) {
|
||||
tsk->area.is_active = 1;
|
||||
task_active = tsk;
|
||||
}
|
||||
|
||||
for (k = 0; k < num_results; k++) {
|
||||
if (tsk->win == win[k]) break;
|
||||
}
|
||||
// careful : remove_task change l0->next
|
||||
if (tsk->win != win[k]) remove_task (tsk);
|
||||
}
|
||||
|
||||
for (j = 0; j < num_results; j++) {
|
||||
if (tsk->win == win[j]) break;
|
||||
}
|
||||
// careful : remove_task change l0->next
|
||||
if (tsk->win != win[j]) remove_task (tsk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add any new
|
||||
|
@ -103,19 +192,23 @@ int resize_tasks (Taskbar *taskbar)
|
|||
int ret, task_count, pixel_width, modulo_width=0;
|
||||
int x, taskbar_width;
|
||||
Task *tsk;
|
||||
Panel *panel = (Panel*)taskbar->area.panel;
|
||||
GSList *l;
|
||||
|
||||
// new task width for 'desktop'
|
||||
task_count = g_slist_length(taskbar->area.list);
|
||||
if (!task_count) pixel_width = g_task.maximum_width;
|
||||
if (!task_count) pixel_width = panel->g_task.maximum_width;
|
||||
else {
|
||||
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);
|
||||
taskbar_width = taskbar->area.width - (2 * panel->g_taskbar.pix.border.width) - (2 * panel->g_taskbar.paddingxlr);
|
||||
if (task_count>1) taskbar_width -= ((task_count-1) * panel->g_taskbar.paddingx);
|
||||
|
||||
pixel_width = taskbar_width / task_count;
|
||||
if (pixel_width > g_task.maximum_width) pixel_width = g_task.maximum_width;
|
||||
else modulo_width = taskbar_width % task_count;
|
||||
if (pixel_width > panel->g_task.maximum_width)
|
||||
pixel_width = panel->g_task.maximum_width;
|
||||
else
|
||||
modulo_width = taskbar_width % task_count;
|
||||
}
|
||||
//printf("monitor %d, resize_tasks %d %d\n", panel->monitor, task_count, pixel_width);
|
||||
|
||||
if ((taskbar->task_width == pixel_width) && (taskbar->task_modulo == modulo_width)) {
|
||||
ret = 0;
|
||||
|
@ -124,7 +217,7 @@ int resize_tasks (Taskbar *taskbar)
|
|||
ret = 1;
|
||||
taskbar->task_width = pixel_width;
|
||||
taskbar->task_modulo = modulo_width;
|
||||
taskbar->text_width = pixel_width - g_task.text_posx - g_task.area.pix.border.width - g_task.area.paddingx;
|
||||
taskbar->text_width = pixel_width - panel->g_task.text_posx - panel->g_task.area.pix.border.width - panel->g_task.area.paddingx;
|
||||
}
|
||||
|
||||
// change pos_x and width for all tasks
|
||||
|
@ -138,47 +231,47 @@ int resize_tasks (Taskbar *taskbar)
|
|||
modulo_width--;
|
||||
}
|
||||
|
||||
x += tsk->area.width + g_taskbar.paddingx;
|
||||
x += tsk->area.width + panel->g_taskbar.paddingx;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// initialise taskbar posx and width
|
||||
void resize_taskbar()
|
||||
void resize_taskbar(void *p)
|
||||
{
|
||||
Panel *panel = p;
|
||||
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;
|
||||
if (panel_mode == MULTI_DESKTOP) taskbar_on_screen = panel->nb_desktop;
|
||||
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 (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;
|
||||
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;
|
||||
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++) {
|
||||
int i, modulo=0, posx=0;
|
||||
for (i=0 ; i < panel->nb_desktop ; i++) {
|
||||
if ((i % taskbar_on_screen) == 0) {
|
||||
posx = panel.area.pix.border.width + panel.area.paddingxlr;
|
||||
posx = panel->area.pix.border.width + panel->area.paddingxlr;
|
||||
modulo = modulo_width;
|
||||
}
|
||||
else posx += taskbar_width + panel.area.paddingx;
|
||||
else posx += taskbar_width + panel->area.paddingx;
|
||||
|
||||
panel.taskbar[i].area.posx = posx;
|
||||
panel.taskbar[i].area.width = taskbar_width;
|
||||
panel->taskbar[i].area.posx = posx;
|
||||
panel->taskbar[i].area.width = taskbar_width;
|
||||
if (modulo) {
|
||||
panel.taskbar[i].area.width++;
|
||||
panel->taskbar[i].area.width++;
|
||||
modulo--;
|
||||
}
|
||||
|
||||
resize_tasks(&panel.taskbar[i]);
|
||||
resize_tasks(&panel->taskbar[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ typedef struct {
|
|||
Area area;
|
||||
|
||||
int desktop;
|
||||
int monitor;
|
||||
|
||||
// task parameters
|
||||
int task_width;
|
||||
|
@ -25,10 +24,9 @@ typedef struct {
|
|||
} Taskbar;
|
||||
|
||||
|
||||
// --------------------------------------------------
|
||||
// global taskbar parameter
|
||||
Area g_taskbar;
|
||||
|
||||
void init_taskbar();
|
||||
void cleanup_taskbar();
|
||||
|
||||
Task *task_get_task (Window win);
|
||||
void task_refresh_tasklist ();
|
||||
|
@ -36,9 +34,8 @@ void task_refresh_tasklist ();
|
|||
// return 1 if task_width changed
|
||||
int resize_tasks (Taskbar *tskbar);
|
||||
|
||||
void resize_taskbar();
|
||||
void resize_taskbar(void *panel);
|
||||
|
||||
//void add_taskbar(Area *a);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
309
src/tint.c
309
src/tint.c
|
@ -44,7 +44,7 @@
|
|||
void signal_handler(int sig)
|
||||
{
|
||||
// signal handler is light as it should be
|
||||
panel.signal_pending = sig;
|
||||
signal_pending = sig;
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,13 +56,7 @@ void init ()
|
|||
signal(SIGTERM, signal_handler);
|
||||
|
||||
// set global data
|
||||
memset(&panel, 0, sizeof(Panel));
|
||||
memset(&server, 0, sizeof(Server_global));
|
||||
memset(&g_task, 0, sizeof(Global_task));
|
||||
memset(&g_taskbar, 0, sizeof(Area));
|
||||
panel.clock.area.draw_foreground = draw_foreground_clock;
|
||||
g_task.area.draw_foreground = draw_foreground_task;
|
||||
window.main_win = 0;
|
||||
|
||||
server.dsp = XOpenDisplay (NULL);
|
||||
if (!server.dsp) {
|
||||
|
@ -99,6 +93,21 @@ void init ()
|
|||
}
|
||||
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
cleanup_panel();
|
||||
|
||||
if (time1_font_desc) pango_font_description_free(time1_font_desc);
|
||||
if (time2_font_desc) pango_font_description_free(time2_font_desc);
|
||||
if (time1_format) g_free(time1_format);
|
||||
if (time2_format) g_free(time2_format);
|
||||
|
||||
if (server.monitor) free(server.monitor);
|
||||
XFreeGC(server.dsp, server.gc);
|
||||
XCloseDisplay(server.dsp);
|
||||
}
|
||||
|
||||
|
||||
void window_action (Task *tsk, int action)
|
||||
{
|
||||
switch (action) {
|
||||
|
@ -112,7 +121,7 @@ void window_action (Task *tsk, int action)
|
|||
XIconifyWindow (server.dsp, tsk->win, server.screen);
|
||||
break;
|
||||
case TOGGLE_ICONIFY:
|
||||
if (tsk == panel.task_active) XIconifyWindow (server.dsp, tsk->win, server.screen);
|
||||
if (tsk == task_active) XIconifyWindow (server.dsp, tsk->win, server.screen);
|
||||
else set_active (tsk->win);
|
||||
break;
|
||||
case SHADE:
|
||||
|
@ -122,17 +131,22 @@ void window_action (Task *tsk, int action)
|
|||
}
|
||||
|
||||
|
||||
void event_button_press (int x, int y)
|
||||
void event_button_press (XEvent *e)
|
||||
{
|
||||
if (panel.mode == SINGLE_DESKTOP) {
|
||||
Panel *panel = get_panel(e->xany.window);
|
||||
if (!panel) return;
|
||||
|
||||
if (panel_mode != MULTI_DESKTOP) {
|
||||
// drag and drop disabled
|
||||
XLowerWindow (server.dsp, window.main_win);
|
||||
//XLowerWindow (server.dsp, panel.main_win);
|
||||
return;
|
||||
}
|
||||
|
||||
Taskbar *tskbar;
|
||||
GSList *l0;
|
||||
for (l0 = panel.area.list; l0 ; l0 = l0->next) {
|
||||
Taskbar *tskbar;
|
||||
int x = e->xbutton.x;
|
||||
int y = e->xbutton.y;
|
||||
for (l0 = panel->area.list; l0 ; l0 = l0->next) {
|
||||
tskbar = l0->data;
|
||||
if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
|
||||
break;
|
||||
|
@ -143,68 +157,72 @@ void event_button_press (int x, int y)
|
|||
for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
|
||||
tsk = l0->data;
|
||||
if (x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
|
||||
panel.task_drag = tsk;
|
||||
task_drag = tsk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XLowerWindow (server.dsp, window.main_win);
|
||||
//XLowerWindow (server.dsp, panel.main_win);
|
||||
}
|
||||
|
||||
|
||||
void event_button_release (int button, int x, int y)
|
||||
void event_button_release (XEvent *e)
|
||||
{
|
||||
int action = TOGGLE_ICONIFY;
|
||||
// TODO: convert event_button_press(int x, int y) to area->event_button_press()
|
||||
// if systray is ok
|
||||
|
||||
switch (button) {
|
||||
Panel *panel = get_panel(e->xany.window);
|
||||
if (!panel) return;
|
||||
|
||||
int action = TOGGLE_ICONIFY;
|
||||
int x = e->xbutton.x;
|
||||
int y = e->xbutton.y;
|
||||
switch (e->xbutton.button) {
|
||||
case 2:
|
||||
action = panel.mouse_middle;
|
||||
action = mouse_middle;
|
||||
break;
|
||||
case 3:
|
||||
action = panel.mouse_right;
|
||||
action = mouse_right;
|
||||
break;
|
||||
case 4:
|
||||
action = panel.mouse_scroll_up;
|
||||
action = mouse_scroll_up;
|
||||
break;
|
||||
case 5:
|
||||
action = panel.mouse_scroll_down;
|
||||
action = mouse_scroll_down;
|
||||
break;
|
||||
}
|
||||
|
||||
// search taskbar
|
||||
Taskbar *tskbar;
|
||||
GSList *l0;
|
||||
for (l0 = panel.area.list; l0 ; l0 = l0->next) {
|
||||
for (l0 = panel->area.list; l0 ; l0 = l0->next) {
|
||||
tskbar = l0->data;
|
||||
if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
|
||||
goto suite;
|
||||
}
|
||||
|
||||
// TODO: check better solution to keep window below
|
||||
XLowerWindow (server.dsp, window.main_win);
|
||||
panel.task_drag = 0;
|
||||
//XLowerWindow (server.dsp, panel.main_win);
|
||||
task_drag = 0;
|
||||
return;
|
||||
|
||||
suite:
|
||||
// drag and drop task
|
||||
if (panel.task_drag) {
|
||||
if (tskbar != panel.task_drag->area.parent && action == TOGGLE_ICONIFY) {
|
||||
if (!panel.task_drag->all_desktop && panel.mode == MULTI_DESKTOP) {
|
||||
windows_set_desktop(panel.task_drag->win, tskbar->desktop);
|
||||
if (task_drag) {
|
||||
if (tskbar != task_drag->area.parent && action == TOGGLE_ICONIFY) {
|
||||
if (task_drag->desktop != ALLDESKTOP && panel_mode == MULTI_DESKTOP) {
|
||||
windows_set_desktop(task_drag->win, tskbar->desktop);
|
||||
if (tskbar->desktop == server.desktop)
|
||||
set_active(panel.task_drag->win);
|
||||
panel.task_drag = 0;
|
||||
set_active(task_drag->win);
|
||||
task_drag = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else panel.task_drag = 0;
|
||||
else task_drag = 0;
|
||||
}
|
||||
|
||||
// switch desktop
|
||||
if (panel.mode == MULTI_DESKTOP)
|
||||
if (panel_mode == MULTI_DESKTOP)
|
||||
if (tskbar->desktop != server.desktop && action != CLOSE)
|
||||
set_desktop (tskbar->desktop);
|
||||
|
||||
|
@ -220,12 +238,14 @@ suite:
|
|||
}
|
||||
|
||||
// to keep window below
|
||||
XLowerWindow (server.dsp, window.main_win);
|
||||
//XLowerWindow (server.dsp, panel.main_win);
|
||||
}
|
||||
|
||||
|
||||
void event_property_notify (Window win, Atom at)
|
||||
{
|
||||
int i, j;
|
||||
Task *tsk;
|
||||
|
||||
if (win == server.root_win) {
|
||||
if (!server.got_root_win) {
|
||||
|
@ -235,39 +255,38 @@ void event_property_notify (Window win, Atom at)
|
|||
|
||||
/* Change number of desktops */
|
||||
else if (at == server.atom._NET_NUMBER_OF_DESKTOPS) {
|
||||
config_taskbar();
|
||||
visible_object();
|
||||
server.nb_desktop = server_get_number_of_desktop ();
|
||||
cleanup_taskbar();
|
||||
init_taskbar();
|
||||
visible_object();
|
||||
task_refresh_tasklist();
|
||||
panel_refresh = 1;
|
||||
}
|
||||
/* Change desktop */
|
||||
else if (at == server.atom._NET_CURRENT_DESKTOP) {
|
||||
server.desktop = server_get_current_desktop ();
|
||||
if (panel.mode != MULTI_DESKTOP) {
|
||||
visible_object();
|
||||
if (panel_mode != MULTI_DESKTOP) {
|
||||
visible_object();
|
||||
}
|
||||
}
|
||||
/* Window list */
|
||||
else if (at == server.atom._NET_CLIENT_LIST) {
|
||||
task_refresh_tasklist ();
|
||||
panel.refresh = 1;
|
||||
task_refresh_tasklist();
|
||||
panel_refresh = 1;
|
||||
}
|
||||
/* Change active */
|
||||
else if (at == server.atom._NET_ACTIVE_WINDOW) {
|
||||
if (panel.task_active) {
|
||||
if (panel.task_active->all_desktop) {
|
||||
Task *tsk;
|
||||
GSList *l0;
|
||||
int i, nb;
|
||||
nb = server.nb_desktop * server.nb_monitor;
|
||||
for (i=0 ; i < nb ; i++) {
|
||||
for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) {
|
||||
GSList *l0;
|
||||
if (task_active) {
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
|
||||
tsk = l0->data;
|
||||
tsk->area.is_active = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
panel.task_active->area.is_active = 0;
|
||||
panel.task_active = 0;
|
||||
}
|
||||
}
|
||||
task_active = 0;
|
||||
}
|
||||
Window w1 = window_get_active ();
|
||||
Task *t = task_get_task(w1);
|
||||
|
@ -277,97 +296,97 @@ void event_property_notify (Window win, Atom at)
|
|||
if (w2) t = task_get_task(w2);
|
||||
}
|
||||
if (t) {
|
||||
if (t->all_desktop) {
|
||||
Task *tsk;
|
||||
GSList *l0;
|
||||
int i, nb;
|
||||
nb = server.nb_desktop * server.nb_monitor;
|
||||
for (i=0 ; i < nb ; i++) {
|
||||
for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) {
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
|
||||
tsk = l0->data;
|
||||
if (tsk->win == t->win)
|
||||
if (tsk->win == t->win) {
|
||||
tsk->area.is_active = 1;
|
||||
//printf("active monitor %d, task %s\n", panel1[i].monitor, tsk->title);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
t->area.is_active = 1;
|
||||
panel.task_active = t;
|
||||
}
|
||||
}
|
||||
task_active = t;
|
||||
}
|
||||
panel.refresh = 1;
|
||||
panel_refresh = 1;
|
||||
}
|
||||
/* Wallpaper changed */
|
||||
else if (at == server.atom._XROOTPMAP_ID) {
|
||||
set_panel_background();
|
||||
panel.refresh = 1;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
set_panel_background(&panel1[i]);
|
||||
}
|
||||
panel_refresh = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Task *tsk;
|
||||
tsk = task_get_task (win);
|
||||
if (!tsk) return;
|
||||
//printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), tsk->title);
|
||||
|
||||
/* Window title changed */
|
||||
if (at == server.atom._NET_WM_VISIBLE_NAME || at == server.atom._NET_WM_NAME || at == server.atom.WM_NAME) {
|
||||
if (tsk->all_desktop) {
|
||||
Task *tsk2;
|
||||
GSList *l0;
|
||||
int i, nb;
|
||||
nb = server.nb_desktop * server.nb_monitor;
|
||||
for (i=0 ; i < nb ; i++) {
|
||||
for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) {
|
||||
tsk2 = l0->data;
|
||||
if (tsk->win == tsk2->win) {
|
||||
get_title(tsk2);
|
||||
tsk2->area.redraw = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
get_title(tsk);
|
||||
tsk->area.redraw = 1;
|
||||
}
|
||||
panel.refresh = 1;
|
||||
Task *tsk2;
|
||||
GSList *l0;
|
||||
get_title(tsk);
|
||||
// changed other tsk->title
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
|
||||
tsk2 = l0->data;
|
||||
if (tsk->win == tsk2->win && tsk != tsk2) {
|
||||
tsk2->title = tsk->title;
|
||||
tsk2->area.redraw = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
panel_refresh = 1;
|
||||
}
|
||||
/* Iconic state */
|
||||
else if (at == server.atom.WM_STATE) {
|
||||
if (window_is_iconified (win))
|
||||
if (panel.task_active) {
|
||||
if (panel.task_active->win == tsk->win) {
|
||||
if (tsk->all_desktop) {
|
||||
Task *tsk2;
|
||||
GSList *l0;
|
||||
int i, nb;
|
||||
nb = server.nb_desktop * server.nb_monitor;
|
||||
for (i=0 ; i < nb ; i++) {
|
||||
for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) {
|
||||
tsk2 = l0->data;
|
||||
tsk2->area.is_active = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
panel.task_active->area.is_active = 0;
|
||||
panel.task_active = 0;
|
||||
if (task_active) {
|
||||
if (task_active->win == tsk->win) {
|
||||
Task *tsk2;
|
||||
GSList *l0;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
|
||||
tsk2 = l0->data;
|
||||
tsk2->area.is_active = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
task_active = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Window icon changed */
|
||||
else if (at == server.atom._NET_WM_ICON) {
|
||||
if (tsk->icon_data) {
|
||||
free (tsk->icon_data);
|
||||
tsk->icon_data = 0;
|
||||
}
|
||||
tsk->area.redraw = 1;
|
||||
panel.refresh = 1;
|
||||
get_icon(tsk);
|
||||
Task *tsk2;
|
||||
GSList *l0;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||
for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
|
||||
tsk2 = l0->data;
|
||||
if (tsk->win == tsk2->win && tsk != tsk2) {
|
||||
tsk2->icon_width = tsk->icon_width;
|
||||
tsk2->icon_height = tsk->icon_height;
|
||||
tsk2->icon_data = tsk->icon_data;
|
||||
tsk2->area.redraw = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
panel_refresh = 1;
|
||||
}
|
||||
/* Window desktop changed */
|
||||
else if (at == server.atom._NET_WM_DESKTOP) {
|
||||
remove_task (tsk);
|
||||
add_task (win);
|
||||
panel.refresh = 1;
|
||||
panel_refresh = 1;
|
||||
}
|
||||
|
||||
if (!server.got_root_win) server.root_win = RootWindow (server.dsp, server.screen);
|
||||
|
@ -377,17 +396,18 @@ void event_property_notify (Window win, Atom at)
|
|||
|
||||
void event_configure_notify (Window win)
|
||||
{
|
||||
if (panel.mode != MULTI_MONITOR) return;
|
||||
if (panel_mode != SINGLE_MONITOR) return;
|
||||
if (server.nb_monitor == 1) return;
|
||||
|
||||
Task *tsk = task_get_task (win);
|
||||
if (!tsk) return;
|
||||
|
||||
Taskbar *tskbar = tsk->area.parent;
|
||||
if (tskbar->monitor != window_get_monitor (win)) {
|
||||
Panel *p = tsk->area.panel;
|
||||
if (p->monitor != window_get_monitor (win)) {
|
||||
// task on another monitor
|
||||
remove_task (tsk);
|
||||
add_task (win);
|
||||
panel.refresh = 1;
|
||||
panel_refresh = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,8 +425,12 @@ void event_timer()
|
|||
// update clock
|
||||
time_clock.tv_sec = stv.tv_sec;
|
||||
time_clock.tv_sec -= time_clock.tv_sec % time_precision;
|
||||
panel.clock.area.redraw = 1;
|
||||
panel.refresh = 1;
|
||||
|
||||
int i;
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
panel1[i].clock.area.redraw = 1;
|
||||
}
|
||||
panel_refresh = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -416,16 +440,14 @@ int main (int argc, char *argv[])
|
|||
fd_set fd;
|
||||
int x11_fd, i, c;
|
||||
struct timeval tv;
|
||||
Panel *panel;
|
||||
|
||||
c = getopt (argc, argv, "c:");
|
||||
init ();
|
||||
|
||||
load_config:
|
||||
// append full transparency background
|
||||
list_back = g_slist_append(0, calloc(1, sizeof(Area)));
|
||||
|
||||
// read tint2rc config
|
||||
i = 0;
|
||||
init_config();
|
||||
if (c != -1)
|
||||
i = config_read_file (optarg);
|
||||
if (!i)
|
||||
|
@ -435,15 +457,15 @@ load_config:
|
|||
cleanup();
|
||||
exit(1);
|
||||
}
|
||||
config_finish ();
|
||||
|
||||
window_draw_panel ();
|
||||
config_finish();
|
||||
|
||||
// BUG: refresh(clock) is needed here, but 'on the paper' it's not necessary.
|
||||
refresh(&panel.clock.area);
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
refresh(&panel1[i].clock.area);
|
||||
}
|
||||
|
||||
x11_fd = ConnectionNumber (server.dsp);
|
||||
XSync (server.dsp, False);
|
||||
x11_fd = ConnectionNumber(server.dsp);
|
||||
XSync(server.dsp, False);
|
||||
|
||||
while (1) {
|
||||
// thanks to AngryLlama for the timer
|
||||
|
@ -461,21 +483,24 @@ load_config:
|
|||
|
||||
switch (e.type) {
|
||||
case ButtonPress:
|
||||
if (e.xbutton.button == 1) event_button_press (e.xbutton.x, e.xbutton.y);
|
||||
//printf("ButtonPress %lx\n", e.xproperty.window);
|
||||
if (e.xbutton.button == 1) event_button_press (&e);
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
event_button_release (e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
||||
event_button_release (&e);
|
||||
break;
|
||||
|
||||
case Expose:
|
||||
panel = get_panel(e.xany.window);
|
||||
if (!panel) break;
|
||||
//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.paddingxlr, 0, panel.area.width-(2*panel.area.paddingxlr), panel.area.height, 0, 0);
|
||||
XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, 0, 0, panel.area.width, panel.area.height, 0, 0);
|
||||
//XCopyArea (server.dsp, server.pmap, panel.main_win, server.gc, panel.area.paddingxlr, 0, panel.area.width-(2*panel.area.paddingxlr), panel.area.height, 0, 0);
|
||||
XCopyArea (server.dsp, panel->root_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0);
|
||||
break;
|
||||
|
||||
case PropertyNotify:
|
||||
//printf("PropertyNotify\n");
|
||||
//printf("PropertyNotify %lx\n", e.xproperty.window);
|
||||
event_property_notify (e.xproperty.window, e.xproperty.atom);
|
||||
break;
|
||||
|
||||
|
@ -490,7 +515,7 @@ load_config:
|
|||
}
|
||||
else event_timer();
|
||||
|
||||
switch (panel.signal_pending) {
|
||||
switch (signal_pending) {
|
||||
case SIGUSR1:
|
||||
goto load_config;
|
||||
case SIGINT:
|
||||
|
@ -499,10 +524,12 @@ load_config:
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (panel.refresh && !panel.sleep_mode) {
|
||||
visual_refresh ();
|
||||
//printf(" *** visual_refresh\n");
|
||||
}
|
||||
if (panel_refresh) {
|
||||
for (i=0 ; i < nb_panel ; i++)
|
||||
visual_refresh(&panel1[i]);
|
||||
XFlush (server.dsp);
|
||||
panel_refresh = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
BIN
src/tint2
BIN
src/tint2
Binary file not shown.
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "area.h"
|
||||
#include "server.h"
|
||||
#include "panel.h"
|
||||
|
||||
|
||||
void refresh (Area *a)
|
||||
|
@ -37,13 +38,11 @@ void refresh (Area *a)
|
|||
if (a->use_active)
|
||||
draw(a, 1);
|
||||
a->redraw = 0;
|
||||
//printf("end draw pix\n");
|
||||
}
|
||||
|
||||
Pixmap *pmap = (a->is_active == 0) ? (&a->pix.pmap) : (&a->pix_active.pmap);
|
||||
|
||||
// draw current Area
|
||||
XCopyArea (server.dsp, *pmap, server.pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
|
||||
Pixmap *pmap = (a->is_active == 0) ? (&a->pix.pmap) : (&a->pix_active.pmap);
|
||||
XCopyArea (server.dsp, *pmap, ((Panel *)a->panel)->root_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
|
||||
|
||||
// and then refresh child object
|
||||
GSList *l = a->list;
|
||||
|
@ -71,7 +70,7 @@ void draw (Area *a, int active)
|
|||
*pmap = XCreatePixmap (server.dsp, server.root_win, a->width, a->height, server.depth);
|
||||
|
||||
// add layer of root pixmap
|
||||
XCopyArea (server.dsp, server.pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
|
||||
XCopyArea (server.dsp, ((Panel *)a->panel)->root_pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
|
||||
|
||||
cairo_surface_t *cs;
|
||||
cairo_t *c;
|
||||
|
@ -153,9 +152,8 @@ void draw_background (Area *a, cairo_t *c, int active)
|
|||
|
||||
void remove_area (Area *a)
|
||||
{
|
||||
Area *parent;
|
||||
Area *parent = (Area*)a->parent;
|
||||
|
||||
parent = (Area*)a->parent;
|
||||
parent->list = g_slist_remove(parent->list, a);
|
||||
set_redraw (parent);
|
||||
|
||||
|
@ -164,9 +162,8 @@ void remove_area (Area *a)
|
|||
|
||||
void add_area (Area *a)
|
||||
{
|
||||
Area *parent;
|
||||
Area *parent = (Area*)a->parent;
|
||||
|
||||
parent = (Area*)a->parent;
|
||||
parent->list = g_slist_remove(parent->list, a);
|
||||
set_redraw (parent);
|
||||
|
||||
|
|
|
@ -80,6 +80,8 @@ typedef struct {
|
|||
int paddingxlr, paddingx, paddingy;
|
||||
// parent Area
|
||||
void *parent;
|
||||
// panel
|
||||
void *panel;
|
||||
|
||||
// each object can overwrite following function
|
||||
void (*draw_foreground)(void *obj, cairo_t *c, int active);
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
|
||||
#include "area.h"
|
||||
|
||||
// taskbar table : convert 2 dimension in 1 dimension
|
||||
#define index(i, j) ((i * panel.nb_monitor) + j)
|
||||
|
||||
/*
|
||||
void fxfree(void** ptr){
|
||||
if(*ptr){
|
||||
|
@ -33,6 +30,7 @@ FXint fxmalloc(void** ptr,unsigned long size){
|
|||
// mouse actions
|
||||
enum { NONE=0, CLOSE, TOGGLE, ICONIFY, SHADE, TOGGLE_ICONIFY };
|
||||
|
||||
#define ALLDESKTOP 0xFFFFFFFF
|
||||
|
||||
|
||||
typedef struct config_border
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "common.h"
|
||||
#include "window.h"
|
||||
#include "server.h"
|
||||
#include "panel.h"
|
||||
|
||||
|
||||
|
||||
|
@ -93,11 +94,16 @@ int window_is_hidden (Window win)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
XFree(at);
|
||||
|
||||
for (i=0 ; i < nb_panel ; i++) {
|
||||
if (panel1[i].main_win == win)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// specification
|
||||
// Windows with neither _NET_WM_WINDOW_TYPE nor WM_TRANSIENT_FOR set
|
||||
// MUST be taken as top-level window.
|
||||
XFree(at);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -114,6 +120,8 @@ int window_get_monitor (Window win)
|
|||
Window src;
|
||||
|
||||
XTranslateCoordinates(server.dsp, win, server.root_win, 0, 0, &x, &y, &src);
|
||||
x += 2;
|
||||
y += 2;
|
||||
for (i = 0; i < server.nb_monitor; i++) {
|
||||
if (x >= server.monitor[i].x && x <= (server.monitor[i].x + server.monitor[i].width))
|
||||
if (y >= server.monitor[i].y && y <= (server.monitor[i].y + server.monitor[i].height))
|
||||
|
|
|
@ -12,13 +12,6 @@
|
|||
#include <pango/pangocairo.h>
|
||||
|
||||
|
||||
typedef struct window_global
|
||||
{
|
||||
Window main_win;
|
||||
} window_global;
|
||||
|
||||
window_global window;
|
||||
|
||||
void set_active (Window win);
|
||||
void set_desktop (int desktop);
|
||||
void set_close (Window win);
|
||||
|
|
17
tintrc01
17
tintrc01
|
@ -1,5 +1,5 @@
|
|||
#---------------------------------------------
|
||||
# TINT CONFIG FILE
|
||||
# TINT2 CONFIG FILE
|
||||
#---------------------------------------------
|
||||
|
||||
#---------------------------------------------
|
||||
|
@ -23,10 +23,10 @@ border_color = #ffffff 70
|
|||
#---------------------------------------------
|
||||
# PANEL
|
||||
#---------------------------------------------
|
||||
panel_monitor = 1
|
||||
panel_position = bottom center
|
||||
panel_size = 0 30
|
||||
panel_margin = 20 2
|
||||
panel_monitor = all
|
||||
panel_position = top center
|
||||
panel_size = 90% 30
|
||||
panel_margin = 0 0
|
||||
panel_padding = 9 0
|
||||
font_shadow = 0
|
||||
panel_background_id = 1
|
||||
|
@ -34,7 +34,7 @@ panel_background_id = 1
|
|||
#---------------------------------------------
|
||||
# TASKBAR
|
||||
#---------------------------------------------
|
||||
taskbar_mode = single_desktop
|
||||
taskbar_mode = single_monitor
|
||||
taskbar_padding = 2 4
|
||||
taskbar_background_id = 0
|
||||
|
||||
|
@ -52,11 +52,6 @@ task_active_font_color = #ffffff 85
|
|||
task_background_id = 2
|
||||
task_active_background_id = 3
|
||||
|
||||
#---------------------------------------------
|
||||
# SYSTRAY
|
||||
#---------------------------------------------
|
||||
#systray_padding = 9 3
|
||||
#systray_background_id = 0
|
||||
|
||||
#---------------------------------------------
|
||||
# CLOCK
|
||||
|
|
22
tintrc02
22
tintrc02
|
@ -1,5 +1,5 @@
|
|||
#---------------------------------------------
|
||||
# TINT CONFIG FILE
|
||||
# TINT2 CONFIG FILE
|
||||
#---------------------------------------------
|
||||
|
||||
#---------------------------------------------
|
||||
|
@ -23,10 +23,10 @@ border_color = #cccccc 40
|
|||
#---------------------------------------------
|
||||
# PANEL
|
||||
#---------------------------------------------
|
||||
panel_monitor = 1
|
||||
panel_position = top center
|
||||
panel_size = 0 27
|
||||
panel_margin = 5 0
|
||||
panel_monitor = all
|
||||
panel_position = bottom center
|
||||
panel_size = 92% 30
|
||||
panel_margin = 0 0
|
||||
panel_padding = 7 3 7
|
||||
font_shadow = 0
|
||||
panel_background_id = 1
|
||||
|
@ -34,7 +34,7 @@ panel_background_id = 1
|
|||
#---------------------------------------------
|
||||
# TASKBAR
|
||||
#---------------------------------------------
|
||||
taskbar_mode = multi_monitor
|
||||
taskbar_mode = multi_desktop
|
||||
taskbar_padding = 0 0 0
|
||||
taskbar_background_id = 2
|
||||
|
||||
|
@ -43,21 +43,15 @@ taskbar_background_id = 2
|
|||
#---------------------------------------------
|
||||
task_icon = 1
|
||||
task_text = 0
|
||||
task_width = 35
|
||||
task_width = 34
|
||||
task_centered = 1
|
||||
task_padding = 2 1
|
||||
task_padding = 2 3
|
||||
task_font = sans 8
|
||||
task_font_color = #ffffff 60
|
||||
task_active_font_color = #ffffff 100
|
||||
task_background_id = 0
|
||||
task_active_background_id = 3
|
||||
|
||||
#---------------------------------------------
|
||||
# SYSTRAY
|
||||
#---------------------------------------------
|
||||
#systray_padding = 9 3
|
||||
#systray_background_id = 0
|
||||
|
||||
#---------------------------------------------
|
||||
# CLOCK
|
||||
#---------------------------------------------
|
||||
|
|
24
tintrc03
24
tintrc03
|
@ -1,5 +1,5 @@
|
|||
#---------------------------------------------
|
||||
# TINT CONFIG FILE
|
||||
# TINT2 CONFIG FILE
|
||||
#---------------------------------------------
|
||||
|
||||
#---------------------------------------------
|
||||
|
@ -16,24 +16,23 @@ background_color = #ffffff 30
|
|||
border_color = #ffffff 15
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
# PANEL
|
||||
#---------------------------------------------
|
||||
panel_monitor = 1
|
||||
panel_monitor = all
|
||||
panel_position = bottom center
|
||||
panel_size = 0 30
|
||||
panel_size = 100% 30
|
||||
panel_margin = 0 0
|
||||
panel_padding = 5 4
|
||||
panel_padding = 6 0 6
|
||||
font_shadow = 0
|
||||
panel_background_id = 0
|
||||
panel_background_id = 1
|
||||
|
||||
#---------------------------------------------
|
||||
# TASKBAR
|
||||
#---------------------------------------------
|
||||
taskbar_mode = multi_desktop
|
||||
taskbar_padding = 8 0 0
|
||||
taskbar_background_id = 1
|
||||
taskbar_background_id = 0
|
||||
|
||||
#---------------------------------------------
|
||||
# TASKS
|
||||
|
@ -42,20 +41,13 @@ task_icon = 1
|
|||
task_text = 1
|
||||
task_width = 160
|
||||
task_centered = 1
|
||||
task_padding = 2 1
|
||||
task_padding = 2 5
|
||||
task_font = Dejavu sans 8
|
||||
task_font_color = #000000 60
|
||||
task_active_font_color = #000000 100
|
||||
task_background_id = 0
|
||||
task_active_background_id = 2
|
||||
|
||||
#---------------------------------------------
|
||||
# SYSTRAY
|
||||
#---------------------------------------------
|
||||
#systray_padding = 9 3
|
||||
#systray_icon_opacity = 50
|
||||
#systray_background_id = 1
|
||||
|
||||
#---------------------------------------------
|
||||
# CLOCK
|
||||
#---------------------------------------------
|
||||
|
@ -65,7 +57,7 @@ time1_font = Dejavu sans 10
|
|||
time2_font = sans 7
|
||||
clock_font_color = #000000 80
|
||||
clock_padding = 8 0
|
||||
clock_background_id = 1
|
||||
clock_background_id = 0
|
||||
|
||||
#---------------------------------------------
|
||||
# MOUSE ACTION ON TASK
|
||||
|
|
23
tintrc06
23
tintrc06
|
@ -1,5 +1,5 @@
|
|||
#---------------------------------------------
|
||||
# TINT CONFIG FILE
|
||||
# TINT2 CONFIG FILE
|
||||
#---------------------------------------------
|
||||
|
||||
#---------------------------------------------
|
||||
|
@ -24,9 +24,9 @@ border_color = #ffffff 0
|
|||
#---------------------------------------------
|
||||
# PANEL
|
||||
#---------------------------------------------
|
||||
panel_monitor = 1
|
||||
panel_position = bottom left
|
||||
panel_size = 0 30
|
||||
panel_monitor = all
|
||||
panel_position = bottom center
|
||||
panel_size = 95% 30
|
||||
panel_margin = 0 0
|
||||
panel_padding = 9 2 7
|
||||
font_shadow = 0
|
||||
|
@ -42,30 +42,23 @@ taskbar_background_id = 1
|
|||
#---------------------------------------------
|
||||
# TASKS
|
||||
#---------------------------------------------
|
||||
task_icon = 0
|
||||
task_icon = 1
|
||||
task_text = 1
|
||||
task_width = 160
|
||||
task_centered = 1
|
||||
task_padding = 2 2
|
||||
task_padding = 4 2
|
||||
task_font = sans bold 8
|
||||
task_font_color = #ffffff 60
|
||||
task_active_font_color = #ffffff 85
|
||||
task_background_id = 0
|
||||
task_active_background_id = 2
|
||||
|
||||
#---------------------------------------------
|
||||
# SYSTRAY
|
||||
#---------------------------------------------
|
||||
#systray_padding = 9 3
|
||||
#systray_icon_opacity = 50
|
||||
#systray_background_id = 1
|
||||
|
||||
#---------------------------------------------
|
||||
# CLOCK
|
||||
#---------------------------------------------
|
||||
time1_format = %A %d %H:%M
|
||||
time1_format = %H:%M
|
||||
time1_font = sans bold 8
|
||||
#time2_format = %A %d %B
|
||||
time2_format = %A %d %B
|
||||
time2_font = sans 7
|
||||
clock_font_color = #ffffff 65
|
||||
clock_padding = 6 0
|
||||
|
|
Loading…
Reference in a new issue