[education/rkward/kf5] rkward/windows: Fix compile errors on Mac
Thomas Friedrichsmeier
null at kde.org
Wed Apr 10 16:12:08 BST 2024
Git commit 3121d0e17be7e9ae567b92b64a19ed91b3db7511 by Thomas Friedrichsmeier.
Committed on 07/04/2024 at 14:46.
Pushed by tfry into branch 'kf5'.
Fix compile errors on Mac
M +1 -1 rkward/windows/rktoolwindowlist.cpp
M +12 -8 rkward/windows/rkwindowcatcher.cpp
https://invent.kde.org/education/rkward/-/commit/3121d0e17be7e9ae567b92b64a19ed91b3db7511
diff --git a/rkward/windows/rktoolwindowlist.cpp b/rkward/windows/rktoolwindowlist.cpp
index b48955302..8efc8fbaf 100644
--- a/rkward/windows/rktoolwindowlist.cpp
+++ b/rkward/windows/rktoolwindowlist.cpp
@@ -28,7 +28,7 @@ void RKToolWindowList::registerToolWindow (RKMDIWindow *window, const QString &i
tr.default_shortcut = default_shortcut;
#ifdef Q_OS_MACOS
// HACK: Workaround for shortcut conflict issue: https://mail.kde.org/pipermail/rkward-devel/2011-December/003153.html
- if (default_shortcut & Qt::AltModifier) tr.default_shortcut |= Qt::ControlModifier;
+ if (default_shortcut.keyboardModifiers() & Qt::AltModifier) tr.default_shortcut = default_shortcut.keyboardModifiers() | Qt::ControlModifier | default_shortcut.key();
#endif
RKToolWindowListPrivate::registered_tool_windows.append (tr);
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index 6ee51eead..d99e1878f 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -77,28 +77,32 @@ void RKWindowCatcher::start (int prev_cur_device) {
RK_DEBUG (RBACKEND, DL_DEBUG, "Window Catcher activated");
last_cur_device = prev_cur_device;
-#ifdef Q_OS_WIN
+#if __has_include(<KWindowInfo>)
+ windows_before_add = KX11Extras::windows ();
+#elif defined(Q_OS_WIN)
windows_before_add = RKWindowCatcherPrivate::toplevelWindows ();
#else
- windows_before_add = KX11Extras::windows ();
+ RK_ASSERT(false); // code should not be reached
#endif
}
WId RKWindowCatcher::createdWindow () {
RK_TRACE (MISC);
-#ifdef Q_OS_WIN
- QList<WId> windows_after_add = RKWindowCatcherPrivate::toplevelWindows ();
- for (int i = windows_after_add.size () - 1; i >= 0; --i) {
- if (!windows_before_add.contains (windows_after_add[i])) return windows_after_add[i];
- }
-#else
+#if __has_include(<KWindowInfo>)
// A whole lot of windows appear to get created, but it does look like the last one is the one we need.
QList<WId> windows_after_add = KX11Extras::windows ();
WId candidate = windows_after_add.value (windows_after_add.size () - 1);
if (!windows_before_add.contains (windows_after_add.last ())) {
return candidate;
}
+#elif defined(Q_OS_WIN)
+ QList<WId> windows_after_add = RKWindowCatcherPrivate::toplevelWindows ();
+ for (int i = windows_after_add.size () - 1; i >= 0; --i) {
+ if (!windows_before_add.contains (windows_after_add[i])) return windows_after_add[i];
+ }
+#else
+ RK_ASSERT(false); // code should not be reached
#endif
return 0;
}
More information about the rkward-tracker
mailing list