Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
b1be3ddb
Commit
b1be3ddb
authored
14 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
winex11: Build the mouse input structure directly in the mouse event handlers.
parent
a8575a8b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/winex11.drv/mouse.c
+82
-70
82 additions, 70 deletions
dlls/winex11.drv/mouse.c
with
82 additions
and
70 deletions
dlls/winex11.drv/mouse.c
+
82
−
70
View file @
b1be3ddb
...
...
@@ -92,6 +92,32 @@ static const UINT button_up_flags[NB_BUTTONS] =
MOUSEEVENTF_XUP
};
static
const
UINT
button_down_data
[
NB_BUTTONS
]
=
{
0
,
0
,
0
,
WHEEL_DELTA
,
-
WHEEL_DELTA
,
XBUTTON1
,
XBUTTON2
,
XBUTTON1
,
XBUTTON2
};
static
const
UINT
button_up_data
[
NB_BUTTONS
]
=
{
0
,
0
,
0
,
0
,
0
,
XBUTTON1
,
XBUTTON2
,
XBUTTON1
,
XBUTTON2
};
static
HWND
cursor_window
;
static
HCURSOR
last_cursor
;
static
DWORD
last_cursor_change
;
...
...
@@ -214,34 +240,35 @@ void sync_window_cursor( Window window )
*
* Update the various window states on a mouse event.
*/
static
void
send_mouse_input
(
HWND
hwnd
,
UINT
flags
,
Window
window
,
int
x
,
int
y
,
unsigned
int
state
,
DWORD
mouse_data
,
Time
time
)
static
void
send_mouse_input
(
HWND
hwnd
,
Window
window
,
unsigned
int
state
,
INPUT
*
input
)
{
struct
x11drv_win_data
*
data
;
POINT
pt
;
INPUT
input
;
input
->
type
=
INPUT_MOUSE
;
if
(
!
hwnd
&&
window
==
clip_window
)
{
pt
.
x
=
x
+
clip_rect
.
left
;
pt
.
y
=
y
+
clip_rect
.
top
;
goto
done
;
input
->
u
.
mi
.
dx
+=
clip_rect
.
left
;
input
->
u
.
mi
.
dy
+=
clip_rect
.
top
;
__wine_send_input
(
hwnd
,
input
);
return
;
}
if
(
!
(
data
=
X11DRV_get_win_data
(
hwnd
)))
return
;
if
(
window
==
data
->
whole_window
)
{
x
+=
data
->
whole_rect
.
left
-
data
->
client_rect
.
left
;
y
+=
data
->
whole_rect
.
top
-
data
->
client_rect
.
top
;
input
->
u
.
mi
.
d
x
+=
data
->
whole_rect
.
left
-
data
->
client_rect
.
left
;
input
->
u
.
mi
.
d
y
+=
data
->
whole_rect
.
top
-
data
->
client_rect
.
top
;
}
if
(
window
==
root_window
)
{
x
+=
virtual_screen_rect
.
left
;
y
+=
virtual_screen_rect
.
top
;
input
->
u
.
mi
.
d
x
+=
virtual_screen_rect
.
left
;
input
->
u
.
mi
.
d
y
+=
virtual_screen_rect
.
top
;
}
pt
.
x
=
x
;
pt
.
y
=
y
;
pt
.
x
=
input
->
u
.
mi
.
d
x
;
pt
.
y
=
input
->
u
.
mi
.
d
y
;
if
(
GetWindowLongW
(
data
->
hwnd
,
GWL_EXSTYLE
)
&
WS_EX_LAYOUTRTL
)
pt
.
x
=
data
->
client_rect
.
right
-
data
->
client_rect
.
left
-
1
-
pt
.
x
;
MapWindowPoints
(
hwnd
,
0
,
&
pt
,
1
);
...
...
@@ -277,16 +304,9 @@ static void send_mouse_input( HWND hwnd, UINT flags, Window window, int x, int y
SERVER_END_REQ
;
}
done:
input
.
type
=
INPUT_MOUSE
;
input
.
u
.
mi
.
dx
=
pt
.
x
;
input
.
u
.
mi
.
dy
=
pt
.
y
;
input
.
u
.
mi
.
mouseData
=
mouse_data
;
input
.
u
.
mi
.
dwFlags
=
flags
;
input
.
u
.
mi
.
time
=
EVENT_x11_time_to_win32_time
(
time
);
input
.
u
.
mi
.
dwExtraInfo
=
0
;
__wine_send_input
(
hwnd
,
&
input
);
input
->
u
.
mi
.
dx
=
pt
.
x
;
input
->
u
.
mi
.
dy
=
pt
.
y
;
__wine_send_input
(
hwnd
,
input
);
}
#ifdef SONAME_LIBXCURSOR
...
...
@@ -983,35 +1003,21 @@ void X11DRV_ButtonPress( HWND hwnd, XEvent *xev )
{
XButtonEvent
*
event
=
&
xev
->
xbutton
;
int
buttonNum
=
event
->
button
-
1
;
WORD
wData
=
0
;
INPUT
input
;
if
(
buttonNum
>=
NB_BUTTONS
)
return
;
switch
(
buttonNum
)
{
case
3
:
wData
=
WHEEL_DELTA
;
break
;
case
4
:
wData
=
-
WHEEL_DELTA
;
break
;
case
5
:
wData
=
XBUTTON1
;
break
;
case
6
:
wData
=
XBUTTON2
;
break
;
case
7
:
wData
=
XBUTTON1
;
break
;
case
8
:
wData
=
XBUTTON2
;
break
;
}
TRACE
(
"hwnd %p/%lx button %u pos %d,%d
\n
"
,
hwnd
,
event
->
window
,
buttonNum
,
event
->
x
,
event
->
y
);
input
.
u
.
mi
.
dx
=
event
->
x
;
input
.
u
.
mi
.
dy
=
event
->
y
;
input
.
u
.
mi
.
mouseData
=
button_down_data
[
buttonNum
];
input
.
u
.
mi
.
dwFlags
=
button_down_flags
[
buttonNum
]
|
MOUSEEVENTF_ABSOLUTE
|
MOUSEEVENTF_MOVE
;
input
.
u
.
mi
.
time
=
EVENT_x11_time_to_win32_time
(
event
->
time
);
input
.
u
.
mi
.
dwExtraInfo
=
0
;
update_user_time
(
event
->
time
);
send_mouse_input
(
hwnd
,
button_down_flags
[
buttonNum
]
|
MOUSEEVENTF_ABSOLUTE
|
MOUSEEVENTF_MOVE
,
event
->
window
,
event
->
x
,
event
->
y
,
event
->
state
,
wData
,
event
->
time
);
send_mouse_input
(
hwnd
,
event
->
window
,
event
->
state
,
&
input
);
}
...
...
@@ -1022,28 +1028,20 @@ void X11DRV_ButtonRelease( HWND hwnd, XEvent *xev )
{
XButtonEvent
*
event
=
&
xev
->
xbutton
;
int
buttonNum
=
event
->
button
-
1
;
WORD
wData
=
0
;
INPUT
input
;
if
(
buttonNum
>=
NB_BUTTONS
||
!
button_up_flags
[
buttonNum
])
return
;
switch
(
buttonNum
)
{
case
5
:
wData
=
XBUTTON1
;
break
;
case
6
:
wData
=
XBUTTON2
;
break
;
case
7
:
wData
=
XBUTTON1
;
break
;
case
8
:
wData
=
XBUTTON2
;
break
;
}
TRACE
(
"hwnd %p/%lx button %u pos %d,%d
\n
"
,
hwnd
,
event
->
window
,
buttonNum
,
event
->
x
,
event
->
y
);
input
.
u
.
mi
.
dx
=
event
->
x
;
input
.
u
.
mi
.
dy
=
event
->
y
;
input
.
u
.
mi
.
mouseData
=
button_up_data
[
buttonNum
];
input
.
u
.
mi
.
dwFlags
=
button_up_flags
[
buttonNum
]
|
MOUSEEVENTF_ABSOLUTE
|
MOUSEEVENTF_MOVE
;
input
.
u
.
mi
.
time
=
EVENT_x11_time_to_win32_time
(
event
->
time
);
input
.
u
.
mi
.
dwExtraInfo
=
0
;
send_mouse_input
(
hwnd
,
button_up_flags
[
buttonNum
]
|
MOUSEEVENTF_ABSOLUTE
|
MOUSEEVENTF_MOVE
,
event
->
window
,
event
->
x
,
event
->
y
,
event
->
state
,
wData
,
event
->
time
);
send_mouse_input
(
hwnd
,
event
->
window
,
event
->
state
,
&
input
);
}
...
...
@@ -1053,11 +1051,18 @@ void X11DRV_ButtonRelease( HWND hwnd, XEvent *xev )
void
X11DRV_MotionNotify
(
HWND
hwnd
,
XEvent
*
xev
)
{
XMotionEvent
*
event
=
&
xev
->
xmotion
;
INPUT
input
;
TRACE
(
"hwnd %p
, event->
is_hint %d
\n
"
,
hwnd
,
event
->
is_hint
);
TRACE
(
"hwnd %p
/%lx pos %d,%d
is_hint %d
\n
"
,
hwnd
,
event
->
window
,
event
->
x
,
event
->
y
,
event
->
is_hint
);
send_mouse_input
(
hwnd
,
MOUSEEVENTF_MOVE
|
MOUSEEVENTF_ABSOLUTE
,
event
->
window
,
event
->
x
,
event
->
y
,
event
->
state
,
0
,
event
->
time
);
input
.
u
.
mi
.
dx
=
event
->
x
;
input
.
u
.
mi
.
dy
=
event
->
y
;
input
.
u
.
mi
.
mouseData
=
0
;
input
.
u
.
mi
.
dwFlags
=
MOUSEEVENTF_MOVE
|
MOUSEEVENTF_ABSOLUTE
;
input
.
u
.
mi
.
time
=
EVENT_x11_time_to_win32_time
(
event
->
time
);
input
.
u
.
mi
.
dwExtraInfo
=
0
;
send_mouse_input
(
hwnd
,
event
->
window
,
event
->
state
,
&
input
);
}
...
...
@@ -1067,13 +1072,20 @@ void X11DRV_MotionNotify( HWND hwnd, XEvent *xev )
void
X11DRV_EnterNotify
(
HWND
hwnd
,
XEvent
*
xev
)
{
XCrossingEvent
*
event
=
&
xev
->
xcrossing
;
INPUT
input
;
TRACE
(
"hwnd %p
, event->
detail %d
\n
"
,
hwnd
,
event
->
detail
);
TRACE
(
"hwnd %p
/%lx pos %d,%d
detail %d
\n
"
,
hwnd
,
event
->
window
,
event
->
x
,
event
->
y
,
event
->
detail
);
if
(
event
->
detail
==
NotifyVirtual
||
event
->
detail
==
NotifyNonlinearVirtual
)
return
;
if
(
event
->
window
==
x11drv_thread_data
()
->
grab_window
)
return
;
/* simulate a mouse motion event */
send_mouse_input
(
hwnd
,
MOUSEEVENTF_MOVE
|
MOUSEEVENTF_ABSOLUTE
,
event
->
window
,
event
->
x
,
event
->
y
,
event
->
state
,
0
,
event
->
time
);
input
.
u
.
mi
.
dx
=
event
->
x
;
input
.
u
.
mi
.
dy
=
event
->
y
;
input
.
u
.
mi
.
mouseData
=
0
;
input
.
u
.
mi
.
dwFlags
=
MOUSEEVENTF_MOVE
|
MOUSEEVENTF_ABSOLUTE
;
input
.
u
.
mi
.
time
=
EVENT_x11_time_to_win32_time
(
event
->
time
);
input
.
u
.
mi
.
dwExtraInfo
=
0
;
send_mouse_input
(
hwnd
,
event
->
window
,
event
->
state
,
&
input
);
}
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