Upgrade WX to r74856, mainly to support @2x.

This commit is contained in:
comex
2013-09-22 18:44:55 -04:00
parent 0bdef3932f
commit 66ed9a1804
1935 changed files with 45373 additions and 22739 deletions

View File

@ -3,7 +3,6 @@
// Purpose: wxAppConsole implementation for Unix
// Author: Lukasz Michalski
// Created: 28/01/2005
// RCS-ID: $Id: app.h 56994 2008-11-28 12:47:07Z VZ $
// Copyright: (c) Lukasz Michalski
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -11,10 +10,17 @@
//Ensure that sigset_t is being defined
#include <signal.h>
class wxFDIODispatcher;
class wxFDIOHandler;
class wxWakeUpPipe;
// wxApp subclass implementing event processing for console applications
class WXDLLIMPEXP_BASE wxAppConsole : public wxAppConsoleBase
{
public:
wxAppConsole();
virtual ~wxAppConsole();
// override base class initialization
virtual bool Initialize(int& argc, wxChar** argv);
@ -38,6 +44,14 @@ public:
// handlers for them
void CheckSignal();
// Register the signal wake up pipe with the given dispatcher.
//
// This is used by wxExecute(wxEXEC_NOEVENTS) implementation only.
//
// The pointer to the handler used for processing events on this descriptor
// is returned so that it can be deleted when we no longer needed it.
wxFDIOHandler* RegisterSignalWakeUpPipe(wxFDIODispatcher& dispatcher);
private:
// signal handler set up by SetSignalHandler() for all signals we handle,
// it just adds the signal to m_signalsCaught -- the real processing is
@ -52,4 +66,8 @@ private:
// the signal handlers
WX_DECLARE_HASH_MAP(int, SignalHandler, wxIntegerHash, wxIntegerEqual, SignalHandlerHash);
SignalHandlerHash m_signalHandlerHash;
// pipe used for wake up signal handling: if a signal arrives while we're
// blocking for input, writing to this pipe triggers a call to our CheckSignal()
wxWakeUpPipe *m_signalWakeUpPipe;
};

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 23.06.2003
// RCS-ID: $Id: apptbase.h 61688 2009-08-17 23:02:46Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -12,9 +11,12 @@
#ifndef _WX_UNIX_APPTBASE_H_
#define _WX_UNIX_APPTBASE_H_
struct wxEndProcessData;
struct wxExecuteData;
#include "wx/evtloop.h"
#include "wx/evtloopsrc.h"
class wxExecuteData;
class wxFDIOManager;
class wxEventLoopSourcesManagerBase;
// ----------------------------------------------------------------------------
// wxAppTraits: the Unix version adds extra hooks needed by Unix code
@ -26,23 +28,13 @@ public:
// wxExecute() support methods
// ---------------------------
// wait for the process termination, return whatever wxExecute() must
// return
// Wait for the process termination and return its exit code or -1 on error.
//
// base class implementation handles all cases except wxEXEC_SYNC without
// wxEXEC_NOEVENTS one which is implemented at the GUI level
// Notice that this is only used when execData.flags contains wxEXEC_SYNC
// and does not contain wxEXEC_NOEVENTS, i.e. when we need to really wait
// until the child process exit and dispatch the events while doing it.
virtual int WaitForChild(wxExecuteData& execData);
// integrate the monitoring of the given fd with the port-specific event
// loop: when this fd, which corresponds to a dummy pipe opened between the
// parent and child processes, is closed by the child, the parent is
// notified about this via a call to wxHandleProcessTermination() function
//
// the default implementation uses wxFDIODispatcher and so is suitable for
// the console applications or ports which don't have any specific event
// loop
virtual int AddProcessCallback(wxEndProcessData *data, int fd);
#if wxUSE_SOCKETS
// return a pointer to the object which should be used to integrate
// monitoring of the file descriptors to the event loop (currently this is
@ -56,11 +48,19 @@ public:
virtual wxFDIOManager *GetFDIOManager();
#endif // wxUSE_SOCKETS
#if wxUSE_CONSOLE_EVENTLOOP
// Return a non-NULL pointer to the object responsible for managing the
// event loop sources in this kind of application.
virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager();
#endif // wxUSE_CONSOLE_EVENTLOOP
protected:
// a helper for the implementation of WaitForChild() in wxGUIAppTraits:
// checks the streams used for redirected IO in execData and returns true
// if there is any activity in them
bool CheckForRedirectedIO(wxExecuteData& execData);
// Wait for the process termination by running the given event loop until
// this happens.
//
// This is used by the public WaitForChild() after creating the event loop
// of the appropriate kind.
int RunLoopUntilChildExit(wxExecuteData& execData, wxEventLoopBase& loop);
};
#endif // _WX_UNIX_APPTBASE_H_

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 23.06.2003
// RCS-ID: $Id: apptrait.h 61688 2009-08-17 23:02:46Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -51,9 +50,6 @@ class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
public:
virtual wxEventLoopBase *CreateEventLoop();
virtual int WaitForChild(wxExecuteData& execData);
#ifdef wxHAS_GUI_PROCESS_CALLBACKS
virtual int AddProcessCallback(wxEndProcessData *data, int fd);
#endif
#if wxUSE_TIMER
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer);
#endif
@ -67,10 +63,6 @@ public:
#endif
virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const;
#if defined(__WXGTK__) && wxUSE_INTL
virtual void SetLocale();
#endif // __WXGTK__
#ifdef __WXGTK20__
virtual wxString GetDesktopEnvironment() const;
virtual wxString GetStandardCmdLineOptions(wxArrayString& names,
@ -92,6 +84,8 @@ public:
#endif
#endif // wxUSE_SOCKETS
virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager();
};
#endif // wxUSE_GUI

