Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_packages_services_VncFlinger
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
LMODroid
platform_packages_services_VncFlinger
Commits
a890c5ec
Commit
a890c5ec
authored
7 years ago
by
Steve Kondik
Browse files
Options
Downloads
Patches
Plain Diff
vnc: Impove pointer handling
* Better accuracy and state tracking
parent
6ec5bc8d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/InputDevice.cpp
+18
-22
18 additions, 22 deletions
src/InputDevice.cpp
src/InputDevice.h
+5
-0
5 additions, 0 deletions
src/InputDevice.h
with
23 additions
and
22 deletions
src/InputDevice.cpp
+
18
−
22
View file @
a890c5ec
...
...
@@ -53,6 +53,8 @@ status_t InputDevice::start(uint32_t width, uint32_t height) {
status_t
err
=
OK
;
mLeftClicked
=
mMiddleClicked
=
mRightClicked
=
false
;
struct
input_id
id
=
{
BUS_VIRTUAL
,
/* Bus type */
1
,
/* Vendor */
...
...
@@ -230,36 +232,28 @@ void InputDevice::onPointerEvent(int buttonMask, int x, int y, rfbClientPtr cl)
InputDevice
::
getInstance
().
pointerEvent
(
buttonMask
,
x
,
y
,
cl
);
}
void
InputDevice
::
pointerEvent
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
{
static
int
leftClicked
=
0
,
rightClicked
=
0
,
middleClicked
=
0
;
(
void
)
cl
;
void
InputDevice
::
pointerEvent
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
/* cl */
)
{
if
(
mFD
<
0
)
return
;
ALOGV
(
"pointerEvent: buttonMask=%x x=%d y=%d"
,
buttonMask
,
x
,
y
);
Mutex
::
Autolock
_l
(
mLock
);
if
((
buttonMask
&
1
)
&&
leftClicked
)
{
// left btn clicked and moving
static
int
i
=
0
;
i
=
i
+
1
;
if
((
buttonMask
&
1
)
&&
mLeftClicked
)
{
// left btn clicked and moving
inject
(
EV_ABS
,
ABS_X
,
x
);
inject
(
EV_ABS
,
ABS_Y
,
y
);
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
if
(
i
%
10
==
1
)
// some tweak to not report every move event
{
inject
(
EV_ABS
,
ABS_X
,
x
);
inject
(
EV_ABS
,
ABS_Y
,
y
);
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
}
}
else
if
(
buttonMask
&
1
)
{
// left btn clicked
l
eftClicked
=
1
;
mL
eftClicked
=
true
;
inject
(
EV_ABS
,
ABS_X
,
x
);
inject
(
EV_ABS
,
ABS_Y
,
y
);
inject
(
EV_KEY
,
BTN_TOUCH
,
1
);
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
}
else
if
(
l
eftClicked
)
// left btn released
}
else
if
(
mL
eftClicked
)
// left btn released
{
l
eftClicked
=
0
;
mL
eftClicked
=
false
;
inject
(
EV_ABS
,
ABS_X
,
x
);
inject
(
EV_ABS
,
ABS_Y
,
y
);
inject
(
EV_KEY
,
BTN_TOUCH
,
0
);
...
...
@@ -268,34 +262,36 @@ void InputDevice::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) {
if
(
buttonMask
&
4
)
// right btn clicked
{
r
ightClicked
=
1
;
mR
ightClicked
=
true
;
press
(
158
);
// back key
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
}
else
if
(
r
ightClicked
)
// right button released
}
else
if
(
mR
ightClicked
)
// right button released
{
r
ightClicked
=
0
;
mR
ightClicked
=
false
;
release
(
158
);
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
}
if
(
buttonMask
&
2
)
// mid btn clicked
{
middleClicked
=
1
;
m
M
iddleClicked
=
true
;
press
(
KEY_END
);
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
}
else
if
(
middleClicked
)
// mid btn released
}
else
if
(
m
M
iddleClicked
)
// mid btn released
{
middleClicked
=
0
;
m
M
iddleClicked
=
false
;
release
(
KEY_END
);
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
}
if
(
buttonMask
&
8
)
{
inject
(
EV_REL
,
REL_WHEEL
,
1
);
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
}
if
(
buttonMask
&
0x10
)
{
inject
(
EV_REL
,
REL_WHEEL
,
-
1
);
inject
(
EV_SYN
,
SYN_REPORT
,
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/InputDevice.h
+
5
−
0
View file @
a890c5ec
...
...
@@ -64,6 +64,11 @@ private:
int
mFD
;
struct
uinput_user_dev
mUserDev
;
bool
mLeftClicked
;
bool
mRightClicked
;
bool
mMiddleClicked
;
};
};
...
...
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