]> git.saurik.com Git - wxWidgets.git/commitdiff
Nano-X changes: removed spurious -O for Nano-X configuration;
authorJulian Smart <julian@anthemion.co.uk>
Tue, 26 Feb 2002 10:06:07 +0000 (10:06 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 26 Feb 2002 10:06:07 +0000 (10:06 +0000)
got colour working in Nano-X (uses 8 bit RGB values, not 16 bit);
now sets font background mode correctly; window management
call correction

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

configure.in
include/wx/x11/nanox/X11/Xlib.h
src/common/gdicmn.cpp
src/x11/app.cpp
src/x11/colour.cpp
src/x11/dcclient.cpp
src/x11/nanox.c
src/x11/toplevel.cpp
src/x11/window.cpp

index 6f94f8ae606022aee6c93e8ae477ec1c865862c2..e2e151250613f12e0a914ae2d068d2a8733ce82b 100644 (file)
@@ -1904,7 +1904,7 @@ equivalent variable and GTK+ is version 1.2.3 or above.
 
         if test "$wxUSE_NANOX" = "yes"; then
             TOOLKIT_INCLUDE="-I\$(top_srcdir)/include/wx/x11/nanox -I\$(MICROWIN)/src/include $TOOLKIT_INCLUDE"
-            TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__NANOX__ -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_GIF_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DLINUX=1 -DUNIX=1 -O -DUSE_EXPOSURE -DSCREEN_HEIGHT=480 -DSCREEN_WIDTH=640 -DSCREEN_DEPTH=4 -DX11=1"
+            TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__NANOX__ -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_GIF_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DLINUX=1 -DUNIX=1 -DUSE_EXPOSURE -DSCREEN_HEIGHT=480 -DSCREEN_WIDTH=640 -DSCREEN_DEPTH=4 -DX11=1"
             GUI_TK_LIBRARY="$GUI_TK_LIBRARY \$(MICROWIN)/src/lib/libnano-X.a"
         else
             GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lX11$xpm_link"
index 2e28627cb27a5ca62c962ed3efa2378ef351d999..3a4fb63db28e52887c04efe7d4d382d4631d4e5e 100644 (file)
@@ -111,8 +111,6 @@ typedef struct {
 #define GXnand GR_MODE_NAND
 #define GXset GR_MODE_SET
 
-inline void wxNoop() { /* Do nothing */ }
-
 #define XSynchronize(display,sync)
 #define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID
 #define RootWindowOfScreen(s) GR_ROOT_WINDOW_ID
@@ -344,6 +342,8 @@ Status XGetWindowAttributes(Display* display, Window w,
 int XConfigureWindow(Display* display, Window w, int mask, XWindowChanges* changes);
 int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow, int srcX, int srcY, int* destX, int* destY, Window* childReturn);
 
+void wxNoop();
+
 #ifdef __cplusplus
 }
 #endif
index 2210dc3485353d2f091cce653ca86b03f7302f2c..48cd85ace6a243f918f0d92fd6c489d3dcb3085b 100644 (file)
@@ -381,10 +381,16 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
     if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour,&xcolour))
       return NULL;
 
+#if wxUSE_NANOX
+    unsigned char r = (unsigned char)(xcolour.red);
+    unsigned char g = (unsigned char)(xcolour.green);
+    unsigned char b = (unsigned char)(xcolour.blue);
+#else
     unsigned char r = (unsigned char)(xcolour.red >> 8);
     unsigned char g = (unsigned char)(xcolour.green >> 8);
     unsigned char b = (unsigned char)(xcolour.blue >> 8);
-
+#endif
+    
     wxColour *col = new wxColour(r, g, b);
     Append(colour, col);
 
index e40d31131d31e932322894c7a1b13ffec75c03ea..83dbe1346626db2340a3c23be0d96b25a35aecc0 100644 (file)
@@ -457,7 +457,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
     wxWindow* win = NULL;
     Window window = XEventGetWindow(event);
     Window actualWindow = window;
-    
+
     // Find the first wxWindow that corresponds to this event window
     // Because we're receiving events after a window
     // has been destroyed, assume a 1:1 match between
@@ -468,6 +468,10 @@ void wxApp::ProcessXEvent(WXEvent* _event)
     if (!win)
            return;
 
