Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
e666b3b2
Commit
e666b3b2
authored
Jan 20, 2011
by
Jjgod Jiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mouse wheel events in fullscreen mode for OS X
With proposed patch by vernier.
parent
5c9e54ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
14 deletions
+26
-14
SDL_cocoaevents.m
src/video/cocoa/SDL_cocoaevents.m
+1
-0
SDL_cocoamouse.h
src/video/cocoa/SDL_cocoamouse.h
+1
-0
SDL_cocoamouse.m
src/video/cocoa/SDL_cocoamouse.m
+22
-0
SDL_cocoawindow.m
src/video/cocoa/SDL_cocoawindow.m
+2
-14
No files found.
src/video/cocoa/SDL_cocoaevents.m
View file @
e666b3b2
...
...
@@ -201,6 +201,7 @@ Cocoa_PumpEvents(_THIS)
case
NSLeftMouseDragged
:
case
NSRightMouseDragged
:
case
NSOtherMouseDragged
:
/* usually middle mouse dragged */
case
NSScrollWheel
:
case
NSMouseMoved
:
Cocoa_HandleMouseEvent
(
_this
,
event
);
/* Pass through to NSApp to make sure everything stays in sync */
...
...
src/video/cocoa/SDL_cocoamouse.h
View file @
e666b3b2
...
...
@@ -27,6 +27,7 @@
extern
void
Cocoa_InitMouse
(
_THIS
);
extern
void
Cocoa_HandleMouseEvent
(
_THIS
,
NSEvent
*
event
);
extern
void
Cocoa_QuitMouse
(
_THIS
);
extern
void
Cocoa_HandleMouseWheel
(
SDL_Window
*
window
,
NSEvent
*
event
);
#endif
/* _SDL_cocoamouse_h */
...
...
src/video/cocoa/SDL_cocoamouse.m
View file @
e666b3b2
...
...
@@ -93,6 +93,9 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
case
NSRightMouseUp
:
SDL
_
SendMouseButton
(
window
,
SDL
_
RELEASED
,
ConvertMouseButtonToSDL
([
event
buttonNumber
]))
;
break
;
case
NSScrollWheel
:
Cocoa
_
HandleMouseWheel
(
window
,
event
)
;
break
;
case
NSLeftMouseDragged
:
case
NSRightMouseDragged
:
case
NSOtherMouseDragged
:
/*
usually
middle
mouse
dragged
*/
...
...
@@ -109,4 +112,23 @@ Cocoa_QuitMouse(_THIS)
{
}
void
Cocoa
_
HandleMouseWheel
(
SDL
_
Window
*
window
,
NSEvent
*
event
)
{
float
x
=
[
event
deltaX
]
;
float
y
=
[
event
deltaY
]
;
if
(
x
>
0
)
{
x
+=
0.9
f
;
}
else
if
(
x
<
0
)
{
x
-=
0.9
f
;
}
if
(
y
>
0
)
{
y
+=
0.9
f
;
}
else
if
(
y
<
0
)
{
y
-=
0.9
f
;
}
SDL
_
SendMouseWheel
(
window
,
(
int
)
x
,
(
int
)
y
)
;
}
/*
vi
:
set
ts
=
4
sw
=
4
expandtab
:
*/
src/video/cocoa/SDL_cocoawindow.m
View file @
e666b3b2
...
...
@@ -29,6 +29,7 @@
#include "../../events/SDL_windowevents_c.h"
#include "SDL_cocoavideo.h"
#include "SDL_cocoashape.h"
#include "SDL_cocoamouse.h"
static
__inline__
void
ConvertNSRect
(
NSRect
*
r
)
{
...
...
@@ -260,20 +261,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
-
(
void
)
scrollWheel
:
(
NSEvent
*
)
theEvent
{
float
x
=
[
theEvent
deltaX
];
float
y
=
[
theEvent
deltaY
];
if
(
x
>
0
)
{
x
+=
0
.
9
f
;
}
else
if
(
x
<
0
)
{
x
-=
0
.
9
f
;
}
if
(
y
>
0
)
{
y
+=
0
.
9
f
;
}
else
if
(
y
<
0
)
{
y
-=
0
.
9
f
;
}
SDL_SendMouseWheel
(
_data
->
window
,
(
int
)
x
,
(
int
)
y
);
Cocoa_HandleMouseWheel
(
_data
->
window
,
theEvent
);
}
-
(
void
)
touchesBeganWithEvent
:
(
NSEvent
*
)
theEvent
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment