Commit graph

75208 commits

Author SHA1 Message Date
Vadim Zeitlin
6a41d8a486 Relax code style check for NULL
This is fine tuned to allow the string in the last commit to pass this
check, but still generally makes sense too.
2023-10-01 17:05:28 +02:00
Vadim Zeitlin
2a87515660 Fix filtering out of bogus GTK critical errors in wxNotebook
Restore the correct message which was erroneously modified by the
changes of 4f4c5fcfdf (Use nullptr instead of NULL in the code and
documentation, 2022-10-16).
2023-10-01 16:57:08 +02:00
Vadim Zeitlin
0efd803f30 Make GTKSuppressDiagnostics() work again
This got broken by the addition of GTKAllowDiagnosticsControl() in
8af645ed22 (Fix crash when using wxNotebook with glib 2.73 or later,
2022-08-29) as not calling it resulted not only in preventing wx code
from installing its own log function implicitly, but also prevented
explicit calls to GTKSuppressDiagnostics() from working neither.

Fix this by calling GTKAllowDiagnosticsControl() automatically from
GTKSuppressDiagnostics() itself.
2023-10-01 16:49:13 +02:00
Paul Cornett
9b9ec141fb Enable using a dark theme when Gnome "dark style" is set
The dark style setting does not cause a dark theme to be used
automatically, so request it explicitly.

Co-authored-by: Colin Kinloch
2023-09-30 16:42:58 -07:00
Vadim Zeitlin
a190274600 Reformat checks in wxWindow::QtSet{Min,Max}Size()
This should have been part of bbf6b3336d (Fix a recently introduced
crash in wxAUI in wxQt, 2023-09-30).
2023-09-30 23:15:15 +02:00
Vadim Zeitlin
e8faf2f56c Merge branch 'wxlistctrl-fixes'
Improve consistency of checkboxes in wxListCtrl between virtual and
report mode, and between the generic and MSW implementation, see #23869.

Also disable WS_EX_COMPOSITED for virtual wxListCtrl because it
generates an endless stream of cache events, see #23878.

See #23890.
2023-09-30 23:13:51 +02:00
ali kettab
bbf6b3336d Fix a recently introduced crash in wxAUI in wxQt
wxAUI has a special window "wxTabFrame" for which GetHandle() returns nullptr.
This is a problem because this commit 3c68696 (Make wxTopLevelWindow::SetSizeHints()
work in wxQt) doesn't account for the rare situation in which a wxWindow is actually
created without the underlying handle, resulting in a crash when we try to call
Set{Min,Max}Size() for this type of windows.

Closes #23920.
2023-09-30 23:12:20 +02:00
PB
5ca3157467 Fix return type of wxBitmap::UseAlpha() under wxMSW
The method should return bool but was returning void.

This commit is best viewed ignoring whitespace-only changes.

Closes #23903, #23919.
2023-09-30 22:32:34 +02:00
Maarten Bent
f68bb391ce
Update documentation of wxListCtrl IsItemChecked and CheckItem 2023-09-30 17:43:41 +02:00
Maarten Bent
39873236bf
Disable WS_EX_COMPOSITED for virtual wxListCtrl
It generates an endless stream of LVN_ODCACHEHINT events.

Fixes #23878
2023-09-30 17:43:40 +02:00
Maarten Bent
abdbe661c4
Update listctrl example to recent wxListCtrl checkbox changes
Don't override CheckItem/IsItemChecked, but handle the checked/unchecked events.
2023-09-30 17:43:40 +02:00
Maarten Bent
1b8f498685
Ignore wxListCtrl CheckItem/IsItemChecked when checkboxes are disabled 2023-09-30 17:43:37 +02:00
Maarten Bent
fa26c8724d
Don't use internal check state for generic virtual wxListCtrl
Just like the MSW virtual wxListCtrl, the checkbox state is determined by OnGetItemIsChecked.

