Commit Graph

205 Commits

Author SHA1 Message Date
Maarten Bent
fa2242a0a6 Reset static sizes when DPI changes 2019-09-06 20:59:59 +02:00
Tim Stahlhut
f941b50c6b Use cygwin native timeval
__ms_timeval does not exist unless winsock.h or winsock2.h is included.
So, test for __WINDOWS__ before using __ms_timeval.

Fixes #18456
2019-08-02 17:44:21 -04:00
Vadim Zeitlin
5488a1438f Globally replace vadim@wxwindows.org with vadim@wxwidgets.org
The old email address is invalid since many years and shouldn't be used
any longer.

No real changes.
2019-04-22 14:12:05 +02:00
dasimx
a15004fc5f Fix handling display disconnection under wxMSW
Information about display cached in wxDisplayFactory::m_impls and in
wxDisplayFactoryMSW::m_displays could get out of sync after removing a
display from the system, resulting in failures when calling various
wxDisplay functions later.

To fix this, reuse InvalidateCache() to invalidate the cache in
wxDisplayFactoryMSW too, making it virtual in order to allow overriding
it there. Also call InvalidateCache() from wxDisplayFactoryMSW itself
instead of doing it from wxWindow, as this works even when the
application isn't showing any windows (and also keeps all
display-related code together).

Closes https://github.com/wxWidgets/wxWidgets/pull/1246
2019-03-29 23:19:59 +01:00
Vadim Zeitlin
8fbca5cb70 Remove all trailing spaces
No real changes, just clean up sources by removing trailing spaces from
all the non-generated files.

This should hopefully avoid future commits mixing significant changes
with insignificant whitespace ones.
2019-01-30 17:35:54 +01:00
Vadim Zeitlin
22c18a107e Invalidate wxDisplay cache under MSW when the displays change
The cache added in 990c8bfd73 was not
invalidated properly, meaning that wrong information was returned when
displays were [dis]connected after the application startup.

Fix this at least for MSW by invalidating the cache on receiving
WM_DISPLAYCHANGE (which means that sometimes we will do it
unnecessarily, as the change in resolution of an existing display
doesn't require cache invalidation, but this shouldn't be a big problem
in practice as the speed with which the user can change the display
resolution is not very high).

Closes https://github.com/wxWidgets/wxWidgets/pull/1090
2019-01-04 14:09:56 +01:00
Vadim Zeitlin
9f8684c789 Factor out wxDisplayImpl::ComputePPI() helper
No real changes, this is a pure refactoring.
2018-10-30 23:43:29 +01:00
Vadim Zeitlin
f09b9dbfa2 Add wxDisplayImpl::GetScaleFactor() and implement it for wxGTK
We need to account for the scale factor under GTK+ (and, presumably,
under macOS) to compute the correct PPI value as it must use the number
of physical and not logical pixels.
2018-10-29 18:33:26 +01:00
Vadim Zeitlin
ded2894b78 Add wxDisplay::GetPPI() to use instead of wxGetDisplayPPI()
While this is not done for all the ports yet, the new API allows
returning different PPI values for different monitors, unlike the old
(and still existing, but implemented in terms of the new one) global
function.
2018-10-08 13:04:38 +02:00
Vadim Zeitlin
24b5e256df Add wxDisplay::GetDepth() and use it for wxDisplayDepth()
Allow getting the depth of any display, not just the primary one, even
though this is not implemented for Unix ports currently.

Mostly do this for consistency with the other display-related functions.
2018-10-07 00:30:12 +02:00
Vadim Zeitlin
9cc1424b84 Return empty string from wxDisplayImpl::GetName() by default
Simplify the code by not making this function pure virtual as all the
ports except MSW had to override it just to return an empty string.

Instead, just return empty string by default as it's not critical to
force the derived classes to override this function.
2018-10-04 16:37:12 +02:00
Vadim Zeitlin
ddc88b74b6 Remove unnecessary DLL export declarations for private classes
wxDisplayFactory and wxDisplayImpl don't have to be exported from the
wxWidgets shared libraries and, in fact, shouldn't be.
2018-09-30 23:08:43 +02:00
Vadim Zeitlin
c2162792cf Implement wxDisplaySize() and wxClientDisplayRect() via wxDisplay
Instead of forwarding to these functions from wxDisplay implementation
in wxUSE_DISPLAY==0 case, make the functions themselves wrappers around
wxDisplay, which may, or not, depending on the platform, have a simpler
implementation in wxUSE_DISPLAY==0 case, but is always available in any
case.

