Removed some debug code from window headers; added some debug
code to try to figure out capture problems git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -314,7 +314,6 @@ protected:
 | 
				
			|||||||
    virtual void DoSetClientSize(int width, int height);
 | 
					    virtual void DoSetClientSize(int width, int height);
 | 
				
			||||||
    virtual void DoMoveWindow(int x, int y, int width, int height);
 | 
					    virtual void DoMoveWindow(int x, int y, int width, int height);
 | 
				
			||||||
    virtual bool DoPopupMenu(wxMenu *menu, int x, int y);
 | 
					    virtual bool DoPopupMenu(wxMenu *menu, int x, int y);
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    virtual void DoCaptureMouse();
 | 
					    virtual void DoCaptureMouse();
 | 
				
			||||||
    virtual void DoReleaseMouse();
 | 
					    virtual void DoReleaseMouse();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -76,6 +76,8 @@ public:
 | 
				
			|||||||
    // Processes an X event.
 | 
					    // Processes an X event.
 | 
				
			||||||
    virtual void ProcessXEvent(WXEvent* event);
 | 
					    virtual void ProcessXEvent(WXEvent* event);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    virtual void OnAssert(const wxChar *file, int line, const wxChar *msg);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    bool                  m_showOnInit;
 | 
					    bool                  m_showOnInit;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -168,7 +168,6 @@ protected:
 | 
				
			|||||||
        int sizeFlags = wxSIZE_AUTO);
 | 
					        int sizeFlags = wxSIZE_AUTO);
 | 
				
			||||||
    virtual void DoSetClientSize(int width, int height);
 | 
					    virtual void DoSetClientSize(int width, int height);
 | 
				
			||||||
    virtual void DoMoveWindow(int x, int y, int width, int height);
 | 
					    virtual void DoMoveWindow(int x, int y, int width, int height);
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    virtual void DoCaptureMouse();
 | 
					    virtual void DoCaptureMouse();
 | 
				
			||||||
    virtual void DoReleaseMouse();
 | 
					    virtual void DoReleaseMouse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1837,6 +1837,7 @@ int wxMenuBar::GetMenuFromPoint(const wxPoint& pos) const
 | 
				
			|||||||