See #23869
2023-09-30 17:32:54 +02:00
Maarten Bent
eca7ec0c9f
Support using IsItemChecked in MSW virtual wxListCtrl
Forward the call to OnGetItemIsChecked.
2023-09-30 17:32:15 +02:00
Maarten Bent
07df14378a
Generate wxEVT_LIST_ITEM_[UN]CHECKED events for MSW virtual wxListCtrl
Make it consistent with wxListCtrl in report mode, and the generic wxListCtrl implementation.

Fixes #23869
2023-09-30 17:32:04 +02:00
ali kettab
3c6869605e Make wxTopLevelWindow::SetSizeHints() work in wxQt
Override Set{Min,Max}Size and DoSetSizeHints() to pass size information
to Qt: setting min/max widget size at the wxWidgets level is not enough
to take effect unless the information is also set at the Qt level.

Closes #23917.
2023-09-30 15:23:25 +02:00
Vadim Zeitlin
7e9d06f584 Ensure that the currently shown wxSimplebook page has focus
When calling wxSimplebook::ChangeSelection(), the focus remained on the
previous, now hidden, page, unless it was explicitly set to one of the
controls on the new page.

This was completely unexpected as it could result in the user
(inadvertently) changing the values of the already "accepted" controls
on the last page, so don't let this happen and always set the focus to
the new page explicitly, even if this hasn't been done by
ShowWithEffect() which doesn't do it at least under wxMSW.

Closes #23914.
2023-09-30 15:21:50 +02:00
Václav Slavík
f25103313e Fix invisible wxStaticLine on macOS >= 13
NSBox used as a separator must have its type set to NSBoxSeparator.

This apparently didn't matter before in practice, but starting with
macOS 13, separators - i.e. narrow NSBoxes - without the type correctly
set are invisible.

Closes #23913.
2023-09-30 15:21:08 +02:00
Vadim Zeitlin
36f1b0f14c Merge branch 'qt-clientsize' of https://github.com/AliKet/wxWidgets
Fix wxWindow::SetClientSize() under wxQt.

See #23912.
2023-09-30 15:19:28 +02:00
Vadim Zeitlin
aaabb840b5 Merge branch 'egl-wl-swap-interval'
Fix setting EGL swap interval under native Wayland too.

See #23909, #23512.
2023-09-30 15:17:39 +02:00
Vadim Zeitlin
4883e185bc Merge branch 'qt-popup' of https://github.com/AliKet/wxWidgets
Fix wxPopupWindow implementation under wxQt.

See #23904.
2023-09-30 15:15:41 +02:00
Vadim Zeitlin
fe420caa3b Fix background colour for empty cells in generic wxDataViewCtrl
There were two related problems: first, any attempts to set the
background colour for the cells without values were simply ignored
because we didn't call wxDataViewModel::GetAttr() at all from
PrepareForItem() in this case and, second, PrepareForItem() itself was
not called when repainting the control neither, resulting in the
existing attribute being reused for the items without values, meaning
that they used the last background colour that was set instead of at
least not using any background at all.

Fix both of the problems for the generic version. Unfortunately the GTK
one still doesn't allow setting the background for the empty cells, but
at least when not doing it the code now consistently leaves them without
any background.

The following code can be added to MyMusicTreeModel in the dataview
sample for testing this:

--------------------------------- >8 --------------------------------------
    bool GetAttr( const wxDataViewItem& item, unsigned int col, wxDataViewItemAttr& attr) const override
    {
        if (col != 1)
            return false;

        if (IsContainer(item))
        {
            if (item != m_pop)
                return false;

            attr.SetBackgroundColour(*wxYELLOW);
        }
        else
        {
            attr.SetColour(*wxYELLOW);
            attr.SetBackgroundColour(*wxLIGHT_GREY);
        }

        return true;
    }
--------------------------------- >8 --------------------------------------

Closes #23708, #23902.
2023-09-30 15:14:20 +02:00
Vadim Zeitlin
5c28305580 Merge branch 'egl-isshown-fix'
Fix wxGLCanvasEGL::IsShownOnScreen() under Wayland.

