]> Dogcows Code - chaz/tint2/blobdiff - src/tooltip/tooltip.c
Fix segfault when the tooltip has no background in config
[chaz/tint2] / src / tooltip / tooltip.c
index cf62db392d68afcd605d6002398196448766bf3d..714e0a324d6af8eb407bb86eedfca38959d44f71 100644 (file)
@@ -62,6 +62,8 @@ void init_tooltip()
 {
        if (!g_tooltip.font_desc)
                g_tooltip.font_desc = pango_font_description_from_string("sans 10");
+       if (g_tooltip.bg == 0)
+               g_tooltip.bg = &g_array_index(backgrounds, Background, 0);
 
        XSetWindowAttributes attr;
        attr.override_redirect = True;
@@ -99,7 +101,10 @@ void tooltip_show(void* arg)
        int mx, my;
        Window w;
        XTranslateCoordinates( server.dsp, server.root_win, g_tooltip.panel->main_win, x, y, &mx, &my, &w);
-       Area* area = click_area(g_tooltip.panel, mx, my);
+       Area* area;
+       if (!panel_horizontal)
+               my += height/2; /* we adjusted y in tooltip_trigger_show, revert or we won't find the correct area anymore */
+       area = click_area(g_tooltip.panel, mx, my);
        stop_tooltip_timeout();
        if (!g_tooltip.mapped && area->_get_tooltip_text) {
                tooltip_copy_text(area);
This page took 0.021609 seconds and 4 git commands to generate.