View File

@ -3,7 +3,6 @@
* Purpose: Unix-specific config settings consistency checks
* Author: Vadim Zeitlin
* Created: 2007-07-14
* RCS-ID: $Id: chkconf.h 63306 2010-01-29 13:07:26Z VZ $
* Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
* Licence: wxWindows licence
*/

View File

@ -3,7 +3,6 @@
// Purpose: declares wxEventLoop class
// Author: Lukasz Michalski (lm@zork.pl)
// Created: 2007-05-07
// RCS-ID: $Id: evtloop.h 65680 2010-09-30 11:44:45Z VZ $
// Copyright: (c) 2007 Lukasz Michalski
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -17,13 +16,9 @@
// wxConsoleEventLoop
// ----------------------------------------------------------------------------
class wxEventLoopSource;
class wxFDIODispatcher;
class wxUnixEventLoopSource;
namespace wxPrivate
{
class PipeIOHandler;
}
class wxWakeUpPipeMT;
class WXDLLIMPEXP_BASE wxConsoleEventLoop
#ifdef __WXOSX__
@ -45,18 +40,16 @@ public:
virtual bool IsOk() const { return m_dispatcher != NULL; }
virtual bool YieldFor(long WXUNUSED(eventsToProcess)) { return true; }
#if wxUSE_EVENTLOOP_SOURCE
virtual wxEventLoopSource *
AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags);
#endif // wxUSE_EVENTLOOP_SOURCE
protected:
virtual void OnNextIteration();
private:
// pipe used for wake up messages: when a child thread wants to wake up
// the event loop in the main thread it writes to this pipe
wxPrivate::PipeIOHandler *m_wakeupPipe;
wxWakeUpPipeMT *m_wakeupPipe;
// the event loop source used to monitor this pipe
wxEventLoopSource* m_wakeupSource;
// either wxSelectDispatcher or wxEpollDispatcher
wxFDIODispatcher *m_dispatcher;

View File

@ -3,7 +3,6 @@
// Purpose: wxUnixEventLoopSource class
// Author: Vadim Zeitlin
// Created: 2009-10-21
// RCS-ID: $Id: evtloopsrc.h 64140 2010-04-25 21:33:16Z FM $
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////

View File

