]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/utilsgtk.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/utilsgtk.cpp
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
16 #include "wx/string.h"
21 #include "wx/apptrait.h"
22 #include "wx/gtk1/private/timer.h"
23 #include "wx/evtloop.h"
24 #include "wx/process.h"
26 #include "wx/unix/execute.h"
31 #include <sys/types.h>
32 #include <sys/wait.h> // for WNOHANG
38 #include "gtk/gtkfeatures.h"
41 #ifdef HAVE_X11_XKBLIB_H
42 /* under HP-UX and Solaris 2.6, at least, XKBlib.h defines structures with
43 * field named "explicit" - which is, of course, an error for a C++
44 * compiler. To be on the safe side, just redefine it everywhere. */
45 #define explicit __wx_explicit
47 #include "X11/XKBlib.h"
50 #endif // HAVE_X11_XKBLIB_H
52 //-----------------------------------------------------------------------------
54 //-----------------------------------------------------------------------------
56 extern GtkWidget
*wxGetRootWindow();
58 //----------------------------------------------------------------------------
60 //----------------------------------------------------------------------------
62 // on OS/2, we use the wxBell from wxBase library
70 /* Don't synthesize KeyUp events holding down a key and producing
71 KeyDown events with autorepeat. */
72 #ifdef HAVE_X11_XKBLIB_H
73 bool wxSetDetectableAutoRepeat( bool flag
)
76 XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag
, &result
);
77 return result
; /* true if keyboard hardware supports this mode */
80 bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag
) )
86 // ----------------------------------------------------------------------------
87 // display characterstics
88 // ----------------------------------------------------------------------------
95 void wxDisplaySize( int *width
, int *height
)
97 if (width
) *width
= gdk_screen_width();
98 if (height
) *height
= gdk_screen_height();
101 void wxDisplaySizeMM( int *width
, int *height
)
103 if (width
) *width
= gdk_screen_width_mm();
104 if (height
) *height
= gdk_screen_height_mm();
107 void wxGetMousePosition( int* x
, int* y
)
109 gdk_window_get_pointer( NULL
, x
, y
, NULL
);
112 bool wxColourDisplay()
119 return gdk_window_get_visual( wxGetRootWindow()->window
)->depth
;
122 wxWindow
* wxFindWindowAtPoint(const wxPoint
& pt
)
124 return wxGenericFindWindowAtPoint(pt
);
128 // ----------------------------------------------------------------------------
129 // subprocess routines
130 // ----------------------------------------------------------------------------
134 void GTK_EndProcessDetector(gpointer data
, gint source
,
135 GdkInputCondition
WXUNUSED(condition
) )
137 wxEndProcessData
* const
138 proc_data
= static_cast<wxEndProcessData
*>(data
);
140 // child exited, end waiting
143 // don't call us again!
144 gdk_input_remove(proc_data
->tag
);
146 wxHandleProcessTermination(proc_data
);
150 int wxGUIAppTraits::AddProcessCallback(wxEndProcessData
*proc_data
, int fd
)
152 int tag
= gdk_input_add(fd
,
154 GTK_EndProcessDetector
,
155 (gpointer
)proc_data
);
162 wxTimerImpl
* wxGUIAppTraits::CreateTimerImpl(wxTimer
*timer
)
164 return new wxGTKTimerImpl(timer
);
167 #endif // wxUSE_TIMER
169 // ----------------------------------------------------------------------------
170 // wxPlatformInfo-related
171 // ----------------------------------------------------------------------------
173 wxPortId
wxGUIAppTraits::GetToolkitVersion(int *verMaj
, int *verMin
) const
176 *verMaj
= gtk_major_version
;
178 *verMin
= gtk_minor_version
;
183 wxEventLoopBase
* wxGUIAppTraits::CreateEventLoop()
185 return new wxEventLoop
;
189 void wxGUIAppTraits::SetLocale()