changeset 1908:8955c455fa01

different fix for the getWidgetAtPoint problems
author corvid <corvid@lavabit.com>
date Wed, 23 Feb 2011 18:39:01 +0000
parents 5f92140e4bce
children 8433f221dabb cedef3974c12
files dw/layout.cc dw/layout.hh
diffstat 2 files changed, 11 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/dw/layout.cc	Wed Feb 23 08:19:03 2011 +0000
+++ b/dw/layout.cc	Wed Feb 23 18:39:01 2011 +0000
@@ -185,7 +185,6 @@
    view = NULL;
    topLevel = NULL;
    widgetAtPoint = NULL;
-   deletingTopLevel = false;
 
    DBG_OBJ_CREATE (this, "DwRenderLayout");
 
@@ -226,10 +225,11 @@
       platform->removeIdle (resizeIdleId);
    if (bgColor)
       bgColor->unref ();
-   deletingTopLevel = true;
-   if (topLevel)
-      delete topLevel;
-   deletingTopLevel = false;
+   if (topLevel) {
+      Widget *w = topLevel;
+      topLevel = NULL;
+      delete w;
+   }
    delete platform;
    delete view;
    delete anchorsTable;
@@ -282,10 +282,11 @@
 void Layout::setWidget (Widget *widget)
 {
    widgetAtPoint = NULL;
-   deletingTopLevel = true;
-   if (topLevel)
-      delete topLevel;
-   deletingTopLevel = false;
+   if (topLevel) {
+      Widget *w = topLevel;
+      topLevel = NULL;
+      delete w;
+   }
    textZone->zoneFree ();
    addWidget (widget);
 
@@ -775,9 +776,6 @@
 {
    EventButton event;
 
-   if (deletingTopLevel)
-      return true;
-
    moveToWidgetAtPoint (x, y, state);
 
    event.xCanvas = x;
@@ -836,7 +834,7 @@
 {
    _MSG ("------------------------------------------------------------\n");
    _MSG ("widget at (%d, %d)\n", x, y);
-   if (topLevel && !deletingTopLevel)
+   if (topLevel)
       return topLevel->getWidgetAtPoint (x, y, 0);
    else
       return NULL;
--- a/dw/layout.hh	Wed Feb 23 08:19:03 2011 +0000
+++ b/dw/layout.hh	Wed Feb 23 18:39:01 2011 +0000
@@ -132,7 +132,6 @@
    Platform *platform;
    View *view;
    Widget *topLevel, *widgetAtPoint;
-   bool deletingTopLevel; // XXX quick hack for fltk-1.3 port
 
    /* The state, which must be projected into the view. */
    style::Color *bgColor;