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
b243eea6
Commit
b243eea6
authored
Nov 19, 2014
by
Martin Flöser
Browse files
Add createResource to ClientConnection
One place to rule all createResource calls.
parent
fce51fb3
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/wayland/clientconnection.cpp
View file @
b243eea6
...
...
@@ -95,6 +95,11 @@ void ClientConnection::flush()
wl_client_flush
(
d
->
client
);
}
wl_resource
*
ClientConnection
::
createResource
(
const
wl_interface
*
interface
,
quint32
version
,
quint32
id
)
{
return
wl_resource_create
(
d
->
client
,
interface
,
version
,
id
);
}
wl_client
*
ClientConnection
::
client
()
{
return
d
->
client
;
...
...
src/wayland/clientconnection.h
View file @
b243eea6
...
...
@@ -25,6 +25,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include
<KWayland/Server/kwaylandserver_export.h>
struct
wl_client
;
struct
wl_interface
;
struct
wl_resource
;
namespace
KWayland
{
...
...
@@ -40,6 +42,7 @@ public:
virtual
~
ClientConnection
();
void
flush
();
wl_resource
*
createResource
(
const
wl_interface
*
interface
,
quint32
version
,
quint32
id
);
wl_client
*
client
();
Display
*
display
();
...
...
src/wayland/compositor_interface.cpp
View file @
b243eea6
...
...
@@ -72,7 +72,8 @@ CompositorInterface::~CompositorInterface() = default;
void
CompositorInterface
::
Private
::
bind
(
wl_client
*
client
,
uint32_t
version
,
uint32_t
id
)
{
wl_resource
*
resource
=
wl_resource_create
(
client
,
&
wl_compositor_interface
,
qMin
(
version
,
s_version
),
id
);
auto
c
=
display
->
getConnection
(
client
);
wl_resource
*
resource
=
c
->
createResource
(
&
wl_compositor_interface
,
qMin
(
version
,
s_version
),
id
);
if
(
!
resource
)
{
wl_client_post_no_memory
(
client
);
return
;
...
...
src/wayland/datadevicemanager_interface.cpp
View file @
b243eea6
...
...
@@ -65,7 +65,8 @@ DataDeviceManagerInterface::Private::Private(DataDeviceManagerInterface *q, Disp
void
DataDeviceManagerInterface
::
Private
::
bind
(
wl_client
*
client
,
uint32_t
version
,
uint32_t
id
)
{
wl_resource
*
resource
=
wl_resource_create
(
client
,
&
wl_data_device_manager_interface
,
qMin
(
version
,
s_version
),
id
);
auto
c
=
display
->
getConnection
(
client
);
wl_resource
*
resource
=
c
->
createResource
(
&
wl_data_device_manager_interface
,
qMin
(
version
,
s_version
),
id
);
if
(
!
resource
)
{
wl_client_post_no_memory
(
client
);
return
;
...
...
src/wayland/output_interface.cpp
View file @
b243eea6
...
...
@@ -256,7 +256,8 @@ int32_t OutputInterface::Private::toSubPixel() const
void
OutputInterface
::
Private
::
bind
(
wl_client
*
client
,
uint32_t
version
,
uint32_t
id
)
{
wl_resource
*
resource
=
wl_resource_create
(
client
,
&
wl_output_interface
,
qMin
(
version
,
s_version
),
id
);
auto
c
=
display
->
getConnection
(
client
);
wl_resource
*
resource
=
c
->
createResource
(
&
wl_output_interface
,
qMin
(
version
,
s_version
),
id
);
if
(
!
resource
)
{
wl_client_post_no_memory
(
client
);
return
;
...
...
src/wayland/server/resource.cpp
View file @
b243eea6
...
...
@@ -52,7 +52,7 @@ void Resource::Private::create(ClientConnection *c, quint32 version, quint32 id)
Q_ASSERT
(
!
resource
);
Q_ASSERT
(
!
client
);
client
=
c
;
resource
=
wl_resource_create
(
*
client
,
m_interface
,
version
,
id
);
resource
=
client
->
createResource
(
m_interface
,
version
,
id
);
if
(
!
resource
)
{
return
;
}
...
...
src/wayland/server/shell_interface.cpp
View file @
b243eea6
...
...
@@ -114,7 +114,8 @@ ShellInterface::~ShellInterface() = default;
void
ShellInterface
::
Private
::
bind
(
wl_client
*
client
,
uint32_t
version
,
uint32_t
id
)
{
wl_resource
*
shell
=
wl_resource_create
(
client
,
&
wl_shell_interface
,
qMin
(
version
,
s_version
),
id
);
auto
c
=
display
->
getConnection
(
client
);
wl_resource
*
shell
=
c
->
createResource
(
&
wl_shell_interface
,
qMin
(
version
,
s_version
),
id
);
if
(
!
shell
)
{
wl_client_post_no_memory
(
client
);
return
;
...
...
src/wayland/subcompositor_interface.cpp
View file @
b243eea6
...
...
@@ -66,7 +66,8 @@ SubCompositorInterface::Private::Private(SubCompositorInterface *q, Display *d)
void
SubCompositorInterface
::
Private
::
bind
(
wl_client
*
client
,
uint32_t
version
,
uint32_t
id
)
{
wl_resource
*
resource
=
wl_resource_create
(
client
,
&
wl_subcompositor_interface
,
qMin
(
version
,
s_version
),
id
);
auto
c
=
display
->
getConnection
(
client
);
wl_resource
*
resource
=
c
->
createResource
(
&
wl_subcompositor_interface
,
qMin
(
version
,
s_version
),
id
);
if
(
!
resource
)
{
wl_client_post_no_memory
(
client
);
return
;
...
...
src/wayland/surface_interface.cpp
View file @
b243eea6
...
...
@@ -236,7 +236,7 @@ void SurfaceInterface::Private::setTransform(OutputInterface::Transform transfor
void
SurfaceInterface
::
Private
::
addFrameCallback
(
uint32_t
callback
)
{
wl_resource
*
r
=
wl_resource_create
(
*
client
,
&
wl_callback_interface
,
1
,
callback
);
wl_resource
*
r
=
client
->
createResource
(
&
wl_callback_interface
,
1
,
callback
);
if
(
!
r
)
{
wl_resource_post_no_memory
(
resource
);
return
;
...
...
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