+#ifdef __WXDEBUG__
+    wxString windowClass = win->GetClassInfo()->GetClassName();
+#endif
+    
     switch (event->type)
     {
         case KeyPress:
@@ -506,6 +510,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
             if (event->update.utype == GR_UPDATE_SIZE)
 #endif
             {
+                //wxLogDebug("ConfigureNotify: %s", windowClass.c_str());
                 wxSizeEvent sizeEvent( wxSize(XConfigureEventGetWidth(event), XConfigureEventGetHeight(event)), win->GetId() );
                 sizeEvent.SetEventObject( win );
                 
@@ -515,6 +520,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
 #if !wxUSE_NANOX
         case PropertyNotify:
         {
+            //wxLogDebug("PropertyNotify: %s", windowClass.c_str());
             HandlePropertyChange(_event);
             return;
         }
@@ -573,6 +579,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
 #endif
         case Expose:
         {
+            //wxLogDebug("Expose: %s", windowClass.c_str());
             win->GetUpdateRegion().Union( XExposeEventGetX(event), XExposeEventGetY(event),
                                           XExposeEventGetWidth(event), XExposeEventGetHeight(event));
                                               
index f989be7f44a6f32aeb7e9375dd72e3190cf47dad..dfe438e1c4d0b76c99aff7ef6420e7655f3bddac 100644 (file)
@@ -137,9 +137,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
 wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
 {
     m_refData = new wxColourRefData();
+#if wxUSE_NANOX
+    M_COLDATA->m_color.red = ((unsigned short)red) ;
+    M_COLDATA->m_color.green = ((unsigned short)green) ;
+    M_COLDATA->m_color.blue = ((unsigned short)blue) ;
+#else    
     M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
     M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
     M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
+#endif
     M_COLDATA->m_color.pixel = 0;
 }
 
@@ -209,9 +215,15 @@ void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
     AllocExclusive();
     
     m_refData = new wxColourRefData();
+#if wxUSE_NANOX
+    M_COLDATA->m_color.red = ((unsigned short)red) ;
+    M_COLDATA->m_color.green = ((unsigned short)green) ;
+    M_COLDATA->m_color.blue = ((unsigned short)blue) ;
+#else
     M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
     M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
     M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
+#endif
     M_COLDATA->m_color.pixel = 0;
 }
 
@@ -219,21 +231,33 @@ unsigned char wxColour::Red() const
 {
     wxCHECK_MSG( Ok(), 0, wxT("invalid colour") );
 
+#if wxUSE_NANOX
+    return (unsigned char) M_COLDATA->m_color.red ;
+#else
     return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
+#endif
 }
 
 unsigned char wxColour::Green() const
 {
     wxCHECK_MSG( Ok(), 0, wxT("invalid colour") );
 
+#if wxUSE_NANOX
+    return (unsigned char) M_COLDATA->m_color.green ;
+#else
     return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
+#endif
 }
 
 unsigned char wxColour::Blue() const
 {
     wxCHECK_MSG( Ok(), 0, wxT("invalid colour") );
 
+#if wxUSE_NANOX
+    return (unsigned char) M_COLDATA->m_color.blue ;
+#else
     return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
+#endif
 }
 
 void wxColour::CalcPixel( WXColormap cmap )
index 1af88bb2721b7359c1c9742c19dbf48e63bd3a06..aee60a0bfc5c50342e0f850564b5c3c6cceb6629 100644 (file)
@@ -255,6 +255,11 @@ void wxWindowDC::SetUpDC()
 
     XSetFillStyle( (Display*) m_display, (GC) m_textGC, FillSolid );
 
+#if wxUSE_NANOX
+    // By default, draw transparently
+    GrSetGCUseBackground((GC) m_textGC, FALSE);
+#endif
+
     /* m_penGC */
     m_pen.GetColour().CalcPixel( m_cmap );
     XSetForeground( (Display*) m_display, (GC) m_penGC, m_pen.GetColour().GetPixel() );
@@ -1714,6 +1719,10 @@ void wxWindowDC::SetBackgroundMode( int mode )
 
     m_backgroundMode = mode;
 
+#if wxUSE_NANOX
+    GrSetGCUseBackground((GC) m_textGC, mode == wxTRANSPARENT ? FALSE : TRUE);
+#endif
+
     if (!m_window) return;
 
     // CMB 21/7/98: fill style of cross-hatch brushes is affected by
index 1f220e3e517730ac9d9eed0f3a44cedeb3d821fa..c080455ff5221988c4344adcfd1529b57c8567d2 100644 (file)
@@ -433,5 +433,13 @@ int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow,
     return 1;
 }
 
+/* Should not really be necessary but in no-optimize mode
+ * gcc complains that wxNoop is not found if wxNoop is inline.
+ */
+
+void wxNoop()
+{
+}
+
 #endif
   /* wxUSE_NANOX */
index aeba31a27bfad3a754b3e3581026a063793d397a..fd6dea93f95eb66e7c3f392a47e2cdc61243d31e 100644 (file)
@@ -101,6 +101,18 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
     m_backgroundColour.CalcPixel( (WXColormap) cm );
     m_hasBgCol = TRUE;
        
+    wxSize size2(size);
+    if (size2.x == -1)
+       size2.x = 100;
+    if (size2.y == -1)
+       size2.y = 100;
+
+    wxPoint pos2(pos);
+    if (pos2.x == -1)
+       pos2.x = 100;
+    if (pos2.y == -1)
+       pos2.y = 100;
+    
 #if !wxUSE_NANOX
     XSetWindowAttributes xattributes;
     XSizeHints size_hints;
@@ -118,18 +130,6 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
     xattributes.override_redirect = False;
 #endif
     
-    wxSize size2(size);
-    if (size2.x == -1)
-       size2.x = 100;
-    if (size2.y == -1)
-       size2.y = 100;
-
-    wxPoint pos2(pos);
-    if (pos2.x == -1)
-       pos2.x = 100;
-    if (pos2.y == -1)
-       pos2.y = 100;
-    
 #if wxUSE_NANOX
     long backColor, foreColor;
     backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
@@ -148,7 +148,6 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
     extraFlags |= GR_EVENT_MASK_CLOSE_REQ;
 #endif
 
-#if wxUSE_NANOX
     XSelectInput( xdisplay, xwindow,
                   extraFlags |
                   ExposureMask |
@@ -166,25 +165,6 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
                   StructureNotifyMask |
                   PropertyChangeMask
                   );
-#else
-    XSelectInput( xdisplay, xwindow,
-                  extraFlags |
-                  ExposureMask |
-                  KeyPressMask |
-                  KeyReleaseMask |
-                  ButtonPressMask |
-                  ButtonReleaseMask |
-                  ButtonMotionMask |
-                  EnterWindowMask |
-                  LeaveWindowMask |
-                  PointerMotionMask |
-                  KeymapStateMask |
-                  FocusChangeMask |
-                  ColormapChangeMask |
-                  StructureNotifyMask |
-                  PropertyChangeMask
-                  );
-#endif
     
     wxAddWindowToTable( xwindow, (wxWindow*) this );
 
@@ -221,14 +201,7 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
     XSetWMProtocols( xdisplay, xwindow, wm_protocols, 2);
 #endif
     
-#if 0 // wxUSE_NANOX
-    GR_WM_PROPERTIES props;
-    props.flags = GR_WM_FLAGS_TITLE;
-    props.title = (GR_CHAR*) "Hello";
-    GrSetWMProperties(xwindow, &props);
-#else
     wxSetWMDecorations( xwindow, style);
-#endif
 
     SetTitle(title);
     
@@ -423,6 +396,7 @@ bool wxSetWMDecorations(Window w, long style)
     GR_WM_PROPERTIES wmProp;
 
     wmProp.flags = 0;
+    wmProp.props = 0;
 
     if (style & wxRESIZE_BORDER)
     {
index cd6575da0c1d4ca8de8d7e1f834d9abe322b5006..8159498ff70d6d3f7b57653e489605486ddd1cb7 100644 (file)
@@ -960,6 +960,7 @@ void wxWindowX11::Update()
 {
     if (!m_updateRegion.IsEmpty())
     {
+        //        wxLogDebug("wxWindowX11::Update: %s", GetClassInfo()->GetClassName());
         // Actually send erase events.
         SendEraseEvents();
         
@@ -987,7 +988,7 @@ void wxWindowX11::SendEraseEvents()
         
         wxEraseEvent erase_event( GetId(), &dc );
         erase_event.SetEventObject( this );
-    
+
         if (!GetEventHandler()->ProcessEvent(erase_event))
         {
             Window xwindow = (Window) GetMainWindow();
@@ -1022,9 +1023,8 @@ void wxWindowX11::SendPaintEvents()
     wxPaintEvent paint_event( GetId() );
     paint_event.SetEventObject( this );
     GetEventHandler()->ProcessEvent( paint_event );
-
-    m_updateRegion.Clear();
     
+    m_updateRegion.Clear();
     m_clipPaintRegion = FALSE;
 }