wxX11:
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:
@@ -49,8 +49,6 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
|||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
if (m_parent) m_parent->AddChild( this );
|
if (m_parent) m_parent->AddChild( this );
|
||||||
|
|
||||||
wxTopLevelWindows.Append(this);
|
|
||||||
|
|
||||||
Display *xdisplay = wxGlobalDisplay();
|
Display *xdisplay = wxGlobalDisplay();
|
||||||
int xscreen = DefaultScreen( xdisplay );
|
int xscreen = DefaultScreen( xdisplay );
|
||||||
Visual *xvisual = DefaultVisual( xdisplay, xscreen );
|
Visual *xvisual = DefaultVisual( xdisplay, xscreen );
|
||||||
|
@@ -293,43 +293,46 @@ void wxWindowX11::DoCaptureMouse()
|
|||||||
{
|
{
|
||||||
if ((g_captureWindow != NULL) && (g_captureWindow != this))
|
if ((g_captureWindow != NULL) && (g_captureWindow != this))
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(FALSE, "Trying to capture before mouse released.");
|
wxASSERT_MSG(FALSE, "Trying to capture before mouse released.");
|
||||||
|
|
||||||
// Core dump now
|
// Core dump now
|
||||||
int *tmp = NULL;
|
int *tmp = NULL;
|
||||||
(*tmp) = 1;
|
(*tmp) = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_winCaptured )
|
if (m_winCaptured)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Window xwindow = (Window) GetMainWindow();
|
||||||
|
|
||||||
g_captureWindow = (wxWindow*) this;
|
g_captureWindow = (wxWindow*) this;
|
||||||
|
|
||||||
if (GetMainWindow())
|
if (xwindow)
|
||||||
{
|
{
|
||||||
int res = XGrabPointer(wxGlobalDisplay(), (Window) GetMainWindow(),
|
int res = XGrabPointer(wxGlobalDisplay(), xwindow,
|
||||||
FALSE,
|
FALSE,
|
||||||
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
|
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
|
||||||
GrabModeAsync,
|
GrabModeAsync,
|
||||||
GrabModeAsync,
|
GrabModeAsync,
|
||||||
None,
|
None,
|
||||||
None, /* cursor */ // TODO: This may need to be set to the cursor of this window
|
None, /* cursor */ // TODO: This may need to be set to the cursor of this window
|
||||||
CurrentTime);
|
CurrentTime );
|
||||||
|
|
||||||
if (res != GrabSuccess)
|
if (res != GrabSuccess)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf("Failed to grab pointer for window %s", this->GetClassInfo()->GetClassName());
|
msg.Printf("Failed to grab pointer for window %s", this->GetClassInfo()->GetClassName());
|
||||||
wxLogDebug(msg);
|
wxLogDebug(msg);
|
||||||
if (res == GrabNotViewable)
|
if (res == GrabNotViewable)
|
||||||
{
|
{
|
||||||
wxLogDebug("This is not a viewable window - perhaps not shown yet?");
|
wxLogDebug("This is not a viewable window - perhaps not shown yet?");
|
||||||
}
|
}
|
||||||
g_captureWindow = NULL;
|
g_captureWindow = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wxLogDebug("Grabbed pointer");
|
|
||||||
|
wxLogDebug("Grabbed pointer");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
||||||
@@ -351,11 +354,8 @@ void wxWindowX11::DoCaptureMouse()
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
|
res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
|
||||||
#if 0
|
|
||||||
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask,
|
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask,
|
||||||
#else
|
|
||||||
FALSE,
|
FALSE,
|
||||||
#endif
|
|
||||||
GrabModeAsync,
|
GrabModeAsync,
|
||||||
GrabModeAsync,
|
GrabModeAsync,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
@@ -364,10 +364,8 @@ void wxWindowX11::DoCaptureMouse()
|
|||||||
{
|
{
|
||||||
wxLogDebug("Failed to grab keyboard.");
|
wxLogDebug("Failed to grab keyboard.");
|
||||||
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
|
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
|
||||||
#if 0
|
|
||||||
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
||||||
(Window) GetMainWindow());
|
(Window) GetMainWindow());
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -379,18 +377,18 @@ void wxWindowX11::DoCaptureMouse()
|
|||||||
void wxWindowX11::DoReleaseMouse()
|
void wxWindowX11::DoReleaseMouse()
|
||||||
{
|
{
|
||||||
g_captureWindow = NULL;
|
g_captureWindow = NULL;
|
||||||
|
|
||||||
if ( !m_winCaptured )
|
if ( !m_winCaptured )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Window wMain = (Window)GetMainWindow();
|
Window xwindow = (Window) GetMainWindow();
|
||||||
|
|
||||||
if ( wMain )
|
if (xwindow)
|
||||||
{
|
{
|
||||||
XUngrabPointer(wxGlobalDisplay(), wMain);
|
XUngrabPointer( wxGlobalDisplay(), CurrentTime );
|
||||||
#if 0
|
#if 0
|
||||||
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
XUngrabButton( wxGlobalDisplay(), AnyButton, AnyModifier, xwindow);
|
||||||
wMain);
|
XUngrabKeyboard( wxGlobalDisplay(), CurrentTime );
|
||||||
XUngrabKeyboard(wxGlobalDisplay(), CurrentTime);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
wxLogDebug("Ungrabbed pointer");
|
wxLogDebug("Ungrabbed pointer");
|
||||||
|
Reference in New Issue
Block a user