diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-05-10 05:19:21 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-05-10 05:19:21 +0200 |
commit | 25cb8d05c3cbc4e497a0189abb836ea97e441dd0 (patch) | |
tree | ea7dd7b732598a5bee66d2560dbe96dccb4a021b | |
parent | 38c798787810b52da2695df7fe6623f9010ef204 (diff) |
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
-rw-r--r-- | dw/fltkviewport.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index dd779a8f..aa1e8120 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -236,11 +236,20 @@ int FltkViewport::handle (int event) 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(); |