forked from StephanTLavavej/mingw-distro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdl-clipcursor.patch
59 lines (56 loc) · 1.96 KB
/
sdl-clipcursor.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff -aurN SDL2-2.0.4/include/SDL_video.h SDL2-2.0.4-fixed/include/SDL_video.h
--- SDL2-2.0.4/include/SDL_video.h 2016-01-02 11:56:31.000000000 -0800
+++ SDL2-2.0.4-fixed/include/SDL_video.h 2016-04-04 20:54:47.332652900 -0700
@@ -39,6 +39,11 @@
extern "C" {
#endif
+extern int SDL_ClipCursorMarginLeft;
+extern int SDL_ClipCursorMarginTop;
+extern int SDL_ClipCursorMarginRight;
+extern int SDL_ClipCursorMarginBottom;
+
/**
* \brief The structure that defines a display mode
*
diff -aurN SDL2-2.0.4/src/video/windows/SDL_windowswindow.c SDL2-2.0.4-fixed/src/video/windows/SDL_windowswindow.c
--- SDL2-2.0.4/src/video/windows/SDL_windowswindow.c 2016-01-02 11:56:31.000000000 -0800
+++ SDL2-2.0.4-fixed/src/video/windows/SDL_windowswindow.c 2016-04-04 20:54:47.348266600 -0700
@@ -113,6 +113,22 @@
data->expected_resize = SDL_FALSE;
}
+int SDL_ClipCursorMarginLeft = 0;
+int SDL_ClipCursorMarginTop = 0;
+int SDL_ClipCursorMarginRight = 0;
+int SDL_ClipCursorMarginBottom = 0;
+
+void WIN_ClipCursor(const RECT * orig) {
+ RECT adjusted = *orig;
+
+ adjusted.left += SDL_ClipCursorMarginLeft;
+ adjusted.top += SDL_ClipCursorMarginTop;
+ adjusted.right -= SDL_ClipCursorMarginRight;
+ adjusted.bottom -= SDL_ClipCursorMarginBottom;
+
+ ClipCursor(&adjusted);
+}
+
static int
SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
{
@@ -244,7 +260,7 @@
GetClientRect(hwnd, &rect);
ClientToScreen(hwnd, (LPPOINT) & rect);
ClientToScreen(hwnd, (LPPOINT) & rect + 1);
- ClipCursor(&rect);
+ WIN_ClipCursor(&rect);
}
}
@@ -812,7 +828,7 @@
if (GetClientRect(data->hwnd, &rect) && !IsRectEmpty(&rect)) {
ClientToScreen(data->hwnd, (LPPOINT) & rect);
ClientToScreen(data->hwnd, (LPPOINT) & rect + 1);
- ClipCursor(&rect);
+ WIN_ClipCursor(&rect);
}
}
} else {