mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
media-libs/libsdl2: mouse improvements (#3194)
* simple implementation of SDL_ShowCursor for Haiku * mouse_relative mode fix * mouse wheel y inverted
This commit is contained in:
committed by
Gerasim Troeglazov
parent
67d742b209
commit
f74e0cd1e4
@@ -6,7 +6,7 @@ software, emulators, and popular games."
|
||||
HOMEPAGE="https://www.libsdl.org/"
|
||||
COPYRIGHT="1997-2018 Sam Lantinga"
|
||||
LICENSE="Zlib"
|
||||
REVISION="2"
|
||||
REVISION="3"
|
||||
SOURCE_URI="https://www.libsdl.org/release/SDL2-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="edc77c57308661d576e843344d8638e025a7818bff73f8fbfab09c3c5fd092ec"
|
||||
SOURCE_DIR="SDL2-$portVersion"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 8de05611ed9fddb79890310f63a5e3c6baeeb05c Mon Sep 17 00:00:00 2001
|
||||
From 6f1ce1552683c15a58706bdbb7b895b604bc08d4 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Fri, 29 Aug 2014 15:24:11 +0000
|
||||
Subject: haiku patch
|
||||
@@ -30,7 +30,7 @@ index 3456932..d32eb94 100644
|
||||
2.19.0
|
||||
|
||||
|
||||
From f81ab56a49a14808f23270f1ac4c7c069f570b48 Mon Sep 17 00:00:00 2001
|
||||
From f9b2314e6abbb4b5c7fdec8c55c878708f829b99 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Thu, 25 Feb 2016 20:23:41 +0000
|
||||
Subject: remove nacl, missing templates on Haiku
|
||||
@@ -78,7 +78,7 @@ index 1c7e793..8e3a74b 100644
|
||||
2.19.0
|
||||
|
||||
|
||||
From af792add5f34e3b7ae2429bff09af309a65f59bc Mon Sep 17 00:00:00 2001
|
||||
From ef7f8f41c44d90762a53552795ad595575150302 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Sat, 30 Sep 2017 13:36:12 +0200
|
||||
Subject: fix AC_DEFINE
|
||||
@@ -101,7 +101,7 @@ index 8e3a74b..d4d38e4 100644
|
||||
2.19.0
|
||||
|
||||
|
||||
From ffd0621c69136cb61f6513c52b1ae784bd391b66 Mon Sep 17 00:00:00 2001
|
||||
From 6f00f7e3cf2ccaac41860980526654b07ad0602b Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
Date: Fri, 2 Feb 2018 09:40:46 +0100
|
||||
Subject: Fix secondary arch build.
|
||||
@@ -149,7 +149,7 @@ index d4d38e4..7c3a166 100644
|
||||
2.19.0
|
||||
|
||||
|
||||
From 26d7a60c26b9fa2a8534c5df5b69a0973184d437 Mon Sep 17 00:00:00 2001
|
||||
From 342bf540924b738ebb7c2ae0bf7f6e433ce5a07c Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
Date: Fri, 2 Feb 2018 10:40:00 +0100
|
||||
Subject: Fix crash when opening window
|
||||
@@ -207,7 +207,7 @@ index 3e61888..bd4aae7 100644
|
||||
2.19.0
|
||||
|
||||
|
||||
From e8a281bfa86e9ecaaa297cd60f3bc8499dd8bebe Mon Sep 17 00:00:00 2001
|
||||
From 43b13f20932a7e016317246f6264fca7a16af3a3 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
|
||||
@@ -243,7 +243,7 @@ index ba3f927..7d4f442 100644
|
||||
2.19.0
|
||||
|
||||
|
||||
From 4b7d43c12e26c76cb8befa95b7a3b70799332717 Mon Sep 17 00:00:00 2001
|
||||
From 152682748a615a217309e0ed827d121ccaa6f326 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
|
||||
@@ -341,3 +341,128 @@ index bd4aae7..370bdce 100644
|
||||
--
|
||||
2.19.0
|
||||
|
||||
|
||||
From 012ec895e9147bb2d58e104d867d1a39be60aba9 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Kosyh <p.kosyh@gmail.com>
|
||||
Date: Sat, 6 Oct 2018 12:48:15 +0300
|
||||
Subject: haiku: mouse->ShowMouse method added
|
||||
|
||||
|
||||
diff --git a/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h
|
||||
index ec0c458..5ff8bf1 100644
|
||||
--- a/src/main/haiku/SDL_BApp.h
|
||||
+++ b/src/main/haiku/SDL_BApp.h
|
||||
@@ -244,7 +244,7 @@ private:
|
||||
be_app->HideCursor();
|
||||
} else {
|
||||
SDL_SendMouseMotion(win, 0, 0, x, y);
|
||||
- if (be_app->IsCursorHidden())
|
||||
+ if (SDL_ShowCursor(-1) && be_app->IsCursorHidden())
|
||||
be_app->ShowCursor();
|
||||
}
|
||||
|
||||
diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc
|
||||
index afe20e3..c0b1d30 100644
|
||||
--- a/src/video/haiku/SDL_bvideo.cc
|
||||
+++ b/src/video/haiku/SDL_bvideo.cc
|
||||
@@ -19,6 +19,7 @@
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
+#include "../../main/haiku/SDL_BApp.h"
|
||||
|
||||
#if SDL_VIDEO_DRIVER_HAIKU
|
||||
|
||||
@@ -132,6 +133,33 @@ void BE_DeleteDevice(SDL_VideoDevice * device)
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
+static int BE_ShowCursor(SDL_Cursor *cur)
|
||||
+{
|
||||
+ SDL_Mouse *mouse = SDL_GetMouse();
|
||||
+ int show;
|
||||
+ if (!mouse)
|
||||
+ return 0;
|
||||
+ show = (cur || !mouse->focus);
|
||||
+ if (show) {
|
||||
+ if (be_app->IsCursorHidden())
|
||||
+ be_app->ShowCursor();
|
||||
+ } else {
|
||||
+ if (!be_app->IsCursorHidden())
|
||||
+ be_app->HideCursor();
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void BE_MouseInit(_THIS)
|
||||
+{
|
||||
+ SDL_Mouse *mouse = SDL_GetMouse();
|
||||
+ if (!mouse)
|
||||
+ return;
|
||||
+ mouse->ShowCursor = BE_ShowCursor;
|
||||
+ mouse->cur_cursor = (SDL_Cursor*)0x1;
|
||||
+ mouse->def_cursor = (SDL_Cursor*)0x2;
|
||||
+}
|
||||
+
|
||||
int BE_VideoInit(_THIS)
|
||||
{
|
||||
/* Initialize the Be Application for appserver interaction */
|
||||
@@ -145,6 +173,7 @@ int BE_VideoInit(_THIS)
|
||||
/* Init the keymap */
|
||||
BE_InitOSKeymap();
|
||||
|
||||
+ BE_MouseInit(_this);
|
||||
|
||||
#if SDL_VIDEO_OPENGL
|
||||
/* testgl application doesn't load library, just tries to load symbols */
|
||||
--
|
||||
2.19.0
|
||||
|
||||
|
||||
From 271462fa0d722f47c669a19ea262e45e419cc51f Mon Sep 17 00:00:00 2001
|
||||
From: Peter Kosyh <p.kosyh@gmail.com>
|
||||
Date: Sat, 6 Oct 2018 13:50:30 +0300
|
||||
Subject: mouse_relative fix
|
||||
|
||||
|
||||
diff --git a/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h
|
||||
index 5ff8bf1..e0a4b9b 100644
|
||||
--- a/src/main/haiku/SDL_BApp.h
|
||||
+++ b/src/main/haiku/SDL_BApp.h
|
||||
@@ -230,9 +230,7 @@ private:
|
||||
win = GetSDLWindow(winID);
|
||||
|
||||
// Simple relative mode support for mouse.
|
||||
- if ((SDL_GetMouse()->relative_mode ||
|
||||
- (win->flags & SDL_WINDOW_INPUT_GRABBED)) &&
|
||||
- (win->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||
+ if (SDL_GetMouse()->relative_mode) {
|
||||
int winWidth, winHeight, winPosX, winPosY;
|
||||
SDL_GetWindowSize(win, &winWidth, &winHeight);
|
||||
SDL_GetWindowPosition(win, &winPosX, &winPosY);
|
||||
--
|
||||
2.19.0
|
||||
|
||||
|
||||
From a3b7305da8b8c5f7c0375644ed5d4a713f06bdaf Mon Sep 17 00:00:00 2001
|
||||
From: Peter Kosyh <p.kosyh@gmail.com>
|
||||
Date: Sat, 6 Oct 2018 14:28:41 +0300
|
||||
Subject: mouse wheel y invert
|
||||
|
||||
|
||||
diff --git a/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h
|
||||
index e0a4b9b..d59ac34 100644
|
||||
--- a/src/main/haiku/SDL_BApp.h
|
||||
+++ b/src/main/haiku/SDL_BApp.h
|
||||
@@ -277,7 +277,7 @@ private:
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
- SDL_SendMouseWheel(win, 0, xTicks, yTicks, SDL_MOUSEWHEEL_NORMAL);
|
||||
+ SDL_SendMouseWheel(win, 0, xTicks, -yTicks, SDL_MOUSEWHEEL_NORMAL);
|
||||
}
|
||||
|
||||
void _HandleKey(BMessage *msg) {
|
||||
--
|
||||
2.19.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user