Nothing is going to work without the console apps/base traits support for the
event loop but at least make it compile.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The tests for these functions may succeed on the system we're running under
but the functions may not be actually available on the system the application
is going to run under (if it's < 10.7).
So use our own replacements for these functions unless 10.7 was explicitly
chosen as the minimal possible version.
An alternative solution could have been to use weak linking but this is more
difficult and there is no real gain (performance would need to be measured
first).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The changes of r73483 broke inclusion of the manifest in the programs built
using MinGW because wxUSE_RC_MANIFEST was never defined. Somehow nobody
complained about it but this resulted in using comctl32.dll 5.80 instead of
6.0 and e.g. problems with toolbar appearance (see #13512).
Do use the manifest by default with MinGW and, in fact, all the other
compilers if any other ones still work, as only MSVC is known to embed the
manifest automatically and we take care of it separately.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Do keep compiler-specific wxCHECK_MINGW32_VERSION() in wx/compiler.h as it's
needed by wx/cpp.h which includes wx/compiler.h only. But put the rest of the
stuff in gccpriv.h in its old place as including it before wx/setup.h didn't
work correctly and was unnecessary anyhow.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This solves the problem with wx/defs.h -> wx/platform.h -> wx/setup.h which
resolves to msvc/wx/setup.h -> wx/version.h -> wx/cpp.h include path which
resulted in __VISUALC__ not being defined in wx/cpp.h.
This problem was not new but went unnoticed for a long time and was only
discovered when wxCHECK_VISUALC_VERSION() started being used in wx/cpp.h too
as now the compiler started warning about wrong #if syntax due to it being
undefined.
Putting the compiler-specific definitions in a separate file allows this file
to be included from wx/cpp.h to ensure that these symbols are always defined
in it and also makes things a little better organized.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This is needed to at least silence g++ warnings but may actually even fix a
real problem as these classes can be inherited from and are deleted via a
pointer (to "this" itself, in Release() implementation).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The main user-visible effect of this change is that giving configure
--disable-vararg-macros argument now really disables the use of variadic
macros whereas it didn't disable them in wx/cpp.h before.
It is, of course, also less confusing to not have two very similar but
different symbols.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The functions are available in wxBase builds too, but wx/windowid.h
isn't. Rather than always including that header, just use int, for which
wxWindowID is a typedef. This keeps the functions available in wxBase
for compatibility and is consistent with how IDs are handled in other
parts of wxBase, particularly wxEvent.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxNewId(), wxRegisterId() and wxGetCurrentId() functions all work with
window IDs, so they should use the dedicated type. Previously, they
worked with long, which is not even the same type (wxWindowID is int),
causing implicit type conversion warnings.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Add a hack to ignore WM_MENUSELECT messages we get for the top level menu
items: we must not clear the status bar help message when we get those because
it had just been restored to the original message that was there before the
menu was opened from the base class wxEVT_MENU_CLOSE handler, but this message
comes after it when keyboard is used to close the menu.
Closes#15315.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74468 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The compiler warns about content after defined(__has_included), so avoid
the issue by putting these Clang tests inside one big #ifdef
__has_included block.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Using the GNU libstdc++ or Clang's libc++ implementations of the
standard library, <cmath> inclusion undefines the isfinite macro,
resulting in compilation errors when wxFinite() is used. <cmath> can be
included unintentionally, e.g. wx/hashmap.h may result in its inclusion
when using STD containers.
Work around this mess by checking if one of these <cmath>
implementations were already included and using std::isfinite() in that
case.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This happens to work under MSW and Unix where there is only one
wxStandardPaths class for both the console and the GUI applications but
doesn't return the correct result under OS X where the Core Foundation
version, returned by wxStandardPaths::Get(), has to be used for the GUI
programs. And historically this confused a lot of people, so just ensure that
they can't accidentally create an object of the wrong type any more.
Closes#13537.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Record the object propagating the given event upwards in the event object
itself and use it in wxMDIParentFrame to determine whether the event being
handled is already coming from wxMDIChildFrame and avoid sending it back for
processing it there again in this case.
This is ugly and makes wx event processing even more complex but this is the
only way I could find to ensure that
(a) Both the child and the parent frames get the events from the toolbar
(even though the toolbar parent is the parent frame and hence normally
the child wouldn't get notified about them at all and so the forwarding
at wxMDIParentFrame level is required to make this work).
(b) The child gets the event only once, whether it comes from a toolbar (and
hence indirectly via the parent frame) or from the child menu (and hence
directly to the child, at least in wxMSW).
This commit fixes the event propagation unit test case, at least under MSW and
GTK.
See #14314.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74357 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit changes wxExecute() to handle SIGCHLD to be notified about the
child process termination instead of detecting when the file descriptor
corresponding to the other end of a pipe opened in the parent process was
closed in the child as this was not reliable and could (and did) result in not
detecting the termination of the child processes that closed all their file
descriptors before exiting.
This commit also removes a lot of platform-specific code duplicating the
generic event loop sources support and reuses it for wxExecute() purposes too.
Final big change is that wxEndProcessData was merged into wxExecuteData and we
don't have two similar but quite different classes any more but just one,
which is used both to pass the information from wxExecute() to wxAppTraits
methods and to store this information until the child termination.
Closes#10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This method always returns some valid traits, even if we don't have wxTheApp
(which is possible in the console applications) or if its GetTraits() was
overridden to return NULL (which shouldn't be, but still guard against this).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Instead of hardcoding the call to WakeUpIdle() in the signal handler itself,
just wake up the event loop when we catch a signal. This will still result in
WakeUpIdle() being called, before the next event loop iteration, but it will
also allow us to do other things on wakeup from signal as it will be done in
the upcoming wxExecute() changes to support wxEXEC_NOEVENTS in console
applications.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
No real changes but use wxEventLoopSource::AddSourceForFD() instead of
wxFDIODispatcher::RegisterFD() for this pipe because this is the preferred way
and because it will allow reusing this class for wxExecute() purposes later.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This is necessary to ensure that wxUSE_EVENTLOOP_SOURCE which wraps the entire
contents of this header is defined if it's included directly and not after
already including wx/evtloop.h.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74345 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
No real changes, just make the header self-containing instead of relying on
the file including it to include <fcntl.h> itself.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This just reads everything remaining in the stream in a blocking way and will
be used to get the data remaining in the stream buffers after the child
process had been already closed (and hence can't write any more to it and
there is no risk of deadlock).
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Use OS X socket APIs for monitoring file descriptors. They are more flexible
than CFFileDescriptor functions and can be used with any descriptors, not
necessarily the socket ones.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74342 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Any event sources should be registered with all the event loops, including the
ones that will be started in the future, and not only the current (and
potentially not even existing yet) one. So make AddSourceForFD() method static.
To still allow it to do different things in console and GUI applications, as
it must, virtualize it via the new wxEventLoopSourcesManager class which has
different implementations in the two cases, returned via wxAppTraits as usual.
Notice that this required moving the implementation of this method from
src/osx/core/evtloop_cf.cpp to src/osx/core/utilsexc_cf.cpp as the former file
is base-only and didn't have access to wxGUIAppTraits.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This class can also be useful when it's used in the main thread only, so
leave the lock-less part of the code in wxWakeUpPipe and derive a separate
wxWakeUpPipeMT from it for the use in wxConsoleEventLoop where it can be used
by multiple threads.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Get rid of the surprising src/common/execcmn.cpp which had a .cpp extension
but was supposed to be used as an included file only and move its contents to
a new private header to make using wxStreamTempInputBuffer class simpler.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
No real changes, just put these classes in a private header. They're still not
part of the public API but at least it will be easier to reuse them inside the
library itself in the upcoming commits.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This method allows to request exiting from the given event loop even if it's
not the currently active one, unlike Exit() which would assert in this case.
With it, it becomes possible to ask the loop to terminate as soon as possible
even if a nested loop is currently running.
See #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Call it from public Run() after setting the loop as active and resetting
m_shouldExit flag.
No real changes, just cut down on the code duplication among the ports and
make it easier to implement the upcoming changes. see #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Just rename these methods to avoid clashes with DoRun() that will be added to
the base class soon, no real changes.
This is done in preparation for improving nested event loops support, see #10258.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775