void wxMenuBar::SelectMenu(size_t pos)
 | 
					void wxMenuBar::SelectMenu(size_t pos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SetFocus();
 | 
					    SetFocus();
 | 
				
			||||||
 | 
					    wxLogDebug("Capturing mouse from wxMenuBar::SelectMenu");
 | 
				
			||||||
    CaptureMouse();
 | 
					    CaptureMouse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DoSelectMenu(pos);
 | 
					    DoSelectMenu(pos);
 | 
				
			||||||
@@ -1925,6 +1926,7 @@ void wxMenuBar::OnLeftDown(wxMouseEvent& event)
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        else // on item
 | 
					        else // on item
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
						    wxLogDebug("Capturing mouse from wxMenuBar::OnLeftDown");
 | 
				
			||||||
            CaptureMouse();
 | 
					            CaptureMouse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // show it as selected
 | 
					            // show it as selected
 | 
				
			||||||
@@ -2286,7 +2288,10 @@ void wxMenuBar::OnDismissMenu(bool dismissMenuBar)
 | 
				
			|||||||
void wxMenuBar::OnDismiss()
 | 
					void wxMenuBar::OnDismiss()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if ( GetCapture() )
 | 
					    if ( GetCapture() )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        wxLogDebug("Releasing mouse from wxMenuBar::OnDismiss");
 | 
				
			||||||
        GetCapture()->ReleaseMouse();
 | 
					        GetCapture()->ReleaseMouse();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ( m_current != -1 )
 | 
					    if ( m_current != -1 )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -755,6 +755,19 @@ wxApp::GetStdIcon(int which) const
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    // While the GUI isn't working that well, just print out the
 | 
				
			||||||
 | 
					    // message.
 | 
				
			||||||
 | 
					#if 0    
 | 
				
			||||||
 | 
					    wxAppBase::OnAssert(file, line, msg);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    wxString msg2;
 | 
				
			||||||
 | 
					    msg2.Printf("At file %s:%d: %s", file, line, msg);
 | 
				
			||||||
 | 
					    wxLogDebug(msg2);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
// accessors for C modules
 | 
					// accessors for C modules
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -259,17 +259,22 @@ bool wxWindowX11::Enable(bool enable)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool wxWindowX11::Show(bool show)
 | 
					bool wxWindowX11::Show(bool show)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if ( !wxWindowBase::Show(show) )
 | 
					    wxWindowBase::Show(show);
 | 
				
			||||||
        return FALSE;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Window xwin = (Window) GetXWindow();
 | 
					    Window xwin = (Window) GetXWindow();
 | 
				
			||||||
    Display *xdisp = (Display*) GetXDisplay();
 | 
					    Display *xdisp = (Display*) GetXDisplay();
 | 
				
			||||||
    if (show)
 | 
					    if (show)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        wxString msg;
 | 
				
			||||||
 | 
						msg.Printf("Mapping window of type %s", GetClassInfo()->GetClassName());
 | 
				
			||||||
 | 
						wxLogDebug(msg);
 | 
				
			||||||
        XMapWindow(xdisp, xwin);
 | 
					        XMapWindow(xdisp, xwin);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        wxString msg;
 | 
				
			||||||
 | 
						msg.Printf("Unmapping window of type %s", GetClassInfo()->GetClassName());
 | 
				
			||||||
 | 
						wxLogDebug(msg);
 | 
				
			||||||
        XUnmapWindow(xdisp, xwin);
 | 
					        XUnmapWindow(xdisp, xwin);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -292,10 +297,21 @@ void wxWindowX11::Lower()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void wxWindowX11::DoCaptureMouse()
 | 
					void wxWindowX11::DoCaptureMouse()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    g_captureWindow = (wxWindow*) this;
 | 
					    if ((g_captureWindow != NULL) && (g_captureWindow != this))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
						wxASSERT_MSG(FALSE, "Trying to capture before mouse released.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Core dump now
 | 
				
			||||||
 | 
						int *tmp = NULL;
 | 
				
			||||||
 | 
						(*tmp) = 1;
 | 
				
			||||||
 | 
						return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    if ( m_winCaptured )
 | 
					    if ( m_winCaptured )
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_captureWindow = (wxWindow*) this;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (GetMainWindow())
 | 
					    if (GetMainWindow())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        int res = XGrabPointer(wxGlobalDisplay(), (Window) GetMainWindow(),
 | 
					        int res = XGrabPointer(wxGlobalDisplay(), (Window) GetMainWindow(),
 | 
				
			||||||
@@ -309,10 +325,19 @@ void wxWindowX11::DoCaptureMouse()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (res != GrabSuccess)
 | 
					        if (res != GrabSuccess)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            wxLogDebug("Failed to grab pointer.");
 | 
						    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;
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
						wxLogDebug("Grabbed pointer");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
        res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
 | 
					        res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
 | 
				
			||||||
            (Window) GetMainWindow(),
 | 
					            (Window) GetMainWindow(),
 | 
				
			||||||
            FALSE,
 | 
					            FALSE,
 | 
				
			||||||
@@ -328,7 +353,9 @@ void wxWindowX11::DoCaptureMouse()
 | 
				
			|||||||
            XUngrabPointer(wxGlobalDisplay(), CurrentTime);
 | 
					            XUngrabPointer(wxGlobalDisplay(), CurrentTime);
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
        res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
 | 
					        res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
            ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask,
 | 
					            ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask,
 | 
				
			||||||
@@ -343,10 +370,13 @@ 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
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
        m_winCaptured = TRUE;
 | 
					        m_winCaptured = TRUE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -363,10 +393,13 @@ void wxWindowX11::DoReleaseMouse()
 | 
				
			|||||||
    if ( wMain )
 | 
					    if ( wMain )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        XUngrabPointer(wxGlobalDisplay(), wMain);
 | 
					        XUngrabPointer(wxGlobalDisplay(), wMain);
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
        XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
 | 
					        XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
 | 
				
			||||||
                wMain);
 | 
					                wMain);
 | 
				
			||||||
        XUngrabKeyboard(wxGlobalDisplay(), CurrentTime);
 | 
					        XUngrabKeyboard(wxGlobalDisplay(), CurrentTime);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    wxLogDebug("Ungrabbed pointer");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_winCaptured = FALSE;
 | 
					    m_winCaptured = FALSE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user