Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
9e1991b7
Commit
9e1991b7
authored
Jun 12, 2015
by
Martin Flöser
Browse files
[server] Add resource safety checks to TouchInterface
Prevent marshalling errors.
parent
946b1c8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/wayland/touch_interface.cpp
View file @
9e1991b7
...
...
@@ -77,6 +77,9 @@ TouchInterface::~TouchInterface() = default;
void
TouchInterface
::
cancel
()
{
Q_D
();
if
(
!
d
->
resource
)
{
return
;
}
wl_touch_send_cancel
(
d
->
resource
);
d
->
client
->
flush
();
}
...
...
@@ -84,6 +87,9 @@ void TouchInterface::cancel()
void
TouchInterface
::
frame
()
{
Q_D
();
if
(
!
d
->
resource
)
{
return
;
}
wl_touch_send_frame
(
d
->
resource
);
d
->
client
->
flush
();
}
...
...
@@ -91,6 +97,9 @@ void TouchInterface::frame()
void
TouchInterface
::
move
(
qint32
id
,
const
QPointF
&
localPos
)
{
Q_D
();
if
(
!
d
->
resource
)
{
return
;
}
wl_touch_send_motion
(
d
->
resource
,
d
->
seat
->
timestamp
(),
id
,
wl_fixed_from_double
(
localPos
.
x
()),
wl_fixed_from_double
(
localPos
.
y
()));
d
->
client
->
flush
();
}
...
...
@@ -98,6 +107,9 @@ void TouchInterface::move(qint32 id, const QPointF &localPos)
void
TouchInterface
::
up
(
qint32
id
,
quint32
serial
)
{
Q_D
();
if
(
!
d
->
resource
)
{
return
;
}
wl_touch_send_up
(
d
->
resource
,
serial
,
d
->
seat
->
timestamp
(),
id
);
d
->
client
->
flush
();
}
...
...
@@ -105,6 +117,9 @@ void TouchInterface::up(qint32 id, quint32 serial)
void
TouchInterface
::
down
(
qint32
id
,
quint32
serial
,
const
QPointF
&
localPos
)
{
Q_D
();
if
(
!
d
->
resource
)
{
return
;
}
wl_touch_send_down
(
d
->
resource
,
serial
,
d
->
seat
->
timestamp
(),
d
->
seat
->
focusedTouchSurface
()
->
resource
(),
id
,
wl_fixed_from_double
(
localPos
.
x
()),
wl_fixed_from_double
(
localPos
.
y
()));
d
->
client
->
flush
();
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment