]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/utilsgtk.cpp
Added wxOKlibc(), which checks for glibc2.0, which incorrectly does UTF-8
[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
KB
20#include <stdarg.h>
21#include <dirent.h>
22#include <string.h>
23#include <sys/stat.h>
24#include <sys/types.h>
25#include <unistd.h>
26#include <sys/wait.h>
27#include <pwd.h>
28#include <errno.h>
29#include <netdb.h>
82052aff 30#include <signal.h>
4e13eb84 31#include <fcntl.h> // for O_WRONLY and friends
c801d85f 32
afb74891
VZ
33#include <glib.h>
34#include <gdk/gdk.h>
35#include <gtk/gtk.h>
36#include <gtk/gtkfeatures.h>
37#include <gdk/gdkx.h>
dfcb1ae0 38
518b5d2f 39// ----------------------------------------------------------------------------
c801d85f 40// misc.
518b5d2f 41// ----------------------------------------------------------------------------
c801d85f 42
518b5d2f 43void wxBell()
c801d85f 44{
e52f60e6
RR
45 gdk_beep();
46}
c801d85f 47
518b5d2f
VZ
48// ----------------------------------------------------------------------------
49// display characterstics
50// ----------------------------------------------------------------------------
82052aff 51
c0392997
RR
52void wxDisplaySize( int *width, int *height )
53{
e52f60e6
RR
54 if (width) *width = gdk_screen_width();
55 if (height) *height = gdk_screen_height();
c0392997
RR
56}
57
6de97a3b
RR
58void wxGetMousePosition( int* x, int* y )
59{
bbe0af5b 60 gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
e52f60e6 61}
6de97a3b 62
518b5d2f 63bool wxColourDisplay()
6de97a3b 64{
e52f60e6 65 return TRUE;
6de97a3b
RR
66}
67
518b5d2f 68int wxDisplayDepth()
6de97a3b 69{
2d17d68f 70 return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
6de97a3b
RR
71}
72
bbe0af5b
RR
73int wxGetOsVersion(int *majorVsn, int *minorVsn)
74{
75 if (majorVsn) *majorVsn = GTK_MAJOR_VERSION;
76 if (minorVsn) *minorVsn = GTK_MINOR_VERSION;
7e84f02d 77
bbe0af5b
RR
78 return wxGTK;
79}
80
518b5d2f 81// ----------------------------------------------------------------------------
c801d85f 82// subprocess routines
518b5d2f 83// ----------------------------------------------------------------------------
cf447356
GL
84
85static void GTK_EndProcessDetector(gpointer data, gint source,
e3e65dac 86 GdkInputCondition WXUNUSED(condition) )
cf447356 87{
bbe0af5b 88 wxEndProcessData *proc_data = (wxEndProcessData *)data;
cf447356 89
518b5d2f 90 wxHandleProcessTermination(proc_data);
cf447356 91
bbe0af5b
RR
92 close(source);
93 gdk_input_remove(proc_data->tag);
3069ac4e 94}
cf447356 95
518b5d2f 96int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
c801d85f 97{
518b5d2f
VZ
98 int tag = gdk_input_add(fd,
99 GDK_INPUT_READ,
100 GTK_EndProcessDetector,
101 (gpointer)proc_data);
c801d85f 102
518b5d2f 103 return tag;
3069ac4e 104}
c801d85f 105