}
-void init ()
+void init (int argc, char *argv[])
{
+ int c;
+
+ // read options
+ c = getopt (argc, argv, "c:");
+ if (c != -1) {
+ config_path = strdup (optarg);
+ c = getopt (argc, argv, "j:");
+ if (c != -1)
+ thumbnail_path = strdup (optarg);
+ }
+
// Set signal handler
signal(SIGUSR1, signal_handler);
signal(SIGINT, signal_handler);
#endif
if (clock_lclick_command) g_free(clock_lclick_command);
if (clock_rclick_command) g_free(clock_rclick_command);
+ if (config_path) g_free(config_path);
+ if (thumbnail_path) g_free(thumbnail_path);
if (server.monitor) free(server.monitor);
XFreeGC(server.dsp, server.gc);
window_maximize_restore (tsk->win);
break;
case DESKTOP_LEFT:
- if ( desk == 0 ) break;
+ if ( tsk->desktop == 0 ) break;
desk = tsk->desktop - 1;
windows_set_desktop(tsk->win, desk);
if (desk == server.desktop)
set_active(tsk->win);
break;
case DESKTOP_RIGHT:
- if (desk == server.nb_desktop ) break;
+ if (tsk->desktop == server.nb_desktop ) break;
desk = tsk->desktop + 1;
windows_set_desktop(tsk->win, desk);
if (desk == server.desktop)
// switch desktop
if (panel_mode == MULTI_DESKTOP) {
- if (tskbar->desktop != server.desktop && action != CLOSE && action != mouse_tilt_left && action != mouse_tilt_right)
+ if (tskbar->desktop != server.desktop && action != CLOSE && action != DESKTOP_LEFT && action != DESKTOP_RIGHT)
set_desktop (tskbar->desktop);
}
// Change desktop
else if (at == server.atom._NET_CURRENT_DESKTOP) {
server.desktop = server_get_current_desktop ();
+ for (i=0 ; i < nb_panel ; i++) {
+ Panel *panel = &panel1[i];
+ if (panel_mode == MULTI_DESKTOP && panel->g_taskbar.use_active) {
+ // redraw taskbar
+ panel_refresh = 1;
+ Taskbar *tskbar;
+ Task *tsk;
+ GSList *l;
+ for (j=0 ; j < panel->nb_desktop ; j++) {
+ tskbar = &panel->taskbar[j];
+ if (tskbar->area.is_active) {
+ tskbar->area.is_active = 0;
+ tskbar->area.redraw = 1;
+ for (l = tskbar->area.list; l ; l = l->next) {
+ tsk = l->data;
+ tsk->area.redraw = 1;
+ }
+ }
+ if (j == server.desktop) {
+ tskbar->area.is_active = 1;
+ tskbar->area.redraw = 1;
+ for (l = tskbar->area.list; l ; l = l->next) {
+ tsk = l->data;
+ tsk->area.redraw = 1;
+ }
+ }
+ }
+ }
+ }
if (panel_mode != MULTI_DESKTOP) {
visible_object();
}
{
XEvent e;
fd_set fd;
- int x11_fd, i, c;
+ int x11_fd, i;
struct timeval tv;
Panel *panel;
GSList *it;
- init ();
+ init (argc, argv);
load_config:
i = 0;
- c = getopt (argc, argv, "c:");
init_config();
- if (c != -1) {
- i = config_read_file (optarg);
- c = getopt (argc, argv, "j:");
- if (c != -1) {
- // usage: tint2 [-c] <config_file> -j <file> for internal use
- printf("file %s\n", optarg);
- cleanup();
- exit(0);
- }
+ if (config_path)
+ i = config_read_file (config_path);
+ else
+ i = config_read ();
+ if (!i) {
+ fprintf(stderr, "usage: tint2 [-c] <config_file>\n");
+ cleanup();
+ exit(1);
}
- if (!i)
- i = config_read ();
- if (!i) {
- fprintf(stderr, "usage: tint2 [-c] <config_file>\n");
- cleanup();
- exit(1);
- }
config_finish();
+ if (thumbnail_path) {
+ // usage: tint2 -j <file> for internal use
+ printf("file %s\n", thumbnail_path);
+ cleanup();
+ exit(0);
+ }
x11_fd = ConnectionNumber(server.dsp);
XSync(server.dsp, False);