See #23900.
2023-09-30 15:13:16 +02:00
Vadim Zeitlin
72ab8f2889 Merge branch 'egl-hidden-refresh'
Don't slow the entire program down to a crawl if a wxGLCanvasEGL is
entirely hidden when using XWayland.

See #23898.
2023-09-30 15:12:04 +02:00
Vadim Zeitlin
df75c27233 Optimize wxInputStream::SeekI() from start or current position
It's not clear whether it's worth explicitly checking for no-op seeks at
all, but unnecessarily calling GetLength() when doing it is certainly a
pessimization rather than optimization, so don't do it.

And don't bother checking for no-op seeks when seeking from end at all,
as it's not obviously faster than just performing the seek and the
existing code didn't work correctly anyhow, as it compared the current
position with "size-pos" instead of the correct "size+pos", so removing
it certainly shouldn't make things worse.

Closes #23895, #23897.
2023-09-30 15:11:03 +02:00
Vadim Zeitlin
d57e175a7c Merge branch 'qt-bmp-premult' of https://github.com/AliKet/wxWidgets
Use premultiplied ARGB32 format for wxBitmap under wxQt: this makes
bitmap-related unit tests pass with wxQt too.

See #23872.
2023-09-30 15:07:13 +02:00
Vadim Zeitlin
19ed2580d3 Merge branch 'egl-initialize-check-runtime-version' of https://github.com/Steelskin/wxWidgets
Improve error handling when EGL version is less than 1.5: fail earlier
and with more clear error message.

See #22325, #23855.
2023-09-30 15:04:30 +02:00
PB
6caaf589f1 Use more modern appearance for wxMSW wxTreeCtrl by default
Change wxTreeCtrl default style under wxMSW to make it look more
up-to-date by default: use twisting buttons and full-row highlight and
don't display connector lines.

Using wxTR_LINES_AT_ROOT together with wxTR_NO_LINES may look odd but it
is needed because without wxTR_LINES_AT_ROOT, the buttons would not be
displayed.

Also update wxTreeCtrl screenshot in the docs.

Closes #23844.
2023-09-30 15:00:48 +02:00
ali kettab
fbd9dcba59 wxWindowQt::DoSetClientSize() fixup!
Since we are not using any Qt geometry management (QLayout) inside wxWidgets
that guarantees proper resizeing of Qt window when its client widget is resized,
we have to do manual resizing to ensure that.
2023-09-28 14:33:38 +01:00
ali kettab
36aa1184c7 Code refactoring only
No real changes. the code setting the Qt window's client size is
extracted to be reused in the next upcoming commit.
2023-09-28 14:23:43 +01:00
ali kettab
9c0ab149b3 Make wxComboCtrl and its derivatives work again under wxQt
see issue #23894
2023-09-28 14:09:59 +01:00
ali kettab
9ef8f26c54 Don't destroy the wxTipWindow window when it is closed
This leads to double deletion problem because it was already destroyed
in wxEVT_KILL_FOCUS handler when the popup window is hidden.
2023-09-28 14:09:59 +01:00
ali kettab
4036a555bf wxPopupWindow implementation under wxQt completed 2023-09-28 14:09:59 +01:00
Vadim Zeitlin
647564126b Call eglSwapInterval() when it can succeed
Postpone calling this function until we get the (first) frame callback
as by this time the EGL context is fully valid and can be used inside it
and it doesn't fail any longer.
2023-09-27 14:43:58 +02:00
Vadim Zeitlin
6e8fc23705 Make Wayland frame callback a wxGLCanvasEGL member function
This allows to make m_readyToDraw private.

No real changes otherwise.
2023-09-27 14:38:12 +02:00
Vadim Zeitlin
c9bbc7e570 Check if eglSwapInterval() failed and log a message in this case
This allows to see that currently it always fails with EGL_BAD_CONTEXT
error.
2023-09-27 14:32:30 +02:00
Vadim Zeitlin
cf44a87ec6 Fix wxGLCanvasEGL::IsShownOnScreen() under Wayland
Don't use m_readyToDraw in it, as the canvas is still shown even when
it's not ready to draw yet, and use m_wlSubsurface instead as it is
destroyed when the window is unmapped.

