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
m_parent = parent;
if (m_parent) m_parent->AddChild( this );
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 );
Display *xdisplay = wxGlobalDisplay();
int xscreen = DefaultScreen( xdisplay );
Visual *xvisual = DefaultVisual( xdisplay, xscreen );
{
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
- int *tmp = NULL;
- (*tmp) = 1;
- return;
+ // Core dump now
+ int *tmp = NULL;
+ (*tmp) = 1;
+ return;
+ Window xwindow = (Window) GetMainWindow();
+
g_captureWindow = (wxWindow*) this;
g_captureWindow = (wxWindow*) this;
- 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
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
if (res != GrabSuccess)
{
if (res != GrabSuccess)
{
- wxString msg;
- msg.Printf("Failed to grab pointer for window %s", this->GetClassInfo()->GetClassName());
- wxLogDebug(msg);
- if (res == GrabNotViewable)
- {
- wxLogDebug("This is not a viewable window - perhaps not shown yet?");
- }
- g_captureWindow = NULL;
+ wxString msg;
+ msg.Printf("Failed to grab pointer for window %s", this->GetClassInfo()->GetClassName());
+ wxLogDebug(msg);
+ if (res == GrabNotViewable)
+ {
+ wxLogDebug("This is not a viewable window - perhaps not shown yet?");
+ }
+ g_captureWindow = NULL;
- wxLogDebug("Grabbed pointer");
+
+ wxLogDebug("Grabbed pointer");
#if 0
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
#if 0
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
#if 0
res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
#if 0
res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask,
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask,
GrabModeAsync,
GrabModeAsync,
CurrentTime);
GrabModeAsync,
GrabModeAsync,
CurrentTime);
{
wxLogDebug("Failed to grab keyboard.");
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
{
wxLogDebug("Failed to grab keyboard.");
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
(Window) GetMainWindow());
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
(Window) GetMainWindow());
void wxWindowX11::DoReleaseMouse()
{
g_captureWindow = NULL;
void wxWindowX11::DoReleaseMouse()
{
g_captureWindow = NULL;
if ( !m_winCaptured )
return;
if ( !m_winCaptured )
return;
- Window wMain = (Window)GetMainWindow();
+ Window xwindow = (Window) GetMainWindow();
- XUngrabPointer(wxGlobalDisplay(), wMain);
+ XUngrabPointer( wxGlobalDisplay(), CurrentTime );
- XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
- wMain);
- XUngrabKeyboard(wxGlobalDisplay(), CurrentTime);
+ XUngrabButton( wxGlobalDisplay(), AnyButton, AnyModifier, xwindow);
+ XUngrabKeyboard( wxGlobalDisplay(), CurrentTime );
#endif
}
wxLogDebug("Ungrabbed pointer");
#endif
}
wxLogDebug("Ungrabbed pointer");