]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/utilsgtk.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/string.h"
16 #include "wx/process.h"
18 #include "wx/unix/execute.h"
23 #include <sys/types.h>
29 #include "gtk/gtkfeatures.h"
32 #ifdef HAVE_X11_XKBLIB_H
33 /* under HP-UX and Solaris 2.6, at least, XKBlib.h defines structures with
34 * field named "explicit" - which is, of course, an error for a C++
35 * compiler. To be on the safe side, just redefine it everywhere. */
36 #define explicit __wx_explicit
38 #include "X11/XKBlib.h"
41 #endif // HAVE_X11_XKBLIB_H
43 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
47 extern GtkWidget
*wxRootWindow
;
49 //----------------------------------------------------------------------------
51 //----------------------------------------------------------------------------
58 /* Don't synthesize KeyUp events holding down a key and producing
59 KeyDown events with autorepeat. */
60 #ifdef HAVE_X11_XKBLIB_H
61 bool wxSetDetectableAutoRepeat( bool flag
)
64 XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag
, &result
);
65 return result
; /* TRUE if keyboard hardware supports this mode */
68 bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag
) )
74 // ----------------------------------------------------------------------------
75 // display characterstics
76 // ----------------------------------------------------------------------------
83 void wxDisplaySize( int *width
, int *height
)
85 if (width
) *width
= gdk_screen_width();
86 if (height
) *height
= gdk_screen_height();
89 void wxGetMousePosition( int* x
, int* y
)
91 gdk_window_get_pointer( (GdkWindow
*) NULL
, x
, y
, (GdkModifierType
*) NULL
);
94 bool wxColourDisplay()
101 return gdk_window_get_visual( wxRootWindow
->window
)->depth
;
104 int wxGetOsVersion(int *majorVsn
, int *minorVsn
)
106 if (majorVsn
) *majorVsn
= GTK_MAJOR_VERSION
;
107 if (minorVsn
) *minorVsn
= GTK_MINOR_VERSION
;
112 // ----------------------------------------------------------------------------
113 // subprocess routines
114 // ----------------------------------------------------------------------------
116 static void GTK_EndProcessDetector(gpointer data
, gint source
,
117 GdkInputCondition
WXUNUSED(condition
) )
119 wxEndProcessData
*proc_data
= (wxEndProcessData
*)data
;
121 gdk_input_remove(proc_data
->tag
);
123 // This has to come after gdk_input_remove() or we will
124 // occasionally receive multiple callbacks with corrupt data
126 wxHandleProcessTermination(proc_data
);
129 int wxAddProcessCallback(wxEndProcessData
*proc_data
, int fd
)
131 int tag
= gdk_input_add(fd
,
133 GTK_EndProcessDetector
,
134 (gpointer
)proc_data
);