]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
3cbab641 | 2 | // Name: src/gtk1/utilsgtk.cpp |
c801d85f KB |
3 | // Purpose: |
4 | // Author: Robert Roebling | |
dfcb1ae0 | 5 | // Id: $Id$ |
6c9a19aa | 6 | // Copyright: (c) 1998 Robert Roebling |
65571936 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
14f355c2 VS |
10 | // For compilers that support precompilation, includes "wx.h". |
11 | #include "wx/wxprec.h" | |
12 | ||
c801d85f | 13 | #include "wx/utils.h" |
df91131c WS |
14 | |
15 | #ifndef WX_PRECOMP | |
16 | #include "wx/string.h" | |
88a7a4e1 | 17 | #include "wx/intl.h" |
e4db172a | 18 | #include "wx/log.h" |
df91131c | 19 | #endif |
c801d85f | 20 | |
46446cc2 | 21 | #include "wx/apptrait.h" |
c2ca375c | 22 | #include "wx/gtk1/private/timer.h" |
b46b1d59 | 23 | #include "wx/evtloop.h" |
5336ece4 VZ |
24 | #include "wx/process.h" |
25 | ||
c801d85f | 26 | #include <stdarg.h> |
c801d85f KB |
27 | #include <string.h> |
28 | #include <sys/stat.h> | |
29 | #include <sys/types.h> | |
dbd25330 | 30 | #include <sys/wait.h> // for WNOHANG |
c801d85f | 31 | #include <unistd.h> |
91b8de8d RR |
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" | |
88ac883a | 38 | |
27933891 | 39 | #ifdef HAVE_X11_XKBLIB_H |
154c4aa1 VZ |
40 | /* under HP-UX and Solaris 2.6, at least, XKBlib.h defines structures with |
41 | * field named "explicit" - which is, of course, an error for a C++ | |
42 | * compiler. To be on the safe side, just redefine it everywhere. */ | |
88ac883a | 43 | #define explicit __wx_explicit |
ec5d7799 | 44 | |
154c4aa1 | 45 | #include "X11/XKBlib.h" |
ec5d7799 | 46 | |
88ac883a | 47 | #undef explicit |
27933891 | 48 | #endif // HAVE_X11_XKBLIB_H |
dfcb1ae0 | 49 | |
d76fe38b RR |
50 | //----------------------------------------------------------------------------- |
51 | // data | |
52 | //----------------------------------------------------------------------------- | |
53 | ||
c2fa61e8 | 54 | extern GtkWidget *wxGetRootWindow(); |
d76fe38b RR |
55 | |
56 | //---------------------------------------------------------------------------- | |
c801d85f | 57 | // misc. |
d76fe38b | 58 | //---------------------------------------------------------------------------- |
c801d85f | 59 | |
518b5d2f | 60 | void wxBell() |
c801d85f | 61 | { |
e52f60e6 RR |
62 | gdk_beep(); |
63 | } | |
c801d85f | 64 | |
27933891 RR |
65 | /* Don't synthesize KeyUp events holding down a key and producing |
66 | KeyDown events with autorepeat. */ | |
67 | #ifdef HAVE_X11_XKBLIB_H | |
f0492f7d RR |
68 | bool wxSetDetectableAutoRepeat( bool flag ) |
69 | { | |
70 | Bool result; | |
71 | XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag, &result ); | |
df91131c | 72 | return result; /* true if keyboard hardware supports this mode */ |
27933891 RR |
73 | } |
74 | #else | |
75 | bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) ) | |
76 | { | |
df91131c | 77 | return false; |
f0492f7d | 78 | } |
27933891 | 79 | #endif |
f0492f7d | 80 | |
518b5d2f VZ |
81 | // ---------------------------------------------------------------------------- |
82 | // display characterstics | |
83 | // ---------------------------------------------------------------------------- | |
82052aff | 84 | |
d111a89a VZ |
85 | void *wxGetDisplay() |
86 | { | |
27df579a | 87 | return GDK_DISPLAY(); |
d111a89a VZ |
88 | } |
89 | ||
c0392997 RR |
90 | void wxDisplaySize( int *width, int *height ) |
91 | { | |
e52f60e6 RR |
92 | if (width) *width = gdk_screen_width(); |
93 | if (height) *height = gdk_screen_height(); | |
c0392997 RR |
94 | } |
95 | ||
904a68b6 RL |
96 | void wxDisplaySizeMM( int *width, int *height ) |
97 | { | |
98 | if (width) *width = gdk_screen_width_mm(); | |
99 | if (height) *height = gdk_screen_height_mm(); | |
100 | } | |
101 | ||
6de97a3b RR |
102 | void wxGetMousePosition( int* x, int* y ) |
103 | { | |
d3b9f782 | 104 | gdk_window_get_pointer( NULL, x, y, NULL ); |
e52f60e6 | 105 | } |
6de97a3b | 106 | |
518b5d2f | 107 | bool wxColourDisplay() |
6de97a3b | 108 | { |
df91131c | 109 | return true; |
6de97a3b RR |
110 | } |
111 | ||
518b5d2f | 112 | int wxDisplayDepth() |
6de97a3b | 113 | { |
c2fa61e8 | 114 | return gdk_window_get_visual( wxGetRootWindow()->window )->depth; |
6de97a3b RR |
115 | } |
116 | ||
57591e0e JS |
117 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt) |
118 | { | |
119 | return wxGenericFindWindowAtPoint(pt); | |
120 | } | |
121 | ||
122 | ||
518b5d2f | 123 | // ---------------------------------------------------------------------------- |
c801d85f | 124 | // subprocess routines |
518b5d2f | 125 | // ---------------------------------------------------------------------------- |
cf447356 | 126 | |
1d043598 VZ |
127 | #if wxUSE_TIMER |
128 | ||
c2ca375c VZ |
129 | wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) |
130 | { | |
131 | return new wxGTKTimerImpl(timer); | |
132 | } | |
133 | ||
1d043598 VZ |
134 | #endif // wxUSE_TIMER |
135 | ||
8bb6b2c0 VZ |
136 | // ---------------------------------------------------------------------------- |
137 | // wxPlatformInfo-related | |
138 | // ---------------------------------------------------------------------------- | |
139 | ||
140 | wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const | |
141 | { | |
142 | if ( verMaj ) | |
143 | *verMaj = gtk_major_version; | |
144 | if ( verMin ) | |
145 | *verMin = gtk_minor_version; | |
146 | ||
147 | return wxPORT_GTK; | |
148 | } | |
61ecd225 | 149 | |
2ddff00c | 150 | wxEventLoopBase* wxGUIAppTraits::CreateEventLoop() |
61ecd225 | 151 | { |
b46b1d59 | 152 | return new wxEventLoop; |
61ecd225 | 153 | } |
a1f1afe4 | 154 |