@ -2,65 +2,56 @@
// Name: wx/unix/execute.h
// Purpose: private details of wxExecute() implementation
// Author: Vadim Zeitlin
// Id: $Id: execute.h 67254 2011-03-20 00:14:35Z DS $
// Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin
// (c) 2013 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIX_EXECUTE_H
#define _WX_UNIX_EXECUTE_H
#include "wx/unix/pipe.h"
#include "wx/app.h"
#include "wx/hashmap.h"
#include "wx/process.h"
class WXDLLIMPEXP_FWD_BASE wxProcess;
class wxStreamTempInputBuffer;
#if wxUSE_STREAMS
#include "wx/unix/pipe.h"
#include "wx/private/streamtempinput.h"
#endif
struct wxEndProcessData
{
wxEndProcessData()
{
pid =
tag =
exitcode = -1;
process = NULL;
async = false;
}
int pid; // pid of the process
int tag; // port dependent value
wxProcess *process; // if !NULL: notified on process termination
int exitcode; // the exit code
bool async; // if true, delete us on process termination
};
// struct in which information is passed from wxExecute() to wxAppTraits
// methods
struct wxExecuteData
class wxEventLoopBase;
// Information associated with a running child process.
class wxExecuteData
{
public:
wxExecuteData()
{
flags =
pid = 0;
exitcode = -1;
process = NULL;
#if wxUSE_STREAMS
bufOut =
bufErr = NULL;
syncEventLoop = NULL;
#if wxUSE_STREAMS
fdOut =
fdErr = wxPipe::INVALID_FD;
#endif // wxUSE_STREAMS
}
// get the FD corresponding to the read end of the process end detection
// pipe and close the write one
int GetEndProcReadFD()
{
const int fd = pipeEndProcDetect.Detach(wxPipe::Read);
pipeEndProcDetect.Close();
return fd;
}
// This must be called in the parent process as soon as fork() returns to
// update us with the effective child PID. It also ensures that we handle
// SIGCHLD to be able to detect when this PID exits, so wxTheApp must be
// available.
void OnStart(int pid);
// Called when the child process exits.
void OnExit(int exitcode);
// Return true if we should (or already did) redirect the child IO.
bool IsRedirected() const { return process && process->IsRedirected(); }
// wxExecute() flags
@ -69,26 +60,43 @@ struct wxExecuteData
// the pid of the child process
int pid;
// The exit code of the process, set once the child terminates.
int exitcode;
// the associated process object or NULL
wxProcess *process;
// pipe used for end process detection
wxPipe pipeEndProcDetect;
// Local event loop used to wait for the child process termination in
// synchronous execution case. We can't create it ourselves as its exact
// type depends on the application kind (console/GUI), so we rely on
// wxAppTraits setting up this pointer to point to the appropriate object.
wxEventLoopBase *syncEventLoop;
#if wxUSE_STREAMS
// the input buffer bufOut is connected to stdout, this is why it is
// called bufOut and not bufIn
wxStreamTempInputBuffer *bufOut,
*bufErr;
wxStreamTempInputBuffer bufOut,
bufErr;
// the corresponding FDs, -1 if not redirected
int fdOut,
fdErr;
#endif // wxUSE_STREAMS
private:
// SIGCHLD signal handler that checks whether any of the currently running
// children have exited.
static void OnSomeChildExited(int sig);
// All currently running child processes indexed by their PID.
//
// Notice that the container doesn't own its elements.
WX_DECLARE_HASH_MAP(int, wxExecuteData*, wxIntegerHash, wxIntegerEqual,
ChildProcessesData);
static ChildProcessesData ms_childProcesses;
wxDECLARE_NO_COPY_CLASS(wxExecuteData);
};
// this function is called when the process terminates from port specific
// callback function and is common to all ports (src/unix/utilsunx.cpp)
extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data);
#endif // _WX_UNIX_EXECUTE_H

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 05.11.99
// RCS-ID: $Id: fontutil.h 58227 2009-01-19 13:55:27Z VZ $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -3,7 +3,6 @@
// Purpose: wxInotifyFileSystemWatcher
// Author: Bartosz Bekier
// Created: 2009-05-26
// RCS-ID: $Id: fswatcher_inotify.h 62474 2009-10-22 11:35:43Z VZ $
// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -26,6 +25,8 @@ public:
virtual ~wxInotifyFileSystemWatcher();
void OnDirDeleted(const wxString& path);
protected:
bool Init();
};

View File

