changeset 3963:eb902ac9fc66

Fix a problem with FLTK's fl_oldfocus variable (now private) Starting with fltk-1.3.3, we can't use fl_oldfocus, this patch fixes this problem. IOW. this patch is necessary to link with fltk-1.3.3.
author Jorge Arellano Cid <jcid@dillo.org>
date Tue, 18 Nov 2014 12:53:29 -0300
parents 59a0c49315d7
children e126cef02388
files dw/fltkviewbase.cc dw/fltkviewbase.hh
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkviewbase.cc	Tue Nov 18 11:48:08 2014 +0100
+++ b/dw/fltkviewbase.cc	Tue Nov 18 12:53:29 2014 -0300
@@ -69,7 +69,7 @@
    canvasHeight = 1;
    bgColor = FL_WHITE;
    mouse_x = mouse_y = 0;
-   // focused_child = NULL;
+   focused_child = NULL;
    exposeArea = NULL;
    if (backBuffer == NULL) {
       backBuffer = new BackBuffer ();
@@ -355,8 +355,6 @@
    case FL_LEAVE:
       theLayout->leaveNotify (this, getDwButtonState ());
       break;
-#if 0
-   // BUG: starting with fltk-1.3.3, we can't use fl_oldfocus.
    case FL_FOCUS:
       if (focused_child && find(focused_child) < children()) {
          /* strangely, find() == children() if the child is not found */
@@ -364,9 +362,11 @@
       }
       return 1;
    case FL_UNFOCUS:
-      focused_child = fl_oldfocus;
+      // was: focused_child = fl_oldfocus;
+      for (Fl_Widget *p = this; p; p = p->parent())
+        focused_child = p;
+
       return 0;
-#endif
    case FL_KEYBOARD:
       if (Fl::event_key() == FL_Tab)
          return manageTabToFocus();
--- a/dw/fltkviewbase.hh	Tue Nov 18 11:48:08 2014 +0100
+++ b/dw/fltkviewbase.hh	Tue Nov 18 12:53:29 2014 -0300
@@ -56,7 +56,7 @@
    core::Layout *theLayout;
    int canvasWidth, canvasHeight;
    int mouse_x, mouse_y;
-   // Fl_Widget *focused_child;
+   Fl_Widget *focused_child;
 
    virtual int translateViewXToCanvasX (int x) = 0;
    virtual int translateViewYToCanvasY (int y) = 0;