Commit Graph

67434 Commits

Author SHA1 Message Date
Vadim Zeitlin
00a56a28b6 Merge branch 'sock-event-fix'
Fix unwanted (and sometimes fatal) socket events for blocking sockets
under Unix.

See https://github.com/wxWidgets/wxWidgets/pull/1658
2019-12-03 02:25:18 +01:00
Vadim Zeitlin
14cfc2c2b2 Avoid clang -Wnon-virtual-dtor without triggering MSVC warnings
The change of 4990515aba resulted in
(disabled by default, but which may be enabled when building
applications using wxWidgets) MSVS 2017 warning C4265 ('class' : class
has virtual functions, but destructor is not virtual), so test for clang
explicitly instead of just testing for non-gcc.
2019-12-02 22:35:36 +01:00
Artur Wieczorek
7143ff46b0 Ensure bitmap image exists while querying for a row stride
Obtaining bytes per row makes sense only for bitmap image representation
so we have to ensure that the bitmap represenation exists before querying
for its row stride length. NSImage per se cannot provide this information.

Closes #18606.
2019-12-01 22:58:18 +01:00
Artur Wieczorek
a1cc2056bc Update NSImage with changes made to bitmap pixel data
In order to get access to wxBitmap's pixel data we actually have to work
with CGBitmapContext data and this context is created from NSImage by call
to wxBitmapRefData::EnsureBitmapExists() when we prepare to get access
to the data in wxBitmapRefData::GetRawAccess().
So, when we finish updating bitmap data we should update original NSImage
with actual CGBitmapContext data in wxBitmapRefData::EndRawAccess().

See #18606.
2019-12-01 22:39:38 +01:00
Vadim Zeitlin
36546b6f3f Merge branch 'grid-editors-placement'
Fix positions of the checkboxes drawn by wxGridCellBoolRenderer and
shown by wxGridCellBoolEditor so that there is no jump when starting or
stopping to edit grid cells with boolean values.

See https://github.com/wxWidgets/wxWidgets/pull/1662
2019-11-29 16:24:07 +01:00
Vadim Zeitlin
56bf5282d7 Merge branch 'gtk-fractional-font-scaling'
Apply system's fractional font scaling parameter when displaying text in
wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/1650
2019-11-29 05:04:56 +01:00
Vadim Zeitlin
abc8841f0b Use default wxCheckBox size in wxGridCellBoolEditor
Using wxRendererNative::GetCheckBoxSize() as the size of wxCheckBox just
doesn't work with GTK 3, as the control has additional padding between
its actual contents and the focus rectangle, which means that its actual
size must be greater than the size to be passed to DrawCheckBox() in
order to draw a checkbox of the same size.

However it isn't really necessary to resize wxCheckBox at all, it's
enough for DrawCheckBox() to produce a check mark of the same size as
that shown in a default-sized wxCheckBox and this does work in wxGTK.

So keep the default size of wxCheckBox to make everything work.

