Add wxCocoaPowerModule and CocoaPowerEventsObserver Add support for wxPowerEvent generation under macOS. Register observers with notifications center, with callbacks for NSWorkspaceWillSleepNotification and NSWorkspaceDidWakeNotification notifications. These callbacks inform the top level window to handle POWER SUSPENDED and/or RESUME. For consistency with wxGTK/Linux, only generate these events once wxPowerResource::Acquire() has been called. Signed-off-by: Tijs Van Buggenhout <tijs.van....@axsguard.com> Closes #25778.
Upgrade auto-downloaded WebView2 version Download 1.0.3485.44 instead of 1.0.1722.45 used before. Also document how to update SHA256 hash in the build script. Closes #25817.
Generate help events with the IDs of wxToolBar tools This is more useful than generating the events with the ID of the toolbar itself, as help is typically associated with a particular tool and not the entire toolbar. Add wxWindow::GetHelpIdAtPoint() virtual function to allow customizing this for the other controls as well. Closes #25802. Closes #25820. Co-authored-by: Vadim Zeitlin <va...@wxwidgets.org>
Add --with-iphonesimulator configure option Make it simpler to cross compile wxiOS on Silicon Macs by allowing to just specify this option and document its use. Closes #25782.
Fix SetCursor(wxNullCursor) behaviour in wxOSX This should set the default cursor for the window instead of doing nothing. Also simplify the code by overriding just the new WXUpdateCursor() member function instead of SetCursor() itself: this avoids the need for checking if the cursor has really changed. See #25814.
macOS: fix warning about unused variable Closes #25823.
Correct name of user CMake presets file There was a typo in this file name when it was added in 7f2268c4a0 (Add CMakePresets.json, 2023-03-09). See #23335. Closes #25826.
Disable check in wxSlider unit test for Qt 6.8 Something has changed in Qt 6.8 installed in GitHub Actions CI build recently and broke this test, which now fails because we get 2 changed events instead of the expected one. Disable it for now, until this can be really fixed.
... | ... | @@ -104,6 +104,14 @@ jobs: |
104 | 104 | skip_samples: true
|
105 | 105 | skip_testing: true
|
106 | 106 | allow_warnings: true
|
107 | + - name: wxiOS Simulator on Silicon Mac
|
|
108 | + runner: macos-15
|
|
109 | + arch: arm64
|
|
110 | + configure_flags: --with-iphonesimulator --enable-monolithic --disable-shared --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) --host=aarch64-apple-darwin24.6.0 --build=aarch64-apple-darwin --without-libtiff
|
|
111 | + xcode_sdk: iphonesimulator
|
|
112 | + skip_samples: true
|
|
113 | + skip_testing: true
|
|
114 | + allow_warnings: true
|
|
107 | 115 | |
108 | 116 | env:
|
109 | 117 | wxUSE_ASAN: ${{ matrix.use_asan && 1 || 0 }}
|
... | ... | @@ -456,4 +456,4 @@ |
456 | 456 | /3rdparty/webview2
|
457 | 457 | |
458 | 458 | /build/cmake/output/
|
459 | -CMakePresetsUser.json |
|
459 | +CMakeUserPresets.json |
... | ... | @@ -44,9 +44,12 @@ if(APPLE) |
44 | 44 | elseif(WXMSW)
|
45 | 45 | if(wxUSE_WEBVIEW_EDGE)
|
46 | 46 | # Update the following variables if updating WebView2 SDK
|
47 | - set(WEBVIEW2_VERSION "1.0.1722.45")
|
|
47 | + set(WEBVIEW2_VERSION "1.0.3485.44")
|
|
48 | 48 | set(WEBVIEW2_URL "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/${WEBVIEW2_VERSION}")
|
49 | - set(WEBVIEW2_SHA256 "10d78e9e11c7851f0a8bf0dd4c22bbf6383de45bd337e1be42240b103812947d")
|
|
49 | + # When updating the above version of WebView2, download the nupkg from the above URL.
|
|
50 | + # Then, from a PowerShell session, call Get-FileHash on the downloaded nupkg file to get its SHA256
|
|
51 | + # to update here.
|
|
52 | + set(WEBVIEW2_SHA256 "BC09150B179246AC90189649B13BE8E6B11B3AC200E817E18DF106E1F3CF489E")
|
|
50 | 53 | |
51 | 54 | set(WEBVIEW2_DEFAULT_PACKAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/packages/Microsoft.Web.WebView2.${WEBVIEW2_VERSION}")
|
52 | 55 |
... | ... | @@ -1093,6 +1093,7 @@ with_osx_iphone |
1093 | 1093 | with_osx
|
1094 | 1094 | with_cocoa
|
1095 | 1095 | with_iphone
|
1096 | +with_iphonesimulator
|
|
1096 | 1097 | with_mac
|
1097 | 1098 | with_wine
|
1098 | 1099 | with_msw
|
... | ... | @@ -2379,6 +2380,7 @@ Optional Packages: |
2379 | 2380 | --with-osx use macOS (default port, Cocoa)
|
2380 | 2381 | --with-cocoa same as --with-osx_cocoa
|
2381 | 2382 | --with-iphone same as --with-osx_iphone
|
2383 | + --with-iphonesimulator same as --with-osx_iphonesimulator
|
|
2382 | 2384 | --with-mac same as --with-osx
|
2383 | 2385 | --with-wine use Wine
|
2384 | 2386 | --with-msw use MS-Windows
|
... | ... | @@ -4478,6 +4480,19 @@ fi |
4478 | 4480 | |
4479 | 4481 | |
4480 | 4482 | |
4483 | +# Check whether --with-iphonesimulator was given.
|
|
4484 | +if test "${with_iphonesimulator+set}" = set; then :
|
|
4485 | + withval=$with_iphonesimulator;
|
|
4486 | + if test "$withval" != yes; then
|
|
4487 | + as_fn_error $? "Option --with-iphonesimulator doesn't accept any arguments" "$LINENO" 5
|
|
4488 | + fi
|
|
4489 | + wxUSE_OSX_IPHONE="$withval" wxUSE_IPHONESIMULATOR="yes" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1
|
|
4490 | + |
|
4491 | +fi
|
|
4492 | + |
|
4493 | + |
|
4494 | + |
|
4495 | + |
|
4481 | 4496 | # Check whether --with-mac was given.
|
4482 | 4497 | if test "${with_mac+set}" = set; then :
|
4483 | 4498 | withval=$with_mac;
|
... | ... | @@ -23176,7 +23191,11 @@ fi |
23176 | 23191 | |
23177 | 23192 | if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then
|
23178 | 23193 | if test "$wxUSE_OSX_IPHONE" = 1; then
|
23179 | - MACOSX_VERSION_MIN_OPTS="-miphoneos-version-min=$wxUSE_MACOSX_VERSION_MIN"
|
|
23194 | + if test "$wxUSE_IPHONESIMULATOR" = "yes"; then
|
|
23195 | + MACOSX_VERSION_MIN_OPTS="-miphonesimulator-version-min=$wxUSE_MACOSX_VERSION_MIN"
|
|
23196 | + else
|
|
23197 | + MACOSX_VERSION_MIN_OPTS="-miphoneos-version-min=$wxUSE_MACOSX_VERSION_MIN"
|
|
23198 | + fi
|
|
23180 | 23199 | else
|
23181 | 23200 | MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN"
|
23182 | 23201 | fi
|
... | ... | @@ -418,6 +418,7 @@ WX_ARG_ONLY_WITH(osx_iphone, [ --with-osx_iphone use iOS], [wxUSE_OSX_ |
418 | 418 | WX_ARG_ONLY_WITH(osx, [ --with-osx use macOS (default port, Cocoa)], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
|
419 | 419 | WX_ARG_ONLY_WITH(cocoa, [ --with-cocoa same as --with-osx_cocoa], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
|
420 | 420 | WX_ARG_ONLY_WITH(iphone, [ --with-iphone same as --with-osx_iphone], [wxUSE_OSX_IPHONE="$withval" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1])
|
421 | +WX_ARG_ONLY_WITH(iphonesimulator, [ --with-iphonesimulator same as --with-osx_iphonesimulator], [wxUSE_OSX_IPHONE="$withval" wxUSE_IPHONESIMULATOR="yes" CACHE_OSX_IPHONE=1 TOOLKIT_GIVEN=1])
|
|
421 | 422 | WX_ARG_ONLY_WITH(mac, [ --with-mac same as --with-osx], [wxUSE_OSX_COCOA="$withval" CACHE_OSX_COCOA=1 TOOLKIT_GIVEN=1])
|
422 | 423 | WX_ARG_ONLY_WITH(wine, [ --with-wine use Wine], [wxUSE_WINE="$withval" CACHE_WINE=1])
|
423 | 424 | WX_ARG_ONLY_WITH(msw, [ --with-msw use MS-Windows], [wxUSE_MSW="$withval" CACHE_MSW=1 TOOLKIT_GIVEN=1])
|
... | ... | @@ -1339,7 +1340,11 @@ fi |
1339 | 1340 | |
1340 | 1341 | if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then
|
1341 | 1342 | if test "$wxUSE_OSX_IPHONE" = 1; then
|
1342 | - MACOSX_VERSION_MIN_OPTS="-miphoneos-version-min=$wxUSE_MACOSX_VERSION_MIN"
|
|
1343 | + if test "$wxUSE_IPHONESIMULATOR" = "yes"; then
|
|
1344 | + MACOSX_VERSION_MIN_OPTS="-miphonesimulator-version-min=$wxUSE_MACOSX_VERSION_MIN"
|
|
1345 | + else
|
|
1346 | + MACOSX_VERSION_MIN_OPTS="-miphoneos-version-min=$wxUSE_MACOSX_VERSION_MIN"
|
|
1347 | + fi
|
|
1343 | 1348 | else
|
1344 | 1349 | MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN"
|
1345 | 1350 | fi
|
... | ... | @@ -25,3 +25,11 @@ The library can also be build via configure/make: |
25 | 25 | --enable-macosx_arch=i386 \
|
26 | 26 | --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path)
|
27 | 27 | make
|
28 | + |
|
29 | +On a recent Silicon Mac in the 3.3 branch you need this configure
|
|
30 | +to compile for the iPhone simulator:
|
|
31 | + |
|
32 | + ../wxWidgets/configure --with-iphonesimulator --enable-monolithic \
|
|
33 | + --disable-shared --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) \
|
|
34 | + --host=$(../wxWidgets/config.guess) --build=aarch64-apple-darwin --without-libtiff
|
|
35 | + make |
|
\ No newline at end of file |
... | ... | @@ -82,7 +82,6 @@ public: |
82 | 82 | virtual void Update() override;
|
83 | 83 | virtual void ClearBackground() override;
|
84 | 84 | |
85 | - virtual bool SetCursor( const wxCursor &cursor ) override;
|
|
86 | 85 | virtual bool SetFont( const wxFont &font ) override;
|
87 | 86 | virtual bool SetBackgroundColour( const wxColour &colour ) override;
|
88 | 87 | virtual bool SetForegroundColour( const wxColour &colour ) override;
|
... | ... | @@ -130,6 +129,8 @@ public: |
130 | 129 | // implementation from now on
|
131 | 130 | // --------------------------
|
132 | 131 | |
132 | + virtual void WXUpdateCursor() override;
|
|
133 | + |
|
133 | 134 | void MacClientToRootWindow( int *x , int *y ) const;
|
134 | 135 | |
135 | 136 | void MacWindowToRootWindow( int *x , int *y ) const;
|
... | ... | @@ -40,7 +40,7 @@ enum wxBatteryState |
40 | 40 | // compiling in the code for handling them which is never going to be invoked
|
41 | 41 | // under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event
|
42 | 42 | // is available, it should be used to guard all code using wxPowerEvent
|
43 | -#if defined(__WINDOWS__) || defined(__WXGTK__)
|
|
43 | +#if defined(__WINDOWS__) || defined(__WXGTK__) || defined(__WXOSX_COCOA__)
|
|
44 | 44 | |
45 | 45 | #define wxHAS_POWER_EVENTS
|
46 | 46 |
... | ... | @@ -509,6 +509,12 @@ public: |
509 | 509 | // Argument is wxID_ANY if mouse is exiting the toolbar.
|
510 | 510 | virtual void OnMouseEnter(int toolid);
|
511 | 511 | |
512 | +#if wxUSE_HELP
|
|
513 | + // override to return the ID of the tool at the given point
|
|
514 | + virtual int GetHelpIdAtPoint(const wxPoint& pt) override;
|
|
515 | +#endif // wxUSE_HELP
|
|
516 | + |
|
517 | + |
|
512 | 518 | // more deprecated functions
|
513 | 519 | // -------------------------
|
514 | 520 |
... | ... | @@ -1448,6 +1448,12 @@ public: |
1448 | 1448 | return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown);
|
1449 | 1449 | }
|
1450 | 1450 | |
1451 | + // may be overridden to return a more appropriate ID for the help event
|
|
1452 | + // generated at the given point (in client window coordinates)
|
|
1453 | + virtual int GetHelpIdAtPoint(const wxPoint& WXUNUSED(pt))
|
|
1454 | + {
|
|
1455 | + return GetId();
|
|
1456 | + }
|
|
1451 | 1457 | #else // !wxUSE_HELP
|
1452 | 1458 | // silently ignore SetHelpText() calls
|
1453 | 1459 | void SetHelpText(const wxString& WXUNUSED(text)) { }
|
... | ... | @@ -3831,6 +3831,11 @@ public: |
3831 | 3831 | clicked-on window, and then either show some suitable help or call wxEvent::Skip()
|
3832 | 3832 | if the identifier is unrecognised.
|
3833 | 3833 | |
3834 | + Note that for some windows, such as wxToolBar, the event uses the ID of the
|
|
3835 | + tool that was under the mouse, if any, and not the ID of the window itself.
|
|
3836 | + If necessary, wxEvent::GetEventObject() may be used to get the pointer to
|
|
3837 | + the toolbar itself.
|
|
3838 | + |
|
3834 | 3839 | Calling Skip is important because it allows wxWidgets to generate further
|
3835 | 3840 | events for ancestors of the clicked-on window. Otherwise it would be impossible to
|
3836 | 3841 | show help for container windows, since processing would stop after the first window
|
... | ... | @@ -67,9 +67,9 @@ enum wxPowerBlockKind |
67 | 67 | system is suspended, hibernated, plugged into or unplugged from the wall socket
|
68 | 68 | and so on. wxPowerEvents are emitted by wxWindows.
|
69 | 69 | |
70 | - Notice that currently these events are generated only under MSW and Linux
|
|
71 | - and that under Linux you @e must use wxPowerResource::Acquire() to receive
|
|
72 | - them, e.g. typically an application interested in these events should
|
|
70 | + Notice that currently these events are generated only under MSW, Linux and
|
|
71 | + MacOS (cocoa). Under Linux and MacOS you @e must use wxPowerResource::Acquire()
|
|
72 | + to receive them, e.g. typically an application interested in these events should
|
|
73 | 73 | initialize wxPowerResourceBlocker for ::wxPOWER_RESOURCE_SYSTEM resource
|
74 | 74 | using ::wxPOWER_DELAY block kind when initializing either the application
|
75 | 75 | itself or its main window. E.g. for an application that wants to handle
|
... | ... | @@ -3139,6 +3139,21 @@ public: |
3139 | 3139 | */
|
3140 | 3140 | ///@{
|
3141 | 3141 | |
3142 | + /**
|
|
3143 | + Get the ID to be used for help events generated at the given point.
|
|
3144 | + |
|
3145 | + By default help events use the ID of the window for which they are
|
|
3146 | + generated, but in some cases it may be preferable to use an ID for a
|
|
3147 | + sub-element of the window instead, e.g. this is used by wxToolBar to
|
|
3148 | + generate help events with the ID of the tool under the mouse, if any.
|
|
3149 | + |
|
3150 | + Similarly, this function may be overridden in other composite controls
|
|
3151 | + in the application code.
|
|
3152 | + |
|
3153 | + @since 3.3.2
|
|
3154 | + */
|
|
3155 | + virtual int GetHelpIdAtPoint(const wxPoint& pt);
|
|
3156 | + |
|
3142 | 3157 | /**
|
3143 | 3158 | Gets the help text to be used as context-sensitive help for this window.
|
3144 | 3159 | Note that the text is actually stored by the current wxHelpProvider
|
... | ... | @@ -199,7 +199,9 @@ bool wxContextHelp::DispatchEvent(wxWindow* win, const wxPoint& pt) |
199 | 199 | {
|
200 | 200 | wxCHECK_MSG( win, false, wxT("win parameter can't be null") );
|
201 | 201 | |
202 | - wxHelpEvent helpEvent(wxEVT_HELP, win->GetId(), pt,
|
|
202 | + wxHelpEvent helpEvent(wxEVT_HELP,
|
|
203 | + win->GetHelpIdAtPoint(win->ScreenToClient(pt)),
|
|
204 | + pt,
|
|
203 | 205 | wxHelpEvent::Origin_HelpButton);
|
204 | 206 | helpEvent.SetEventObject(win);
|
205 | 207 |
... | ... | @@ -810,6 +810,17 @@ void wxToolBarBase::UpdateWindowUI(long flags) |
810 | 810 | }
|
811 | 811 | }
|
812 | 812 | |
813 | +#if wxUSE_HELP
|
|
814 | +int wxToolBarBase::GetHelpIdAtPoint(const wxPoint& pt)
|
|
815 | +{
|
|
816 | + if ( wxToolBarToolBase* const tool = FindToolForPosition(pt.x, pt.y) )
|
|
817 | + return tool->GetId();
|
|
818 | + |
|
819 | + return wxControl::GetHelpIdAtPoint(pt);
|
|
820 | +}
|
|
821 | +#endif // wxUSE_HELP
|
|
822 | + |
|
823 | + |
|
813 | 824 | #if wxUSE_MENUS
|
814 | 825 | bool wxToolBarBase::SetDropdownMenu(int toolid, wxMenu* menu)
|
815 | 826 | {
|
... | ... | @@ -3286,7 +3286,6 @@ bool wxDataViewIconTextRenderer::MacRender() |
3286 | 3286 | |
3287 | 3287 | cell = (wxImageTextCell*) GetNativeData()->GetItemCell();
|
3288 | 3288 | iconText << GetValue();
|
3289 | - const wxDataViewCtrl* const dvc = GetOwner()->GetOwner();
|
|
3290 | 3289 | [cell setImage:wxOSXGetImageFromBundle(iconText.GetBitmapBundle())];
|
3291 | 3290 | [cell setStringValue:wxCFStringRef(iconText.GetText()).AsNSString()];
|
3292 | 3291 | return true;
|
... | ... | @@ -13,6 +13,11 @@ |
13 | 13 | |
14 | 14 | #include "wx/wxprec.h"
|
15 | 15 | |
16 | +#ifndef WX_PRECOMP
|
|
17 | + #include "wx/module.h"
|
|
18 | + #include "wx/window.h"
|
|
19 | +#endif
|
|
20 | + |
|
16 | 21 | #include "wx/power.h"
|
17 | 22 | #include "wx/atomic.h"
|
18 | 23 | #include "wx/osx/private.h"
|
... | ... | @@ -20,11 +25,89 @@ |
20 | 25 | |
21 | 26 | #include <IOKit/pwr_mgt/IOPMLib.h>
|
22 | 27 | |
28 | +#import <Cocoa/Cocoa.h>
|
|
29 | + |
|
30 | +static wxAtomicInt g_powerResourceSystemRefCount = 0;
|
|
31 | + |
|
32 | +// ----------------------------------------------------------------------------
|
|
33 | +// wxCocoaPowerModule
|
|
34 | +// ----------------------------------------------------------------------------
|
|
35 | + |
|
36 | +@interface wxCocoaPowerEventsObserver : NSObject
|
|
37 | +@end
|
|
38 | + |
|
39 | +@implementation wxCocoaPowerEventsObserver
|
|
40 | + |
|
41 | +- (id)init {
|
|
42 | + self = [super init];
|
|
43 | + if (self) {
|
|
44 | + NSNotificationCenter *center = [[NSWorkspace sharedWorkspace] notificationCenter];
|
|
45 | + |
|
46 | + // Register for "will sleep" notification
|
|
47 | + [center addObserver:self
|
|
48 | + selector:@selector(handleWillSleep:)
|
|
49 | + name:NSWorkspaceWillSleepNotification
|
|
50 | + object:nil];
|
|
51 | + |
|
52 | + // Register for "did wake" notification
|
|
53 | + [center addObserver:self
|
|
54 | + selector:@selector(handleDidWake:)
|
|
55 | + name:NSWorkspaceDidWakeNotification
|
|
56 | + object:nil];
|
|
57 | + }
|
|
58 | + return self;
|
|
59 | +}
|
|
60 | + |
|
61 | +- (void)dealloc {
|
|
62 | + [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self];
|
|
63 | + [super dealloc];
|
|
64 | +}
|
|
65 | + |
|
66 | +- (void)handleWillSleep:(NSNotification *)notification {
|
|
67 | + wxPowerEvent event(wxEVT_POWER_SUSPENDED);
|
|
68 | + |
|
69 | + for ( auto tlw : wxTopLevelWindows )
|
|
70 | + tlw->HandleWindowEvent(event);
|
|
71 | +}
|
|
72 | + |
|
73 | +- (void)handleDidWake:(NSNotification *)notification {
|
|
74 | + wxPowerEvent event(wxEVT_POWER_RESUME);
|
|
75 | + |
|
76 | + for ( auto tlw : wxTopLevelWindows )
|
|
77 | + tlw->HandleWindowEvent(event);
|
|
78 | +}
|
|
79 | + |
|
80 | +@end
|
|
81 | + |
|
82 | +namespace {
|
|
83 | +// the global power events observer
|
|
84 | +static wxCFRef<wxCocoaPowerEventsObserver*> g_powerEventsObserver;
|
|
85 | + |
|
86 | +// add power observers on init and remove on exit
|
|
87 | +class wxCocoaPowerModule : public wxModule
|
|
88 | +{
|
|
89 | +public:
|
|
90 | + bool OnInit() override { return true; }
|
|
91 | + void OnExit() override
|
|
92 | + {
|
|
93 | + // There should be no other threads by now, so no locking is needed.
|
|
94 | + if ( g_powerResourceSystemRefCount )
|
|
95 | + {
|
|
96 | + g_powerEventsObserver.reset();
|
|
97 | + |
|
98 | + g_powerResourceSystemRefCount = 0;
|
|
99 | + }
|
|
100 | + }
|
|
101 | + |
|
102 | +private:
|
|
103 | + wxDECLARE_NO_COPY_CLASS(wxCocoaPowerModule);
|
|
104 | +};
|
|
105 | +}; // anonymous namespace
|
|
106 | + |
|
23 | 107 | // ----------------------------------------------------------------------------
|
24 | 108 | // wxPowerResource
|
25 | 109 | // ----------------------------------------------------------------------------
|
26 | 110 | |
27 | -static wxAtomicInt g_powerResourceSystemRefCount = 0;
|
|
28 | 111 | static NSObject* g_processInfoActivity = nil;
|
29 | 112 | |
30 | 113 | bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason)
|
... | ... | @@ -58,9 +141,9 @@ bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason) |
58 | 141 | [[NSProcessInfo processInfo]
|
59 | 142 | endActivity:(id)g_processInfoActivity];
|
60 | 143 | g_processInfoActivity = nil;
|
61 | - |
|
62 | - return true;
|
|
63 | 144 | }
|
145 | + |
|
146 | + g_powerEventsObserver.reset();
|
|
64 | 147 | }
|
65 | 148 | |
66 | 149 | return true;
|
... | ... | @@ -73,7 +156,16 @@ wxPowerResource::Acquire(wxPowerResourceKind kind, |
73 | 156 | {
|
74 | 157 | if ( blockKind == wxPOWER_DELAY )
|
75 | 158 | {
|
76 | - // We don't support this mode under macOS because it's not needed there.
|
|
159 | + if ( kind == wxPOWER_RESOURCE_SYSTEM )
|
|
160 | + {
|
|
161 | + wxAtomicInc(g_powerResourceSystemRefCount);
|
|
162 | + |
|
163 | + if ( g_powerEventsObserver.get() == nullptr )
|
|
164 | + {
|
|
165 | + g_powerEventsObserver = [[wxCocoaPowerEventsObserver alloc] init];
|
|
166 | + }
|
|
167 | + }
|
|
168 | + |
|
77 | 169 | return true;
|
78 | 170 | }
|
79 | 171 |
... | ... | @@ -844,29 +844,14 @@ void wxWindowMac::DoGetClientSize( int *x, int *y ) const |
844 | 844 | }
|
845 | 845 | }
|
846 | 846 | |
847 | -bool wxWindowMac::SetCursor(const wxCursor& cursor)
|
|
847 | +void wxWindowMac::WXUpdateCursor()
|
|
848 | 848 | {
|
849 | - if (m_cursor.IsSameAs(cursor))
|
|
850 | - return false;
|
|
849 | + wxWindowBase::WXUpdateCursor();
|
|
851 | 850 | |
852 | - if (!cursor.IsOk())
|
|
853 | - {
|
|
854 | - if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) )
|
|
855 | - return false ;
|
|
856 | - }
|
|
857 | - else
|
|
851 | + if ( GetPeer() != nullptr )
|
|
858 | 852 | {
|
859 | - if ( ! wxWindowBase::SetCursor( cursor ) )
|
|
860 | - return false ;
|
|
853 | + GetPeer()->SetCursor( m_cursor.IsOk() ? m_cursor : *wxSTANDARD_CURSOR ) ;
|
|
861 | 854 | }
|
862 | - |
|
863 | - wxASSERT_MSG( m_cursor.IsOk(),
|
|
864 | - wxT("cursor must be valid after call to the base version"));
|
|
865 | - |
|
866 | - if ( GetPeer() != nullptr )
|
|
867 | - GetPeer()->SetCursor( m_cursor );
|
|
868 | - |
|
869 | - return true ;
|
|
870 | 855 | }
|
871 | 856 | |
872 | 857 | #if wxUSE_MENUS
|
... | ... | @@ -16,6 +16,10 @@ |
16 | 16 | #include "wx/slider.h"
|
17 | 17 | #endif // WX_PRECOMP
|
18 | 18 | |
19 | +#ifdef __WXQT__
|
|
20 | + #include <QtGlobal> // QT_VERSION and QT_VERSION_CHECK
|
|
21 | +#endif
|
|
22 | + |
|
19 | 23 | #include "wx/uiaction.h"
|
20 | 24 | #include "testableframe.h"
|
21 | 25 | |
... | ... | @@ -225,7 +229,8 @@ void SliderTestCase::Thumb() |
225 | 229 | |
226 | 230 | CPPUNIT_ASSERT(track.GetCount() != 0);
|
227 | 231 | CPPUNIT_ASSERT_EQUAL(1, release.GetCount());
|
228 | -#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXQT__)
|
|
232 | +#if defined(__WXMSW__) || defined(__WXGTK__) || \
|
|
233 | + (defined(__WXQT__) && QT_VERSION < QT_VERSION_CHECK(6, 8, 0))
|
|
229 | 234 | CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
|
230 | 235 | #endif
|
231 | 236 | #endif
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help