summaryrefslogtreecommitdiff
path: root/src/tipwin.hh
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2012-11-14 09:56:01 -0300
committerJorge Arellano Cid <jcid@dillo.org>2012-11-14 09:56:01 -0300
commitf1a5856eeda2ee4c17dd7b1d4dfa0d8f4330ad3e (patch)
treec2e47588894418653eeb58b8050cf9e868ff34f9 /src/tipwin.hh
parentb56864d7c883b204f55bf31eb09fc30a68ab4f10 (diff)
Avoid scroll flickering with a custom tooltip class (TipWin) & a custom button
Removed the workaround [1] that added a full UI and viewport redraw to conceal the lingering tooltips bug [2]. It produced annoying scroll flickering when the mouse was in the UI but outside the viewport (e.g. over the panel). This is more a FLTK bug than anything; the FLTK team's plan is to fix it in FLTK3, and also extend the tooltips API. As FLTK3 may take long to be released, and porting dillo to it is non-trivial (if both events ever come to happen), this custom solution looks quite reasonable for the present times. The patch introduces a new CustButton class that uses TipWin, and thus the tooltip handling is no longer handled by FLTK. This patch switches the UI buttons to the new CustButton. 1] http://lists.auriga.wearlab.de/pipermail/dillo-dev/2011-July/008515.html 2] http://lists.auriga.wearlab.de/pipermail/dillo-dev/2011-July/008494.html
Diffstat (limited to 'src/tipwin.hh')
-rw-r--r--src/tipwin.hh58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/tipwin.hh b/src/tipwin.hh
new file mode 100644
index 00000000..77ffa60e
--- /dev/null
+++ b/src/tipwin.hh
@@ -0,0 +1,58 @@
+#ifndef __TIPWIN_HH__
+#define __TIPWIN_HH__
+
+#include <FL/Fl_Menu_Window.H>
+#include <FL/Fl_Button.H>
+
+
+/*
+ * Custom tooltip window
+ */
+class TipWin : public Fl_Menu_Window {
+ char tip[256];
+ int bgcolor, recent;
+ void *cur_widget;
+public:
+ TipWin();
+ void draw();
+ void value(const char *s);
+ void do_show(void *wid);
+ void do_hide();
+ void recent_tooltip(int val);
+
+ void cancel(void *wid) {
+ if (wid == cur_widget) { cur_widget = NULL; do_hide(); }
+ }
+};
+
+extern TipWin *my_tipwin(void);
+
+
+/*
+ * A Button sharing a custom tooltip window
+ */
+class TipWinButton : public Fl_Button {
+ char *mytooltip;
+ TipWin *tipwin;
+ public:
+ TipWinButton(int x, int y, int w, int h, const char *l = 0);
+ ~TipWinButton();
+ virtual int handle(int e);
+
+ void set_tooltip(const char *s);
+};
+
+/*
+ * A button that highlights on mouse over
+ */
+class CustButton : public TipWinButton {
+ Fl_Color norm_color, light_color;
+public:
+ CustButton(int x, int y, int w, int h, const char *l=0);
+ virtual int handle(int e);
+ void hl_color(Fl_Color col);
+};
+
+
+#endif // __TIPWIN_HH__
+