X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cce442ba7c8506fda1b1bf350390ef06b0863150..8b3fddc49326c0b6019cd7082218726aa17a5727:/src/motif/window.cpp diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 30f5695703..e51b353f98 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -80,6 +80,8 @@ static const int SCROLL_MARGIN = 4; // ---------------------------------------------------------------------------- extern wxHashTable *wxWidgetHashTable; +static wxWindow* g_captureWindow = NULL; + // ---------------------------------------------------------------------------- // private functions @@ -224,7 +226,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, parent->AddChild(this); - m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); m_foregroundColour = *wxBLACK; //// TODO: we should probably optimize by only creating a @@ -355,7 +357,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, // Scrolled widget needs to have its colour changed or we get a little blue // square where the scrollbars abutt - wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); DoChangeBackgroundColour(m_scrolledWindow, backgroundColour, TRUE); DoChangeBackgroundColour(m_drawingArea, backgroundColour, TRUE); @@ -374,7 +376,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, // Without this, the cursor may not be restored properly (e.g. in splitter // sample). SetCursor(*wxSTANDARD_CURSOR); - SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); SetSize(pos.x, pos.y, size.x, size.y); return TRUE; @@ -383,6 +385,9 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, // Destructor wxWindow::~wxWindow() { + if (g_captureWindow == this) + g_captureWindow = NULL; + m_isBeingDeleted = TRUE; // Motif-specific actions first @@ -504,7 +509,7 @@ void wxWindow::CreateScrollbar(wxOrientation orientation) m_hScrollBar = (WXWidget) hScrollBar; - wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); DoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE); XtRealizeWidget(hScrollBar); @@ -539,7 +544,7 @@ void wxWindow::CreateScrollbar(wxOrientation orientation) NULL); m_vScrollBar = (WXWidget) vScrollBar; - wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); DoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE); XtRealizeWidget(vScrollBar); @@ -708,8 +713,9 @@ wxString wxWindow::GetTitle() const return wxString(title); } -void wxWindow::CaptureMouse() +void wxWindow::DoCaptureMouse() { + g_captureWindow = this; if ( m_winCaptured ) return; @@ -720,8 +726,9 @@ void wxWindow::CaptureMouse() m_winCaptured = TRUE; } -void wxWindow::ReleaseMouse() +void wxWindow::DoReleaseMouse() { + g_captureWindow = NULL; if ( !m_winCaptured ) return; @@ -1359,17 +1366,6 @@ wxPoint wxWindow::GetClientAreaOrigin() const return wxPoint(0, 0); } -// Makes an adjustment to the window position (for example, a frame that has -// a toolbar that it manages itself). -void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) -{ - if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent()) - { - wxPoint pt(GetParent()->GetClientAreaOrigin()); - x += pt.x; y += pt.y; - } -} - void wxWindow::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW, int incH) { m_minWidth = minW; @@ -1669,8 +1665,8 @@ bool wxWindow::ProcessAccelerator(wxKeyEvent& event) 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 @@ -2140,12 +2136,13 @@ static void wxCanvasInputEvent(Widget drawingArea, case KeyPress: { KeySym keySym; + static char buf[100]; #if 0 XComposeStatus compose; - (void) XLookupString ((XKeyEvent *) & local_event, wxBuffer, 20, &keySym, &compose); + (void) XLookupString ((XKeyEvent *) & local_event, buf, 20, &keySym, &compose); #endif // 0 - (void) XLookupString ((XKeyEvent *) & local_event, wxBuffer, 20, &keySym, NULL); + (void) XLookupString ((XKeyEvent *) & local_event, buf, 20, &keySym, NULL); int id = wxCharCodeXToWX (keySym); wxEventType eventType = wxEVT_CHAR; @@ -2193,8 +2190,9 @@ static void wxCanvasInputEvent(Widget drawingArea, } case KeyRelease: { + static char buf[100]; KeySym keySym; - (void) XLookupString ((XKeyEvent *) & local_event, wxBuffer, 20, &keySym, NULL); + (void) XLookupString ((XKeyEvent *) & local_event, buf, 20, &keySym, NULL); int id = wxCharCodeXToWX (keySym); wxKeyEvent event (wxEVT_KEY_UP); @@ -2655,22 +2653,12 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, { // 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 { @@ -2873,7 +2861,7 @@ void wxWindow::ChangeBackgroundColour() DoChangeBackgroundColour(m_scrolledWindow, m_backgroundColour); // Have to set the scrollbar colours back since // the scrolled window seemed to change them - wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); if (m_hScrollBar) DoChangeBackgroundColour(m_hScrollBar, backgroundColour); @@ -2987,6 +2975,13 @@ wxWindow *wxGetActiveWindow() 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) @@ -3011,12 +3006,10 @@ wxPoint wxGetMousePosition() return wxPoint(rootX, rootY); } + // ---------------------------------------------------------------------------- // wxNoOptimize: switch off size optimization // ---------------------------------------------------------------------------- int wxNoOptimize::ms_count = 0; - - -