@ -3,7 +3,6 @@
// Purpose: wxKqueueFileSystemWatcher
// Author: Bartosz Bekier
// Created: 2009-05-26
// RCS-ID: $Id: fswatcher_kqueue.h 62474 2009-10-22 11:35:43Z VZ $
// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -3,7 +3,6 @@
// Purpose: class common for all X11-based wxGLCanvas implementations
// Author: Vadim Zeitlin
// Created: 2007-04-15
// RCS-ID: $Id: glx11.h 54022 2008-06-08 00:12:12Z VZ $
// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
// Author: Guilhem Lavaux
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: joystick.h 50443 2007-12-03 02:55:14Z PC $
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 23.09.98
// RCS-ID: $Id: mimetype.h 62356 2009-10-09 17:39:19Z PC $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence (part of wxExtra library)
/////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 24.06.2003 (extracted from src/unix/utilsunx.cpp)
// RCS-ID: $Id: pipe.h 66152 2010-11-14 14:04:37Z VZ $
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -13,6 +12,7 @@
#define _WX_UNIX_PIPE_H_
#include <unistd.h>
#include <fcntl.h>
#include "wx/log.h"
#include "wx/intl.h"
@ -44,7 +44,7 @@ public:
{
if ( pipe(m_fds) == -1 )
{
wxLogSysError(_("Pipe creation failed"));
wxLogSysError(wxGetTranslation("Pipe creation failed"));
return false;
}
@ -98,41 +98,5 @@ private:
int m_fds[2];
};
#if wxUSE_STREAMS && wxUSE_FILE
#include "wx/wfstream.h"
// ----------------------------------------------------------------------------
// wxPipeInputStream: stream for reading from a pipe
// ----------------------------------------------------------------------------
class wxPipeInputStream : public wxFileInputStream
{
public:
wxPipeInputStream(int fd) : wxFileInputStream(fd) { }
// return TRUE if the pipe is still opened
bool IsOpened() const { return !Eof(); }
// return TRUE if we have anything to read, don't block
virtual bool CanRead() const;
};
// ----------------------------------------------------------------------------
// wxPipeOutputStream: stream for writing to a pipe
// ----------------------------------------------------------------------------
class wxPipeOutputStream : public wxFileOutputStream
{
public:
wxPipeOutputStream(int fd) : wxFileOutputStream(fd) { }
// Override the base class version to ignore "pipe full" errors: this is
// not an error for this class.
size_t OnSysWrite(const void *buffer, size_t size);
};
#endif // wxUSE_STREAMS && wxUSE_FILE
#endif // _WX_UNIX_PIPE_H_

View File

@ -3,7 +3,6 @@
// Purpose: miscellaneous private things for Unix wx ports
// Author: Vadim Zeitlin
// Created: 2005-09-25
// RCS-ID: $Id: private.h 56927 2008-11-23 01:52:20Z VZ $
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
// Authors: Lukasz Michalski
// Created: April 2007
// Copyright: (c) Lukasz Michalski
// RCS-ID: $Id: epolldispatcher.h 67254 2011-03-20 00:14:35Z DS $
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,136 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/unix/private/executeiohandler.h
// Purpose: IO handler class for the FD used by wxExecute() under Unix
// Author: Rob Bresalier, Vadim Zeitlin
// Created: 2013-01-06
// Copyright: (c) 2013 Rob Bresalier, Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIX_PRIVATE_EXECUTEIOHANDLER_H_
#define _WX_UNIX_PRIVATE_EXECUTEIOHANDLER_H_
#include "wx/private/streamtempinput.h"
// This class handles IO events on the pipe FD connected to the child process
// stdout/stderr and is used by wxExecute().
//
// Currently it can derive from either wxEventLoopSourceHandler or
// wxFDIOHandler depending on the kind of dispatcher/event loop it is used
// with. In the future, when we get rid of wxFDIOHandler entirely, it will
// derive from wxEventLoopSourceHandler only.
template <class T>
class wxExecuteIOHandlerBase : public T
{
public:
wxExecuteIOHandlerBase(int fd, wxStreamTempInputBuffer& buf)
: m_fd(fd),
m_buf(buf)
{
m_callbackDisabled = false;
}
// Called when the associated descriptor is available for reading.
virtual void OnReadWaiting()
{
// Sync process, process all data coming at us from the pipe so that
// the pipe does not get full and cause a deadlock situation.
m_buf.Update();
if ( m_buf.Eof() )
DisableCallback();
}
// These methods are never called as we only monitor the associated FD for
// reading, but we still must implement them as they're pure virtual in the
// base class.
virtual void OnWriteWaiting() { }
virtual void OnExceptionWaiting() { }
// Disable any future calls to our OnReadWaiting(), can be called when
// we're sure that no more input is forthcoming.
void DisableCallback()
{
if ( !m_callbackDisabled )
{
m_callbackDisabled = true;
DoDisable();
}
}
protected:
const int m_fd;
private:
virtual void DoDisable() = 0;
wxStreamTempInputBuffer& m_buf;
// If true, DisableCallback() had been already called.
bool m_callbackDisabled;
wxDECLARE_NO_COPY_CLASS(wxExecuteIOHandlerBase);
};
// This is the version used with wxFDIODispatcher, which must be passed to the
// ctor in order to register this handler with it.
class wxExecuteFDIOHandler : public wxExecuteIOHandlerBase<wxFDIOHandler>
{
public:
wxExecuteFDIOHandler(wxFDIODispatcher& dispatcher,
int fd,
wxStreamTempInputBuffer& buf)
: wxExecuteIOHandlerBase<wxFDIOHandler>(fd, buf),
m_dispatcher(dispatcher)
{
dispatcher.RegisterFD(fd, this, wxFDIO_INPUT);
}
virtual ~wxExecuteFDIOHandler()
{
DisableCallback();
}
private:
virtual void DoDisable()
{
m_dispatcher.UnregisterFD(m_fd);
}
wxFDIODispatcher& m_dispatcher;
wxDECLARE_NO_COPY_CLASS(wxExecuteFDIOHandler);
};
// And this is the version used with an event loop. As AddSourceForFD() is
// static, we don't require passing the event loop to the ctor but an event
// loop must be running to handle our events.
class wxExecuteEventLoopSourceHandler
: public wxExecuteIOHandlerBase<wxEventLoopSourceHandler>
{
public:
wxExecuteEventLoopSourceHandler(int fd, wxStreamTempInputBuffer& buf)
: wxExecuteIOHandlerBase<wxEventLoopSourceHandler>(fd, buf)
{
m_source = wxEventLoop::AddSourceForFD(fd, this, wxEVENT_SOURCE_INPUT);
}
virtual ~wxExecuteEventLoopSourceHandler()
{
DisableCallback();
}
private:
virtual void DoDisable()
{
delete m_source;
m_source = NULL;
}
wxEventLoopSource* m_source;
wxDECLARE_NO_COPY_CLASS(wxExecuteEventLoopSourceHandler);
};
#endif // _WX_UNIX_PRIVATE_EXECUTEIOHANDLER_H_

