Commit Graph

67395 Commits

Author SHA1 Message Date
Vadim Zeitlin
b891ffe8d0 Factor out another wxSpinCtrl helper for getting its max length
This will be used in wxGTK implementation.

For now no real changes yet.
2019-11-13 15:46:16 +01:00
Vadim Zeitlin
eb3d8395c2 Rename wxSpinCtrl helper functions
Put them in wxSpinCtrlImpl namespace and remove "wxSpinCtrl" prefix from
the function names themselves, this was ugly.

No real changes.
2019-11-13 15:46:16 +01:00
Vadim Zeitlin
c8cb8756f0 Merge branch 'stattext-ellipsize-fix'
Fix static text ellipsization fix in presence of borders.

See https://github.com/wxWidgets/wxWidgets/pull/1646
2019-11-13 15:45:02 +01:00
Vadim Zeitlin
c26353f13f Add another workaround for failures in wxDateTime::UNow test
If current time doesn't have the milliseconds parts, we need to sleep
for a little before retrying.
2019-11-13 15:39:36 +01:00
Vadim Zeitlin
4444694043 Move private wxSpinCtrl helpers into a private header
Np real changes, just don't put these functions in the public
wx/spinctrl.h, they have nothing to do there.
2019-11-13 02:59:42 +01:00
Vadim Zeitlin
73eabe2f12 Remove redundant wxClientDC::SetFont() call
wxClientDC inherits the font used by the associated window anyhow, there
is no need to set it explicitly.

No real changes, just a micro optimization.
2019-11-12 23:21:51 +01:00
Vadim Zeitlin
6223f67ccc Use client size when ellipsizing wxStaticText label
The full size includes the borders and the return value of this function
might not actually be fully visible if we use it, as it can fit into the
full width but not the client width. And at least under MSW this
resulted in the ellipsized label being wrapped, which was completely
unexpected, especially if the second line of the control was not visible
at all as it seemed that the last word simply disappeared.

Closes #18573.
2019-11-12 23:18:35 +01:00
Stefan Csomor
f1aa3c1c9a add bridging info for apps using ARC
this is not wx building with -fobjc-arc but for apps using wx
2019-11-12 15:03:03 +01:00
Paul Cornett
df9f4af357 Improve our estimate of GtkEntry margins
For GTK2, get the "inner border" the same way GTK does it. And for GTK3,
provide an actual implementation. Also, don't return a wxPoint for a size.
See #18567
2019-11-11 08:29:28 -08:00
wangqr
46a94c2b48 Add support for GTK4 to CMake build too
Closes https://github.com/wxWidgets/wxWidgets/pull/1643
2019-11-11 14:52:43 +01:00
Vadim Zeitlin
c433d3d0fd Use wxALPHA_XXX constants instead of 0 and 255
No real changes, just try to improve the code clarity.
2019-11-10 17:56:44 +01:00
Vadim Zeitlin
d6d5375fe9 Try to simply alpha handling in wxCairoBitmapData a bit more
Don't use hasAlpha under platforms where it's always true.
2019-11-10 17:51:55 +01:00
Vadim Zeitlin
c81021e850 Simplify condition in wxCairoBitmapData ctor
Don't test for "bufferFormat == CAIRO_FORMAT_ARGB32" which will be
always true in this branch if hasAlpha is true anyhow.

No real changes.

See #18570.
2019-11-10 17:44:48 +01:00
Andreas Falkenhahn
5646ba7261 Fix problem with nested wxEVT_PAINT handlers in wxMSW
If wxEVT_PAINT handler did something that resulted in another window
being repainted, the state of the global wxDidCreatePaintDC flag got
out of sync with reality, resulting in refresh problems.

This notably happened with wxStyledTextCtrl, which generates
wxEVT_STC_UPDATEUI from its own paint handler, and so wxSTC itself
wasn't redrawn correctly if wxEVT_STC_UPDATEUI handler did anything
resulting in another repaint itself, such as calling
wxStatusBar::SetStatusText().

Fix this by replacing a single global bool with a stack of booleans,
with each window being repainted storing and removing its own flag
indicating whether a wxPaintDC was created for it in this stack.

This is sufficient for nested repaints and we really shouldn't have
any interleaved ones in any case, os it's not a problem not to support
those.

Closes #18451.
2019-11-10 17:15:39 +01:00
Artur Wieczorek
4f7dde18ca Fix creating wxCairoBitmapData from wxBitmap under wxOSX
Under wxOSX bitmap pixel values are already premultiplied so bitmap data
can be copied to the target surface directly.
Since 992b594c wxMask bitmap colours are no longer inverted and have
the same meaning as for another ports.
2019-11-10 15:55:07 +01:00
Artur Wieczorek
1b9f7fcd29 Fix creating wxCairoBitmapData from wxBitmap under wxGTK2
wxAlphaPixelData can be only used to access pixel data in 32 bpp bitmaps.
Also, because bitmaps can have both alpha values and mask, the mask should
be applied to the created surface even if alpha channel exists. Masked
pixels become fully transparent and unmasked pixels should retain original
alpha values.

