From 7c23a487758e986e9c6bc7351204aba5b50e7c98 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Thu, 20 Jun 2019 23:44:09 +1000 Subject: [PATCH] libsdl2: fix event mask for relative mouse mode --- media-libs/libsdl2/libsdl2-2.0.9.recipe | 2 +- .../libsdl2/patches/libsdl2-2.0.9.patchset | 121 ++++++++++++++---- 2 files changed, 98 insertions(+), 25 deletions(-) diff --git a/media-libs/libsdl2/libsdl2-2.0.9.recipe b/media-libs/libsdl2/libsdl2-2.0.9.recipe index eea1a4427..28d17eec4 100644 --- a/media-libs/libsdl2/libsdl2-2.0.9.recipe +++ b/media-libs/libsdl2/libsdl2-2.0.9.recipe @@ -6,7 +6,7 @@ software, emulators, and popular games." HOMEPAGE="https://www.libsdl.org/" COPYRIGHT="1997-2018 Sam Lantinga" LICENSE="Zlib" -REVISION="1" +REVISION="2" SOURCE_URI="https://www.libsdl.org/release/SDL2-$portVersion.tar.gz" CHECKSUM_SHA256="255186dc676ecd0c1dbf10ec8a2cc5d6869b5079d8a38194c2aecdff54b324b1" SOURCE_DIR="SDL2-$portVersion" diff --git a/media-libs/libsdl2/patches/libsdl2-2.0.9.patchset b/media-libs/libsdl2/patches/libsdl2-2.0.9.patchset index a477d1f97..cb314d116 100644 --- a/media-libs/libsdl2/patches/libsdl2-2.0.9.patchset +++ b/media-libs/libsdl2/patches/libsdl2-2.0.9.patchset @@ -1,4 +1,4 @@ -From 9145a1f1a70d80f9cbbf1f905bb4a86696de1e9a Mon Sep 17 00:00:00 2001 +From 547d126802b8059e16bf73c7b6c9f5b78000109f Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Fri, 29 Aug 2014 15:24:11 +0000 Subject: haiku patch @@ -27,10 +27,10 @@ index e599062..3b145a3 100644 &location)) == B_OK) { return location; -- -2.19.1 +2.21.0 -From 313046cb8e582cd1485589302f7f469766592aca Mon Sep 17 00:00:00 2001 +From 7f29b18a1153196ca53a081ccdecbaa60de5f20c Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 25 Feb 2016 20:23:41 +0000 Subject: remove nacl, missing templates on Haiku @@ -75,10 +75,10 @@ index ae866ff..57afa1f 100644 { AC_ARG_ENABLE(video-rpi, -- -2.19.1 +2.21.0 -From 69d3ffdec32e5fd06126102298d0bdc3c82912f9 Mon Sep 17 00:00:00 2001 +From 3169c62e87c3a6912716332298259cedfd5e2140 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sat, 30 Sep 2017 13:36:12 +0200 Subject: fix AC_DEFINE @@ -98,10 +98,10 @@ index 57afa1f..4c87ce0 100644 ]) AC_MSG_RESULT($have_xinput2_multitouch) -- -2.19.1 +2.21.0 -From 5a8b19e6e594ce29fd579c4554a32f4628ffb7b7 Mon Sep 17 00:00:00 2001 +From b15e0202c2761049337002dc044bbbd151fa7e3d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 2 Feb 2018 09:40:46 +0100 Subject: Fix secondary arch build. @@ -146,10 +146,10 @@ index 4c87ce0..7dd7cd8 100644 arm*-apple-darwin*|*-ios-*) ARCH=ios -- -2.19.1 +2.21.0 -From b56132ee7db02db18db43eeedc53892cdc89583e Mon Sep 17 00:00:00 2001 +From b0f10f9c4c4622e2da9cdcb8767e7ff13be6f44b Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 2 Feb 2018 10:40:00 +0100 Subject: Fix crash when opening window @@ -204,10 +204,10 @@ index b22f74b..7cb2de9 100644 thread_id _draw_thread_id; -- -2.19.1 +2.21.0 -From e1745294f598df356ba81e4a4471367a7425876a Mon Sep 17 00:00:00 2001 +From 3dfd7cf9d4cce998ac749f71de0f98567041de7c Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sat, 15 Sep 2018 23:16:25 +1000 Subject: Add simple relative mode for mouse @@ -240,10 +240,10 @@ index 7adbd00..786a57e 100644 HAIKU_UpdateWindowFramebuffer(NULL,win,NULL,-1); } -- -2.19.1 +2.21.0 -From 9e78031698012e2ef19a1a935972f8048b6297de Mon Sep 17 00:00:00 2001 +From 89ef2180606cdc3ff27765c7f24529df8ca0c4b8 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Tue, 18 Sep 2018 20:47:07 +1000 Subject: Add support for relative mouse mode @@ -339,10 +339,10 @@ index 7cb2de9..fa945a5 100644 _last_buttons = buttons; -- -2.19.1 +2.21.0 -From 022d289781c1a582ff6a732ce521b741aba62a42 Mon Sep 17 00:00:00 2001 +From 16f828785ee64e617ac3f03bcc1962d894bc81ee Mon Sep 17 00:00:00 2001 From: Peter Kosyh Date: Sat, 6 Oct 2018 12:48:15 +0300 Subject: haiku: mouse->ShowMouse method added @@ -417,10 +417,10 @@ index e7b4b6e..747f7d4 100644 /* testgl application doesn't load library, just tries to load symbols */ /* is it correct? if so we have to load library here */ -- -2.19.1 +2.21.0 -From b4513263389947c11b17f264a241803e3c5a4a6e Mon Sep 17 00:00:00 2001 +From e96e33627597f3a1ea89025dcbe129eb86787dd9 Mon Sep 17 00:00:00 2001 From: Peter Kosyh Date: Sat, 6 Oct 2018 13:50:30 +0300 Subject: mouse_relative fix @@ -442,10 +442,10 @@ index f86ba9a..1e7a8b5 100644 SDL_GetWindowSize(win, &winWidth, &winHeight); SDL_GetWindowPosition(win, &winPosX, &winPosY); -- -2.19.1 +2.21.0 -From 72367442fc2d13b6727cadf8d0a7d221a55c49d0 Mon Sep 17 00:00:00 2001 +From 47a0f9a87eaa8ec30b3e69e77f11692fcd49aee4 Mon Sep 17 00:00:00 2001 From: Peter Kosyh Date: Sat, 6 Oct 2018 14:28:41 +0300 Subject: mouse wheel y invert @@ -465,10 +465,10 @@ index 1e7a8b5..3fe4bb0 100644 void _HandleKey(BMessage *msg) { -- -2.19.1 +2.21.0 -From faefae6437eaa7e9bae17a117d7453126fa1e136 Mon Sep 17 00:00:00 2001 +From 32e7fb1e506b5d6554935fbb807893c21fe8012b Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Mon, 5 Nov 2018 23:25:54 +1000 Subject: Disable pointer history @@ -487,10 +487,10 @@ index fa945a5..9bcfa66 100644 _SDL_GLView->LockGL(); /* "New" GLViews are created */ Unlock(); -- -2.19.1 +2.21.0 -From 3c12c62dbeea984063c2ecb3153dcef3977d1855 Mon Sep 17 00:00:00 2001 +From 8a0fa60cab85f7334af1cbb7872046a0c0598c93 Mon Sep 17 00:00:00 2001 From: EXL Date: Wed, 5 Dec 2018 07:02:11 +0000 Subject: Implement message box for Haiku @@ -1097,5 +1097,78 @@ index 142a3fa..462608b 100644 -- -2.19.1 +2.21.0 + + +From 62dfd165b406bb3d983615ab1c114acbcba864c3 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Thu, 20 Jun 2019 23:29:44 +1000 +Subject: Move SetEventMask to SetRelativeMouseMode handler + + +diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h +index 9bcfa66..fa945a5 100644 +--- a/src/video/haiku/SDL_BWin.h ++++ b/src/video/haiku/SDL_BWin.h +@@ -140,7 +140,6 @@ class SDL_BWin:public BDirectWindow + _gl_type = gl_flags; + } + AddChild(_SDL_GLView); +- _SDL_GLView->SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY); + _SDL_GLView->EnableDirectMode(true); + _SDL_GLView->LockGL(); /* "New" GLViews are created */ + Unlock(); +diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc +index 747f7d4..14c7060 100644 +--- a/src/video/haiku/SDL_bvideo.cc ++++ b/src/video/haiku/SDL_bvideo.cc +@@ -36,6 +36,11 @@ extern "C" { + #include "SDL_bmodes.h" + #include "SDL_bframebuffer.h" + #include "SDL_bevents.h" ++#include "SDL_BWin.h" ++ ++static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { ++ return ((SDL_BWin*)(window->driverdata)); ++} + + /* FIXME: Undefined functions */ + // #define HAIKU_PumpEvents NULL +@@ -150,12 +155,34 @@ static int HAIKU_ShowCursor(SDL_Cursor *cur) + return 0; + } + ++static int ++HAIKU_SetRelativeMouseMode(SDL_bool enabled) ++{ ++ SDL_Window *window = SDL_GetMouseFocus(); ++ if (!window) { ++ return 0; ++ } ++ ++ SDL_BWin *bewin = _ToBeWin(window); ++ BGLView *_SDL_GLView = bewin->GetGLView(); ++ ++ bewin->Lock(); ++ if (enabled) ++ _SDL_GLView->SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY); ++ else ++ _SDL_GLView->SetEventMask(0, 0); ++ bewin->Unlock(); ++ ++ return 0; ++} ++ + static void HAIKU_MouseInit(_THIS) + { + SDL_Mouse *mouse = SDL_GetMouse(); + if (!mouse) + return; + mouse->ShowCursor = HAIKU_ShowCursor; ++ mouse->SetRelativeMouseMode = HAIKU_SetRelativeMouseMode; + mouse->cur_cursor = (SDL_Cursor*)0x1; + mouse->def_cursor = (SDL_Cursor*)0x2; + } +-- +2.21.0