virtual void DoCaptureMouse();
virtual void DoReleaseMouse();
-
+
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
virtual void DoCaptureMouse();
virtual void DoReleaseMouse();
-
+
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
virtual void DoSetClientSize(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 void DoCaptureMouse();
virtual void DoReleaseMouse();
virtual void DoCaptureMouse();
virtual void DoReleaseMouse();
-
+
// move the window to the specified location and resize it: this is called
// from both DoSetSize() and DoSetClientSize() and would usually just call
// ::MoveWindow() except for composite controls which will want to arrange
virtual void DoCaptureMouse(void);
virtual void DoReleaseMouse(void);
-
+
// move the window to the specified location and resize it: this is called
// from both DoSetSize() and DoSetClientSize() and would usually just call
// ::WinSetWindowPos() except for composite controls which will want to arrange
// capture/release the mouse, used by Capture/ReleaseMouse()
virtual void DoCaptureMouse() = 0;
virtual void DoReleaseMouse() = 0;
-
+
// retrieve the position/size of the window
virtual void DoGetPosition( int *x, int *y ) const = 0;
virtual void DoGetSize( int *width, int *height ) const = 0;
// Processes an X event.
virtual void ProcessXEvent(WXEvent* event);
+ virtual void OnAssert(const wxChar *file, int line, const wxChar *msg);
+
protected:
bool m_showOnInit;
int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height);
virtual void DoMoveWindow(int x, int y, int width, int height);
-
virtual void DoCaptureMouse();
virtual void DoReleaseMouse();
-
+
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
void wxMenuBar::SelectMenu(size_t pos)
{
SetFocus();
+ wxLogDebug("Capturing mouse from wxMenuBar::SelectMenu");
CaptureMouse();
DoSelectMenu(pos);
}
else // on item
{
+ wxLogDebug("Capturing mouse from wxMenuBar::OnLeftDown");
CaptureMouse();
// show it as selected
void wxMenuBar::OnDismiss()
{
if ( GetCapture() )
+ {
+ wxLogDebug("Releasing mouse from wxMenuBar::OnDismiss");
GetCapture()->ReleaseMouse();
+ }
if ( m_current != -1 )
{
}
}
+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
// ----------------------------------------------------------------------------
bool wxWindowX11::Show(bool show)
{
- if ( !wxWindowBase::Show(show) )
- return FALSE;
+ wxWindowBase::Show(show);
Window xwin = (Window) GetXWindow();
Display *xdisp = (Display*) GetXDisplay();
if (show)
{
+ wxString msg;
+ msg.Printf("Mapping window of type %s", GetClassInfo()->GetClassName());
+ wxLogDebug(msg);
XMapWindow(xdisp, xwin);
}
else
{
+ wxString msg;
+ msg.Printf("Unmapping window of type %s", GetClassInfo()->GetClassName());
+ wxLogDebug(msg);
XUnmapWindow(xdisp, xwin);
}
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 )
return;
+ g_captureWindow = (wxWindow*) this;
+
if (GetMainWindow())
{
int res = XGrabPointer(wxGlobalDisplay(), (Window) GetMainWindow(),
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;
}
+ wxLogDebug("Grabbed pointer");
+#if 0
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
(Window) GetMainWindow(),
FALSE,
GrabModeAsync,
None,
None);
-
+
if (res != GrabSuccess)
{
wxLogDebug("Failed to grab mouse buttons.");
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
return;
}
+#endif
+#if 0
res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
#if 0
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask,
{
wxLogDebug("Failed to grab keyboard.");
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
+#if 0
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
(Window) GetMainWindow());
+#endif
return;
}
-
+#endif
+
m_winCaptured = TRUE;
}
}
if ( wMain )
{
XUngrabPointer(wxGlobalDisplay(), wMain);
+#if 0
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
wMain);
XUngrabKeyboard(wxGlobalDisplay(), CurrentTime);
+#endif
}
+ wxLogDebug("Ungrabbed pointer");
m_winCaptured = FALSE;
}