Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fancy2209
SRB2
Commits
716aa1f3
Commit
716aa1f3
authored
10 years ago
by
Eidolon
Browse files
Options
Downloads
Patches
Plain Diff
sdl2: fix mouse motion (remove -mousewarp)
parent
0d82e3b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sdl2/i_video.c
+6
-26
6 additions, 26 deletions
src/sdl2/i_video.c
with
6 additions
and
26 deletions
src/sdl2/i_video.c
+
6
−
26
View file @
716aa1f3
...
...
@@ -129,7 +129,6 @@ static Uint16 realheight = BASEVIDHEIGHT;
static
const
Uint32
surfaceFlagsW
=
0
/*|SDL_RESIZABLE*/
;
static
const
Uint32
surfaceFlagsF
=
0
;
static
SDL_bool
mousegrabok
=
SDL_TRUE
;
static
SDL_bool
mousewarp
=
SDL_FALSE
;
#define HalfWarpMouse(x,y) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2))
static
SDL_bool
videoblitok
=
SDL_FALSE
;
static
SDL_bool
exposevideo
=
SDL_FALSE
;
...
...
@@ -760,6 +759,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
break
;
case
SDL_WINDOWEVENT_FOCUS_GAINED
:
kbfocus
=
SDL_TRUE
;
mousefocus
=
SDL_TRUE
;
break
;
case
SDL_WINDOWEVENT_FOCUS_LOST
:
kbfocus
=
SDL_FALSE
;
...
...
@@ -800,7 +800,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
if
(
MOUSE_MENU
)
{
SDLdoUngrabMouse
();
return
;
}
}
...
...
@@ -832,43 +831,26 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
SDL_GetWindowSize
(
window
,
&
wwidth
,
&
wheight
);
if
(
MOUSE_MENU
)
if
(
(
SDL_GetMouseFocus
()
!=
window
&&
SDL_GetKeyboardFocus
()
!=
window
)
)
{
SDLdoUngrabMouse
();
return
;
}
if
(
mousewarp
&&
(
evt
.
x
==
w
width
/
2
)
&&
(
evt
.
y
==
w
height
/
2
))
if
((
evt
.
x
==
real
width
/
2
)
&&
(
evt
.
y
==
real
height
/
2
))
{
return
;
}
else
{
event
.
data2
=
+
evt
.
xrel
;
event
.
data3
=
-
evt
.
yrel
;
event
.
data2
=
(
evt
.
xrel
)
*
(
wwidth
/
realwidth
)
*
2
;
event
.
data3
=
-
evt
.
yrel
*
(
wheight
/
realheight
)
*
2
;
}
event
.
type
=
ev_mouse
;
D_PostEvent
(
&
event
);
if
(
mousewarp
)
{
// Warp the pointer back to the middle of the window
// or we cannot move any further if it's at a border.
if
((
evt
.
x
<
(
wwidth
/
2
)
-
(
wwidth
/
4
))
||
(
evt
.
y
<
(
wheight
/
2
)
-
(
wheight
/
4
))
||
(
evt
.
x
>
(
wwidth
/
2
)
+
(
wwidth
/
4
))
||
(
evt
.
y
>
(
wheight
/
2
)
+
(
wheight
/
4
)
)
)
{
HalfWarpMouse
(
wwidth
,
wheight
);
}
}
else
{
SDL_SetWindowGrab
(
window
,
mousegrabok
);
SDL_SetRelativeMouseMode
(
SDL_TRUE
);
}
HalfWarpMouse
(
wwidth
,
wheight
);
}
static
void
Impl_HandleMouseButtonEvent
(
SDL_MouseButtonEvent
evt
,
Uint32
type
)
...
...
@@ -1902,8 +1884,6 @@ void I_StartupGraphics(void)
if
(
M_CheckParm
(
"-nomousegrab"
))
mousegrabok
=
SDL_FALSE
;
else
if
(
M_CheckParm
(
"-mousewarp"
)
||
SDL_SetRelativeMouseMode
(
SDL_TRUE
)
==
-
1
)
mousewarp
=
SDL_TRUE
;
#if 0 // defined (_DEBUG)
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment