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
e15b82ad
Commit
e15b82ad
authored
May 07, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
May 07, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Consolidate mouse button handling into -[WineApplicationController handleMouseButton:].
parent
72e89323
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
37 deletions
+90
-37
cocoa_app.h
dlls/winemac.drv/cocoa_app.h
+1
-0
cocoa_app.m
dlls/winemac.drv/cocoa_app.m
+89
-5
cocoa_window.m
dlls/winemac.drv/cocoa_window.m
+0
-32
No files found.
dlls/winemac.drv/cocoa_app.h
View file @
e15b82ad
...
...
@@ -61,6 +61,7 @@ enum {
WineWindow
*
lastTargetWindow
;
BOOL
forceNextMouseMoveAbsolute
;
double
mouseMoveDeltaX
,
mouseMoveDeltaY
;
NSUInteger
unmatchedMouseDowns
;
NSMutableArray
*
orderedWineWindows
;
...
...
dlls/winemac.drv/cocoa_app.m
View file @
e15b82ad
...
...
@@ -1219,6 +1219,87 @@ int macdrv_err_on;
}
}
-
(
void
)
handleMouseButton
:
(
NSEvent
*
)
theEvent
{
WineWindow
*
window
=
(
WineWindow
*
)[
theEvent
window
];
if
([
window
isKindOfClass
:[
WineWindow
class
]])
{
NSEventType
type
=
[
theEvent
type
];
BOOL
pressed
=
(
type
==
NSLeftMouseDown
||
type
==
NSRightMouseDown
||
type
==
NSOtherMouseDown
);
CGPoint
pt
=
CGEventGetLocation
([
theEvent
CGEvent
]);
BOOL
process
;
if
(
pressed
)
{
// Test if the click was in the window's content area.
NSPoint
nspoint
=
[
self
flippedMouseLocation
:
NSPointFromCGPoint
(
pt
)];
NSRect
contentRect
=
[
window
contentRectForFrameRect
:[
window
frame
]];
process
=
NSPointInRect
(
nspoint
,
contentRect
);
if
(
process
&&
[
window
styleMask
]
&
NSResizableWindowMask
)
{
// Ignore clicks in the grow box (resize widget).
HIPoint
origin
=
{
0
,
0
};
HIThemeGrowBoxDrawInfo
info
=
{
0
};
HIRect
bounds
;
OSStatus
status
;
info
.
kind
=
kHIThemeGrowBoxKindNormal
;
info
.
direction
=
kThemeGrowRight
|
kThemeGrowDown
;
if
([
window
styleMask
]
&
NSUtilityWindowMask
)
info
.
size
=
kHIThemeGrowBoxSizeSmall
;
else
info
.
size
=
kHIThemeGrowBoxSizeNormal
;
status
=
HIThemeGetGrowBoxBounds
(
&
origin
,
&
info
,
&
bounds
);
if
(
status
==
noErr
)
{
NSRect
growBox
=
NSMakeRect
(
NSMaxX
(
contentRect
)
-
bounds
.
size
.
width
,
NSMinY
(
contentRect
),
bounds
.
size
.
width
,
bounds
.
size
.
height
);
process
=
!
NSPointInRect
(
nspoint
,
growBox
);
}
}
if
(
process
)
unmatchedMouseDowns
|=
NSEventMaskFromType
(
type
);
}
else
{
NSEventType
downType
=
type
-
1
;
NSUInteger
downMask
=
NSEventMaskFromType
(
downType
);
process
=
(
unmatchedMouseDowns
&
downMask
)
!=
0
;
unmatchedMouseDowns
&=
~
downMask
;
}
if
(
process
)
{
macdrv_event
*
event
;
event
=
macdrv_create_event
(
MOUSE_BUTTON
,
window
);
event
->
mouse_button
.
button
=
[
theEvent
buttonNumber
];
event
->
mouse_button
.
pressed
=
pressed
;
event
->
mouse_button
.
x
=
pt
.
x
;
event
->
mouse_button
.
y
=
pt
.
y
;
event
->
mouse_button
.
time_ms
=
[
self
ticksForEventTime
:[
theEvent
timestamp
]];
[
window
.
queue
postEvent
:
event
];
macdrv_release_event
(
event
);
}
}
// Since mouse button events deliver absolute cursor position, the
// accumulating delta from move events is invalidated. Make sure
// next mouse move event starts over from an absolute baseline.
// Also, it's at least possible that the title bar widgets (e.g. close
// button, etc.) could enter an internal event loop on a mouse down that
// wouldn't exit until a mouse up. In that case, we'd miss any mouse
// dragged events and, after that, any notion of the cursor position
// computed from accumulating deltas would be wrong.
forceNextMouseMoveAbsolute
=
TRUE
;
}
// Returns TRUE if the event was handled and caller should do nothing more
// with it. Returns FALSE if the caller should process it as normal and
// then call -didSendEvent:.
...
...
@@ -1240,12 +1321,15 @@ int macdrv_err_on;
}
else
if
(
type
==
NSLeftMouseDown
||
type
==
NSLeftMouseUp
||
type
==
NSRightMouseDown
||
type
==
NSRightMouseUp
||
type
==
NSOtherMouseDown
||
type
==
NSOtherMouseUp
||
type
==
NSScrollWheel
)
type
==
NSOtherMouseDown
||
type
==
NSOtherMouseUp
)
{
[
self
handleMouseButton
:
anEvent
];
}
else
if
(
type
==
NSScrollWheel
)
{
// Since
mouse button and scroll wheel events deliver absolute cursor
//
position, the accumulating delta from move events is invalidated.
//
Make sure next
mouse move event starts over from an absolute baseline.
// Since
scroll wheel events deliver absolute cursor position, the
//
accumulating delta from move events is invalidated. Make sure next
// mouse move event starts over from an absolute baseline.
forceNextMouseMoveAbsolute
=
TRUE
;
}
else
if
(
type
==
NSKeyDown
&&
!
[
anEvent
isARepeat
]
&&
[
anEvent
keyCode
]
==
kVK_Tab
)
...
...
dlls/winemac.drv/cocoa_window.m
View file @
e15b82ad
...
...
@@ -250,13 +250,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
}
}
/* By default, NSView will swallow right-clicks in an attempt to support contextual
menus. We need to bypass that and allow the event to make it to the window. */
-
(
void
)
rightMouseDown
:
(
NSEvent
*
)
theEvent
{
[[
self
window
]
rightMouseDown
:
theEvent
];
}
-
(
void
)
addGLContext
:
(
WineOpenGLContext
*
)
context
{
if
(
!
glContexts
)
...
...
@@ -839,23 +832,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
[
self
checkTransparency
];
}
-
(
void
)
postMouseButtonEvent
:
(
NSEvent
*
)
theEvent
pressed
:
(
int
)
pressed
{
CGPoint
pt
=
CGEventGetLocation
([
theEvent
CGEvent
]);
macdrv_event
*
event
;
event
=
macdrv_create_event
(
MOUSE_BUTTON
,
self
);
event
->
mouse_button
.
button
=
[
theEvent
buttonNumber
];
event
->
mouse_button
.
pressed
=
pressed
;
event
->
mouse_button
.
x
=
pt
.
x
;
event
->
mouse_button
.
y
=
pt
.
y
;
event
->
mouse_button
.
time_ms
=
[[
WineApplicationController
sharedController
]
ticksForEventTime
:[
theEvent
timestamp
]];
[
queue
postEvent
:
event
];
macdrv_release_event
(
event
);
}
-
(
void
)
makeFocused
:
(
BOOL
)
activate
{
WineApplicationController
*
controller
=
[
WineApplicationController
sharedController
];
...
...
@@ -1061,14 +1037,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
/*
* ---------- NSResponder method overrides ----------
*/
-
(
void
)
mouseDown
:
(
NSEvent
*
)
theEvent
{
[
self
postMouseButtonEvent
:
theEvent
pressed
:
1
];
}
-
(
void
)
rightMouseDown
:
(
NSEvent
*
)
theEvent
{
[
self
mouseDown
:
theEvent
];
}
-
(
void
)
otherMouseDown
:
(
NSEvent
*
)
theEvent
{
[
self
mouseDown
:
theEvent
];
}
-
(
void
)
mouseUp
:
(
NSEvent
*
)
theEvent
{
[
self
postMouseButtonEvent
:
theEvent
pressed
:
0
];
}
-
(
void
)
rightMouseUp
:
(
NSEvent
*
)
theEvent
{
[
self
mouseUp
:
theEvent
];
}
-
(
void
)
otherMouseUp
:
(
NSEvent
*
)
theEvent
{
[
self
mouseUp
:
theEvent
];
}
-
(
void
)
keyDown
:
(
NSEvent
*
)
theEvent
{
[
self
postKeyEvent
:
theEvent
];
}
-
(
void
)
keyUp
:
(
NSEvent
*
)
theEvent
{
[
self
postKeyEvent
:
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