Closes #23899.
2023-09-25 00:51:30 +02:00
Vadim Zeitlin
8654766fed Check that Wayland subsurface creation succeeded
It seems that the check for m_surface added in 952de605f6 (Handle
map/unmap events on Wayland's wxGLCanvasEGL, 2023-08-25) was a
copy-paste error and we actually need to check m_wlSubsurface here.
2023-09-25 00:43:58 +02:00
Vadim Zeitlin
d128afe1e8 Handle all cases in switch instead of using "default"
No real changes, just clean up the code a bit to make sure we get a
-Wswitch if any elements are added to wxDisplayType enum in the future.
2023-09-25 00:38:46 +02:00
Paul Cornett
df6366ff57 Fix showing popup menu with GTK/Wayland without active event
Since a261c80 (Avoid Gdk-CRITICAL warnings when using PopupMenu() with
Wayland, 2022-04-22) popup menus shown when there is no related current
event did not work when using default positioning. Fix this by always
providing a GdkWindow and a GdkEvent, and using a suitable substitute
when a real event is not available.
See #23892
2023-09-24 14:20:29 -07:00
Vadim Zeitlin
284edcd83c Disable blocking in eglSwapBuffers() when using X11 too
Unfortunately we can't let EGL under XWayland block neither, even if we
can't update the window efficiently in this case, as we could do when
using real Wayland in 194a7be33f (Improve wxGLCanvasEGL refresh logic
under Wayland, 2023-05-17), because otherwise occluding any window with
a wxGLCanvasEGL inside it slows down the entire program to a crawl as
all events are generated at a rate of 1 per second only.

Choose the lesser of two evils and update even completely hidden
windows, which is inefficient, but at least allows to also update the
other ones, unlike before.

Also note that we must call eglSwapInterval() in SwapBuffers() and that
calling it in CreateSurface() somehow has no effect when using Sway WM,
even though it would also solve the problem under GNOME/mutter.

Closes #23512.

Co-authored-by: Tristan Daniel <tdaniel22@users.noreply.github.com>
2023-09-24 21:33:56 +02:00
Vadim Zeitlin
547fb15c51 Show the window in wxGLCanvasEGL tracing messages
This is useful when there is more than one window using EGL.
2023-09-24 20:37:50 +02:00
ali kettab
be75c73880 Add missing guard before using wxImage in wxBitmap code 2023-09-24 11:39:58 +01:00
ali kettab
4bbd313ecf Check the bitmap is valid before accessing its height/width/depth 2023-09-24 11:30:45 +01:00
ali kettab
b12cdc6739 Minor fixes to constructors
Make wxMask constructor taking QBitmap explicit

And wxBitmapRefData already has a constructor taking a QPixmap
2023-09-24 11:11:02 +01:00
ali kettab
3875b9d117 Code refactoring only
No real changes, just extract the common code between SaveFile() and LoadFile()
that converts wxBitmapType to Qt type and reuse it to eliminate code duplication.
2023-09-23 23:04:02 +01:00
ali kettab
1e43b375bc Added QtBlendMaskWithAlpha() to wxBitmap under wxQt
Blend mask with alpha channel and remove the mask.

We need this function for performance reasons. e.g. the wxImageList (used by
wxTreeCtrl and wxListCtrl) calls this function to convert the mask (if any)
to alpha. Because the controls (under wxQt) using the image list ignore the
mask on the bitmaps and expect alpha instead.

This is similar to MSWBlendMaskWithAlpha() found in wxMSW port.
2023-09-23 21:53:26 +01:00
Artur Wieczorek
3b7d81b7f2 Use C++11 standard library to generate pseudo-random numbers 2023-09-22 23:39:53 +02:00
Artur Wieczorek
5595c1a028 Use range-based loop to iterate over wxPGProperty children 2023-09-22 23:39:53 +02:00
Artur Wieczorek
a3b7839c41 Add wxFlagsProperty demonstration to propgrid sample 2023-09-22 23:39:53 +02:00