John's possible fix to the Bad Window problems that some people have

been experiencing.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3610 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-02-28 14:36:23 +00:00
parent 4b07057b7e
commit 3026a589b0
4 changed files with 36 additions and 4 deletions

View 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

View 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());
}

View 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

View 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);
}
}