changeset 1673:cde7dddff1e7

fix focus handling Let fltk decide which widget should get the focus when the window regains focus. Unfocus any form widgets when the view area is clicked with the left mouse button. Reported by: Roger http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-May/007486.html
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Mon, 10 May 2010 05:19:21 +0200
parents 2ad866aed0a1
children f9c22caddf71
files dw/fltkviewport.cc
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkviewport.cc	Thu Apr 29 21:41:51 2010 +0000
+++ b/dw/fltkviewport.cc	Mon May 10 05:19:21 2010 +0200
@@ -236,11 +236,20 @@
 
    case ::fltk::FOCUS:
       /** \bug Draw focus box. */
-      return 1;
+
+      /* If the user clicks with the left button we take focus
+       * and thereby unfocus any form widgets.
+       * Otherwise we let fltk do the focus handling.
+       */
+      if (::fltk::event_button() == ::fltk::LeftButton) {
+         set_focus(this);
+         return 1;
+      }
+      break;
 
    case ::fltk::UNFOCUS:
       /** \bug Undraw focus box. */
-      return 1;
+      break;
 
    case ::fltk::PUSH:
       take_focus();