X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/61bd618fe776bac0d54ef51b14d706da394a2635..e26c0634d0040057f09d902842c2b77aa9f0cbfc:/src/mgl/window.cpp diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 09f69f1dd7..dac506d518 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -117,7 +117,6 @@ bool wxCreateMGL_WM() #if wxUSE_SYSTEM_OPTIONS // FIXME_MGL -- so what is The Proper Way? - width=800, height=600; if ( wxSystemOptions::HasOption(wxT("mgl.screen-width") ) width = wxSystemOptions::GetOptionInt(wxT("mgl.screen-width")); if ( wxSystemOptions::HasOption(wxT("mgl.screen-height") ) @@ -174,6 +173,21 @@ static wxWindowMGL* wxGetTopLevelParent(wxWindowMGL *win) return p; } +#ifdef __WXDEBUG__ +// Add an easy way to capture screenshots: +static void CaptureScreenshot() +{ + wxBusyCursor bcur; + + static int screenshot_num = 0; + char screenshot[128]; + sprintf(screenshot, "screenshot-%03i.png", screenshot_num++); + g_displayDC->savePNGFromDC(screenshot, 0, 0, + g_displayDC->sizex(), + g_displayDC->sizey()); +} +#endif + // --------------------------------------------------------------------------- // MGL_WM hooks: // --------------------------------------------------------------------------- @@ -199,7 +213,13 @@ static ibool wxWindowMouseHandler(window_t *wnd, event_t *e) MGL_wmCoordGlobalToLocal(win->GetHandle(), e->where_x, e->where_y, &where.x, &where.y); - if ( !win->IsEnabled() ) return FALSE; + for (wxWindowMGL *w = win; w; w = w->GetParent()) + { + if ( !w->IsEnabled() ) + return FALSE; + if ( w->IsTopLevel() ) + break; + } wxEventType type = wxEVT_NULL; wxMouseEvent event; @@ -462,6 +482,14 @@ static ibool wxWindowKeybHandler(window_t *wnd, event_t *e) ret = win->GetEventHandler()->ProcessEvent(event); + +#ifdef __WXDEBUG__ + // Add an easy way to capture screenshots: + if ( event.m_keyCode == WXK_F1 && + event.m_shiftDown && event.m_controlDown ) + CaptureScreenshot(); +#endif + #if wxUSE_ACCEL if ( !ret ) { @@ -626,6 +654,8 @@ bool wxWindowMGL::Create(wxWindow *parent, void wxWindowMGL::SetFocus() { + if ( gs_focusedWindow == this ) return; + if ( gs_focusedWindow ) gs_focusedWindow->KillFocus(); @@ -658,7 +688,7 @@ void wxWindowMGL::SetFocus() wxFocusEvent event(wxEVT_SET_FOCUS, GetId()); event.SetEventObject(this); - AddPendingEvent(event); + GetEventHandler()->ProcessEvent(event); } void wxWindowMGL::KillFocus() @@ -679,7 +709,7 @@ void wxWindowMGL::KillFocus() wxFocusEvent event(wxEVT_KILL_FOCUS, GetId()); event.SetEventObject(this); - AddPendingEvent(event); + GetEventHandler()->ProcessEvent(event); } // ---------------------------------------------------------------------------- @@ -1096,6 +1126,12 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc) return; } +#if 0 // FIXME_MGL -- debugging stuff! + dc->setColorRGB(255,0,255); + dc->fillRect(-1000,-1000,2000,2000); + wxUsleep(100); +#endif + MGLRegion clip; dc->getClipRegion(clip); m_updateRegion = wxRegion(clip);