As part of this change, only use src/osx/core/display.cpp in macOS
builds, not iOS ones and update the Xcode project accordingly too.

This cuts down on code duplication, especially in wxGTK, and facilitates
further additions to wxDisplay API.
2018-09-30 23:07:45 +02:00
Vadim Zeitlin
990c8bfd73 Cache wxDisplayImpl object for faster access
Avoid a heap allocation on every wxDisplay creation by caching the
wxDisplayImpl objects once they're created.

Currently we never invalidate the cache, but we should add a way to do
it in the future.

This speeds up wxDisplay::GetGeometry() benchmark by a factor of 4.
2018-09-30 00:53:59 +02:00
Vadim Zeitlin
bac28b95cd Move wx/display_impl.h to wx/private/display.h
This shows more clearly that this header is private to wxWidgets and
can't be included by user code.

No real changes.
2018-09-30 00:38:26 +02:00
Vadim Zeitlin
5d4ca0dbbe Add support for strike through attribute to markup spans
It can be handled in exactly the same way as underlining, so just do it
instead of leaving a "TODO" comment about it.
2018-09-17 15:24:42 +02:00
Vadim Zeitlin
ea00b0b603 Use SetFractionalPointSize() in wxMarkupParser code
Now that fractional sizes are supported, use them instead of rounding up
to integer size.
2018-09-17 15:24:42 +02:00
Vadim Zeitlin
4e0b4e5939 Fix wxDFB build after the font changes
Implement the new wxFont pure virtual methods in this port version of
this class.

Neither arbitrary weights nor fractional point sizes are actually
supported in this port however.
2018-09-17 15:24:40 +02:00
Blake-Eryx
49e20a961d Fix misspellings in comments and documentation
No real changes.

Closes https://github.com/wxWidgets/wxWidgets/pull/870
2018-07-31 13:20:17 +02:00
Vadim Zeitlin
8ebcfebc5c Fix wxGTK 1 build after gtk/gtk.h wrapper header addition
Changes of c0b0562533 to common code broke
wxGTK1 build, as wx/gtk/private/wrapgtk.h is for wxGTK 2+ only.

Fix this by handling wxGTK 1 separately and including gtk/gtk.h directly
for it.

Hopefully this code will be removed, together with the rest of wxGTK1
support, in some not so distant future.
2018-07-10 14:54:19 +02:00
Vadim Zeitlin
6ae7aa4443 Fix saving/restoring window position for maximized windows
Save both the normal window geometry and its maximized position instead
of saving just its current position. This fixes restoring geometry of
the maximized windows as previously they were always restored on the
primary monitor, as their original position was lost.

Use the native {Get,Set}WindowPlacement() functions for a MSW-specific
wxTLWGeometry implementation to achieve this.

Closes #16335.
2018-04-29 20:35:44 +02:00
Vadim Zeitlin
d97c055514 Introduce platform-dependent wxTLWGeometry class
Previously, TLW geometry was implicitly defined as just its position,
size and the maximized/iconized state by wxPersistentTLW code. This
already wasn't enough for wxGTK which added the decoration sizes to the
geometry being saved/restored, but this had to be done using conditional
compilation, which was not ideal. And it didn't allow using an entirely
different geometry representation as will be done for wxMSW soon.

Change the code to use wxTLWGeometry class defining the geometry, as
used by the current port, explicitly and move wxPersistentTLW logic into
it, as wxPersistentXXX classes are supposed to be very simple, which
wasn't really the case.

Also provide public SaveGeometry() and RestoreToGeometry() methods in
wxTopLevelWindow, which can be useful even to people not using
wxPersistentTLW for whatever reason.

There should be no changes in behaviour so far.
2018-04-29 19:51:10 +02:00
Maarten Bent
3d427a1af1 Fix wxWebView::RunScript() with string containing backslashes
Escape backslashes in wxJSScriptWrapper to allow strings with
backslashes in them to work again -- this was broken while implementing
support for returning values from JavaScript to C++.

