]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/utilsgtk.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/string.h"
16 #include "wx/process.h"
18 #include "wx/unix/execute.h"
23 #include <sys/types.h>
30 #include "gtk/gtkfeatures.h"
34 #ifdef HAVE_X11_XKBLIB_H
35 /* under HP-UX and Solaris 2.6, at least, XKBlib.h defines structures with
36 * field named "explicit" - which is, of course, an error for a C++
37 * compiler. To be on the safe side, just redefine it everywhere. */
38 #define explicit __wx_explicit
40 #include "X11/XKBlib.h"
43 #endif // HAVE_X11_XKBLIB_H
45 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
49 extern GtkWidget
*wxRootWindow
;
51 //----------------------------------------------------------------------------
53 //----------------------------------------------------------------------------
60 /* Don't synthesize KeyUp events holding down a key and producing
61 KeyDown events with autorepeat. */
62 #ifdef HAVE_X11_XKBLIB_H
63 bool wxSetDetectableAutoRepeat( bool flag
)
66 XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag
, &result
);
67 return result
; /* TRUE if keyboard hardware supports this mode */
70 bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag
) )
76 // ----------------------------------------------------------------------------
77 // display characterstics
78 // ----------------------------------------------------------------------------
85 void wxDisplaySize( int *width
, int *height
)
87 if (width
) *width
= gdk_screen_width();
88 if (height
) *height
= gdk_screen_height();
91 void wxDisplaySizeMM( int *width
, int *height
)
93 if (width
) *width
= gdk_screen_width_mm();
94 if (height
) *height
= gdk_screen_height_mm();
97 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
99 // This is supposed to return desktop dimensions minus any window
100 // manager panels, menus, taskbars, etc. If there is a way to do that
101 // for this platform please fix this function, otherwise it defaults
102 // to the entire desktop.
105 wxDisplaySize(width
, height
);
108 void wxGetMousePosition( int* x
, int* y
)
110 gdk_window_get_pointer( (GdkWindow
*) NULL
, x
, y
, (GdkModifierType
*) NULL
);
113 bool wxColourDisplay()
120 return gdk_window_get_visual( wxRootWindow
->window
)->depth
;
123 int wxGetOsVersion(int *majorVsn
, int *minorVsn
)
125 if (majorVsn
) *majorVsn
= GTK_MAJOR_VERSION
;
126 if (minorVsn
) *minorVsn
= GTK_MINOR_VERSION
;
131 wxWindow
* wxFindWindowAtPoint(const wxPoint
& pt
)
133 return wxGenericFindWindowAtPoint(pt
);
137 // ----------------------------------------------------------------------------
138 // subprocess routines
139 // ----------------------------------------------------------------------------
141 static void GTK_EndProcessDetector(gpointer data
, gint source
,
142 GdkInputCondition
WXUNUSED(condition
) )
144 wxEndProcessData
*proc_data
= (wxEndProcessData
*)data
;
146 gdk_input_remove(proc_data
->tag
);
148 // This has to come after gdk_input_remove() or we will
149 // occasionally receive multiple callbacks with corrupt data
151 wxHandleProcessTermination(proc_data
);
154 int wxAddProcessCallback(wxEndProcessData
*proc_data
, int fd
)
156 int tag
= gdk_input_add(fd
,
158 GTK_EndProcessDetector
,
159 (gpointer
)proc_data
);