]>
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 //----------------------------------------------------------------------------
67 /* Don't synthesize KeyUp events holding down a key and producing
68 KeyDown events with autorepeat. */
69 #ifdef HAVE_X11_XKBLIB_H
70 bool wxSetDetectableAutoRepeat( bool flag
)
73 XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag
, &result
);
74 return result
; /* true if keyboard hardware supports this mode */
77 bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag
) )
83 // ----------------------------------------------------------------------------
84 // display characterstics
85 // ----------------------------------------------------------------------------
92 void wxDisplaySize( int *width
, int *height
)
94 if (width
) *width
= gdk_screen_width();
95 if (height
) *height
= gdk_screen_height();
98 void wxDisplaySizeMM( int *width
, int *height
)
100 if (width
) *width
= gdk_screen_width_mm();
101 if (height
) *height
= gdk_screen_height_mm();
104 void wxGetMousePosition( int* x
, int* y
)
106 gdk_window_get_pointer( NULL
, x
, y
, NULL
);
109 bool wxColourDisplay()
116 return gdk_window_get_visual( wxGetRootWindow()->window
)->depth
;
119 wxWindow
* wxFindWindowAtPoint(const wxPoint
& pt
)
121 return wxGenericFindWindowAtPoint(pt
);
125 // ----------------------------------------------------------------------------
126 // subprocess routines
127 // ----------------------------------------------------------------------------
131 void GTK_EndProcessDetector(gpointer data
, gint source
,
132 GdkInputCondition
WXUNUSED(condition
) )
134 wxEndProcessData
* const
135 proc_data
= static_cast<wxEndProcessData
*>(data
);
137 // child exited, end waiting
140 // don't call us again!
141 gdk_input_remove(proc_data
->tag
);
143 wxHandleProcessTermination(proc_data
);
147 int wxGUIAppTraits::AddProcessCallback(wxEndProcessData
*proc_data
, int fd
)
149 int tag
= gdk_input_add(fd
,
151 GTK_EndProcessDetector
,
152 (gpointer
)proc_data
);
159 wxTimerImpl
* wxGUIAppTraits::CreateTimerImpl(wxTimer
*timer
)
161 return new wxGTKTimerImpl(timer
);
164 #endif // wxUSE_TIMER
166 // ----------------------------------------------------------------------------
167 // wxPlatformInfo-related
168 // ----------------------------------------------------------------------------
170 wxPortId
wxGUIAppTraits::GetToolkitVersion(int *verMaj
, int *verMin
) const
173 *verMaj
= gtk_major_version
;
175 *verMin
= gtk_minor_version
;
180 wxEventLoopBase
* wxGUIAppTraits::CreateEventLoop()
182 return new wxEventLoop
;
186 void wxGUIAppTraits::SetLocale()