patch from Robert Escriva and fixed MULTI_MONITOR mode with task_on_all_desktop
git-svn-id: http://tint2.googlecode.com/svn/trunk@27 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
d818e66097
commit
024e8fb1f3
6 changed files with 69 additions and 79 deletions
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
2009-01-19
|
||||||
|
- patch from Robert Escriva, fixed tint2 on multi-monitor
|
||||||
|
- fixed bug between MULTI_MONITOR mode and 'task on all desktop'
|
||||||
|
|
||||||
2009-01-18
|
2009-01-18
|
||||||
- update documentation for new config format
|
- update documentation for new config format
|
||||||
- fixed memory corruption
|
- fixed memory corruption
|
||||||
|
|
|
@ -529,7 +529,7 @@ void config_finish ()
|
||||||
fprintf(stderr, "tint2 error : invalid monitor size.\n");
|
fprintf(stderr, "tint2 error : invalid monitor size.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!panel.area.width) panel.area.width = server.monitor[panel.monitor].width;
|
if (!panel.area.width) panel.area.width = server.monitor[panel.monitor].width - 1;
|
||||||
|
|
||||||
// taskbar
|
// taskbar
|
||||||
g_taskbar.posy = panel.area.pix.border.width + panel.area.paddingy;
|
g_taskbar.posy = panel.area.pix.border.width + panel.area.paddingy;
|
||||||
|
|
|
@ -37,64 +37,47 @@
|
||||||
void add_task (Window win)
|
void add_task (Window win)
|
||||||
{
|
{
|
||||||
Task *new_tsk;
|
Task *new_tsk;
|
||||||
int desktop, monitor;
|
int desktop, monitor, all_desktop;
|
||||||
|
|
||||||
if (!win) return;
|
if (!win) return;
|
||||||
if (window_is_hidden (win) || win == window.main_win) return;
|
if (window_is_hidden (win) || win == window.main_win) return;
|
||||||
|
|
||||||
|
desktop = window_get_desktop (win);
|
||||||
|
if (desktop == 0xFFFFFFFF) {
|
||||||
|
desktop = 0;
|
||||||
|
all_desktop = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
all_desktop = 0;
|
||||||
|
|
||||||
|
if (panel.mode == MULTI_MONITOR) monitor = window_get_monitor (win);
|
||||||
|
else monitor = 0;
|
||||||
|
|
||||||
|
deb:
|
||||||
new_tsk = malloc(sizeof(Task));
|
new_tsk = malloc(sizeof(Task));
|
||||||
new_tsk->win = win;
|
new_tsk->win = win;
|
||||||
|
new_tsk->all_desktop = all_desktop;
|
||||||
new_tsk->title = 0;
|
new_tsk->title = 0;
|
||||||
new_tsk->icon_data = 0;
|
new_tsk->icon_data = 0;
|
||||||
|
|
||||||
get_icon(new_tsk);
|
get_icon(new_tsk);
|
||||||
get_title(new_tsk);
|
get_title(new_tsk);
|
||||||
memcpy(&new_tsk->area, &g_task.area, sizeof(Area));
|
memcpy(&new_tsk->area, &g_task.area, sizeof(Area));
|
||||||
desktop = window_get_desktop (new_tsk->win);
|
|
||||||
monitor = window_get_monitor (new_tsk->win);
|
|
||||||
|
|
||||||
//if (panel.mode == MULTI_MONITOR) monitor = window_get_monitor (new_tsk->win);
|
|
||||||
//else monitor = 0;
|
|
||||||
//printf("task %s : desktop %d, monitor %d\n", new_tsk->title, desktop, monitor);
|
//printf("task %s : desktop %d, monitor %d\n", new_tsk->title, desktop, monitor);
|
||||||
XSelectInput (server.dsp, new_tsk->win, PropertyChangeMask|StructureNotifyMask);
|
XSelectInput (server.dsp, new_tsk->win, PropertyChangeMask|StructureNotifyMask);
|
||||||
|
|
||||||
Taskbar *tskbar;
|
Taskbar *tskbar = &panel.taskbar[index(desktop, monitor)];
|
||||||
if (desktop == 0xFFFFFFFF) {
|
|
||||||
tskbar = &panel.taskbar[index(0, monitor)];
|
|
||||||
new_tsk->all_desktop = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tskbar = &panel.taskbar[index(desktop, monitor)];
|
|
||||||
new_tsk->all_desktop = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//printf("add_task %d %s\n", index(desktop, monitor), new_tsk->title);
|
|
||||||
new_tsk->area.parent = tskbar;
|
new_tsk->area.parent = tskbar;
|
||||||
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk);
|
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk);
|
||||||
|
|
||||||
if (resize_tasks (tskbar))
|
if (resize_tasks (tskbar))
|
||||||
set_redraw (&tskbar->area);
|
set_redraw (&tskbar->area);
|
||||||
|
|
||||||
if (desktop == 0xFFFFFFFF) {
|
if (all_desktop) {
|
||||||
// task on all desktop
|
desktop++;
|
||||||
int i;
|
if (desktop < server.nb_desktop)
|
||||||
Task *new_tsk2;
|
goto deb;
|
||||||
for (i = 1 ; i < server.nb_desktop ; i++) {
|
|
||||||
new_tsk2 = malloc(sizeof(Task));
|
|
||||||
memcpy(new_tsk2, new_tsk, sizeof(Task));
|
|
||||||
|
|
||||||
new_tsk2->title = 0;
|
|
||||||
new_tsk2->icon_data = 0;
|
|
||||||
get_icon(new_tsk2);
|
|
||||||
get_title(new_tsk2);
|
|
||||||
|
|
||||||
tskbar = &panel.taskbar[index(i, monitor)];
|
|
||||||
new_tsk2->area.parent = tskbar;
|
|
||||||
tskbar->area.list = g_slist_append(tskbar->area.list, new_tsk2);
|
|
||||||
|
|
||||||
if (resize_tasks (tskbar))
|
|
||||||
set_redraw (&tskbar->area);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,31 +85,51 @@ void add_task (Window win)
|
||||||
void remove_task (Task *tsk)
|
void remove_task (Task *tsk)
|
||||||
{
|
{
|
||||||
if (!tsk) return;
|
if (!tsk) return;
|
||||||
|
|
||||||
|
Task *tsk2 = tsk;
|
||||||
Taskbar *tskbar;
|
Taskbar *tskbar;
|
||||||
tskbar = (Taskbar*)tsk->area.parent;
|
Window win = tsk->win;
|
||||||
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk);
|
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;
|
||||||
|
|
||||||
|
tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2);
|
||||||
resize_tasks (tskbar);
|
resize_tasks (tskbar);
|
||||||
set_redraw (&tskbar->area);
|
set_redraw (&tskbar->area);
|
||||||
//printf("remove_task %d %s\n", index(tskbar->desktop, tskbar->monitor), tsk->title);
|
//printf("remove_task %d %s\n", index(tskbar->desktop, tskbar->monitor), tsk->title);
|
||||||
|
|
||||||
if (tsk == panel.task_active)
|
if (tsk2 == panel.task_active)
|
||||||
panel.task_active = 0;
|
panel.task_active = 0;
|
||||||
if (tsk == panel.task_drag)
|
if (tsk2 == panel.task_drag)
|
||||||
panel.task_drag = 0;
|
panel.task_drag = 0;
|
||||||
|
|
||||||
if (tsk->title) {
|
if (tsk2->title)
|
||||||
free (tsk->title);
|
free (tsk2->title);
|
||||||
tsk->title = 0;
|
if (tsk2->icon_data)
|
||||||
}
|
free (tsk2->icon_data);
|
||||||
if (tsk->icon_data) {
|
|
||||||
free (tsk->icon_data);
|
|
||||||
tsk->icon_data = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
XFreePixmap (server.dsp, tsk->area.pix.pmap);
|
XFreePixmap (server.dsp, tsk2->area.pix.pmap);
|
||||||
XFreePixmap (server.dsp, tsk->area.pix_active.pmap);
|
XFreePixmap (server.dsp, tsk2->area.pix_active.pmap);
|
||||||
free(tsk);
|
free(tsk2);
|
||||||
|
|
||||||
|
if (all_desktop) {
|
||||||
|
desktop++;
|
||||||
|
if (desktop < server.nb_desktop)
|
||||||
|
goto deb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
27
src/tint.c
27
src/tint.c
|
@ -364,23 +364,7 @@ void event_property_notify (Window win, Atom at)
|
||||||
}
|
}
|
||||||
/* Window desktop changed */
|
/* Window desktop changed */
|
||||||
else if (at == server.atom._NET_WM_DESKTOP) {
|
else if (at == server.atom._NET_WM_DESKTOP) {
|
||||||
Window win2 = tsk->win;
|
remove_task (tsk);
|
||||||
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 ; ) {
|
|
||||||
tsk2 = l0->data;
|
|
||||||
l0 = l0->next;
|
|
||||||
if (win2 == tsk2->win)
|
|
||||||
remove_task (tsk2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
remove_task (tsk);
|
|
||||||
add_task (win);
|
add_task (win);
|
||||||
panel.refresh = 1;
|
panel.refresh = 1;
|
||||||
}
|
}
|
||||||
|
@ -392,16 +376,16 @@ void event_property_notify (Window win, Atom at)
|
||||||
|
|
||||||
void event_configure_notify (Window win)
|
void event_configure_notify (Window win)
|
||||||
{
|
{
|
||||||
Task *tsk;
|
if (panel.mode != MULTI_MONITOR) return;
|
||||||
|
|
||||||
tsk = task_get_task (win);
|
Task *tsk = task_get_task (win);
|
||||||
if (!tsk) return;
|
if (!tsk) return;
|
||||||
|
|
||||||
Taskbar *tskbar = tsk->area.parent;
|
Taskbar *tskbar = tsk->area.parent;
|
||||||
if (tskbar->monitor != window_get_monitor (win)) {
|
if (tskbar->monitor != window_get_monitor (win)) {
|
||||||
// task on another monitor
|
// task on another monitor
|
||||||
add_task (tsk->win);
|
|
||||||
remove_task (tsk);
|
remove_task (tsk);
|
||||||
|
add_task (win);
|
||||||
panel.refresh = 1;
|
panel.refresh = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,8 +483,7 @@ load_config:
|
||||||
if (e.xconfigure.window == server.root_win)
|
if (e.xconfigure.window == server.root_win)
|
||||||
goto load_config;
|
goto load_config;
|
||||||
else
|
else
|
||||||
if (panel.mode == MULTI_MONITOR)
|
event_configure_notify (e.xconfigure.window);
|
||||||
event_configure_notify (e.xconfigure.window);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
src/tint2
BIN
src/tint2
Binary file not shown.
6
tintrc02
6
tintrc02
|
@ -19,8 +19,8 @@ border_color = #cccccc 40
|
||||||
# PANEL
|
# PANEL
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
panel_monitor = 1
|
panel_monitor = 1
|
||||||
panel_position = top right
|
panel_position = bottom left
|
||||||
panel_size = 600 27
|
panel_size = 0 27
|
||||||
panel_margin = 0 0
|
panel_margin = 0 0
|
||||||
panel_padding = 4 0
|
panel_padding = 4 0
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
@ -29,7 +29,7 @@ panel_background_id = 1
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
# TASKBAR
|
# TASKBAR
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
taskbar_mode = multi_desktop
|
taskbar_mode = multi_monitor
|
||||||
taskbar_padding = 4 0
|
taskbar_padding = 4 0
|
||||||
taskbar_background_id = 0
|
taskbar_background_id = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue