#include <string.h>
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-static const int SCROLL_MARGIN = 4;
-
// ----------------------------------------------------------------------------
// global variables for this module
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxWindowX11, wxWindowBase)
EVT_SYS_COLOUR_CHANGED(wxWindowX11::OnSysColourChanged)
- EVT_IDLE(wxWindowX11::OnIdle)
END_EVENT_TABLE()
// ============================================================================
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;
}
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;
&ascent, &descent2, &overall);
#endif
- XTextExtents((XFontStruct*) pFontStruct, string, slen,
+ XTextExtents((XFontStruct*) pFontStruct, string.c_str(), slen,
&direction, &ascent, &descent2, &overall);
if ( x )
}
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()
paint_event.SetEventObject( this );
GetEventHandler()->ProcessEvent( paint_event );
+ m_updateRegion.Clear();
+
m_clipPaintRegion = FALSE;
}
}
}
-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();