#include "tooltip.h"
#include "timer.h"
+
void signal_handler(int sig)
{
// signal handler is light as it should be
{
int i;
+ // set global data
+ default_timeout();
+ default_systray();
+ memset(&server, 0, sizeof(Server_global));
+ default_battery();
+ default_clock();
+ default_taskbar();
+ default_tooltip();
+ default_config();
+
// read options
for (i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
// sigaddset(&block_mask, SIGHUP);
// sigaddset(&block_mask, SIGUSR1);
// sigprocmask(SIG_BLOCK, &block_mask, 0);
-
- // set global data
- memset(&server, 0, sizeof(Server_global));
- memset(&systray, 0, sizeof(Systraybar));
}
void init_X11()
void cleanup()
{
- stop_all_timeouts();
+printf("*** cleanup()\n");
+ cleanup_timeout();
cleanup_systray();
stop_net();
cleanup_panel();
#ifdef ENABLE_BATTERY
cleanup_battery();
#endif
+ cleanup_config();
if (default_icon) {
imlib_context_set_image(default_icon);
imlib_free_image();
}
- if (config_path) g_free(config_path);
- if (snapshot_path) g_free(snapshot_path);
cleanup_server();
if (server.dsp) XCloseDisplay(server.dsp);
{
Panel *panel = &panel1[0];
- if (panel->temp_pmap) XFreePixmap(server.dsp, panel->temp_pmap);
- panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
+ if (panel->area.width > server.monitor[0].width)
+ panel->area.width = server.monitor[0].width;
+ panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
refresh(&panel->area);
Imlib_Image img = NULL;
img = imlib_create_image_from_drawable(0, 0, 0, panel->area.width, panel->area.height, 0);
imlib_context_set_image(img);
+ if (!panel_horizontal) {
+ // rotate 90° vertical panel
+ imlib_image_flip_horizontal();
+ imlib_image_flip_diagonal();
+ }
imlib_save_image(path);
imlib_free_image();
+ XFreePixmap(server.dsp, panel->temp_pmap);
}
Panel * panel = get_panel(e->xany.window);
if(!panel || !task_drag)
return;
-
+
// Find the taskbar on the event's location
Taskbar * event_taskbar = click_taskbar(panel, e->xbutton.x, e->xbutton.y);
if(event_taskbar == NULL)
return;
}
- // switch desktop
- if (panel_mode == MULTI_DESKTOP) {
- if (tskbar->desktop != server.desktop && action != CLOSE && action != DESKTOP_LEFT && action != DESKTOP_RIGHT)
- set_desktop (tskbar->desktop);
- }
-
// drag and drop task
if (task_dragged) {
task_drag = 0;
return;
}
+ // switch desktop
+ if (panel_mode == MULTI_DESKTOP) {
+ if (tskbar->desktop != server.desktop && action != CLOSE && action != DESKTOP_LEFT && action != DESKTOP_RIGHT)
+ set_desktop (tskbar->desktop);
+ }
+
// action on task
window_action( click_task(panel, e->xbutton.x, e->xbutton.y), action);
init (argc, argv);
init_config();
+ init_X11();
+
i = 0;
if (config_path)
i = config_read_file (config_path);
exit(1);
}
- init_X11();
init_panel();
cleanup_config();
if (snapshot_path) {
unsigned int button_mask = Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask;
if (e.xmotion.state & button_mask)
event_button_motion_notify (&e);
-
+
if (!g_tooltip.enabled) break;
Panel* panel = get_panel(e.xmotion.window);
Area* area = click_area(panel, e.xmotion.x, e.xmotion.y);