Fix wrong return value from wxWebViewIE::Find() in 64 bit build.
Using wxNOT_FOUND and an unsigned size() return value in the same operator ?:
resulted in wxNOT_FOUND being converted to an unsigned size_t type and while
converting it back to (signed) long worked in 32 bit builds where long and
size_t have the same size, it was broken in 64 bit builds where their sizes
are different.
Make destructors of COM interface classes virtual.
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).
Reconcile HAVE_VARIADIC_MACROS and wxHAS_VARIADIC_MACROS definitions.
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.
Václav Slavík [Thu, 11 Jul 2013 07:53:35 +0000 (07:53 +0000)]
Use int instead of wxWindowID in wxNewId() and friends.
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.
Václav Slavík [Thu, 11 Jul 2013 06:58:35 +0000 (06:58 +0000)]
Use wxWindowID in wxNewId() and related functions.
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.
Fix restoring the status bar help message after closing MSW menu from keyboard.
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.
Allow retrieving the descent and external leading of empty strings.
This used to work before wxTextMeasure changes so make it work again instead
of optimizing the case of empty string away and not returning anything in the
descent and externalLeading output parameters in this case.
Václav Slavík [Tue, 9 Jul 2013 17:29:02 +0000 (17:29 +0000)]
Fix VC++ warnings about __has_include().
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.
Václav Slavík [Tue, 9 Jul 2013 15:44:01 +0000 (15:44 +0000)]
Work around wxFinite() definition conflict with <cmath>.
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.
Check for buffer being big enough in wxPathOnly().
Just return NULL or empty string if the input path is too long. This is
probably not ideal but it fixes a buffer overflow and all this code needs to
be rewritten to use wxFileName() anyhow so it's not worth doing anything more
at this moment.
Add pngprefix.h file generated by libpng configure/make process (which we
don't run during wxWidgets build, so this is something that will need to be
redone manually whenever libpng is upgraded, the procedure for doing this is
documented in docs/tech/tn0025.txt) in order to use "wx_" prefix for all
libpng public symbols. This should avoid at least some problems due to the
conflicts between the built-in libpng and shared libpng loaded into the
process as GTK+ libraries dependency under Unix.
Also rename wx_png_{warning,error} to use upper case PNG for consistency with
wx_PNG_stream_{reader,writer} and to avoid conflict with png_{warning,error}()
which we now rename to have "wx_" prefix.
Define XML_STATIC in Expat header instead of Expat projects.
This reverts r74444 and defines XML_STATIC unconditionally in Expat sources
themselves as we always use the built-in Expat as a static library, so this
solution is simpler and more portable.
Define XML_STATIC for Expat build to fix linking of Windows DLLs.
The new Expat assumes it's built as a DLL by default, define XML_STATIC to
indicate that this is not the case as we always build it as a static library.
Václav Slavík [Sun, 7 Jul 2013 13:42:50 +0000 (13:42 +0000)]
Don't look for catalogs in AddCatalogLookupPathPrefix() path directly.
Previously, the prefix directory itself for searched for catalogs, in
addition to prefix/lang/LC_MESSAGES and prefix/lang. This never made
much sense, because only one catalog could be in such place, instead of
multiple catalogs for more languages. It also prevented successful
identification of catalog's language and didn't work with
GetAvailableLanguages().
Remove this misfeature and update the documentation accordingly. Update
OS X-specific code so that it continues to work (it previously depended
on this behavior). As a side effect, *.lproj directories are now
recognized in all search prefixes, not just in Resources.
Václav Slavík [Sun, 7 Jul 2013 13:42:02 +0000 (13:42 +0000)]
Correct wxTranslations docs: CWD is not searched.
The documentation incorrectly stated that the current working directory
is searched for translations. This isn't the case (and wouldn't be a
good thing to do).
Merge with the latest version, mostly discarding our changes to 1.95.6 as they
seem to be unnecessary any longer, keep just bakefile-specific addition to
configure.
Also update our own makefile to define HAVE_EXPAT_CONFIG_H which is now needed
by Unix build.
Václav Slavík [Sun, 7 Jul 2013 11:47:17 +0000 (11:47 +0000)]
Use wxConvAuto() in wxStyledTextCtrl::DoLoadFile().
This is both more reasonable than the current runtime encoding (the
input file is from unknown source) and more robust (it can handle UTF-*
encoded files transparently).
Forbid creation of wxStandardPaths object directly.
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.
Reuse wxMessageOutputStderr for wxLogStderr implementation.
In addition to avoiding (tiny) code duplication, this ensures that both places
use the stream in the same orientation, i.e. either both use the narrow
functions or the wide ones. Thus, it fixes a problem with output simply
disappearing if wxLogStderr and wxMessageOutputStderr were both used: the one
used first disabled any output by the other one.
Fix FILETIME <-> wxDateTime conversions while DST is in effect in wxMSW.
The result was (consistently, so the tests still passed) off by an hour when
the program was ran while DST was in effect. Fix this by avoiding the use of
FileTimeToLocalFileTime() and LocalFileTimeToFileTime() and just directly
converting FILETIME values to wxDateTime. Not only this is more correct but
it's also simpler and more efficient as well.
Also add a unit test for wxFileName::SetTimes() too.
Exclude expat files from pre commit hook checks too.
All the other 3rd party libraries were already excluded but not this one, for
some reason -- do exclude it now as upcoming Expat 2.1.0 sources contain some
files with TABs.
The library was already present in the makefiles but came before the
monolithic library itself, which broke the linking of the samples when using
GNU ld as the dependent libraries must come after the libraries using them.
Fix test for Windows in the new wxExecute() unit test.
TestOverlappedSyncExecute() doesn't currently pass under Windows and was
supposed to not be executed there but was, in console test, as __WXMSW__ is
not defined in this case, only __WINDOWS__ is (as there is no GUI toolkit in
the console applications).
Prevent duplicate menu event processing in MDI windows.
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.
Ensure that the MDI child is active in event propagation test.
Call wxMDIChildFrame::Activate() explicitly as the behaviour was different
under MSW (where the activation happened too late for the test) and GTK where
the child did become active because of the hacks in place to ensure it.
Don't ignore child process output if it exits with -1 exit code.
While this code is used by us if the program couldn't be launched at all, it
doesn't mean that it didn't run as -1 could also be returned by the child
process to indicate an error after outputting something, so we should still
read its output in this case.
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.
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).
Treat G_IO_HUP as read, not error, event because EOF is not exceptional.
When EOF is reached on a file descriptor, call the handler OnReadWaiting()
because this is not really different from getting to the EOF while reading
data in the same function. Only call OnExceptionWaiting() for the real errors.
Make Unix wxAppConsole signal handling more flexible.
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.
Change wxWakeUpPipe to be a wxEventLoopSourceHandler.
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.
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.
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).
Use CFSocket instead of CFFileDescriptor in wxCFEventLoopSource.
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.
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.
Split wxWakeUpPipe class in MT-unsafe and MT-safe parts.
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.
No changes, move wxStreamTempInputBuffer to a header file.
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.
Extract wxPipeInputStream and wxPipeOutputStream in a header.
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.
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.