This means wxGetGridCheckBoxRect() is not useful any more, so replace it
with wxGetContentRect() which just positions a rectangle of the given
size inside another one (this should probably be moved somewhere else,
as it's more general than wxGrid).
2019-11-29 04:57:59 +01:00
Vadim Zeitlin
eadee05729 Don't change CSS for wxCheckNox with wxNO_BORDER in wxGTK 3
This makes the checkbox look ugly as it's clearly not supposed to be
rendered without the border at all, so it's better to do nothing than
mangle its CSS.

It could be better to add some virtual GTKTurnOffBorder() method that
could be overridden to do nothing in wxCheckBox and we should consider
doing this if there are other classes for which wxNO_BORDER breaks their
appearance, but for now, as long as it's the only case in which we need
to do this, just turn wxNO_BORDER off when calling PostCreation().
2019-11-29 04:31:14 +01:00
Vadim Zeitlin
edd0d9b68f Ensure DrawCheckBox() fits inside the rectangle passed to it
This results in rather ugly checkboxes when the rectangle is too small,
and even "critical" GTK warnings with wxGTK 3, but is still arguably
better than drawing outside of the provided rectangle.
2019-11-28 23:57:15 +01:00
Stepan Hrbek
4340841565 Fix uninitialized thread pointer in wxMSW wxJoystick
Initialize m_thread to null to ensure we don't dereference an invalid
pointer later if no joystick with the specified index was found.

Closes https://github.com/wxWidgets/wxWidgets/pull/1663
2019-11-28 22:49:42 +01:00
Paul Cornett
632363775d Fix -Wclass-memaccess warning from previous change 2019-11-28 09:12:48 -08:00
Paul Cornett
9c5ec2f959 Restore resetting of wxMiniFrame cached decor size
This was inadvertently lost in 8cdd20667f, apparently causing wxRESIZE_BORDER
functionality to stop working on some platforms. See #18591
2019-11-28 09:03:38 -08:00
Vadim Zeitlin
2eb312b5f9 Avoid changing checkbox background in wxGrid under non-MSW
Doing this makes the checkbox unusable with the default GTK 3 theme as
the default grid background colour (white) is the same as the colour of
the check mark -- so changing the checkbox background to it makes it
invisible.

Work around this by adding a new SetTransparentPartColour() method that
can be used by wxGrid (and, in the future, user code if we decide that
this is really the best solution to this problem that we can provide) to
make the checkbox blend in with its background without actually changing
its appearance.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
e2bb8b05bf Factor out common checkbox-related code into CheckBoxInfo
No real changes, just extract the same code used in both GTK 2 and GTK 3
implementations of GetCheckBoxSize() and DrawCheckBox() in a helper
class which is now just used from both places.

This makes the code more clear and hopefully easier to maintain in the
future.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
9ae808dc86 Synchronize structure of DrawCheckBox() and GetCheckBoxSize()
Put GTK 3 version first in both functions instead of putting it in the
middle (!) of GTK 2 code in the former one for some reason.

No real changes, the code was just moved around (this commit is best
viewed with "git diff --color-moved").
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
ab02d36e10 Account for vertical alignment in wxGetGridCheckBoxRect() too
Do it if only for consistency with the horizontal alignment.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
6b63016fb2 Use helper wxRect::CentreIn()
No real changes, just make the code a bit more concise and clear.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
57f89c626c Fix the code which tried to account for too small cell rect
It didn't actually manage to do it as it used wrong comparison.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
4f6b29fb0c Remove "X" suffix from GRID_CELL_CHECKBOX_MARGIN_X
The same margin will be used in the vertical direction too.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
04b6fc2f90 Add another cell with boolean renderer/editor to the sample
No real changes, just test the boolean cells appearance with the default
white background too.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
851d11ba2c Determine the checkbox size in wxGetGridCheckBoxRect() itself
It doesn't make much sense to pass the size to the function supposed to
compute it, so call wxRendererNative::GetCheckBoxSize() from the
function itself instead of forcing its callers to do it.

No real changes.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
f4756eaa2f Centre checkboxes in wxGrid vertically by default
Make the alignment used by default in wxGridCellBoolRenderer and
wxGridCellBoolEditor consistent and centre the checkbox vertically in
both of them: previously only the editor tried to do it, but failed,
because the code wrongly overwrote the default alignment as it used
GetAlignment() instead of GetNonDefaultAlignment(), while the renderer
didn't even try.
2019-11-28 02:14:50 +01:00
Ilya Sinitsyn
dacf25ac99 Support wxNO_BORDER for wxCheckBox under GTK2 2019-11-28 02:14:50 +01:00
Ilya Sinitsyn
3ca9491c5f Improve grid editors placing
Remove the code in wxGrid::ShowCellEditControl() which moves grid
editors unnecessarily and also remove workarounds that were required
because of it in the editors SetSize() functions.

This helps to ensure that the editor is placed at the same position the
renderer draws the cell value, so that it doesn't jump around annoyingly
when editing starts (which was especially noticeable for boolean-valued
cells).
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
6a21d6f2e4 Add missing required header to wx/generic/private/grid.h
Make this header self-sufficient, instead of requiring wx/headerctrl.h
to be included before including it.

Remove the now unnecessary wx/headerctrl.h inclusion from
src/generic/grideditors.cpp.
2019-11-28 02:14:50 +01:00
Ilya Sinitsyn
53ffbf6cf5 Allow ignoring margins in wxRendererNative::GetCheckBoxSize()
Add ability to get the size of the checkbox without any margins by
passing wxCONTROL_CELL flag: this can be useful when the checkbox is
part of some "cell", e.g. wxGrid one, and doesn't need any extra margins
around it.

Currently wxCONTROL_CELL is only really used by wxGTK2 implementation.
2019-11-28 02:14:50 +01:00
Vadim Zeitlin
4ca327b50a Declare AddTreeviewHeaderButton() only when it's defined
This method of wxGtkStyleContext uses a GTK function only available
since 3.20, and so can't be implemented for the earlier versions, hence
don't even define it in this case.

Note that the caller still needs to test for the run-time version.
2019-11-27 23:23:57 +01:00
Vadim Zeitlin
8997d06397 Fix build with GTK 3 < 3.20
Restore a check removed in d85794e87f as
it's still needed: AddTreeviewHeaderButton() is only defined for 3.20
or later.
2019-11-27 23:21:45 +01:00
Vadim Zeitlin
5ad2470504 Avoid disabling -Wcast-function-type when not using gcc 8
The changes of 173f035bc2 resulted in

unknown warning group '-Wcast-function-type', ignored [-Wunknown-warning-option]

diagnostics from clang (even clang-10) and, presumably, also from
versions of gcc earlier than 8, which added this option, so use the
special wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() macro added in
ed01fede2e just for this instead.

No real changes.
2019-11-27 17:39:21 +01:00
Paul Cornett
ae7fcc440c Use C++11 default copy ctor for wxUniCharRef
It's a little simpler, and still suppresses -Wdeprecated-copy warnings
2019-11-25 21:27:09 -08:00
Paul Cornett
4990515aba Avoid clang-cl -Wnon-virtual-dtor warning
Extend the existing workaround to all compilers, not just GCC
2019-11-25 21:16:00 -08:00
Paul Cornett
ef99c2a6db Avoid warning from clang-cl about unrecognized pragma 2019-11-25 21:05:35 -08:00
Paul Cornett
d3ea00b40f Remove an extraneous semicolon 2019-11-25 20:59:21 -08:00
Paul Cornett
173f035bc2 Suppress a GCC -Wcast-function-type warning
We're setting the same event handler GTK uses internally, so the warning isn't helpful
2019-11-25 20:58:16 -08:00
Paul Cornett
d85794e87f Remove some unnecessary GTK preprocessor version checks
The contained code no longer uses anything version-specific
2019-11-25 20:54:51 -08:00
Paul Cornett
0fab5eb071 Allow scrollwheel events when mouse is captured with GTK3, see #18593 2019-11-25 20:52:12 -08:00
Paul Cornett
abaccbc2e2 Fixes for checkbox rendering with GTK3
Size should include border and padding. Margin values seem to be for a checkbox with text
label, so don't include margin. Check mark should be drawn inside border and padding.
2019-11-24 23:31:09 -08:00
Artur Wieczorek
7b86958b25 Fix wxColour::GetAsString called for non-solid colour
Don't return RGB values if colour is not solid
and hence cannot be represented with these values.
Non-solid colour should be reported as an unknown
RGB value, e.g. '??????'.

Closes #18596.
2019-11-24 19:49:59 +01:00
Paul Cornett
fee30940b6 Take wxDC transformations into account when resetting clipping with GTK3
The paint update region is in device coordinates, it needs to be converted to
current logical coordinates to apply correctly. See #18584, #18560
2019-11-23 08:41:31 -08:00
Artur Wieczorek
e763ae96ac Fix wxSystemAppearance::GetName()
'NSApp.effectiveAppearance' is available for macOS
10.14+ not 10.9.

Closes #18595.
2019-11-22 18:41:43 +01:00
Maarten Bent
84edda2ba0 Fix wxSpinCtrl arrow position in RTL layout and High DPI
Just use hardcoded 2px overlap between the text control and the spin
buttons, as it doesn't seem to depend on the DPI and works in both LTR
and RTL modes, unlike the existing code, which claimed to work but
actually didn't.

Closes https://github.com/wxWidgets/wxWidgets/pull/1660
2019-11-22 15:23:07 +01:00
Vadim Zeitlin
a77b8f85bf Merge branch 'display-unique-modes' of https://github.com/MaartenBent/wxWidgets
Return unique modes from wxDisplay::GetModes() and minor improvements to
the display sample.

See https://github.com/wxWidgets/wxWidgets/pull/1659
2019-11-22 15:22:22 +01:00
Vadim Zeitlin
d51a9f9686 Use "wxWidgets application" in the manifests descriptions
We don't use "wxWindows" since many years.
2019-11-22 15:21:15 +01:00
GH Cao
c0c2260944 Add MSW manifests for ARM and ARM64 platforms
Closes https://github.com/wxWidgets/wxWidgets/pull/1657
2019-11-22 15:17:40 +01:00
Vadim Zeitlin
2bc6e50ede Wrap variable initializations after '=' consistently
Replace a few occurrences of

        type var
            = value;

with

        type var =
            value;

which is used much more widely in wx sources for consistency.

Also get rid of a couple of such lines, when it could be done easily.

No real changes.
2019-11-22 00:53:45 +01:00
Maarten Bent
136a43f033 Fix building display sample without wxUSE_DISPLAY 2019-11-21 23:43:04 +01:00
Maarten Bent
c4e54c78fd Select active mode in display sample
Update sample to use SizerFlags.
Set a minimum size to the dialog.
2019-11-21 23:43:02 +01:00
Maarten Bent
44cd0409cd Return unique modes from wxDisplay::GetModes 2019-11-21 23:18:12 +01:00
Vadim Zeitlin
73f0c9dff8 Fix crash with blocking accepting sockets in threads under Unix
Sockets returned by wxSocket::Accept() are non-blocking by default and
the only way to use them safely in worker threads is by switching them
to the blocking mode by calling SetFlags(wxSOCKET_BLOCK).

However this didn't work correctly since at least 2.8 days, as turning
wxSOCKET_BLOCK on didn't unregister the socket from the event loop, with
which it had been registered on creation. Fix this by doing this now,
which ensures that the main thread doesn't get any notifications about
the socket if it's used, in a blocking way, in a worker thread.

Note that making the new socket blocking after accpeting is still pretty
inefficient and pre-creating the socket as blocking and using
AcceptWith() is still preferable, but at least it does work now.

Closes #12886.
2019-11-20 20:21:25 +01:00
Vadim Zeitlin
51ea713826 Extend and rename wxSocketImpl::UnblockAndRegisterWithEventLoop()
In addition to unblocking and registering the socket, also support using
this function to make the socket blocking and unregistering it from the
event loop, if its flags include wxSOCKET_BLOCK.

This was already half-done by wxMSW, which took wxSOCKET_BLOCK presence
into account in its implementation, but not by the Unix implementation.
Now do it under all platforms, as this will be useful for switching a
previously non-blocking socket to blocking mode.

Finally, rename the function to better reflect what it really does.

See #12886.
2019-11-20 18:59:51 +01:00