]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/utilsx.cpp
remove streams tests: they're very basic and already-existing CppUnit stream tests...
[wxWidgets.git] / src / x11 / utilsx.cpp
index 23394613467ff888c0b62ffb29c4c0fb5653162b..3285b0a2a4f8145ccd0ef9a7ac8c89fb7525b5c5 100644 (file)
@@ -6,28 +6,47 @@
 // Created:     05/04/03
 // RCS-ID:      $Id$
 // Copyright:   (c) Mattia Barbon
-// Licence:     wxWidgets licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #ifdef __VMS
 #define XShapeQueryExtension XSHAPEQUERYEXTENSION
-#define XtDisplay XTDISPLAY
 #endif
 
 #include "wx/x11/privx.h"
 
 #ifdef HAVE_XSHAPE
-#ifdef __VMS
-# include "wx/vms_x_fix.h"
-# include <X11/shape.h>
-#else
-# include <X11/extensions/shape.h>
-#endif
-#include "wx/region.h"
-#include "wx/bitmap.h"
-#include "wx/dcmemory.h"
+
+    #ifndef WX_PRECOMP
+        #include "wx/bitmap.h"
+        #include "wx/region.h"
+    #endif
+
+    #ifdef __VMS
+        #include "wx/vms_x_fix.h"
+        #include <X11/shape.h>
+    #else
+        #include <X11/extensions/shape.h>
+    #endif
+
+    #include "wx/dcmemory.h"
 #endif
 
+#ifdef HAVE_X11_XKBLIB_H
+    /* under HP-UX and Solaris 2.6, at least, XKBlib.h defines structures with
+     * field named "explicit" - which is, of course, an error for a C++
+     * compiler. To be on the safe side, just redefine it everywhere. */
+    #define explicit __wx_explicit
+
+    #include "X11/XKBlib.h"
+
+    #undef explicit
+#endif // HAVE_X11_XKBLIB_H
+
+
 // ----------------------------------------------------------------------------
 // XShape code
 // ----------------------------------------------------------------------------
@@ -51,14 +70,14 @@ bool wxDoSetShape( Display* xdisplay,
     else
     {
         // wxRegion::ConvertToBitmap gives us the wrong Pixmap:
-        // polichrome and with black and whire reversed
+        // polychrome and with black and white reversed
         wxRect box = region.GetBox();
         wxBitmap bmp(box.GetRight(), box.GetBottom(), 1);
         wxMemoryDC dc;
         dc.SelectObject(bmp);
         dc.SetBackground(*wxBLACK_BRUSH);
         dc.Clear();
-        dc.SetClippingRegion(region);
+        dc.SetDeviceClippingRegion(region);
         dc.SetBackground(*wxWHITE_BRUSH);
         dc.Clear();
         dc.SelectObject(wxNullBitmap);
@@ -180,7 +199,7 @@ void wxXVisualInfo::Init( Display* dpy, XVisualInfo* vi )
     XColor* colors = (XColor*) m_visualColormap;
 
     for (int i = 0; i < m_visualColormapSize; i++)
-           colors[i].pixel = i;
+        colors[i].pixel = i;
 
     XQueryColors( dpy, DefaultColormap(dpy, vi->screen),
                   colors, m_visualColormapSize );
@@ -222,10 +241,25 @@ void wxXVisualInfo::Init( Display* dpy, XVisualInfo* vi )
                     index |= (g >> (5 - m_visualGreenPrec)) << m_visualGreenShift;
                     index |= (b >> (5 - m_visualBluePrec)) << m_visualBlueShift;
                 }
-                m_colorCube[ (r*1024) + (g*32) + b ] = index;
+                m_colorCube[ (r*1024) + (g*32) + b ] = (unsigned char)index;
             }
         }
     }
 }
 
 #endif // !wxUSE_NANOX
+
+/* Don't synthesize KeyUp events holding down a key and producing
+   KeyDown events with autorepeat. */
+bool wxSetDetectableAutoRepeat( bool flag )
+{
+#ifdef HAVE_X11_XKBLIB_H
+    Bool result;
+    XkbSetDetectableAutoRepeat( (Display *)wxGetDisplay(), flag, &result );
+    return result;       /* true if keyboard hardware supports this mode */
+#else
+    wxUnusedVar(flag);
+    return false;
+#endif
+}
+