]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/gtk/utilsgtk.cpp
Implemented Reparent() and added test for it to minifram sample.
[wxWidgets.git] / src / gtk / utilsgtk.cpp
... / ...
CommitLineData
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#include "X11/XKBlib.h"
39
40// ----------------------------------------------------------------------------
41// misc.
42// ----------------------------------------------------------------------------
43
44void wxBell()
45{
46 gdk_beep();
47}
48
49// Synthesize KeyUp events holding down a key and producing
50// KeyDown events with autorepeat.
51bool wxSetDetectableAutoRepeat( bool flag )
52{
53 Bool result;
54 XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag, &result );
55 return result; // true if keyboard hardware supports this mode
56}
57
58// ----------------------------------------------------------------------------
59// display characterstics
60// ----------------------------------------------------------------------------
61
62void wxDisplaySize( int *width, int *height )
63{
64 if (width) *width = gdk_screen_width();
65 if (height) *height = gdk_screen_height();
66}
67
68void wxGetMousePosition( int* x, int* y )
69{
70 gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
71}
72
73bool wxColourDisplay()
74{
75 return TRUE;
76}
77
78int wxDisplayDepth()
79{
80 return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
81}
82
83int wxGetOsVersion(int *majorVsn, int *minorVsn)
84{
85 if (majorVsn) *majorVsn = GTK_MAJOR_VERSION;
86 if (minorVsn) *minorVsn = GTK_MINOR_VERSION;
87
88 return wxGTK;
89}
90
91// ----------------------------------------------------------------------------
92// subprocess routines
93// ----------------------------------------------------------------------------
94
95static void GTK_EndProcessDetector(gpointer data, gint source,
96 GdkInputCondition WXUNUSED(condition) )
97{
98 wxEndProcessData *proc_data = (wxEndProcessData *)data;
99
100 wxHandleProcessTermination(proc_data);
101
102 close(source);
103 gdk_input_remove(proc_data->tag);
104}
105
106int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
107{
108 int tag = gdk_input_add(fd,
109 GDK_INPUT_READ,
110 GTK_EndProcessDetector,
111 (gpointer)proc_data);
112
113 return tag;
114}
115