+/**************************************************************************
+*
+* Copyright (C) 2009 Andreas.Fink (Andreas.Fink85@gmail.com)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License version 2
+* as published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+**************************************************************************/
+
#include <stdio.h>
#include <unistd.h>
#include <cairo.h>
}
+void cleanup_tooltip()
+{
+ alarm(0);
+ tooltip_hide();
+ g_tooltip.enabled = False;
+ g_tooltip.current_state = TOOLTIP_ABOUT_TO_HIDE;
+ if (g_tooltip.task) {
+ g_tooltip.task = 0;
+ }
+ if (g_tooltip.window) {
+ XDestroyWindow(server.dsp, g_tooltip.window);
+ g_tooltip.window = 0;
+ }
+ if (g_tooltip.font_desc) {
+ pango_font_description_free(g_tooltip.font_desc);
+ g_tooltip.font_desc = 0;
+ }
+}
+
+
void tooltip_sighandler(int sig)
{
if (g_tooltip.current_state == TOOLTIP_ABOUT_TO_SHOW)
g_tooltip.current_state = TOOLTIP_ABOUT_TO_SHOW;
g_tooltip.task = task;
struct timeval t = g_tooltip.show_timeout.it_value;
- if (t.tv_sec == 0 && t.tv_usec == 0)
+ if (t.tv_sec == 0 && t.tv_usec == 0) {
+ alarm(0);
tooltip_show();
+ }
else
setitimer(ITIMER_REAL, &g_tooltip.show_timeout, 0);
}
if (!g_tooltip.mapped) {
g_tooltip.mapped = True;
XMapWindow(server.dsp, g_tooltip.window);
- tooltip_update();
+ //tooltip_update();
alarm(0);
}
}
else if (panel_position & LEFT)
x = panel->posx + panel->area.width;
else
- x = panel->posx - width;
+ x = panel->posx - width;
+
g_object_unref(layout);
cairo_destroy(c);
cairo_surface_destroy(cs);
int min_x, min_y, max_width, max_height;
Panel* panel = g_tooltip.task->area.panel;
- int screen_width = server.monitor[panel->monitor].width;
- int screen_height = server.monitor[panel->monitor].height;
+ int screen_width = server.monitor[panel->monitor].x + server.monitor[panel->monitor].width;
+ int screen_height = server.monitor[panel->monitor].y + server.monitor[panel->monitor].height;
if ( x+width <= screen_width && y+height <= screen_height && x>=0 && y>=0)
return; // no adjustment needed
min_x=0;
}
- if (x+width > server.monitor[panel->monitor].width)
- x = server.monitor[panel->monitor].width-width;
- if ( y+height>server.monitor[panel->monitor].height)
- y = server.monitor[panel->monitor].height-height;
+ if (x+width > server.monitor[panel->monitor].x + server.monitor[panel->monitor].width)
+ x = server.monitor[panel->monitor].x + server.monitor[panel->monitor].width - width;
+ if ( y+height > server.monitor[panel->monitor].y + server.monitor[panel->monitor].height)
+ y = server.monitor[panel->monitor].y + server.monitor[panel->monitor].height - height;
if (x<min_x)
x=min_x;
return;
}
+ //printf("tooltip_update\n");
tooltip_update_geometry();
tooltip_adjust_geometry();
XMoveResizeWindow(server.dsp, g_tooltip.window, x, y, width, height);
if (g_tooltip.mapped) {
g_tooltip.current_state = TOOLTIP_ABOUT_TO_HIDE;
struct timeval t = g_tooltip.hide_timeout.it_value;
- if (t.tv_sec == 0 && t.tv_usec == 0)
+ g_tooltip.task = 0;
+ if (t.tv_sec == 0 && t.tv_usec == 0) {
tooltip_hide();
+ alarm(0);
+ }
else
setitimer(ITIMER_REAL, &g_tooltip.hide_timeout, 0);
}
g_tooltip.mapped = False;
XUnmapWindow(server.dsp, g_tooltip.window);
}
- g_tooltip.task = 0;
}