Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
572324ba
Commit
572324ba
authored
Feb 06, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Feb 07, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Implement MOUSE_MOVED(_ABSOLUTE) events.
parent
6289a612
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
1 deletion
+138
-1
cocoa_event.m
dlls/winemac.drv/cocoa_event.m
+29
-1
cocoa_window.h
dlls/winemac.drv/cocoa_window.h
+3
-0
cocoa_window.m
dlls/winemac.drv/cocoa_window.m
+64
-0
event.c
dlls/winemac.drv/event.c
+12
-0
macdrv.h
dlls/winemac.drv/macdrv.h
+1
-0
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+7
-0
mouse.c
dlls/winemac.drv/mouse.c
+22
-0
No files found.
dlls/winemac.drv/cocoa_event.m
View file @
572324ba
...
...
@@ -112,8 +112,36 @@
-
(
void
)
postEventObject
:
(
MacDrvEvent
*
)
event
{
MacDrvEvent
*
lastEvent
;
[
eventsLock
lock
];
[
events
addObject
:
event
];
if
((
event
->
event
.
type
==
MOUSE_MOVED
||
event
->
event
.
type
==
MOUSE_MOVED_ABSOLUTE
)
&&
(
lastEvent
=
[
events
lastObject
])
&&
(
lastEvent
->
event
.
type
==
MOUSE_MOVED
||
lastEvent
->
event
.
type
==
MOUSE_MOVED_ABSOLUTE
)
&&
lastEvent
->
event
.
window
==
event
->
event
.
window
)
{
if
(
event
->
event
.
type
==
MOUSE_MOVED
)
{
lastEvent
->
event
.
mouse_moved
.
x
+=
event
->
event
.
mouse_moved
.
x
;
lastEvent
->
event
.
mouse_moved
.
y
+=
event
->
event
.
mouse_moved
.
y
;
}
else
{
lastEvent
->
event
.
type
=
MOUSE_MOVED_ABSOLUTE
;
lastEvent
->
event
.
mouse_moved
.
x
=
event
->
event
.
mouse_moved
.
x
;
lastEvent
->
event
.
mouse_moved
.
y
=
event
->
event
.
mouse_moved
.
y
;
}
lastEvent
->
event
.
mouse_moved
.
time_ms
=
event
->
event
.
mouse_moved
.
time_ms
;
macdrv_cleanup_event
(
&
event
->
event
);
}
else
[
events
addObject
:
event
];
[
eventsLock
unlock
];
[
self
signalEventAvailable
];
...
...
dlls/winemac.drv/cocoa_window.h
View file @
572324ba
...
...
@@ -48,6 +48,9 @@
NSUInteger
lastModifierFlags
;
BOOL
forceNextMouseMoveAbsolute
;
double
mouseMoveDeltaX
,
mouseMoveDeltaY
;
BOOL
causing_becomeKeyWindow
;
BOOL
ignore_windowMiniaturize
;
BOOL
ignore_windowDeminiaturize
;
...
...
dlls/winemac.drv/cocoa_window.m
View file @
572324ba
...
...
@@ -234,6 +234,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
{
WineWindow
*
window
;
WineContentView
*
contentView
;
NSTrackingArea
*
trackingArea
;
[
self
flipRect
:
&
window_frame
];
...
...
@@ -244,6 +245,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
if
(
!
window
)
return
nil
;
window
->
normalStyleMask
=
[
window
styleMask
];
window
->
forceNextMouseMoveAbsolute
=
TRUE
;
/* Standardize windows to eliminate differences between titled and
borderless windows and between NSWindow and NSPanel. */
...
...
@@ -263,6 +265,17 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
return
nil
;
[
contentView
setAutoresizesSubviews
:
NO
];
trackingArea
=
[[[
NSTrackingArea
alloc
]
initWithRect
:[
contentView
bounds
]
options
:(
NSTrackingMouseEnteredAndExited
|
NSTrackingMouseMoved
|
NSTrackingActiveAlways
|
NSTrackingInVisibleRect
)
owner
:
window
userInfo
:
nil
]
autorelease
];
if
(
!
trackingArea
)
return
nil
;
[
contentView
addTrackingArea
:
trackingArea
];
[
window
setContentView
:
contentView
];
return
window
;
...
...
@@ -387,6 +400,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
{
self
.
latentParentWindow
=
[
self
parentWindow
];
[
latentParentWindow
removeChildWindow
:
self
];
forceNextMouseMoveAbsolute
=
TRUE
;
[
self
orderOut
:
nil
];
[
NSApp
removeWindowsItem
:
self
];
}
...
...
@@ -581,6 +595,48 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
event
:
theEvent
];
}
-
(
void
)
postMouseMovedEvent
:
(
NSEvent
*
)
theEvent
{
macdrv_event
event
;
if
(
forceNextMouseMoveAbsolute
)
{
CGPoint
point
=
CGEventGetLocation
([
theEvent
CGEvent
]);
event
.
type
=
MOUSE_MOVED_ABSOLUTE
;
event
.
mouse_moved
.
x
=
point
.
x
;
event
.
mouse_moved
.
y
=
point
.
y
;
mouseMoveDeltaX
=
0
;
mouseMoveDeltaY
=
0
;
forceNextMouseMoveAbsolute
=
FALSE
;
}
else
{
/* Add event delta to accumulated delta error */
/* deltaY is already flipped */
mouseMoveDeltaX
+=
[
theEvent
deltaX
];
mouseMoveDeltaY
+=
[
theEvent
deltaY
];
event
.
type
=
MOUSE_MOVED
;
event
.
mouse_moved
.
x
=
mouseMoveDeltaX
;
event
.
mouse_moved
.
y
=
mouseMoveDeltaY
;
/* Keep the remainder after integer truncation. */
mouseMoveDeltaX
-=
event
.
mouse_moved
.
x
;
mouseMoveDeltaY
-=
event
.
mouse_moved
.
y
;
}
if
(
event
.
type
==
MOUSE_MOVED_ABSOLUTE
||
event
.
mouse_moved
.
x
||
event
.
mouse_moved
.
y
)
{
event
.
window
=
(
macdrv_window
)[
self
retain
];
event
.
mouse_moved
.
time_ms
=
[
NSApp
ticksForEventTime
:[
theEvent
timestamp
]];
[
queue
postEvent
:
&
event
];
}
}
/*
* ---------- NSWindow method overrides ----------
...
...
@@ -709,6 +765,14 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
}
}
-
(
void
)
mouseEntered
:
(
NSEvent
*
)
theEvent
{
forceNextMouseMoveAbsolute
=
TRUE
;
}
-
(
void
)
mouseExited
:
(
NSEvent
*
)
theEvent
{
forceNextMouseMoveAbsolute
=
TRUE
;
}
-
(
void
)
mouseMoved
:
(
NSEvent
*
)
theEvent
{
[
self
postMouseMovedEvent
:
theEvent
];
}
-
(
void
)
mouseDragged
:
(
NSEvent
*
)
theEvent
{
[
self
postMouseMovedEvent
:
theEvent
];
}
-
(
void
)
rightMouseDragged
:
(
NSEvent
*
)
theEvent
{
[
self
postMouseMovedEvent
:
theEvent
];
}
-
(
void
)
otherMouseDragged
:
(
NSEvent
*
)
theEvent
{
[
self
postMouseMovedEvent
:
theEvent
];
}
/*
* ---------- NSWindowDelegate methods ----------
...
...
dlls/winemac.drv/event.c
View file @
572324ba
...
...
@@ -37,6 +37,8 @@ static const char *dbgstr_event(int type)
"KEY_RELEASE"
,
"KEYBOARD_CHANGED"
,
"MOUSE_BUTTON"
,
"MOUSE_MOVED"
,
"MOUSE_MOVED_ABSOLUTE"
,
"WINDOW_CLOSE_REQUESTED"
,
"WINDOW_DID_MINIMIZE"
,
"WINDOW_DID_UNMINIMIZE"
,
...
...
@@ -69,6 +71,12 @@ static macdrv_event_mask get_event_mask(DWORD mask)
if
(
mask
&
QS_MOUSEBUTTON
)
event_mask
|=
event_mask_for_type
(
MOUSE_BUTTON
);
if
(
mask
&
QS_MOUSEMOVE
)
{
event_mask
|=
event_mask_for_type
(
MOUSE_MOVED
);
event_mask
|=
event_mask_for_type
(
MOUSE_MOVED_ABSOLUTE
);
}
if
(
mask
&
QS_POSTMESSAGE
)
{
event_mask
|=
event_mask_for_type
(
APP_DEACTIVATED
);
...
...
@@ -114,6 +122,10 @@ void macdrv_handle_event(macdrv_event *event)
case
MOUSE_BUTTON
:
macdrv_mouse_button
(
hwnd
,
event
);
break
;
case
MOUSE_MOVED
:
case
MOUSE_MOVED_ABSOLUTE
:
macdrv_mouse_moved
(
hwnd
,
event
);
break
;
case
WINDOW_CLOSE_REQUESTED
:
macdrv_window_close_requested
(
hwnd
);
break
;
...
...
dlls/winemac.drv/macdrv.h
View file @
572324ba
...
...
@@ -135,6 +135,7 @@ extern void macdrv_window_did_minimize(HWND hwnd) DECLSPEC_HIDDEN;
extern
void
macdrv_window_did_unminimize
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_mouse_button
(
HWND
hwnd
,
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_mouse_moved
(
HWND
hwnd
,
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_compute_keyboard_layout
(
struct
macdrv_thread_data
*
thread_data
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_keyboard_changed
(
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
...
...
dlls/winemac.drv/macdrv_cocoa.h
View file @
572324ba
...
...
@@ -130,6 +130,8 @@ enum {
KEY_RELEASE
,
KEYBOARD_CHANGED
,
MOUSE_BUTTON
,
MOUSE_MOVED
,
MOUSE_MOVED_ABSOLUTE
,
WINDOW_CLOSE_REQUESTED
,
WINDOW_DID_MINIMIZE
,
WINDOW_DID_UNMINIMIZE
,
...
...
@@ -163,6 +165,11 @@ typedef struct macdrv_event {
unsigned
long
time_ms
;
}
mouse_button
;
struct
{
int
x
;
int
y
;
unsigned
long
time_ms
;
}
mouse_moved
;
struct
{
CGRect
frame
;
}
window_frame_changed
;
struct
{
...
...
dlls/winemac.drv/mouse.c
View file @
572324ba
...
...
@@ -120,3 +120,25 @@ void macdrv_mouse_button(HWND hwnd, const macdrv_event *event)
event
->
mouse_button
.
x
,
event
->
mouse_button
.
y
,
data
,
event
->
mouse_button
.
time_ms
);
}
/***********************************************************************
* macdrv_mouse_moved
*
* Handler for MOUSE_MOVED and MOUSE_MOVED_ABSOLUTE events.
*/
void
macdrv_mouse_moved
(
HWND
hwnd
,
const
macdrv_event
*
event
)
{
UINT
flags
=
MOUSEEVENTF_MOVE
;
TRACE
(
"win %p/%p %s (%d,%d) time %lu (%lu ticks ago)
\n
"
,
hwnd
,
event
->
window
,
(
event
->
type
==
MOUSE_MOVED
)
?
"relative"
:
"absolute"
,
event
->
mouse_moved
.
x
,
event
->
mouse_moved
.
y
,
event
->
mouse_moved
.
time_ms
,
(
GetTickCount
()
-
event
->
mouse_moved
.
time_ms
));
if
(
event
->
type
==
MOUSE_MOVED_ABSOLUTE
)
flags
|=
MOUSEEVENTF_ABSOLUTE
;
send_mouse_input
(
hwnd
,
flags
,
event
->
mouse_moved
.
x
,
event
->
mouse_moved
.
y
,
0
,
event
->
mouse_moved
.
time_ms
);
}
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