]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/utilsgtk.cpp
Convert argv[] to Unicode
[wxWidgets.git] / src / gtk1 / utilsgtk.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: utils.cpp
3// Purpose:
4// Author: Robert Roebling
dfcb1ae0 5// Id: $Id$
c801d85f 6// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
518b5d2f 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
c801d85f
KB
10#include "wx/utils.h"
11#include "wx/string.h"
12
02847e59
VZ
13#include "wx/intl.h"
14#include "wx/log.h"
15
5336ece4
VZ
16#include "wx/process.h"
17
518b5d2f
VZ
18#include "wx/unix/execute.h"
19
c801d85f 20#include <stdarg.h>
c801d85f
KB
21#include <string.h>
22#include <sys/stat.h>
23#include <sys/types.h>
24#include <unistd.h>
91b8de8d
RR
25
26#include "glib.h"
27#include "gdk/gdk.h"
28#include "gtk/gtk.h"
29#include "gtk/gtkfeatures.h"
30#include "gdk/gdkx.h"
88ac883a 31
27933891
RR
32#ifdef HAVE_X11_XKBLIB_H
33 #ifdef __HPUX__
34 /* under HP-UX XKBlib.h defines structures with field named "explicit" -
35 * which is, of course, an error for a C++ compiler */
88ac883a 36 #define explicit __wx_explicit
27933891
RR
37 #endif
38
39 #include "X11/XKBlib.h"
40
41 #ifdef __HPUX__
88ac883a 42 #undef explicit
27933891
RR
43 #endif // __HPUX__
44#endif // HAVE_X11_XKBLIB_H
dfcb1ae0 45
518b5d2f 46// ----------------------------------------------------------------------------
c801d85f 47// misc.
518b5d2f 48// ----------------------------------------------------------------------------
c801d85f 49
518b5d2f 50void wxBell()
c801d85f 51{
e52f60e6
RR
52 gdk_beep();
53}
c801d85f 54
27933891
RR
55/* Don't synthesize KeyUp events holding down a key and producing
56 KeyDown events with autorepeat. */
57#ifdef HAVE_X11_XKBLIB_H
f0492f7d
RR
58bool wxSetDetectableAutoRepeat( bool flag )
59{
60 Bool result;
61 XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag, &result );
27933891
RR
62 return result; /* TRUE if keyboard hardware supports this mode */
63}
64#else
65bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) )
66{
67 return FALSE;
f0492f7d 68}
27933891 69#endif
f0492f7d 70
518b5d2f
VZ
71// ----------------------------------------------------------------------------
72// display characterstics
73// ----------------------------------------------------------------------------
82052aff 74
c0392997
RR
75void wxDisplaySize( int *width, int *height )
76{
e52f60e6
RR
77 if (width) *width = gdk_screen_width();
78 if (height) *height = gdk_screen_height();
c0392997
RR
79}
80
6de97a3b
RR
81void wxGetMousePosition( int* x, int* y )
82{
bbe0af5b 83 gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
e52f60e6 84}
6de97a3b 85
518b5d2f 86bool wxColourDisplay()
6de97a3b 87{
e52f60e6 88 return TRUE;
6de97a3b
RR
89}
90
518b5d2f 91int wxDisplayDepth()
6de97a3b 92{
2d17d68f 93 return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
6de97a3b
RR
94}
95
bbe0af5b
RR
96int wxGetOsVersion(int *majorVsn, int *minorVsn)
97{
98 if (majorVsn) *majorVsn = GTK_MAJOR_VERSION;
99 if (minorVsn) *minorVsn = GTK_MINOR_VERSION;
7e84f02d 100
bbe0af5b
RR
101 return wxGTK;
102}
103
518b5d2f 104// ----------------------------------------------------------------------------
c801d85f 105// subprocess routines
518b5d2f 106// ----------------------------------------------------------------------------
cf447356
GL
107
108static void GTK_EndProcessDetector(gpointer data, gint source,
e3e65dac 109 GdkInputCondition WXUNUSED(condition) )
cf447356 110{
bbe0af5b 111 wxEndProcessData *proc_data = (wxEndProcessData *)data;
cf447356 112
518b5d2f 113 wxHandleProcessTermination(proc_data);
cf447356 114
bbe0af5b
RR
115 close(source);
116 gdk_input_remove(proc_data->tag);
3069ac4e 117}
cf447356 118
518b5d2f 119int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
c801d85f 120{
518b5d2f
VZ
121 int tag = gdk_input_add(fd,
122 GDK_INPUT_READ,
123 GTK_EndProcessDetector,
124 (gpointer)proc_data);
c801d85f 125
518b5d2f 126 return tag;
3069ac4e 127}
c801d85f 128