]> git.saurik.com Git - wxWidgets.git/commitdiff
Define wxSetDetectableAutoRepeat() for X11-based ports only.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 22 Sep 2009 00:22:44 +0000 (00:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 22 Sep 2009 00:22:44 +0000 (00:22 +0000)
This function is not needed in wxGTK2 as GTK+ sets detectable auto-repeat on
its own in gdk_display_open() anyhow, so move its implementation to
src/x11/utilsx.cpp where it can be used by wxX11 and wxMotif which do need it.

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

src/common/utilscmn.cpp
src/gtk/app.cpp
src/gtk/utilsgtk.cpp
src/x11/utilsx.cpp

index 3127e809500cae079b67583821f779deb2a845c0..3c6d04dcd1e55985d679f271a6756f196b8a793d 100644 (file)
@@ -923,12 +923,15 @@ void wxQsort(void *const pbase, size_t total_elems,
 
 #if wxUSE_GUI
 
-#ifndef __WXGTK__
+// this function is only really implemented for X11-based ports, including GTK1
+// (GTK2 sets detectable auto-repeat automatically anyhow)
+#if !(defined(__WXX11__) || defined(__WXMOTIF__) || \
+        (defined(__WXGTK__) && !defined(__WXGTK20__)))
 bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) )
 {
-    return true;    // detectable auto-repeat is the only mode MSW supports
+    return true;
 }
-#endif // !wxGTK
+#endif // !X11-based port
 
 // ----------------------------------------------------------------------------
 // Launch default browser
index a627c8ee2207cf536472109aaacb3b719cf13d3f..a605152fbff5df3cfc1de8e6d4d64646baf2787d 100644 (file)
@@ -438,8 +438,6 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_)
     // we can not enter threads before gtk_init is done
     gdk_threads_enter();
 
-    wxSetDetectableAutoRepeat( true );
-
 #if wxUSE_INTL
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
 #endif
index e14420108288c8d94d6988a9dfc7b2c678781c14..bfcbbc8ab20497ec8a771cf321381e7600418f1f 100644 (file)
 #include "gtk/gtk.h"
 #include "gdk/gdkx.h"
 
-#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
-
-
 #if wxUSE_DETECT_SM
     #include "X11/Xlib.h"
     #include "X11/SM/SMlib.h"
@@ -80,22 +68,6 @@ void wxBell()
 }
 #endif
 
-/* Don't synthesize KeyUp events holding down a key and producing
-   KeyDown events with autorepeat. */
-#ifdef HAVE_X11_XKBLIB_H
-bool wxSetDetectableAutoRepeat( bool flag )
-{
-    Bool result;
-    XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag, &result );
-    return result;       /* true if keyboard hardware supports this mode */
-}
-#else
-bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) )
-{
-    return false;
-}
-#endif
-
 // ----------------------------------------------------------------------------
 // display characterstics
 // ----------------------------------------------------------------------------
index a635f8f7e816cb8ae0209c9677a3872e76e313b6..3285b0a2a4f8145ccd0ef9a7ac8c89fb7525b5c5 100644 (file)
     #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
 // ----------------------------------------------------------------------------
@@ -236,3 +248,18 @@ void wxXVisualInfo::Init( Display* dpy, XVisualInfo* vi )
 }
 
 #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
+}
+