See https://github.com/wxWidgets/wxWidgets/pull/741
2018-02-22 13:44:00 +01:00
Vadim Zeitlin
fa41d06cce Fix some harmless gcc 7 -Wimplicit-fallthrough warnings
Add wxFALLTHROUGH to avoid the warnings where fall-through is actually
desired.
2018-02-03 18:22:45 +01:00
Vadim Zeitlin
ebb06fbeaf Use wxTimeVal_t instead of timeval to fix 64 bit Cygwin problems
Due to the same problem with sizeof(long) mismatch as in the previous
commit, we can't use struct timeval, with its long fields, in 64 bit
Cygwin builds, and need to use __ms_timeval instead.

Add wxTimeVal_t type to hide this difference and update all code
compiled under MSW (there is no need to uglify Unix-only code using
timeval, as in wxSelectDispatcher, for example) to use it instead of
timeval.
2018-01-14 02:25:51 +01:00
Vadim Zeitlin
3e0adbf541 Merge branch 'gesture-events'
Integrate GSoC 2017 work by Prashant Kumar implementing support for
gesture events.

Closes https://github.com/wxWidgets/wxWidgets/pull/551

Closes https://github.com/wxWidgets/wxWidgets/pull/565
2017-12-02 18:46:53 +01:00
Vadim Zeitlin
471a771382 Fix built-in wxPrintf() for repeated positional parameters
Allow wxPrintf("%1$s %1$s", "foo") to work.

Take into account the possibility that the number of format specifiers
and the number of actual arguments can be different.

Closes #9367.
2017-11-25 11:13:02 +01:00
Vadim Zeitlin
020c598c18 Rename wxExternalField methods to not mention "Window"
This class doesn't have to be used with wxWindow or similar as object
type, so use a more neutral "Object" instead of "Window".
2017-11-22 03:05:03 +01:00
Vadim Zeitlin
6fd435b83f Extract "external field" approach in a reusable class
Add wxExternalField<> template that can be used for other fields and/or
in other ports too.
2017-11-22 03:05:03 +01:00
Vadim Zeitlin
40b629641b Don't define "objElements" in JavaScript code unless we need it
This variable is only used when dumping object fields, so define it
there both as a micro-optimization and for clarity.
2017-10-22 23:38:04 +02:00
Vadim Zeitlin
d1c15bfe0e Reformat JavaScript code in wxJSScriptWrapper
No real changes, but just use string concatenation instead of line
continuation backslashes and also replace hard TABs with spaces.

Notice that the code is still completely unreadable as JavaScript, but
this shouldn't be a problem as nobody will see it there anyhow, so it's
quite enough to have it more readable in its string form in C++.
2017-10-22 23:38:02 +02:00
Vadim Zeitlin
3907524098 Remove unused wxJSScriptWrapper::GetOutputJSVariable() method
There doesn't seem to be any reason to keep it.
2017-10-22 23:38:00 +02:00
Vadim Zeitlin
eff7a2e07f Improve wxJSScriptWrapper methods comments
Explain more clearly what each of them does.
2017-10-22 23:37:58 +02:00
Vadim Zeitlin
6563f38496 Make wxJSScriptWrapper methods const
Do not mark as const their returned values, which is useless, and seems
to have been a result of some confusion about how "const" works in C++.
2017-10-22 23:37:56 +02:00
Vadim Zeitlin
836c874c88 Escape JavaScript code in wxJSScriptWrapper constructor
We can prepare the escaped code directly here, instead of waiting for
GetWrappedCode() call, this is more clear and safer as it avoids
escaping the code twice accidentally if GetWrappedCode() ends up being
called twice somehow.
2017-10-22 23:37:54 +02:00
Vadim Zeitlin
1b7bb46568 Don't use dollar sign in the JavaScript variable name neither
While it is allowed there, it is confusing and unnecessary.

