]> git.lyx.org Git - features.git/commitdiff
John's possible fix to the Bad Window problems that some people have
authorAngus Leeming <leeming@lyx.org>
Thu, 28 Feb 2002 14:36:23 +0000 (14:36 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 28 Feb 2002 14:36:23 +0000 (14:36 +0000)
been experiencing.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3610 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/FormBase.C
src/frontends/xforms/FormBaseDeprecated.C
src/frontends/xforms/FormFiledialog.C

index e89f12a11393d26f43d6776ef376fa9d6317ed80..838f9fc27d4a73455ea04bdd570f589f7e64b9d8 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-28  John Levon  <moz@compsoc.man.ac.uk>
+
+       * FormBase.C:
+       * FormBaseDeprecated.C:
+       * FormFiledialog.C: possible fix to the Bad Window problems that some
+       people have been experiencing.
+
 2002-02-28  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormForks.C (input_button_all): resolve comparison between signed
index bb16b6fa75f0158f5c873bd7b53d5cfe38b7b1bc..814247e298bebe8c302b445d69350e2a7cac7221 100644 (file)
@@ -19,6 +19,7 @@
 #include "Dialogs.h"
 #include "FormBase.h"
 #include "xformsBC.h"
+#include "GUIRunTime.h"
 #include "support/LAssert.h"
 #include "Tooltips.h"
 #include "xforms_helpers.h" // formatted
@@ -109,6 +110,13 @@ void FormBase::show()
 
 void FormBase::hide()
 {
+       // xforms sometimes tries to process a hint-type MotionNotify, and
+       // use XQueryPointer, without verifying if the window still exists.
+       // So we try to clear out motion events in the queue before the
+       // DestroyNotify
+       XSync(fl_get_display(), false);
+       GUIRunTime::processEvents();
+
        if (form() && form()->visible)
                fl_hide_form(form());
 }
index f9ed4ef1fce84e8b3d38fe6483e9d926c6a0089f..cd17667c900ca2f84da38cbdaef95878be9c97d0 100644 (file)
@@ -19,6 +19,7 @@
 #include "Dialogs.h"
 #include "FormBaseDeprecated.h"
 #include "LyXView.h"
+#include "GUIRunTime.h"
 #include "support/LAssert.h"
 #include "xformsBC.h"
 #include "lyxrc.h"
@@ -113,6 +114,13 @@ void FormBaseDeprecated::show()
 
 void FormBaseDeprecated::hide()
 {
+       // xforms sometimes tries to process a hint-type MotionNotify, and
+       // use XQueryPointer, without verifying if the window still exists.
+       // So we try to clear out motion events in the queue before the
+       // DestroyNotify
+       XSync(fl_get_display(), false);
+       GUIRunTime::processEvents();
+
        if (form() && form()->visible) {
                // some dialogs might do things to the form first
                // such as the nested tabfolder problem in Preferences
index 95a4701b88b4276016bf8a305cd48f18f6420e3a..e5ed32b8e446e647f491397c9102c65640e0b5df 100644 (file)
@@ -509,25 +509,34 @@ string const FileDialog::Private::GetDirectory() const
                return string(".");
 }
 
+namespace {
+       bool x_sync_kludge(bool ret) 
+       {
+               XSync(fl_get_display(), false);
+               return ret;
+       }
+} // namespace anon
 
 // RunDialog: handle dialog during file selection
 bool FileDialog::Private::RunDialog()
 {
        force_cancel = false;
        force_ok = false;
-       
+
         // event loop
         while (true) {
                 FL_OBJECT * pObject = fl_do_forms();
 
                 if (pObject == pFileDlgForm->Ready) {
                        if (HandleOK())
-                               return true;
+                               return x_sync_kludge(true);
+
                } else if (pObject == pFileDlgForm->Cancel
                           || force_cancel)
-                       return false;
+                       return x_sync_kludge(false);
+
                else if (force_ok)
-                       return true;
+                       return x_sync_kludge(true);
        }
 }