diff --git a/HaikuSeat.cpp b/HaikuSeat.cpp index 864160a..0eed5b1 100644 --- a/HaikuSeat.cpp +++ b/HaikuSeat.cpp @@ -168,6 +168,23 @@ static uint32_t FromHaikuModifiers(uint32 haikuModifiers) return wlModifiers; } +bool IsHaikuSystemShortcut(BMessage *msg) +{ + // Haiku bug #18172 workaround + + const char* bytes = NULL; + if (msg->FindString("bytes", &bytes) < B_OK) + return false; + + char key = bytes[0]; + int32 rawKey = msg->GetInt32("key", 0); + uint32 modifiers = msg->GetInt32("modifiers", 0); + + return + ((key == B_TAB || rawKey == 0x11) && (modifiers & B_CONTROL_KEY) != 0) || + (key == B_FUNCTION_KEY && rawKey == B_PRINT_KEY); +} + class SurfaceCursorHook: public HaikuSurface::Hook { public: BPoint fHotspot; diff --git a/HaikuSeat.h b/HaikuSeat.h index 9daaf5b..dfbeb83 100644 --- a/HaikuSeat.h +++ b/HaikuSeat.h @@ -64,4 +64,6 @@ class HaikuSeat: public WlSeat { }; +bool IsHaikuSystemShortcut(BMessage *msg); + HaikuSeat *HaikuGetSeat(struct wl_client *wl_client); diff --git a/HaikuXdgPopup.cpp b/HaikuXdgPopup.cpp index bf6940c..542ed9a 100644 --- a/HaikuXdgPopup.cpp +++ b/HaikuXdgPopup.cpp @@ -1,6 +1,7 @@ #include "HaikuXdgPopup.h" #include "HaikuXdgSurface.h" #include "HaikuXdgPositioner.h" +#include "HaikuSeat.h" #include "WaylandEnv.h" #include "AppKitPtrs.h" @@ -43,6 +44,9 @@ void WaylandPopupWindow::DispatchMessage(BMessage *msg, BHandler *target) switch (msg->what) { case B_KEY_DOWN: case B_UNMAPPED_KEY_DOWN: + if (IsHaikuSystemShortcut(msg)) + break; + // Do not use built-in shortcut handling. target->MessageReceived(msg); return; diff --git a/HaikuXdgToplevel.cpp b/HaikuXdgToplevel.cpp index 52726ca..4126936 100644 --- a/HaikuXdgToplevel.cpp +++ b/HaikuXdgToplevel.cpp @@ -88,6 +88,9 @@ void WaylandWindow::DispatchMessage(BMessage *msg, BHandler *target) switch (msg->what) { case B_KEY_DOWN: case B_UNMAPPED_KEY_DOWN: + if (IsHaikuSystemShortcut(msg)) + break; + // Do not use built-in shortcut handling. target->MessageReceived(msg); return;