tooltip in the way when typing

"corvid" <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <20130115065150.GA26418@local>
With fltk's built-in tooltip system, Fl::handle_(), upon receipt of a
FL_KEYBOARD event, calls Fl_Tooltip::enter((Fl_Widget*)0); to hide
the tooltip.

Once in a while, after giving a text input focus, I'm careless with
the mouse, moving it away and then back over the input, putting a
tooltip over what I'm typing. (And presumably textareas could have
that happen as well...)

Here's one way that it could be dealt with:

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
tooltip_leave.diff (text/plain, 915 B)
diff -r dd6f2d1eb15a dw/fltkui.cc
--- a/dw/fltkui.cc	Mon Jan 14 10:26:37 2013 -0300
+++ b/dw/fltkui.cc	Tue Jan 15 06:25:46 2013 +0000
@@ -591,7 +591,7 @@
    if (password)
       input->type(FL_SECRET_INPUT);
    input->callback (widgetCallback, this);
-   input->when (FL_WHEN_ENTER_KEY_ALWAYS);
+   input->when (FL_WHEN_ENTER_KEY_ALWAYS | FL_WHEN_CHANGED);
 
    if (label) {
       input->label(label);
@@ -666,7 +666,17 @@
 
 void FltkEntryResource::widgetCallback (Fl_Widget *widget, void *data)
 {
-   ((FltkEntryResource*)data)->emitActivate ();
+   FltkEntryResource *res = (FltkEntryResource *)data;
+
+   if (Fl::event_key() == FL_Enter)
+      res->emitActivate ();
+   else {
+      /* Don't let a tooltip obscure what we're doing. */
+      core::style::Tooltip *tooltip = res->style->x_tooltip;
+
+      if (tooltip)
+         tooltip->onLeave();
+   }
 }
 
 const char *FltkEntryResource::getText ()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.