// ----------------------------------------------------------------------------
extern wxHashTable *wxWidgetHashTable;
+static wxWindow* g_captureWindow = NULL;
+
// ----------------------------------------------------------------------------
// private functions
// Destructor
wxWindow::~wxWindow()
{
+ if (g_captureWindow == this)
+ g_captureWindow = NULL;
+
m_isBeingDeleted = TRUE;
// Motif-specific actions first
void wxWindow::CaptureMouse()
{
+ g_captureWindow = this;
if ( m_winCaptured )
return;
void wxWindow::ReleaseMouse()
{
+ g_captureWindow = NULL;
if ( !m_winCaptured )
return;
wxAcceleratorEntry* entry = & (entries[i]);
if (entry->MatchesEvent(event))
{
- // Bingo, we have a match. Now find a control that matches the entry
- // command id.
+ // Bingo, we have a match. Now find a control that matches the
+ // entry command id.
// Need to go up to the top of the window hierarchy, since it might
// be e.g. a menu item
{
// I have a dclick
canvas->SetLastClick(0, ts);
- switch ( eventType )
+
+ wxEventType typeDouble;
+ if ( eventType == wxEVT_LEFT_DOWN )
+ typeDouble = wxEVT_LEFT_DCLICK;
+ else if ( eventType == wxEVT_MIDDLE_DOWN )
+ typeDouble = wxEVT_MIDDLE_DCLICK;
+ else if ( eventType == wxEVT_RIGHT_DOWN )
+ typeDouble = wxEVT_RIGHT_DCLICK;
+ else
+ typeDouble = wxEVT_NULL;
+
+ if ( typeDouble != wxEVT_NULL )
{
- case wxEVT_LEFT_DOWN:
- wxevent.SetEventType(wxEVT_LEFT_DCLICK);
- break;
- case wxEVT_MIDDLE_DOWN:
- wxevent.SetEventType(wxEVT_MIDDLE_DCLICK);
- break;
- case wxEVT_RIGHT_DOWN:
- wxevent.SetEventType(wxEVT_RIGHT_DCLICK);
- break;
-
- default :
- break;
+ wxevent.SetEventType(typeDouble);
}
-
}
else
{
{
// I have a dclick
win->SetLastClick(0, ts);
- switch ( eventType )
- {
- case wxEVT_LEFT_DOWN:
- eventType = wxEVT_LEFT_DCLICK;
- break;
- case wxEVT_MIDDLE_DOWN:
- eventType = wxEVT_MIDDLE_DCLICK;
- break;
- case wxEVT_RIGHT_DOWN:
- eventType = wxEVT_RIGHT_DCLICK;
- break;
-
- default :
- break;
- }
-
+ if ( eventType == wxEVT_LEFT_DOWN )
+ eventType = wxEVT_LEFT_DCLICK;
+ else if ( eventType == wxEVT_MIDDLE_DOWN )
+ eventType = wxEVT_MIDDLE_DCLICK;
+ else if ( eventType == wxEVT_RIGHT_DOWN )
+ eventType = wxEVT_RIGHT_DCLICK;
}
else
{
wxWindow *wxGetActiveWindow()
{
// TODO
- wxFAIL_MSG(_("Not implemented"));
+ wxFAIL_MSG("Not implemented");
return NULL;
}
+/* static */
+wxWindow *wxWindowBase::GetCapture()
+{
+ return (wxWindow *)g_captureWindow;
+}
+
+
// Find the wxWindow at the current mouse position, returning the mouse
// position.
wxWindow* wxFindWindowAtPointer(wxPoint& pt)
{
- wxFAIL_MSG(_("Not implemented"));
- return NULL;
+ return wxFindWindowAtPoint(wxGetMousePosition());
}
// Get the current mouse position.
wxPoint wxGetMousePosition()
{
- wxFAIL_MSG(_("Not implemented"));
- return wxPoint;
+ Display *display = (Display*) wxGetDisplay();
+ Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
+ Window rootReturn, childReturn;
+ int rootX, rootY, winX, winY;
+ unsigned int maskReturn;
+
+ XQueryPointer (display,
+ rootWindow,
+ &rootReturn,
+ &childReturn,
+ &rootX, &rootY, &winX, &winY, &maskReturn);
+ return wxPoint(rootX, rootY);
}
+
// ----------------------------------------------------------------------------
// wxNoOptimize: switch off size optimization
// ----------------------------------------------------------------------------
int wxNoOptimize::ms_count = 0;
-
-
-