]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/utilsgtk.cpp
Changed capitalization style of wxConv*
[wxWidgets.git] / src / gtk1 / utilsgtk.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: utils.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #include "wx/utils.h"
11 #include "wx/string.h"
12
13 #include "wx/intl.h"
14 #include "wx/log.h"
15
16 #include "wx/process.h"
17
18 #include "wx/unix/execute.h"
19
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>
30 #include <signal.h>
31 #include <fcntl.h> // for O_WRONLY and friends
32
33 #include <glib.h>
34 #include <gdk/gdk.h>
35 #include <gtk/gtk.h>
36 #include <gtk/gtkfeatures.h>
37 #include <gdk/gdkx.h>
38
39 // ----------------------------------------------------------------------------
40 // misc.
41 // ----------------------------------------------------------------------------
42
43 void wxBell()
44 {
45 gdk_beep();
46 }
47
48 // ----------------------------------------------------------------------------
49 // display characterstics
50 // ----------------------------------------------------------------------------
51
52 void wxDisplaySize( int *width, int *height )
53 {
54 if (width) *width = gdk_screen_width();
55 if (height) *height = gdk_screen_height();
56 }
57
58 void wxGetMousePosition( int* x, int* y )
59 {
60 gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
61 }
62
63 bool wxColourDisplay()
64 {
65 return TRUE;
66 }
67
68 int wxDisplayDepth()
69 {
70 return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
71 }
72
73 int wxGetOsVersion(int *majorVsn, int *minorVsn)
74 {
75 if (majorVsn) *majorVsn = GTK_MAJOR_VERSION;
76 if (minorVsn) *minorVsn = GTK_MINOR_VERSION;
77
78 return wxGTK;
79 }
80
81 // ----------------------------------------------------------------------------
82 // subprocess routines
83 // ----------------------------------------------------------------------------
84
85 static void GTK_EndProcessDetector(gpointer data, gint source,
86 GdkInputCondition WXUNUSED(condition) )
87 {
88 wxEndProcessData *proc_data = (wxEndProcessData *)data;
89
90 wxHandleProcessTermination(proc_data);
91
92 close(source);
93 gdk_input_remove(proc_data->tag);
94 }
95
96 int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
97 {
98 int tag = gdk_input_add(fd,
99 GDK_INPUT_READ,
100 GTK_EndProcessDetector,
101 (gpointer)proc_data);
102
103 return tag;
104 }
105