Modifications to get wxNanoX compiling again
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -108,6 +108,7 @@ public:
|
||||
bool m_showIconic;
|
||||
wxSize m_initialSize;
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
// Someone find a better place for these
|
||||
int m_visualType; // TrueColor, DirectColor etc.
|
||||
int m_visualDepth;
|
||||
@@ -125,6 +126,7 @@ public:
|
||||
int m_visualBluePrec;
|
||||
|
||||
unsigned char *m_colorCube;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool m_keepGoing;
|
||||
|
@@ -2242,7 +2242,7 @@ void wxMenuBar::PopupCurrentMenu(bool selectFirst)
|
||||
wxCHECK_RET( m_current != -1, _T("no menu to popup") );
|
||||
|
||||
// forgot to call DismissMenu()?
|
||||
wxASSERT_MSG( !m_menuShown, _T("shouldn't show two menu at once!") );
|
||||
wxASSERT_MSG( !m_menuShown, _T("shouldn't show two menus at once!") );
|
||||
|
||||
// in any case, we should show it - even if we won't
|
||||
m_shouldShowMenu = TRUE;
|
||||
|
@@ -28,6 +28,7 @@
|
||||
void wxSetIconsX11( WXDisplay* display, WXWindow window,
|
||||
const wxIconBundle& ib )
|
||||
{
|
||||
#if !wxUSE_NANOX
|
||||
size_t size = 0;
|
||||
size_t i, max = ib.m_icons.GetCount();
|
||||
|
||||
@@ -91,6 +92,7 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
|
||||
(Window)window,
|
||||
net_wm_icon );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -399,17 +399,21 @@ wxApp::wxApp()
|
||||
m_showIconic = FALSE;
|
||||
m_initialSize = wxDefaultSize;
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
m_visualColormap = NULL;
|
||||
m_colorCube = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxApp::~wxApp()
|
||||
{
|
||||
#if !wxUSE_NANOX
|
||||
if (m_colorCube)
|
||||
free( m_colorCube );
|
||||
|
||||
if (m_visualColormap)
|
||||
delete [] (XColor*)m_visualColormap;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wxApp::Initialized()
|
||||
@@ -505,7 +509,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
||||
{
|
||||
case Expose:
|
||||
{
|
||||
#if wxUSE_TWO_WINDOWS
|
||||
#if wxUSE_TWO_WINDOWS && !wxUSE_NANOX
|
||||
if (event->xexpose.window != (Window)win->GetClientWindow())
|
||||
{
|
||||
XEvent tmp_event;
|
||||
@@ -989,6 +993,7 @@ bool wxApp::OnInitGui()
|
||||
|
||||
m_maxRequestSize = XMaxRequestSize( (Display*) wxApp::GetDisplay() );
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
// Get info about the current visual. It is enough
|
||||
// to do this once here unless we support different
|
||||
// visuals, displays and screens. Given that wxX11
|
||||
@@ -1082,6 +1087,7 @@ bool wxApp::OnInitGui()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -734,13 +734,13 @@ wxImage wxBitmap::ConvertToImage() const
|
||||
Display *xdisplay = (Display*) M_BMPDATA->m_display;
|
||||
wxASSERT_MSG( xdisplay, wxT("No display") );
|
||||
|
||||
int bpp = wxTheApp->m_visualDepth;
|
||||
|
||||
#if wxUSE_NANOX
|
||||
//int bpp = DefaultDepth(xdisplay, xscreen);
|
||||
wxGetImageFromDrawable((Pixmap) GetPixmap(), 0, 0, GetWidth(), GetHeight(), image);
|
||||
return image;
|
||||
#else
|
||||
// !wxUSE_NANOX
|
||||
int bpp = wxTheApp->m_visualDepth;
|
||||
XImage *x_image = NULL;
|
||||
if (GetPixmap())
|
||||
{
|
||||
|
@@ -92,7 +92,7 @@ void wxColourRefData::FreeColour()
|
||||
{
|
||||
if (!m_colormap)
|
||||
return;
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
if ((wxTheApp->m_visualType == GrayScale) ||
|
||||
(wxTheApp->m_visualType == PseudoColor))
|
||||
{
|
||||
@@ -105,6 +105,7 @@ void wxColourRefData::FreeColour()
|
||||
XFreeColors( wxGlobalDisplay(), (Colormap) m_colormap, &pixel, 1, 0 );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxColourRefData::AllocColour( WXColormap cmap )
|
||||
@@ -114,6 +115,7 @@ void wxColourRefData::AllocColour( WXColormap cmap )
|
||||
|
||||
FreeColour();
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
if ((wxTheApp->m_visualType == GrayScale) ||
|
||||
(wxTheApp->m_visualType == PseudoColor))
|
||||
{
|
||||
@@ -122,6 +124,7 @@ void wxColourRefData::AllocColour( WXColormap cmap )
|
||||
colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] + 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
m_hasPixel = XAllocColor( wxGlobalDisplay(), (Colormap) cmap, &m_color );
|
||||
}
|
||||
|
@@ -56,8 +56,6 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
||||
Visual *xvisual = DefaultVisual( xdisplay, xscreen );
|
||||
Window xparent = RootWindow( xdisplay, xscreen );
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
|
||||
#if wxUSE_TWO_WINDOWS
|
||||
bool need_two_windows =
|
||||
((( wxSUNKEN_BORDER | wxRAISED_BORDER | wxSIMPLE_BORDER | wxHSCROLL | wxVSCROLL ) & m_windowStyle) != 0);
|
||||
@@ -65,6 +63,10 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
||||
bool need_two_windows = FALSE;
|
||||
#endif
|
||||
|
||||
#if wxUSE_NANOX
|
||||
long xattributes_mask = 0;
|
||||
#else
|
||||
|
||||
XSetWindowAttributes xattributes;
|
||||
long xattributes_mask = 0;
|
||||
|
||||
@@ -79,27 +81,41 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
||||
xattributes.save_under = True;
|
||||
|
||||
xattributes_mask |= CWEventMask;
|
||||
#endif
|
||||
|
||||
if (need_two_windows)
|
||||
{
|
||||
#if !wxUSE_NANOX
|
||||
xattributes.event_mask =
|
||||
ExposureMask | StructureNotifyMask | ColormapChangeMask;
|
||||
#endif
|
||||
|
||||
Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y,
|
||||
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
||||
|
||||
#if wxUSE_NANOX
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask );
|
||||
#endif
|
||||
|
||||
// Set background to None which will prevent X11 from clearing the
|
||||
// background comletely.
|
||||
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
|
||||
|
||||
m_mainWindow = (WXWindow) xwindow;
|
||||
wxAddWindowToTable( xwindow, (wxWindow*) this );
|
||||
|
||||
// XMapWindow( xdisplay, xwindow );
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
xattributes.event_mask =
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask | VisibilityChangeMask ;
|
||||
#endif
|
||||
|
||||
if (HasFlag( wxSUNKEN_BORDER) || HasFlag( wxRAISED_BORDER))
|
||||
{
|
||||
@@ -123,8 +139,18 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
||||
xwindow = XCreateWindow( xdisplay, xwindow, pos2.x, pos2.y, size2.x, size2.y,
|
||||
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
||||
|
||||
// Set background to None which will prevent X11 from clearing the
|
||||
// background comletely.
|
||||
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
|
||||
|
||||
#if wxUSE_NANOX
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask );
|
||||
#endif
|
||||
|
||||
m_clientWindow = (WXWindow) xwindow;
|
||||
wxAddClientWindowToTable( xwindow, (wxWindow*) this );
|
||||
|
||||
@@ -133,15 +159,28 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
||||
}
|
||||
else
|
||||
{
|
||||
// One window
|
||||
#if !wxUSE_NANOX
|
||||
xattributes.event_mask =
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask | VisibilityChangeMask ;
|
||||
#endif
|
||||
|
||||
Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y,
|
||||
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
||||
|
||||
#if wxUSE_NANOX
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask );
|
||||
#endif
|
||||
|
||||
// Set background to None which will prevent X11 from clearing the
|
||||
// background comletely.
|
||||
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
|
||||
|
||||
m_mainWindow = (WXWindow) xwindow;
|
||||
@@ -151,9 +190,6 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
||||
m_isShown = FALSE;
|
||||
// XMapWindow( xdisplay, xwindow );
|
||||
}
|
||||
#else
|
||||
fixme
|
||||
#endif
|
||||
|
||||
XSetTransientForHint( xdisplay, (Window) m_mainWindow, xparent );
|
||||
|
||||
|
@@ -168,8 +168,6 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
if (pos2.y == -1)
|
||||
pos2.y = 0;
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
|
||||
#if wxUSE_TWO_WINDOWS
|
||||
bool need_two_windows =
|
||||
((( wxSUNKEN_BORDER | wxRAISED_BORDER | wxSIMPLE_BORDER | wxHSCROLL | wxVSCROLL ) & m_windowStyle) != 0);
|
||||
@@ -177,6 +175,9 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
bool need_two_windows = FALSE;
|
||||
#endif
|
||||
|
||||
#if wxUSE_NANOX
|
||||
long xattributes = 0;
|
||||
#else
|
||||
XSetWindowAttributes xattributes;
|
||||
long xattributes_mask = 0;
|
||||
|
||||
@@ -187,15 +188,33 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
xattributes.border_pixel = BlackPixel( xdisplay, xscreen );
|
||||
|
||||
xattributes_mask |= CWEventMask;
|
||||
#endif
|
||||
|
||||
if (need_two_windows)
|
||||
{
|
||||
#if wxUSE_NANOX
|
||||
long backColor, foreColor;
|
||||
backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
|
||||
foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
|
||||
|
||||
Window xwindow = XCreateWindowWithColor( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
|
||||
0, 0, InputOutput, xvisual, backColor, foreColor);
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
GR_EVENT_MASK_CLOSE_REQ | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask );
|
||||
|
||||
#else
|
||||
// Normal X11
|
||||
xattributes.event_mask =
|
||||
ExposureMask | StructureNotifyMask | ColormapChangeMask;
|
||||
|
||||
Window xwindow = XCreateWindow( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
|
||||
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
||||
|
||||
#endif
|
||||
|
||||
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
|
||||
|
||||
m_mainWindow = (WXWindow) xwindow;
|
||||
@@ -203,6 +222,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
XMapWindow( xdisplay, xwindow );
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
xattributes.event_mask =
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
@@ -214,6 +234,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
xattributes_mask |= CWBitGravity;
|
||||
xattributes.bit_gravity = StaticGravity;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (HasFlag( wxSUNKEN_BORDER) || HasFlag( wxRAISED_BORDER))
|
||||
{
|
||||
@@ -233,9 +254,22 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
pos2.x = 0;
|
||||
pos2.y = 0;
|
||||
}
|
||||
#if wxUSE_NANOX
|
||||
backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
|
||||
foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
|
||||
|
||||
xwindow = XCreateWindowWithColor( xdisplay, xwindow, pos2.x, pos2.y, size2.x, size2.y,
|
||||
0, 0, InputOutput, xvisual, backColor, foreColor);
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
GR_EVENT_MASK_CLOSE_REQ | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask );
|
||||
|
||||
#else
|
||||
xwindow = XCreateWindow( xdisplay, xwindow, pos2.x, pos2.y, size2.x, size2.y,
|
||||
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
||||
#endif
|
||||
|
||||
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
|
||||
|
||||
@@ -247,7 +281,20 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
else
|
||||
{
|
||||
// wxLogDebug( "No two windows needed %s", GetName().c_str() );
|
||||
#if wxUSE_NANOX
|
||||
long backColor, foreColor;
|
||||
backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
|
||||
foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
|
||||
|
||||
Window xwindow = XCreateWindowWithColor( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
|
||||
0, 0, InputOutput, xvisual, backColor, foreColor);
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
GR_EVENT_MASK_CLOSE_REQ | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask );
|
||||
|
||||
#else
|
||||
xattributes.event_mask =
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
@@ -262,6 +309,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
Window xwindow = XCreateWindow( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
|
||||
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
||||
#endif
|
||||
|
||||
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
|
||||
|
||||
@@ -271,29 +319,6 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
XMapWindow( xdisplay, xwindow );
|
||||
}
|
||||
#else
|
||||
|
||||
int extraFlags = GR_EVENT_MASK_CLOSE_REQ;
|
||||
|
||||
long backColor, foreColor;
|
||||
backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
|
||||
foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
|
||||
|
||||
Window xwindow = XCreateWindowWithColor( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
|
||||
0, 0, InputOutput, xvisual, backColor, foreColor);
|
||||
XSelectInput( xdisplay, xwindow,
|
||||
extraFlags | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask );
|
||||
|
||||
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
|
||||
|
||||
m_mainWindow = (WXWindow) xwindow;
|
||||
wxAddWindowToTable( xwindow, (wxWindow*) this );
|
||||
|
||||
XMapWindow( xdisplay, xwindow );
|
||||
#endif
|
||||
|
||||
// Is a subwindow, so map immediately
|
||||
m_isShown = TRUE;
|
||||
|
Reference in New Issue
Block a user