Don't add popup windows to wxTopLevelWindows,
       espially not if you don't delete them later.
     Corrected ReleaseMouse().


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-02-14 00:45:13 +00:00
parent 81762e79b8
commit 346d4fcde7
2 changed files with 27 additions and 31 deletions

View File

@@ -49,8 +49,6 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
m_parent = parent;
if (m_parent) m_parent->AddChild( this );
wxTopLevelWindows.Append(this);
Display *xdisplay = wxGlobalDisplay();
int xscreen = DefaultScreen( xdisplay );
Visual *xvisual = DefaultVisual( xdisplay, xscreen );

View File

@@ -301,21 +301,23 @@ void wxWindowX11::DoCaptureMouse()
return;
}
if ( m_winCaptured )
if (m_winCaptured)
return;
Window xwindow = (Window) GetMainWindow();
g_captureWindow = (wxWindow*) this;
if (GetMainWindow())
if (xwindow)
{
int res = XGrabPointer(wxGlobalDisplay(), (Window) GetMainWindow(),
int res = XGrabPointer(wxGlobalDisplay(), xwindow,
FALSE,
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
GrabModeAsync,
GrabModeAsync,
None,
None, /* cursor */ // TODO: This may need to be set to the cursor of this window
CurrentTime);
CurrentTime );
if (res != GrabSuccess)
{
@@ -329,6 +331,7 @@ void wxWindowX11::DoCaptureMouse()
g_captureWindow = NULL;
return;
}
wxLogDebug("Grabbed pointer");
#if 0
@@ -351,11 +354,8 @@ void wxWindowX11::DoCaptureMouse()
#if 0
res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
#if 0
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask,
#else
FALSE,
#endif
GrabModeAsync,
GrabModeAsync,
CurrentTime);
@@ -364,10 +364,8 @@ void wxWindowX11::DoCaptureMouse()
{
wxLogDebug("Failed to grab keyboard.");
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
#if 0
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
(Window) GetMainWindow());
#endif
return;
}
#endif
@@ -379,18 +377,18 @@ void wxWindowX11::DoCaptureMouse()
void wxWindowX11::DoReleaseMouse()
{
g_captureWindow = NULL;
if ( !m_winCaptured )
return;
Window wMain = (Window)GetMainWindow();
Window xwindow = (Window) GetMainWindow();
if ( wMain )
if (xwindow)
{
XUngrabPointer(wxGlobalDisplay(), wMain);
XUngrabPointer( wxGlobalDisplay(), CurrentTime );
#if 0
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
wMain);
XUngrabKeyboard(wxGlobalDisplay(), CurrentTime);
XUngrabButton( wxGlobalDisplay(), AnyButton, AnyModifier, xwindow);
XUngrabKeyboard( wxGlobalDisplay(), CurrentTime );
#endif
}
wxLogDebug("Ungrabbed pointer");