X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a3215b22a39f6a9939f7ad02f7121c00037b765b..59c962bf54667cab735353b2ec3b7a2438464f22:/src/x11/window.cpp?ds=sidebyside diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 72833485e9..89ba9d056a 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -49,12 +49,6 @@ #include -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -static const int SCROLL_MARGIN = 4; - // ---------------------------------------------------------------------------- // global variables for this module // ---------------------------------------------------------------------------- @@ -78,7 +72,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxWindowX11, wxWindowBase) BEGIN_EVENT_TABLE(wxWindowX11, wxWindowBase) EVT_SYS_COLOUR_CHANGED(wxWindowX11::OnSysColourChanged) - EVT_IDLE(wxWindowX11::OnIdle) END_EVENT_TABLE() // ============================================================================ @@ -430,11 +423,10 @@ bool wxWindowX11::SetCursor(const wxCursor& cursor) else cursor2 = wxSTANDARD_CURSOR; - WXDisplay *dpy = GetXDisplay(); - WXCursor x_cursor = cursor2->GetXCursor(dpy); + WXCursor x_cursor = cursor2->GetCursor(); Window win = (Window) GetMainWindow(); - XDefineCursor((Display*) dpy, win, (Cursor) x_cursor); + XDefineCursor((Display*) wxGlobalDisplay(), win, (Cursor) x_cursor); return TRUE; } @@ -896,13 +888,12 @@ void wxWindowX11::GetTextExtent(const wxString& string, int *descent, int *externalLeading, const wxFont *theFont) const { - wxFont *fontToUse = (wxFont *)theFont; - if (!fontToUse) - fontToUse = (wxFont *) & m_font; + wxFont fontToUse = m_font; + if (theFont) fontToUse = *theFont; - wxCHECK_RET( fontToUse->Ok(), "valid window font needed" ); - - WXFontStructPtr pFontStruct = theFont->GetFontStruct(1.0, GetXDisplay()); + wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") ); + + WXFontStructPtr pFontStruct = fontToUse.GetFontStruct(1.0, GetXDisplay()); int direction, ascent, descent2; XCharStruct overall; @@ -914,7 +905,7 @@ void wxWindowX11::GetTextExtent(const wxString& string, &ascent, &descent2, &overall); #endif - XTextExtents((XFontStruct*) pFontStruct, string, slen, + XTextExtents((XFontStruct*) pFontStruct, string.c_str(), slen, &direction, &ascent, &descent2, &overall); if ( x ) @@ -959,16 +950,13 @@ void wxWindowX11::Refresh(bool eraseBack, const wxRect *rect) } else { - int height,width; - GetSize( &width, &height ); + int height,width; + GetSize( &width, &height ); // Schedule for later Updating in ::Update() or ::OnInternalIdle(). m_updateRegion.Clear(); m_updateRegion.Union( 0, 0, width, height ); } - - // Actually don't schedule yet.. - Update(); } void wxWindowX11::Update() @@ -1020,6 +1008,8 @@ void wxWindowX11::X11SendPaintEvents() paint_event.SetEventObject( this ); GetEventHandler()->ProcessEvent( paint_event ); + m_updateRegion.Clear(); + m_clipPaintRegion = FALSE; } @@ -1046,8 +1036,11 @@ void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent& event) } } -void wxWindowX11::OnIdle(wxIdleEvent& WXUNUSED(event)) +void wxWindowX11::OnInternalIdle() { + // Update invalidated regions. + Update(); + // This calls the UI-update mechanism (querying windows for // menu/toolbar/control state information) UpdateWindowUI();