Closes #18570.
2019-11-10 15:54:20 +01:00
Vadim Zeitlin
e3d2fd9def Fix paper size correctly for printouts under MSW and Mac
This was broken by 048b7f44ec which wasn't
supposed to change anything, but did because it effectively replaced the
call to wxDC::GetPaperRect() with wxDC::GetSize() when initializing
wxPrintout::m_paperRectPixels, and while GetPaperRect() is the same as
GetSize() in wxGTK, it returns the rectangle including non-printable
margins in wxMSW and wxOSX, and must be used here instead.

Closes #18565.

Closes https://github.com/wxWidgets/wxWidgets/pull/1640
2019-11-10 00:40:29 +01:00
Vadim Zeitlin
0b16b4f439 Merge branch 'primary-display'
Handle the situation when primary display is not the first one.

See https://github.com/wxWidgets/wxWidgets/pull/1641
2019-11-10 00:39:14 +01:00
Vadim Zeitlin
a2ff49eeeb Initialize wxWindowDCImpl::m_window for hidden windows too
Ensure that we set m_window in case of early return from wxWindowDCImpl
ctor, so that using e.g. wxDC::GetSize() works for wxClientDC created
for windows that hadn't been realized yet.

It might be possible to avoid this early return completely as the
comment explaining why we're doing it seems to be out of date: our
SetBackground() doesn't call wxWindow::SetBackground() (and it would be
exceedingly strange if it did), but for now just the bug without
changing anything else.

Closes #18569.
2019-11-10 00:35:07 +01:00
Paul Cornett
a5b03ea23c Suppress -Wdeprecated-declarations warnings from GTK2 headers
GLib has deprecated some things used by GTK2
2019-11-09 12:07:07 -08:00
Maarten Bent
57d054cf95 Fix font size of rich wxTextCtrl when created on display with non-system DPI
Apply a zoom factor based on the active DPI and the system DPI. On the first
DPI change, revert the scaling factor.
2019-11-08 20:46:47 +01:00
Artur Wieczorek
6eccec3ae7 Use empty() member function to determine if string is empty
Use this dedicated function instead of checking if length() function returns zero/non-zero value.
2019-11-08 18:53:03 +01:00
Artur Wieczorek
652e6fbadb Ignore focus events within composite editor control in wxPropertyGrid
Internal focused events of the subcontrols of the composite editor control should not be processed.

Closes #18555.
2019-11-08 18:52:27 +01:00
Artur Wieczorek
ab86e28484 Ignore focus events within composite editor control in wxDataViewRenderer
Internal focused state and focused events of the subcontrols of the composite editor control should not be taken into account.

Closes #18394.
2019-11-08 18:52:26 +01:00
Artur Wieczorek
6b00cc80f1 Revert making wxComboCtrl a wxCompositeWindow
Commit 70e9dbd756 has fixed #18394 but unfortunately it also caused several other issues observed e.g. in #18540. Apparently wxComboCtrl doesn't fit well to the wxCompositeWindow framework -  especially when wxCB_READONLY flag is set and there is no main editor control what is problematic for wxCompositeWindow implementation. At the moment it is more pragmatic to go back to the original wxComboCtrl concept as a plain compound control to fix the regression and try to fix #18394 in an alternative way.

Closes #18540.
See #18394.
2019-11-08 18:51:07 +01:00
wangqr
79794cd415 Fix the pkg-config name for gtk4
See https://developer.gnome.org/gtk4/stable/gtk-compiling.html

Closes https://github.com/wxWidgets/wxWidgets/pull/1642
2019-11-08 15:07:38 +01:00
Vadim Zeitlin
f0871418d0 Merge branch 'x11-layout-fix'
See https://github.com/wxWidgets/wxWidgets/pull/1638
2019-11-08 14:52:56 +01:00
Vadim Zeitlin
cdc6899924 Store MONITORINFOEX inside wxDisplayMSW
There is no reason to call ::GetMonitorInfo() all the time, e.g. just to
determine if the monitor is primary, as we can just store it entirely.

We already invalidate the information stored for all the displays
whenever anything changes, so the cached information doesn't risk
getting out of sync.
2019-11-08 00:34:40 +01:00
Vadim Zeitlin
d8cd02b480 Create primary monitor when using wxDisplay default ctor
Previously, the first monitor was created instead and while it was often
also the primary one, this wasn't always the case.

In particular, this makes wxGetDisplayPPI() always return something
reasonable instead of returning (0, 0) when the first monitor is not the
primary one, as expected by plenty of code, including our own printing
sample, which divides by the values returned from wxGetDisplayPPI()
without checking if they're zero.
2019-11-08 00:26:20 +01:00
Vadim Zeitlin
46cb23b030 Don't assume that the first monitor is always the primary one
This is not necessarily the case at least under MSW, so while it makes
sense to do this by default in wxDisplayImpl::IsPrimary()
implementation, MSW-specific version should override it instead of being
totally unused as it was until now.
2019-11-08 00:09:29 +01:00
Vadim Zeitlin
767f545be5 Number displays in the sample starting from 1, not 0
This is more usual and coincides with the built-in display names under
MSW, where they're called "DISPLAY1", "DISPLAY2" etc.

