]> git.saurik.com Git - wxWidgets.git/commitdiff
Modifications to get wxNanoX compiling again
authorJulian Smart <julian@anthemion.co.uk>
Mon, 1 Apr 2002 14:09:44 +0000 (14:09 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Mon, 1 Apr 2002 14:09:44 +0000 (14:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/x11/app.h
src/univ/menu.cpp
src/unix/utilsx11.cpp
src/x11/app.cpp
src/x11/bitmap.cpp
src/x11/colour.cpp
src/x11/popupwin.cpp
src/x11/window.cpp

index 4eab1ecb67522c0383c2fbfd51fef1d717a7526a..0a689ed00f08d60f5ac66902b656f5ab35e74eaa 100644 (file)
@@ -107,7 +107,8 @@ public:
     static long           sm_lastMessageTime;
     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;
index 6a64d031b96388767aec1846dffcd6fd85f3a607..1a70ef1eb4320cc3f7a9a19a5c4fbf5d16aba4ec 100644 (file)
@@ -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;
index d09ae2499268987d980d7276fa6872b84acf0711..360d59df7eb6ac837d18f3d4134bd3156f782989 100644 (file)
@@ -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
index e923a61920f72c90864d4604adf16555875c7897..3408003de49891d8276d3111fb6f02404fc04635 100644 (file)
@@ -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;
 }
index a365ddf028ff18cfd46e7f8d40af37dcc0a3e348..9659dc351c9a9d236f6549128f06b25366ef8f47 100644 (file)
@@ -733,14 +733,14 @@ 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())
     {
index 058c00d84dddbe030d27c67fa3a0fd44f7d1ed6b..e10c2f486b903121fc35db0a8ae3615d711ed371 100644 (file)
@@ -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 );
     }
index e27499f171b4fa5e806457abc991ac6b5240e0d8..2fbf352a72de1265a437ebc200d4c645ddab1d70 100644 (file)
@@ -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,28 +81,42 @@ 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))
         {
             pos2.x = 2;
@@ -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 );
 
index ce08b9fd81c786eed722eac96b820e0e2218149f..493e7d51c3b05cc176a670d065d60e283e0a81a0 100644 (file)
@@ -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,22 +188,41 @@ 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;
         wxAddWindowToTable( xwindow, (wxWindow*) this );
     
         XMapWindow( xdisplay, xwindow );
-    
+
+#if !wxUSE_NANOX    
         xattributes.event_mask = 
             ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
             ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
@@ -214,7 +234,8 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
             xattributes_mask |= CWBitGravity;
             xattributes.bit_gravity = StaticGravity;
         }
-
+#endif
+        
         if (HasFlag( wxSUNKEN_BORDER) || HasFlag( wxRAISED_BORDER))
         {
             pos2.x = 2;
@@ -233,10 +254,23 @@ 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 );
     
         m_clientWindow = (WXWindow) xwindow;
@@ -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,7 +309,8 @@ 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 );
     
         m_mainWindow = (WXWindow) xwindow;
@@ -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;