#include <sys/wait.h>
#include <pwd.h>
#include <errno.h>
-// #include <netdb.h>
#include <signal.h>
#if (defined(__SUNCC__) || defined(__CLCC__))
#include "wx/unix/execute.h"
-#ifdef __WXMOTIF__
#include <Xm/Xm.h>
#include "wx/motif/private.h"
-#endif
-
-#ifdef __WXX11__
-#include "wx/x11/private.h"
-#endif
#if wxUSE_RESOURCES
#include "X11/Xresource.h"
XSync (display, FALSE);
-#ifdef __WXMOTIF__
// XtAppPending returns availability of events AND timers/inputs, which
// are processed via callbacks, so XtAppNextEvent will not return if
// there are no events. So added '& XtIMXEvent' - Sergey.
// Jan Lessner: works better when events are non-X events
XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMXEvent);
}
-#endif
-#ifdef __WXX11__
- // TODO for X11
- // ??
-#endif
}
+#if 0
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
bool wxCheckForInterrupt(wxWindow *wnd)
{
-#ifdef __WXMOTIF__
wxCHECK_MSG( wnd, FALSE, "NULL window in wxCheckForInterrupt" );
Display *dpy=(Display*) wnd->GetXDisplay();
}
return hadEvents;
-#else
- wxASSERT_MSG(FALSE, "wxCheckForInterrupt not yet implemented.");
- return FALSE;
-#endif
}
+#endif
// ----------------------------------------------------------------------------
// wxExecute stuff
// ----------------------------------------------------------------------------
-#ifdef __WXMOTIF__
+
static void xt_notify_end_process(XtPointer data, int *WXUNUSED(fid),
XtInputId *id)
{
XtRemoveInput(*id);
}
-#endif
int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
{
-#ifdef __WXMOTIF__
XtInputId id = XtAppAddInput((XtAppContext) wxTheApp->GetAppContext(),
fd,
(XtPointer *) XtInputReadMask,
(XtPointer) proc_data);
return (int)id;
-#endif
-#ifdef __WXX11__
- // TODO
- return 0;
-#endif
}
// ----------------------------------------------------------------------------
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
-#ifdef __WXMOTIF__
// FIXME TODO
// This code is WRONG!! Does NOT return the
// Motif version of the libs but the X protocol
*minorVsn = ProtocolRevision (display);
return wxMOTIF_X;
-#endif
-#ifdef __WXX11__
- if (majorVsn)
- *majorVsn = 0;
- if (minorVsn)
- *minorVsn = 0;
- return wxX11;
-#endif
}
// ----------------------------------------------------------------------------
{
if (gs_currentDisplay)
return gs_currentDisplay;
-#ifdef __WXMOTIF__
if (wxTheApp && wxTheApp->GetTopLevelWidget())
return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
else if (wxTheApp)
return wxTheApp->GetInitialDisplay();
return NULL;
-#endif
-#ifdef __WXX11__
- return wxApp::GetDisplay();
-#endif
}
bool wxSetDisplay(const wxString& display_name)
}
else
{
-#ifdef __WXMOTIF__
Cardinal argc = 0;
Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(),
}
else
return FALSE;
-#endif
-#ifdef __WXX11__
- Display* display = XOpenDisplay((char*) display_name.c_str());
-
- if (display)
- {
- gs_currentDisplay = (WXDisplay*) display;
- return TRUE;
- }
- else
- return FALSE;
-#endif
}
}
}
#endif
-#ifdef __WXMOTIF__
// ----------------------------------------------------------------------------
// accelerators
// ----------------------------------------------------------------------------
}
-// These functions duplicate those in wxWindow, but are needed
-// for use outside of wxWindow (e.g. wxMenu, wxMenuBar).
-
// Change a widget's foreground and background colours.
void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
}
-#endif
- // __WXMOTIF__
-
bool wxWindowIsVisible(Window win)
{
XWindowAttributes wa;
XSync (display, FALSE);
-#ifdef __WXMOTIF__
- // XtAppPending returns availability of events AND timers/inputs, which
- // are processed via callbacks, so XtAppNextEvent will not return if
- // there are no events. So added '& XtIMXEvent' - Sergey.
- while (XtAppPending ((XtAppContext) wxTheApp->GetAppContext()) & XtIMXEvent)
- {
- XFlush (XtDisplay ((Widget) wxTheApp->GetTopLevelWidget()));
- // Jan Lessner: works better when events are non-X events
- XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMXEvent);
- }
-#endif
-#ifdef __WXX11__
// TODO for X11
// ??
-#endif
}
bool wxCheckForInterrupt(wxWindow *wnd)
{
-#ifdef __WXMOTIF__
- wxCHECK_MSG( wnd, FALSE, "NULL window in wxCheckForInterrupt" );
-
- Display *dpy=(Display*) wnd->GetXDisplay();
- Window win=(Window) wnd->GetXWindow();
- XEvent event;
- XFlush(dpy);
- if (wnd->GetMainWidget())
- {
- XmUpdateDisplay((Widget)(wnd->GetMainWidget()));
- }
-
- bool hadEvents = FALSE;
- while( XCheckMaskEvent(dpy,
- ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|
- PointerMotionMask|KeyPressMask|KeyReleaseMask,
- &event) )
- {
- if ( event.xany.window == win )
- {
- hadEvents = TRUE;
-
- XtDispatchEvent(&event);
- }
- }
-
- return hadEvents;
-#else
wxASSERT_MSG(FALSE, "wxCheckForInterrupt not yet implemented.");
return FALSE;
-#endif
}
// ----------------------------------------------------------------------------
int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
{
-#ifdef __WXMOTIF__
- XtInputId id = XtAppAddInput((XtAppContext) wxTheApp->GetAppContext(),
- fd,
- (XtPointer *) XtInputReadMask,
- (XtInputCallbackProc) xt_notify_end_process,
- (XtPointer) proc_data);
-
- return (int)id;
-#endif
-#ifdef __WXX11__
// TODO
return 0;
-#endif
}
// ----------------------------------------------------------------------------
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
-#ifdef __WXX11__
if (majorVsn)
*majorVsn = 0;
*minorVsn = 0;
return wxX11;
-#endif
}
// ----------------------------------------------------------------------------
{
if (gs_currentDisplay)
return gs_currentDisplay;
-#ifdef __WXMOTIF__
- if (wxTheApp && wxTheApp->GetTopLevelWidget())
- return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
- else if (wxTheApp)
- return wxTheApp->GetInitialDisplay();
- return NULL;
-#endif
-#ifdef __WXX11__
return wxApp::GetDisplay();
-#endif
}
bool wxSetDisplay(const wxString& display_name)