No real changes.
2019-11-08 00:07:54 +01:00
Paul Cornett
e87ea7389b Avoid inadvertently destroying a shared PangoContext on GTK2
wxMemoryDC and wxScreenDC dtors were freeing a context they didn't own, potentially
causing a crash. Fixed by having the base wxWindowDC dtor free the context.
See #18566
2019-11-07 11:26:10 -08:00
Maarten Bent
6878a46725 Prevent spurious debug error messages in wxMSW wxToolBar code
When wxGetTBItemRect() is called on a control tool, it can cause a
TB_GETITEMRECT error message. Swap the if statements around so
wxGetTBItemRect is only called when it is needed.

Closes https://github.com/wxWidgets/wxWidgets/pull/1639
2019-11-07 00:55:46 +01:00
Vadim Zeitlin
cdc588e4eb Don't resize the parent from wxToolBar::SetSize() in wxUniv
This could result in infinite recursion in wxX11, as the test for the
new size being different from the old one which was supposed to stop the
recursion, failed there in case the new size was 0: as wxX11 can't use 0
size for the window, the actual size was always different and so we kept
sending size events to the parent, which kept resizing the toolbar etc.

It could be argued that there is a bug in wxX11 and that GetSize() must
return the same value as was passed to SetSize(), even if it was 0, and
this might even be correct, in theory, but it doesn't seem worth to do
it just to accommodate this weird use case, especially because resizing
the parent from the child shouldn't be necessary in the first place and
none of wxToolBar implementations in the other ports does it.

So just remove this code completely.

Closes #18554.
2019-11-06 15:06:36 +01:00
Vadim Zeitlin
23f7614626 Don't set 0 client size in wxX11 neither
This also results in BadValue X11 error, so ensure that the size is
valid here too, just as we do in DoSetSize().
2019-11-06 15:05:47 +01:00
Vadim Zeitlin
8df84db842 Add EnsureValidXWindowSize() helper to wxX11 code
Instead of repeating the same checks in several places, do it in a
single one.

Also use the smallest possible valid size (1, 1) instead of the totally
arbitrary (20, 20).
2019-11-06 15:04:35 +01:00
Stefan Csomor
014f04b437 show as many items as possible on macOS 10.13+
on these systems scrollbars on comboboxes are not always shown, even if the system is configured to do so, in these cases show all possible to avoid the impression of a limited subset

see https://github.com/wxWidgets/wxWidgets/pull/1534/files
2019-11-05 22:42:18 +01:00
Maarten Bent
4340e46b72 Fix height of rich wxTextCtrl after DPI change
The font of rich controls is not adjusted when the DPI changes, so do it here.
2019-11-05 22:07:04 +01:00
Stefan Csomor
21063a7850 cleaner implementation 2019-11-05 21:26:03 +01:00
Vadim Zeitlin
b842f2afa2 Merge branch 'im/menu' of https://github.com/imciner2/wxWidgets
Make wxEVT_MENU_HIGHLIGHT generation when there is no highlighted item
consistent across all the major ports: use wxID_NONE instead of wxID_ANY
in wxGTK and send these events, which were previously not sent at all in
this case, in wxOSX.

See https://github.com/wxWidgets/wxWidgets/pull/1637
2019-11-05 20:09:14 +01:00
Vadim Zeitlin
bf43d35636 Merge branch 'socket-thread'
Add a unit test for reading from wxSocket in a thread.

See https://github.com/wxWidgets/wxWidgets/pull/1632
2019-11-05 20:02:22 +01:00
Stefan Csomor
c9c5a4d99d fixing include style 2019-11-05 19:52:53 +01:00
Stefan Csomor
9be9112392 fixing @available warning 2019-11-05 19:50:41 +01:00
Stefan Csomor
294c8a6b23 moving datatransfer.h to source files
former place in private.h broke Audacity builds
2019-11-05 19:20:51 +01:00
Stefan Csomor
f2212f2162 temporary fix for files having urls constructed as directories 2019-11-05 18:53:06 +01:00
Ian McInerney
11f8d9d478 Document unhighlight event changes 2019-11-05 12:09:51 +00:00
Ian McInerney
3a668b4d0a GTK: Use wxID_NONE for unhighlight events 2019-11-05 12:09:26 +00:00
Ian McInerney
790c1818cb Update menuitem docs with unhighlight event 2019-11-05 09:15:55 +00:00
Ian McInerney
11991137e1 Send EVT_MENU_HIGHLIGHT when menu item is unhighlighted
On OSX this only happens if no new menu item is being highlighted.
2019-11-05 08:58:11 +00:00
Ian McInerney
15909a5f7c OSX: If no menu item given, use wxID_NONE as item ID 2019-11-05 08:58:11 +00:00