Also improve the comment explaining why do we need this output variable
name at all and why does it need to be unique.
2017-10-22 23:37:52 +02:00
Vadim Zeitlin
71522731c6 Fix typos in wxJSScriptWrapper comments
No real changes.
2017-10-22 23:37:50 +02:00
Vadim Zeitlin
c45e674fa0 Don't use dollar sign in C++ identifiers in wxJSScriptWrapper
This is a non-standard extension in the first place and the variable
name didn't make any sense too, so rename it to be standard-conforming
and actually correspond to what it contains.
2017-10-22 23:37:48 +02:00
Vadim Zeitlin
148c590017 Get rid of unnecessary "explicit" in wxJSScriptWrapper
This ctor has more than one argument and so can't be used implicitly.
2017-10-22 23:37:46 +02:00
Jose Lorenzo
af8f7f33c3 Merge wxWebView JavaScript improvements branch
This is a squashed commit of the SOC2017_WEBVIEW_JS branch from
https://github.com/joseeloren/wxWidgets.git

Closes https://github.com/wxWidgets/wxWidgets/pull/538
2017-10-21 22:42:30 +02:00
Stefan Csomor
f045323934 Adding native macos Cocoa implementation for overlays into build files 2017-09-09 23:34:50 +02:00
Artur Wieczorek
4bc1c6fb7c Extract wxMenuRadioItemsData to a separate file
wxMenuRadioItemsData implementation is not MSW-specific and can be reused
on other platforms.

See #14213.
2017-08-13 00:36:37 +02:00
Vadim Zeitlin
2fffbde096 Change wxSecretStore API to allow retrieving the username
The old API didn't make any sense for the most common case when both the
user name and password need to be stored, as it required providing the
user name as input, which couldn't work (but somehow this went
unnoticed for more than a year...).

Fix this by returning the username, and not only the password, from
Load() instead of taking it as parameter and removing this parameter
from Delete() as well.

Also improve the documentation, notably include a simple example of
using this class.

Notice that this is a backwards-incompatible change, but the old API was
really badly broken and didn't appear in 3.1.0 yet, so the breakage is
both unavoidable and, hopefully, shouldn't affect much code.
Nevertheless, a special wxHAS_SECRETSTORE_LOAD_USERNAME symbol is added
to allow testing for it if necessary.
2017-07-17 18:26:20 +02:00
Vadim Zeitlin
5353bfc963 Minor whitespace/style fixes
Remove extra spaces, harmonize the style of "#endif" comments.
2017-05-20 17:01:58 +02:00
pbfordev
944f3dffd2 Refactored the previous commit regarding wxIconBundle support for icons stored MS Windows resources. 2017-05-20 08:43:50 +02:00
Václav Slavík
7546989c44 Fix wxMarkupParserAttr's unwinding of colors
Fix the logic for restoring previous span's colors to account for the
possibility of spans that don't change the color, such as in "<i><span
color='red'>...</span></i>foo". Previously, "foo" would always be
rendered black, because unwinding the attributes stack would encounter
an invalid color (which has r=g=b=0) and set it, disregarding and
preexisting attributes.

Because there's code in there that checks whether the attributes are
valid, we need to keep track of both the actually specified attributes
and the currently effective ones, and use the latter for restoration.
2016-10-21 17:36:32 +02:00
ARATA Mizuki
8cfc74491a Replace wxEXPLICIT with the 'explicit' keyword
See #17655.
2016-09-14 18:45:12 +09:00
Vadim Zeitlin
ed73e4f624 Merge branch 'uisim-xtest'
Make wxUIActionSimulator work with GTK+3, including when using DPI scaling.
2016-06-04 22:44:25 +02:00
Vadim Zeitlin
675d9d779d Add wxSecretStore
Add a new class allowing to store passwords and other sensitive information
using the OS-provided facilities.

Add implementations for all the main platforms, documentation and a new sample
(which contains an ad hoc unit test as the real unit test for this class would
probably be a bad idea as it wouldn't run in non-interactive contexts and
could show OS level dialog boxes if it did).
2016-06-04 18:29:15 +02:00
Vadim Zeitlin
cfc1681b4c Virtualize wxUIActionSimulator implementation
Extract platform-specific code in a wxUIActionSimulatorImpl-derived class
instead of keeping it in wxUIActionSimulator itself.

This will allow determining which implementation to use dynamically (i.e. at
run-time and not compile-time) to use later and already allows to get rid of
an __WXOSX__ #ifdef in common code.
2016-05-23 03:00:49 +02:00