X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea59668704de4dcf7a8575c0a907499272d6da5c..44f8caa7862bfdf67605adb801cd1fbb41c8aca5:/src/x11/window.cpp diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 6914ada32d..041217aa9e 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -121,11 +121,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id, CreateBase(parent, id, pos, size, style, wxDefaultValidator, name); - if (parent) - parent->AddChild(this); - - m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); - m_foregroundColour = *wxBLACK; + parent->AddChild(this); int w = size.GetWidth(); int h = size.GetHeight(); @@ -136,18 +132,26 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id, if (x == -1) x = 0; if (y == -1) y = 0; - int screen = DefaultScreen(wxGlobalDisplay()); + Display *xdisplay = (Display*) wxGlobalDisplay(); + int xscreen = DefaultScreen( xdisplay ); + Colormap cm = DefaultColormap( xdisplay, xscreen ); - Window parentWindow; - if (parent) - parentWindow = (Window) parent->GetMainWindow(); - else - parentWindow = RootWindow(wxGlobalDisplay(), screen); + m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); + m_backgroundColour.CalcPixel( (WXColormap) cm ); + m_hasBgCol = TRUE; + + m_foregroundColour = *wxBLACK; + m_foregroundColour.CalcPixel( (WXColormap) cm ); + - Window window = XCreateSimpleWindow(wxGlobalDisplay(), parentWindow, - x, y, w, h, 0, - m_backgroundColour.AllocColour(wxGlobalDisplay()), - m_foregroundColour.AllocColour(wxGlobalDisplay())); + Window parentWindow = (Window) parent->GetMainWindow(); + + Window window = XCreateSimpleWindow( + xdisplay, parentWindow, + x, y, w, h, 0, + m_backgroundColour.GetPixel(), + m_backgroundColour.GetPixel() ); + m_mainWidget = (WXWindow) window; // Select event types wanted @@ -411,6 +415,7 @@ void wxWindowX11::WarpPointer (int x, int y) // Does a physical scroll void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect) { +#if 0 int x, y, w, h; if (rect) { @@ -573,10 +578,7 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect) delete rect; node = node->Next(); } - - // TODO - - // XmUpdateDisplay((Widget) GetMainWidget()); +#endif } // --------------------------------------------------------------------------- @@ -697,7 +699,7 @@ void wxWindowX11::DoGetClientSize(int *x, int *y) const if (window) { XWindowAttributes attr; - Status status = XGetWindowAttributes(wxGlobalDisplay(), window, & attr); + Status status = XGetWindowAttributes( wxGlobalDisplay(), window, &attr ); wxASSERT(status); if (status) @@ -718,11 +720,15 @@ void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags) if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) { + int yy = 0; + AdjustForParentClientOrigin( x, yy, sizeFlags); windowChanges.x = x; valueMask |= CWX; } if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) { + int xx = 0; + AdjustForParentClientOrigin( xx, y, sizeFlags); windowChanges.y = y; valueMask |= CWY; } @@ -736,7 +742,6 @@ void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags) windowChanges.height = height /* -m_borderSize*2*/; valueMask |= CWHeight; } - AdjustForParentClientOrigin( x, y, sizeFlags); XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(), valueMask, & windowChanges); @@ -952,7 +957,7 @@ void wxWindowX11::X11SendPaintEvents() { m_clipPaintRegion = TRUE; - if (!m_clearRegion.IsEmpty()) + // if (!m_clearRegion.IsEmpty()) { wxWindowDC dc( (wxWindow*)this ); dc.SetClippingRegion( m_clearRegion ); @@ -965,7 +970,8 @@ void wxWindowX11::X11SendPaintEvents() wxRegionIterator upd( m_clearRegion ); while (upd) { - // XClearArea( ... , upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() ); + XClearArea( wxGlobalDisplay(), (Window) m_mainWidget, + upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight(), False ); upd ++; } } @@ -1308,15 +1314,20 @@ int wxComputeColours (Display *display, wxColour * back, wxColour * fore) bool wxWindowX11::SetBackgroundColour(const wxColour& col) { - if ( !wxWindowBase::SetBackgroundColour(col) ) - return FALSE; + wxWindowBase::SetBackgroundColour(col); if (!GetMainWindow()) return FALSE; + Display *xdisplay = (Display*) wxGlobalDisplay(); + int xscreen = DefaultScreen( xdisplay ); + Colormap cm = DefaultColormap( xdisplay, xscreen ); + wxColour colour( col ); + colour.CalcPixel( (WXColormap) cm ); + XSetWindowAttributes attrib; - attrib.background_pixel = colour.AllocColour(wxGlobalDisplay()); + attrib.background_pixel = colour.GetPixel(); XChangeWindowAttributes(wxGlobalDisplay(), (Window) GetMainWindow(),