View File

@ -3,7 +3,6 @@
// Purpose: wxFDIOManagerUnix class used by console Unix applications
// Author: Vadim Zeitlin
// Created: 2009-08-17
// RCS-ID: $Id: fdiounix.h 64140 2010-04-25 21:33:16Z FM $
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////

View File

@ -3,7 +3,6 @@
// Purpose: File system watcher impl classes
// Author: Bartosz Bekier
// Created: 2009-05-26
// RCS-ID: $Id: fswatcher_inotify.h 62475 2009-10-22 11:36:35Z VZ $
// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -3,7 +3,6 @@
// Purpose: File system watcher impl classes
// Author: Bartosz Bekier
// Created: 2009-05-26
// RCS-ID: $Id: fswatcher_kqueue.h 62475 2009-10-22 11:36:35Z VZ $
// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,37 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/unix/private/pipestream.h
// Purpose: Unix wxPipeInputStream and wxPipeOutputStream declarations
// Author: Vadim Zeitlin
// Created: 2013-06-08 (extracted from wx/unix/pipe.h)
// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIX_PRIVATE_PIPESTREAM_H_
#define _WX_UNIX_PRIVATE_PIPESTREAM_H_
#include "wx/wfstream.h"
class wxPipeInputStream : public wxFileInputStream
{
public:
wxEXPLICIT wxPipeInputStream(int fd) : wxFileInputStream(fd) { }
// return true if the pipe is still opened
bool IsOpened() const { return !Eof(); }
// return true if we have anything to read, don't block
virtual bool CanRead() const;
};
class wxPipeOutputStream : public wxFileOutputStream
{
public:
wxPipeOutputStream(int fd) : wxFileOutputStream(fd) { }
// Override the base class version to ignore "pipe full" errors: this is
// not an error for this class.
size_t OnSysWrite(const void *buffer, size_t size);
};
#endif // _WX_UNIX_PRIVATE_PIPESTREAM_H_

View File

@ -3,7 +3,6 @@
// Purpose: wxSocketImpl implementation for Unix systems
// Authors: Guilhem Lavaux, Vadim Zeitlin
// Created: April 1997
// RCS-ID: $Id: sockunix.h 65581 2010-09-21 11:56:53Z VZ $
// Copyright: (c) 1997 Guilhem Lavaux
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows licence

View File

