From 06f9158af024042154cf34eba7b0d31d827b3aa5 Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Mon, 23 Jul 2007 19:02:15 +0000 Subject: [PATCH] Get rid of spurious tooltips. SVN revision: 30945 --- src/borders.c | 27 +++++++++------------------ src/buttons.c | 22 ++-------------------- src/desktops.c | 22 +--------------------- src/events.c | 4 ++++ src/tooltips.c | 3 +++ 5 files changed, 19 insertions(+), 59 deletions(-) diff --git a/src/borders.c b/src/borders.c index 10e5582f..4255242f 100644 --- a/src/borders.c +++ b/src/borders.c @@ -1024,25 +1024,14 @@ BorderWinpartGetAclass(void *data) } static void -BorderWinpartHandleTooltip(EWinBit * wbit, int event) +BorderWinpartHandleTooltip(EWinBit * wbit) { EWin *ewin = wbit->ewin; int part = wbit - ewin->bits; - switch (event) - { - case ButtonPress: - case LeaveNotify: - TooltipsSetPending(0, NULL, NULL); - break; - case ButtonRelease: - case EnterNotify: - case MotionNotify: - if (!ewin->border->part[part].aclass) - return; - TooltipsSetPending(0, BorderWinpartGetAclass, wbit); - break; - } + if (!ewin->border->part[part].aclass) + return; + TooltipsSetPending(0, BorderWinpartGetAclass, wbit); } static void @@ -1050,9 +1039,6 @@ BorderWinpartHandleEvents(Win win __UNUSED__, XEvent * ev, void *prm) { EWinBit *wbit = (EWinBit *) prm; - /* Beware! Actions may destroy the current border */ - BorderWinpartHandleTooltip(wbit, ev->type); - switch (ev->type) { case ButtonPress: @@ -1062,11 +1048,16 @@ BorderWinpartHandleEvents(Win win __UNUSED__, XEvent * ev, void *prm) BorderWinpartEventMouseUp(wbit, ev); break; case EnterNotify: + /* Beware! Actions may destroy the current border */ + BorderWinpartHandleTooltip(wbit); BorderWinpartEventEnter(wbit, ev); break; case LeaveNotify: BorderWinpartEventLeave(wbit, ev); break; + case MotionNotify: + BorderWinpartHandleTooltip(wbit); + break; } } diff --git a/src/buttons.c b/src/buttons.c index af0158ca..c1849316 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -634,23 +634,6 @@ ButtonGetAclass(void *data) return b->aclass; } -static void -ButtonHandleTooltip(Button * b, int event) -{ - switch (event) - { - case ButtonPress: - case LeaveNotify: - TooltipsSetPending(0, NULL, NULL); - break; - case ButtonRelease: - case EnterNotify: - case MotionNotify: - TooltipsSetPending(0, ButtonGetAclass, b); - break; - } -} - static void ButtonHandleEvents(Win win __UNUSED__, XEvent * ev, void *prm) { @@ -666,6 +649,8 @@ ButtonHandleEvents(Win win __UNUSED__, XEvent * ev, void *prm) break; case MotionNotify: ButtonEventMotion(b, ev); + if (b->aclass) + TooltipsSetPending(0, ButtonGetAclass, b); break; case EnterNotify: ButtonEventMouseIn(b, ev); @@ -675,9 +660,6 @@ ButtonHandleEvents(Win win __UNUSED__, XEvent * ev, void *prm) break; } - if (b->aclass) - ButtonHandleTooltip(b, ev->type); - if (b->func) b->func(b->owner, ev, NULL); } diff --git a/src/desktops.c b/src/desktops.c index 5db417b5..150e949d 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -1173,8 +1173,6 @@ static void DeskSwitchStart(void) { FocusNewDeskBegin(); - - TooltipsSetPending(1, NULL, NULL); } static void @@ -1908,23 +1906,6 @@ DeskGetAclass(void *data __UNUSED__) return ActionclassFind("DESKBINDINGS"); } -static void -DeskHandleTooltip(Desk * dsk, XEvent * ev) -{ - switch (ev->type) - { - case ButtonPress: - case ButtonRelease: - case LeaveNotify: - TooltipsSetPending(1, NULL, NULL); - break; - - case MotionNotify: - TooltipsSetPending(1, DeskGetAclass, dsk); - break; - } -} - static void DeskPropertyChange(Desk * dsk, XEvent * ev) { @@ -1984,6 +1965,7 @@ DeskHandleEvents(Win win __UNUSED__, XEvent * ev, void *prm) case MotionNotify: /* Motion over desk buttons doesn't go here - We probably don't care much. */ DesksSetCurrent(DesktopAt(Mode.events.x, Mode.events.y)); + TooltipsSetPending(1, DeskGetAclass, dsk); break; case ConfigureNotify: @@ -2006,8 +1988,6 @@ DeskHandleEvents(Win win __UNUSED__, XEvent * ev, void *prm) break; #endif } - - DeskHandleTooltip(dsk, ev); } /* Settings */ diff --git a/src/events.c b/src/events.c index 195d761d..e07941ff 100644 --- a/src/events.c +++ b/src/events.c @@ -27,6 +27,7 @@ #include "events.h" #include "session.h" #include "timers.h" +#include "tooltips.h" #include "xwin.h" #include #if USE_XSYNC @@ -275,6 +276,7 @@ HandleEvent(XEvent * ev) Mode.events.time = ev->xbutton.time; ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root); Mode.events.on_screen = ev->xbutton.same_screen; + TooltipsSetPending(0, NULL, NULL); goto do_stuff; case MotionNotify: @@ -296,6 +298,7 @@ HandleEvent(XEvent * ev) if (!Mode.grabs.pointer_grab_active) Mode.grabs.pointer_grab_active = 2; } + TooltipsSetPending(0, NULL, NULL); goto do_stuff; case LeaveNotify: @@ -307,6 +310,7 @@ HandleEvent(XEvent * ev) Mode.grabs.pointer_grab_window = None; Mode.grabs.pointer_grab_active = 0; } + TooltipsSetPending(0, NULL, NULL); goto do_stuff; case PropertyNotify: diff --git a/src/tooltips.c b/src/tooltips.c index 84395d24..ee58143a 100644 --- a/src/tooltips.c +++ b/src/tooltips.c @@ -797,6 +797,9 @@ ToolTipTimeout(int val __UNUSED__, void *data __UNUSED__) void TooltipsSetPending(int type, CB_GetAclass * func, void *data) { + if (!Mode_tooltips.ac_func && !func) + return; + Mode_tooltips.ac_func = func; Mode_tooltips.ac_data = data;