@ -3,7 +3,6 @@
// Purpose: wxTimer for wxBase (unix)
// Author: Lukasz Michalski
// Created: 15/01/2005
// RCS-ID: $Id: timer.h 69839 2011-11-27 19:50:33Z VZ $
// Copyright: (c) Lukasz Michalski
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,101 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/unix/private/wakeuppipe.h
// Purpose: Helper class allowing to wake up the main thread.
// Author: Vadim Zeitlin
// Created: 2013-06-09 (extracted from src/unix/evtloopunix.cpp)
// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIX_PRIVATE_WAKEUPPIPE_H_
#define _WX_UNIX_PRIVATE_WAKEUPPIPE_H_
#include "wx/unix/pipe.h"
#include "wx/evtloopsrc.h"
// ----------------------------------------------------------------------------
// wxWakeUpPipe: allows to wake up the event loop by writing to it
// ----------------------------------------------------------------------------
// This class is not MT-safe, see wxWakeUpPipeMT below for a wake up pipe
// usable from other threads.
class wxWakeUpPipe : public wxEventLoopSourceHandler
{
public:
// Create and initialize the pipe.
//
// It's the callers responsibility to add the read end of this pipe,
// returned by GetReadFd(), to the code blocking on input.
wxWakeUpPipe();
// Wake up the blocking operation involving this pipe.
//
// It simply writes to the write end of the pipe.
//
// As indicated by its name, this method does no locking and so can be
// called only from the main thread.
void WakeUpNoLock();
// Same as WakeUp() but without locking.
// Return the read end of the pipe.
int GetReadFd() { return m_pipe[wxPipe::Read]; }
// Implement wxEventLoopSourceHandler pure virtual methods
virtual void OnReadWaiting();
virtual void OnWriteWaiting() { }
virtual void OnExceptionWaiting() { }
private:
wxPipe m_pipe;
// This flag is set to true after writing to the pipe and reset to false
// after reading from it in the main thread. Having it allows us to avoid
// overflowing the pipe with too many writes if the main thread can't keep
// up with reading from it.
bool m_pipeIsEmpty;
};
// ----------------------------------------------------------------------------
// wxWakeUpPipeMT: thread-safe version of wxWakeUpPipe
// ----------------------------------------------------------------------------
// This class can be used from multiple threads, i.e. its WakeUp() can be
// called concurrently.
#if wxUSE_THREADS
class wxWakeUpPipeMT : public wxWakeUpPipe
{
public:
wxWakeUpPipeMT() { }
// Thread-safe wrapper around WakeUpNoLock(): can be called from another
// thread to wake up the main one.
void WakeUp()
{
wxCriticalSectionLocker lock(m_pipeLock);
WakeUpNoLock();
}
virtual void OnReadWaiting()
{
wxCriticalSectionLocker lock(m_pipeLock);
wxWakeUpPipe::OnReadWaiting();
}
private:
// Protects access to m_pipeIsEmpty.
wxCriticalSection m_pipeLock;
};
#else // !wxUSE_THREADS
typedef wxWakeUpPipe wxWakeUpPipeMT;
#endif // wxUSE_THREADS/!wxUSE_THREADS
#endif // _WX_UNIX_PRIVATE_WAKEUPPIPE_H_

View File

@ -4,7 +4,6 @@
// Author: Julian Smart, Vaclav Slavik
// Modified by:
// Created: 25/10/98
// RCS-ID: $Id: sound.h 69178 2011-09-21 15:08:02Z VZ $
// Copyright: (c) Julian Smart, Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 2005-01-19
// RCS-ID: $Id: stackwalk.h 58093 2009-01-14 14:38:00Z FM $
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 2004-10-19
// RCS-ID: $Id: stdpaths.h 53094 2008-04-08 13:52:39Z JS $
// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@ -51,6 +50,11 @@ public:
virtual wxString GetDocumentsDir() const;
#endif
protected:
// Ctor is protected, use wxStandardPaths::Get() instead of instantiating
// objects of this class directly.
wxStandardPaths() { }
private:
wxString m_prefix;
};

View File

@ -4,7 +4,6 @@
// Author: Vaclav Slavik
// Modified by:
// Created: 04/04/2003
// RCS-ID: $Id: taskbarx11.h 62789 2009-12-05 19:57:58Z PC $
// Copyright: (c) Vaclav Slavik, 2003
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////

View File

@ -3,7 +3,6 @@
// Purpose: Pthreads implementation of wxTlsValue<>
// Author: Vadim Zeitlin
// Created: 2008-08-08
// RCS-ID: $Id: tls.h 63653 2010-03-08 12:21:58Z VS $
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////

View File

@ -4,7 +4,6 @@
// Author: Mattia Barbon, Vaclav Slavik, Vadim Zeitlin
// Modified by:
// Created: 25.03.02
// RCS-ID: $Id: utilsx11.h 65397 2010-08-24 11:23:22Z JJ $
// Copyright: (c) wxWidgets team
// (c) 2010 Vadim Zeitlin
// Licence: wxWindows licence