summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor.cpp12
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager.cpp2
-rw-r--r--src/compositor/wayland_wrapper/qwlextendedoutput.cpp76
-rw-r--r--src/compositor/wayland_wrapper/qwlextendedoutput_p.h45
-rw-r--r--src/compositor/wayland_wrapper/qwlinputdevice.cpp151
-rw-r--r--src/compositor/wayland_wrapper/qwlinputdevice_p.h75
-rw-r--r--src/compositor/wayland_wrapper/qwloutput.cpp65
-rw-r--r--src/compositor/wayland_wrapper/qwloutput_p.h27
-rw-r--r--src/compositor/wayland_wrapper/qwlqtkey.cpp65
-rw-r--r--src/compositor/wayland_wrapper/qwlqtkey_p.h15
-rw-r--r--src/compositor/wayland_wrapper/qwlshellsurface.cpp146
-rw-r--r--src/compositor/wayland_wrapper/qwlshellsurface_p.h83
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface.cpp1
-rw-r--r--src/compositor/wayland_wrapper/wayland_wrapper.pri5
14 files changed, 285 insertions, 483 deletions
diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp
index 26defc0ba..ee7fe796b 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp
@@ -176,8 +176,7 @@ Compositor::Compositor(QWaylandCompositor *qt_compositor)
wl_display_init_shm(m_display->handle());
- m_output_global = new OutputGlobal();
- wl_display_add_global(m_display->handle(),&wl_output_interface, m_output_global, OutputGlobal::output_bind_func);
+ m_output_global = new OutputGlobal(m_display->handle());
m_shell = new Shell();
wl_display_add_global(m_display->handle(), &wl_shell_interface, m_shell, Shell::bind_func);
@@ -426,8 +425,8 @@ Qt::ScreenOrientations Compositor::orientationUpdateMaskForClient(wl_client *cli
{
Output *output = m_output_global->outputForClient(client);
Q_ASSERT(output);
- if (output->extendedOutput())
- return output->extendedOutput()->orientationUpdateMask();
+ if (output->extendedOutput)
+ return output->extendedOutput->orientationUpdateMask;
return 0;
}
@@ -440,9 +439,8 @@ void Compositor::setScreenOrientation(Qt::ScreenOrientation orientation)
struct wl_client *client = clientList.at(i);
Output *output = m_output_global->outputForClient(client);
Q_ASSERT(output);
- if (output->extendedOutput()){
- output->extendedOutput()->sendOutputOrientation(orientation);
- }
+ if (output->extendedOutput)
+ output->extendedOutput->sendOutputOrientation(orientation);
}
}
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
index f89dbc314..03baa16bd 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
@@ -208,7 +208,7 @@ void DataDeviceManager::get_data_device(struct wl_client *client,
struct wl_resource *input_device_resource)
{
DataDeviceManager *data_device_manager = static_cast<DataDeviceManager *>(data_device_manager_resource->data);
- InputDevice *input_device = resolve<InputDevice>(input_device_resource);
+ InputDevice *input_device = InputDevice::fromSeatResource(input_device_resource);
input_device->clientRequestedDataDevice(data_device_manager,client,id);
}
diff --git a/src/compositor/wayland_wrapper/qwlextendedoutput.cpp b/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
index 8249f2721..6c53afe0d 100644
--- a/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
+++ b/src/compositor/wayland_wrapper/qwlextendedoutput.cpp
@@ -49,58 +49,29 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
OutputExtensionGlobal::OutputExtensionGlobal(Compositor *compositor)
- : m_compositor(compositor)
-{
- wl_display_add_global(compositor->wl_display(),
- &wl_output_extension_interface,
- this,
- OutputExtensionGlobal::bind_func);
-}
-
-void OutputExtensionGlobal::bind_func(wl_client *client, void *data, uint32_t version, uint32_t id)
+ : QtWaylandServer::wl_output_extension(compositor->wl_display())
+ , m_compositor(compositor)
{
- Q_UNUSED(version);
- wl_client_add_object(client,&wl_output_extension_interface,&output_extension_interface,id,data);
}
-void OutputExtensionGlobal::get_extended_output(wl_client *client, wl_resource *output_extension_resource, uint32_t id, wl_resource *output_resource)
+void OutputExtensionGlobal::output_extension_get_extended_output(wl_output_extension::Resource *resource, uint32_t id, wl_resource *output_resource)
{
- OutputExtensionGlobal *output_extension = static_cast<OutputExtensionGlobal *>(output_extension_resource->data);
- Output *output = static_cast<Output *>(output_resource->data);
- new ExtendedOutput(client,id,output,output_extension->m_compositor);
-}
+ Output *output = static_cast<Output *>(OutputGlobal::Resource::fromResource(output_resource));
+ Q_ASSERT(output->extendedOutput == 0);
-const struct wl_output_extension_interface OutputExtensionGlobal::output_extension_interface = {
- OutputExtensionGlobal::get_extended_output
-};
+ ExtendedOutput *extendedOutput = static_cast<ExtendedOutput *>(wl_extended_output::add(resource->client(), id));
-ExtendedOutput::ExtendedOutput(struct wl_client *client, uint32_t id, Output *output, Compositor *compositor)
- : m_output(output)
- , m_compositor(compositor)
-{
- static const struct wl_extended_output_interface extended_output_interface = {
- set_orientation_update_mask
- };
- Q_ASSERT(m_output->extendedOutput() == 0);
- m_output->setExtendedOutput(this);
- m_extended_output_resource = wl_client_add_object(client,&wl_extended_output_interface,&extended_output_interface,id,this);
- m_extended_output_resource->destroy = ExtendedOutput::destroy_resource;
-
- sendOutputOrientation(m_compositor->screenOrientation());
-}
+ Q_ASSERT(!output->extendedOutput);
+ output->extendedOutput = extendedOutput;
+ extendedOutput->output = output;
-void ExtendedOutput::destroy_resource(wl_resource *resource)
-{
- ExtendedOutput *output = static_cast<ExtendedOutput *>(resource->data);
- delete output;
- free(resource);
+ extendedOutput->sendOutputOrientation(m_compositor->screenOrientation());
}
-void ExtendedOutput::set_orientation_update_mask(struct wl_client *client,
- struct wl_resource *resource,
- int32_t orientation_update_mask)
+void OutputExtensionGlobal::extended_output_set_orientation_update_mask(wl_extended_output::Resource *resource,
+ int32_t orientation_update_mask)
{
- ExtendedOutput *output = static_cast<ExtendedOutput *>(resource->data);
+ ExtendedOutput *output = static_cast<ExtendedOutput *>(resource);
Qt::ScreenOrientations mask = 0;
if (orientation_update_mask & WL_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION)
@@ -112,11 +83,11 @@ void ExtendedOutput::set_orientation_update_mask(struct wl_client *client,
if (orientation_update_mask & WL_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION)
mask |= Qt::InvertedLandscapeOrientation;
- Qt::ScreenOrientations oldMask = output->m_orientationUpdateMask;
- output->m_orientationUpdateMask = mask;
+ Qt::ScreenOrientations oldMask = output->orientationUpdateMask;
+ output->orientationUpdateMask = mask;
if (mask != oldMask) {
- QList<Surface*> surfaces = output->m_compositor->surfacesForClient(client);
+ QList<Surface*> surfaces = m_compositor->surfacesForClient(resource->client());
foreach (Surface *surface, surfaces) {
if (surface->waylandSurface())
emit surface->waylandSurface()->orientationUpdateMaskChanged();
@@ -126,24 +97,25 @@ void ExtendedOutput::set_orientation_update_mask(struct wl_client *client,
void ExtendedOutput::sendOutputOrientation(Qt::ScreenOrientation orientation)
{
- int sendOpperation;
+ int sendOperation;
switch (orientation) {
case Qt::PortraitOrientation:
- sendOpperation = WL_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
+ sendOperation = WL_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
break;
case Qt::LandscapeOrientation:
- sendOpperation = WL_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION;
+ sendOperation = WL_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION;
break;
case Qt::InvertedPortraitOrientation:
- sendOpperation = WL_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION;
+ sendOperation = WL_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION;
break;
case Qt::InvertedLandscapeOrientation:
- sendOpperation = WL_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION;
+ sendOperation = WL_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION;
break;
default:
- sendOpperation = WL_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
+ sendOperation = WL_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
}
- wl_extended_output_send_set_screen_rotation(m_extended_output_resource, sendOpperation);
+
+ extended_output->send_set_screen_rotation(handle, sendOperation);
}
}
diff --git a/src/compositor/wayland_wrapper/qwlextendedoutput_p.h b/src/compositor/wayland_wrapper/qwlextendedoutput_p.h
index 46c56beb8..3bc418e90 100644
--- a/src/compositor/wayland_wrapper/qwlextendedoutput_p.h
+++ b/src/compositor/wayland_wrapper/qwlextendedoutput_p.h
@@ -42,12 +42,13 @@
#define WLEXTENDEDOUTPUT_H
#include "wayland-server.h"
-#include "wayland-output-extension-server-protocol.h"
#include <QtCompositor/qwaylandexport.h>
#include <QtCore/qnamespace.h>
+#include <qwayland-server-output-extension.h>
+
QT_BEGIN_NAMESPACE
namespace QtWayland {
@@ -55,46 +56,36 @@ namespace QtWayland {
class Compositor;
class Output;
-class OutputExtensionGlobal
+class ExtendedOutput : public QtWaylandServer::wl_extended_output::Resource
{
public:
- OutputExtensionGlobal(Compositor *compositor);
+ ExtendedOutput() : output(0) {}
-private:
- Compositor *m_compositor;
-
- static void bind_func(struct wl_client *client, void *data,
- uint32_t version, uint32_t id);
- static void get_extended_output(struct wl_client *client,
- struct wl_resource *output_extension_resource,
- uint32_t id,
- struct wl_resource *output_resource);
- static const struct wl_output_extension_interface output_extension_interface;
+ void sendOutputOrientation(Qt::ScreenOrientation orientation);
+ Output *output;
+ Qt::ScreenOrientations orientationUpdateMask;
};
-class ExtendedOutput
+class OutputExtensionGlobal : public QtWaylandServer::wl_output_extension, public QtWaylandServer::wl_extended_output
{
public:
- ExtendedOutput(struct wl_client *client, uint32_t id, Output *output, Compositor *compositor);
-
- Qt::ScreenOrientations orientationUpdateMask() { return m_orientationUpdateMask; }
+ OutputExtensionGlobal(Compositor *compositor);
- void sendOutputOrientation(Qt::ScreenOrientation orientation);
+private:
+ Compositor *m_compositor;
- static void destroy_resource(wl_resource *resource);
+ wl_extended_output::Resource *extended_output_allocate() Q_DECL_OVERRIDE { return new ExtendedOutput; }
- static void set_orientation_update_mask(struct wl_client *client,
- struct wl_resource *resource,
- int32_t orientation_update_mask);
+ void extended_output_set_orientation_update_mask(wl_extended_output::Resource *resource,
+ int32_t orientation_update_mask) Q_DECL_OVERRIDE;
-private:
- struct wl_resource *m_extended_output_resource;
- Output *m_output;
- Compositor *m_compositor;
- Qt::ScreenOrientations m_orientationUpdateMask;
+ void output_extension_get_extended_output(wl_output_extension::Resource *resource,
+ uint32_t id,
+ struct wl_resource *output_resource) Q_DECL_OVERRIDE;
};
+
}
QT_END_NAMESPACE
diff --git a/src/compositor/wayland_wrapper/qwlinputdevice.cpp b/src/compositor/wayland_wrapper/qwlinputdevice.cpp
index 8591de254..eba2caf5b 100644
--- a/src/compositor/wayland_wrapper/qwlinputdevice.cpp
+++ b/src/compositor/wayland_wrapper/qwlinputdevice.cpp
@@ -65,15 +65,12 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
InputDevice::InputDevice(QWaylandInputDevice *handle, Compositor *compositor)
- : m_handle(handle)
+ : QtWaylandServer::wl_seat(compositor->wl_display())
+ , m_handle(handle)
, m_compositor(compositor)
{
- wl_seat_init(base());
+ wl_seat_init(&m_seat);
initDevices();
- wl_display_add_global(compositor->wl_display(),
- &wl_seat_interface,
- this,
- InputDevice::bind_func);
#ifndef QT_NO_WAYLAND_XKB
xkb_rule_names xkb_names;
@@ -150,13 +147,13 @@ InputDevice::~InputDevice()
void InputDevice::initDevices()
{
wl_pointer_init(&m_device_interfaces.pointer);
- wl_seat_set_pointer(base(), &m_device_interfaces.pointer);
+ wl_seat_set_pointer(&m_seat, &m_device_interfaces.pointer);
wl_keyboard_init(&m_device_interfaces.keyboard);
- wl_seat_set_keyboard(base(), &m_device_interfaces.keyboard);
+ wl_seat_set_keyboard(&m_seat, &m_device_interfaces.keyboard);
wl_touch_init(&m_device_interfaces.touch);
- wl_seat_set_touch(base(), &m_device_interfaces.touch);
+ wl_seat_set_touch(&m_seat, &m_device_interfaces.touch);
}
void InputDevice::releaseDevices()
@@ -196,129 +193,71 @@ const wl_touch *InputDevice::touchDevice() const
return &m_device_interfaces.touch;
}
-void InputDevice::destroy_resource(wl_resource *resource)
+void InputDevice::seat_destroy_resource(wl_seat::Resource *resource)
{
- InputDevice *input_device = static_cast<InputDevice *>(resource->data);
- if (input_device->keyboardDevice()->focus_resource == resource) {
- input_device->keyboardDevice()->focus_resource = 0;
- }
- if (input_device->pointerDevice()->focus_resource == resource) {
- input_device->pointerDevice()->focus_resource = 0;
- }
+ if (keyboardDevice()->focus_resource == resource->handle)
+ keyboardDevice()->focus_resource = 0;
- input_device->cleanupDataDeviceForClient(resource->client, true);
+ if (pointerDevice()->focus_resource == resource->handle)
+ pointerDevice()->focus_resource = 0;
- wl_list_remove(&resource->link);
-
- free(resource);
+ cleanupDataDeviceForClient(resource->client(), true);
}
-void InputDevice::bind_func(struct wl_client *client, void *data,
- uint32_t version, uint32_t id)
+void InputDevice::seat_bind_resource(wl_seat::Resource *resource)
{
- Q_UNUSED(version);
- struct wl_resource *resource = wl_client_add_object(client,
- &wl_seat_interface,
- &seat_interface,
- id,
- data);
-
- struct wl_seat *seat = static_cast<struct wl_seat *>(data);
- resource->destroy = destroy_resource;
- wl_list_insert(&seat->base_resource_list, &resource->link);
+ wl_list_insert(&m_seat.base_resource_list, &resource->handle->link);
uint32_t caps = WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD;
if (!QTouchDevice::devices().isEmpty())
caps |= WL_SEAT_CAPABILITY_TOUCH;
- wl_seat_send_capabilities(resource, caps);
+ wl_seat::send_capabilities(resource->handle, caps);
}
-const struct wl_pointer_interface InputDevice::pointer_interface = {
- InputDevice::set_cursor
-};
-
-void InputDevice::set_cursor(wl_client *client, wl_resource *resource,
- uint32_t serial, wl_resource *surface_resource,
- int32_t hotspot_x, int32_t hotspot_y)
+void InputDevice::pointer_set_cursor(wl_pointer::Resource *resource,
+ uint32_t serial, wl_resource *surface_resource,
+ int32_t hotspot_x, int32_t hotspot_y)
{
- Q_UNUSED(client);
+ Q_UNUSED(resource);
Q_UNUSED(serial);
- wl_pointer *pointer = reinterpret_cast<wl_pointer *>(resource->data);
- InputDevice *inputDevice = wayland_cast<InputDevice>(pointer->seat);
QtWayland::Surface *surface = reinterpret_cast<QtWayland::Surface *>(surface_resource->data);
surface->setCursorSurface(true);
- inputDevice->m_compositor->waylandCompositor()->setCursorSurface(surface->waylandSurface(), hotspot_x, hotspot_y);
+ m_compositor->waylandCompositor()->setCursorSurface(surface->waylandSurface(), hotspot_x, hotspot_y);
}
-const struct wl_seat_interface InputDevice::seat_interface = {
- get_pointer,
- get_keyboard,
- get_touch
-};
-
-void InputDevice::destroy_device_resource(wl_resource *resource)
+void InputDevice::seat_get_pointer(wl_seat::Resource *resource, uint32_t id)
{
- wl_list_remove(&resource->link);
- free(resource);
+ ::wl_pointer *pointer = pointerDevice();
+ wl_pointer::add(&pointer->resource_list, resource->client(), id);
}
-void InputDevice::get_pointer(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
+void InputDevice::seat_get_keyboard(wl_seat::Resource *resource, uint32_t id)
{
- InputDevice *inputDevice = static_cast<InputDevice *>(resource->data);
- wl_pointer *pointer = inputDevice->pointerDevice();
- wl_resource *clientResource = wl_client_add_object(client,
- &wl_pointer_interface,
- &pointer_interface,
- id,
- pointer);
- wl_list_insert(&pointer->resource_list, &clientResource->link);
- clientResource->destroy = InputDevice::destroy_device_resource;
+ ::wl_keyboard *keyboard = keyboardDevice();
+ wl_keyboard::add(&keyboard->resource_list, resource->client(), id);
}
-void InputDevice::get_keyboard(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
+void InputDevice::keyboard_bind_resource(wl_keyboard::Resource *resource)
{
- InputDevice *inputDevice = static_cast<InputDevice *>(resource->data);
- wl_keyboard *keyboard = inputDevice->keyboardDevice();
- wl_resource *clientResource = wl_client_add_object(client,
- &wl_keyboard_interface,
- 0,
- id,
- keyboard);
- wl_list_insert(&keyboard->resource_list, &clientResource->link);
- clientResource->destroy = InputDevice::destroy_device_resource;
-
#ifndef QT_NO_WAYLAND_XKB
- wl_keyboard_send_keymap(clientResource, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
- inputDevice->m_keymap_fd, inputDevice->m_keymap_size);
+ wl_keyboard::send_keymap(resource->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
+ m_keymap_fd, m_keymap_size);
#endif
}
-void InputDevice::get_touch(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
+void InputDevice::seat_get_touch(wl_seat::Resource *resource, uint32_t id)
{
- InputDevice *inputDevice = static_cast<InputDevice *>(resource->data);
- wl_touch *touch = inputDevice->touchDevice();
- wl_resource *clientResource = wl_client_add_object(client,
- &wl_touch_interface,
- 0,
- id,
- touch);
- wl_list_insert(&touch->resource_list, &clientResource->link);
- clientResource->destroy = InputDevice::destroy_device_resource;
+ ::wl_touch *touch = touchDevice();
+ wl_touch::add(&touch->resource_list, resource->client(), id);
}
void InputDevice::sendMousePressEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
{
sendMouseMoveEvent(localPos,globalPos);
- wl_pointer *pointer = pointerDevice();
+ ::wl_pointer *pointer = pointerDevice();
pointer->button_count++;
uint32_t time = m_compositor->currentTimeMsecs();
const struct wl_pointer_grab_interface *interface = pointer->grab->interface;
@@ -328,7 +267,7 @@ void InputDevice::sendMousePressEvent(Qt::MouseButton button, const QPointF &loc
void InputDevice::sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos)
{
sendMouseMoveEvent(localPos,globalPos);
- wl_pointer *pointer = pointerDevice();
+ ::wl_pointer *pointer = pointerDevice();
pointer->button_count--;
uint32_t time = m_compositor->currentTimeMsecs();
const struct wl_pointer_grab_interface *interface = pointer->grab->interface;
@@ -339,7 +278,7 @@ void InputDevice::sendMouseMoveEvent(const QPointF &localPos, const QPointF &glo
{
Q_UNUSED(globalPos);
uint32_t time = m_compositor->currentTimeMsecs();
- wl_pointer *pointer = pointerDevice();
+ ::wl_pointer *pointer = pointerDevice();
const struct wl_pointer_grab_interface *interface = pointer->grab->interface;
pointer->x = wl_fixed_from_double(globalPos.x());
pointer->y = wl_fixed_from_double(globalPos.y());
@@ -356,7 +295,7 @@ void InputDevice::sendMouseMoveEvent(Surface *surface, const QPointF &localPos,
void InputDevice::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
{
- wl_pointer *pointer = pointerDevice();
+ ::wl_pointer *pointer = pointerDevice();
struct wl_resource *resource = pointer->focus_resource;
if (!resource)
return;
@@ -376,7 +315,7 @@ void InputDevice::updateModifierState(uint code, int state)
uint32_t mods_locked = xkb_state_serialize_mods(m_state, (xkb_state_component)XKB_STATE_LATCHED);
uint32_t group = xkb_state_serialize_group(m_state, (xkb_state_component)XKB_STATE_EFFECTIVE);
- wl_keyboard *keyboard = keyboardDevice();
+ ::wl_keyboard *keyboard = keyboardDevice();
if (mods_depressed == keyboard->modifiers.mods_depressed
&& mods_latched == keyboard->modifiers.mods_latched
@@ -401,7 +340,7 @@ void InputDevice::updateModifierState(uint code, int state)
void InputDevice::sendKeyModifiers(wl_resource *resource)
{
- wl_keyboard *keyboard = keyboardDevice();
+ ::wl_keyboard *keyboard = keyboardDevice();
uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
wl_keyboard_send_modifiers(resource, serial, keyboard->modifiers.mods_depressed,
keyboard->modifiers.mods_latched, keyboard->modifiers.mods_locked, keyboard->modifiers.group);
@@ -409,7 +348,7 @@ void InputDevice::sendKeyModifiers(wl_resource *resource)
void InputDevice::sendKeyPressEvent(uint code)
{
- wl_keyboard *keyboard = keyboardDevice();
+ ::wl_keyboard *keyboard = keyboardDevice();
if (keyboard->focus_resource) {
uint32_t time = m_compositor->currentTimeMsecs();
uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
@@ -421,7 +360,7 @@ void InputDevice::sendKeyPressEvent(uint code)
void InputDevice::sendKeyReleaseEvent(uint code)
{
- wl_keyboard *keyboard = keyboardDevice();
+ ::wl_keyboard *keyboard = keyboardDevice();
if (keyboard->focus_resource) {
uint32_t time = m_compositor->currentTimeMsecs();
uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
@@ -435,7 +374,7 @@ void InputDevice::sendTouchPointEvent(int id, double x, double y, Qt::TouchPoint
{
uint32_t time = m_compositor->currentTimeMsecs();
uint32_t serial = 0;
- wl_touch *touch = touchDevice();
+ ::wl_touch *touch = touchDevice();
wl_resource *resource = touch->focus_resource;
if (!resource)
return;
@@ -461,7 +400,7 @@ void InputDevice::sendTouchPointEvent(int id, double x, double y, Qt::TouchPoint
void InputDevice::sendTouchFrameEvent()
{
- wl_touch *touch = touchDevice();
+ ::wl_touch *touch = touchDevice();
wl_resource *resource = touch->focus_resource;
if (resource)
wl_touch_send_frame(resource);
@@ -469,7 +408,7 @@ void InputDevice::sendTouchFrameEvent()
void InputDevice::sendTouchCancelEvent()
{
- wl_touch *touch = touchDevice();
+ ::wl_touch *touch = touchDevice();
wl_resource *resource = touch->focus_resource;
if (resource)
wl_touch_send_cancel(resource);
@@ -548,7 +487,7 @@ Surface *InputDevice::mouseFocus() const
void InputDevice::setMouseFocus(Surface *surface, const QPointF &localPos, const QPointF &globalPos)
{
- wl_pointer *pointer = pointerDevice();
+ ::wl_pointer *pointer = pointerDevice();
pointer->x = wl_fixed_from_double(globalPos.x());
pointer->y = wl_fixed_from_double(globalPos.y());
pointer->current = surface ? surface->base() : 0;
@@ -560,7 +499,7 @@ void InputDevice::setMouseFocus(Surface *surface, const QPointF &localPos, const
// We have no separate touch focus management so make it match the pointer focus always.
// No wl_touch_set_focus() is available so set it manually.
- wl_touch *touch = touchDevice();
+ ::wl_touch *touch = touchDevice();
touch->focus = surface ? surface->base() : 0;
touch->focus_resource = Compositor::resourceForSurface(&touch->resource_list, surface);
}
diff --git a/src/compositor/wayland_wrapper/qwlinputdevice_p.h b/src/compositor/wayland_wrapper/qwlinputdevice_p.h
index 9365fa9de..fd1b0fb4e 100644
--- a/src/compositor/wayland_wrapper/qwlinputdevice_p.h
+++ b/src/compositor/wayland_wrapper/qwlinputdevice_p.h
@@ -41,8 +41,6 @@
#ifndef WLINPUTDEVICE_H
#define WLINPUTDEVICE_H
-#include <QtCompositor/qwaylandobject.h>
-
#include <stdint.h>
#include <QtCore/QList>
@@ -52,6 +50,8 @@
#include <xkbcommon/xkbcommon.h>
#endif
+#include <qwayland-server-wayland.h>
+
QT_BEGIN_NAMESPACE
class QKeyEvent;
@@ -65,7 +65,7 @@ class DataDevice;
class Surface;
class DataDeviceManager;
-class InputDevice : public Object<struct wl_seat>
+class InputDevice : public QtWaylandServer::wl_seat, public QtWaylandServer::wl_pointer, public QtWaylandServer::wl_keyboard, public QtWaylandServer::wl_touch
{
public:
InputDevice(QWaylandInputDevice *handle, Compositor *compositor);
@@ -100,12 +100,18 @@ public:
Compositor *compositor() const;
QWaylandInputDevice *handle() const;
- wl_pointer *pointerDevice();
- wl_keyboard *keyboardDevice();
- wl_touch *touchDevice();
- const wl_pointer *pointerDevice() const;
- const wl_keyboard *keyboardDevice() const;
- const wl_touch *touchDevice() const;
+ ::wl_pointer *pointerDevice();
+ ::wl_keyboard *keyboardDevice();
+ ::wl_touch *touchDevice();
+
+ const ::wl_pointer *pointerDevice() const;
+ const ::wl_keyboard *keyboardDevice() const;
+ const ::wl_touch *touchDevice() const;
+
+ static InputDevice *fromSeatResource(struct ::wl_resource *resource)
+ {
+ return static_cast<InputDevice *>(wl_seat::Resource::fromResource(resource)->seat);
+ }
private:
void initDevices();
@@ -117,12 +123,15 @@ private:
QWaylandInputDevice *m_handle;
Compositor *m_compositor;
QList<DataDevice *> m_data_devices;
+
struct {
- wl_pointer pointer;
- wl_keyboard keyboard;
- wl_touch touch;
+ ::wl_pointer pointer;
+ ::wl_keyboard keyboard;
+ ::wl_touch touch;
} m_device_interfaces;
+ ::wl_seat m_seat;
+
#ifndef QT_NO_WAYLAND_XKB
struct xkb_keymap *m_keymap;
struct xkb_state *m_state;
@@ -133,30 +142,24 @@ private:
uint32_t toWaylandButton(Qt::MouseButton button);
- static void bind_func(struct wl_client *client, void *data,
- uint32_t version, uint32_t id);
-
- static void set_cursor(struct wl_client *client,
- struct wl_resource *device_base,
- uint32_t serial,
- struct wl_resource *surface,
- int32_t hotspot_x,
- int32_t hotspot_y);
- const static struct wl_pointer_interface pointer_interface;
-
- static void get_pointer(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void get_keyboard(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void get_touch(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- const static struct wl_seat_interface seat_interface;
-
- static void destroy_resource(wl_resource *resource);
- static void destroy_device_resource(wl_resource *resource);
+ void seat_bind_resource(wl_seat::Resource *resource) Q_DECL_OVERRIDE;
+
+ void pointer_set_cursor(wl_pointer::Resource *resource,
+ uint32_t serial,
+ struct wl_resource *surface,
+ int32_t hotspot_x,
+ int32_t hotspot_y) Q_DECL_OVERRIDE;
+
+ void keyboard_bind_resource(wl_keyboard::Resource *resource) Q_DECL_OVERRIDE;
+
+ void seat_get_pointer(wl_seat::Resource *resource,
+ uint32_t id) Q_DECL_OVERRIDE;
+ void seat_get_keyboard(wl_seat::Resource *resource,
+ uint32_t id) Q_DECL_OVERRIDE;
+ void seat_get_touch(wl_seat::Resource *resource,
+ uint32_t id) Q_DECL_OVERRIDE;
+
+ void seat_destroy_resource(wl_seat::Resource *resource) Q_DECL_OVERRIDE;
};
}
diff --git a/src/compositor/wayland_wrapper/qwloutput.cpp b/src/compositor/wayland_wrapper/qwloutput.cpp
index f248dccdb..bb516f8c4 100644
--- a/src/compositor/wayland_wrapper/qwloutput.cpp
+++ b/src/compositor/wayland_wrapper/qwloutput.cpp
@@ -44,12 +44,15 @@
#include <QtGui/QScreen>
#include <QRect>
+#include "qwaylandresourcecollection.h"
+
QT_BEGIN_NAMESPACE
namespace QtWayland {
-OutputGlobal::OutputGlobal()
- : m_displayId(-1)
+OutputGlobal::OutputGlobal(struct ::wl_display *display)
+ : QtWaylandServer::wl_output(display)
+ , m_displayId(-1)
, m_numQueued(0)
{
QScreen *screen = QGuiApplication::primaryScreen();
@@ -59,7 +62,15 @@ OutputGlobal::OutputGlobal()
OutputGlobal::~OutputGlobal()
{
- qDeleteAll(m_outputs);
+}
+
+void OutputGlobal::output_bind_resource(Resource *resource)
+{
+ wl_output_send_geometry(resource->handle, 0, 0,
+ size().width(), size().height(), 0, "", "", 0);
+
+ wl_output_send_mode(resource->handle, WL_OUTPUT_MODE_CURRENT|WL_OUTPUT_MODE_PREFERRED,
+ size().width(), size().height(), refreshRate());
}
void OutputGlobal::setGeometry(const QRect &geometry)
@@ -74,53 +85,7 @@ void OutputGlobal::setRefreshRate(int rate)
Output *OutputGlobal::outputForClient(wl_client *client) const
{
- return static_cast<Output *>(resourceForClient(client)->data);
-}
-
-void OutputGlobal::output_bind_func(struct wl_client *client, void *data,
- uint32_t version, uint32_t id)
-{
- Q_UNUSED(version);
- OutputGlobal *output_global = static_cast<OutputGlobal *>(data);
-
- Output *output = new Output(output_global,client,version,id);
- output_global->registerResource(output->handle());
- output_global->m_outputs.append(output);
-}
-
-
-
-Output::Output(OutputGlobal *outputGlobal, wl_client *client, uint32_t version, uint32_t id)
- : m_output_global(outputGlobal)
- , m_extended_output(0)
-{
- Q_UNUSED(version);
- m_output_resource = wl_client_add_object(client,&wl_output_interface,0,id,this);
- wl_output_send_geometry(m_output_resource, 0, 0,
- m_output_global->size().width(), m_output_global->size().height(),0,"","",0);
-
- wl_output_send_mode(m_output_resource, WL_OUTPUT_MODE_CURRENT|WL_OUTPUT_MODE_PREFERRED,
- m_output_global->size().width(), m_output_global->size().height(), m_output_global->refreshRate());
-
-}
-
-Output::~Output()
-{
-}
-
-ExtendedOutput *Output::extendedOutput() const
-{
- return m_extended_output;
-}
-
-void Output::setExtendedOutput(ExtendedOutput *extendedOutput)
-{
- m_extended_output = extendedOutput;
-}
-
-wl_resource *Output::handle() const
-{
- return m_output_resource;
+ return static_cast<Output *>(resourceForClient(resourceList(), client)->data);
}
} // namespace Wayland
diff --git a/src/compositor/wayland_wrapper/qwloutput_p.h b/src/compositor/wayland_wrapper/qwloutput_p.h
index 11341737d..514d3e9f5 100644
--- a/src/compositor/wayland_wrapper/qwloutput_p.h
+++ b/src/compositor/wayland_wrapper/qwloutput_p.h
@@ -41,22 +41,27 @@
#ifndef WL_OUTPUT_H
#define WL_OUTPUT_H
-#include <QtCompositor/qwaylandresourcecollection.h>
-
#include <QtCore/QRect>
#include <QtCore/QList>
+#include <qwayland-server-wayland.h>
+
QT_BEGIN_NAMESPACE
namespace QtWayland {
-class Output;
class ExtendedOutput;
-class OutputGlobal : public ResourceCollection
+struct Output : public QtWaylandServer::wl_output::Resource
+{
+ Output() : extendedOutput(0) {}
+ ExtendedOutput *extendedOutput;
+};
+
+class OutputGlobal : public QtWaylandServer::wl_output
{
public:
- OutputGlobal();
+ OutputGlobal(struct ::wl_display *display);
~OutputGlobal();
void setGeometry(const QRect &geometry);
@@ -71,21 +76,21 @@ public:
Output *outputForClient(struct wl_client *client) const;
- static void output_bind_func(struct wl_client *client, void *data,
- uint32_t version, uint32_t id);
+ void output_bind_resource(Resource *resource) Q_DECL_OVERRIDE;
+ Resource *output_allocate() Q_DECL_OVERRIDE { return new Output; }
+
private:
QRect m_geometry;
int m_refreshRate;
int m_displayId;
int m_numQueued;
- QList<Output *> m_outputs;
};
-
+#if 0
class Output
{
public:
- Output(OutputGlobal *outputGlobal, wl_client *client, uint32_t version, uint32_t id);
+ Output(OutputGlobal *outputGlobal, struct ::wl_resource *resource);
~Output();
OutputGlobal *outputGlobal() const;
@@ -98,8 +103,8 @@ private:
struct wl_resource *m_output_resource;
OutputGlobal *m_output_global;
ExtendedOutput *m_extended_output;
-
};
+#endif
}
diff --git a/src/compositor/wayland_wrapper/qwlqtkey.cpp b/src/compositor/wayland_wrapper/qwlqtkey.cpp
index a6fea9f2a..0c9c136ea 100644
--- a/src/compositor/wayland_wrapper/qwlqtkey.cpp
+++ b/src/compositor/wayland_wrapper/qwlqtkey.cpp
@@ -43,68 +43,35 @@
#include <QKeyEvent>
#include <QWindow>
+#include "qwaylandresourcecollection.h"
+
QT_BEGIN_NAMESPACE
namespace QtWayland {
-static void dummy(wl_client *, wl_resource *)
-{
-}
-
-const struct wl_qtkey_extension_interface QtKeyExtensionGlobal::qtkey_interface = {
- dummy
-};
-
QtKeyExtensionGlobal::QtKeyExtensionGlobal(Compositor *compositor)
- : m_compositor(compositor)
+ : QtWaylandServer::wl_qtkey_extension(compositor->wl_display())
+ , m_compositor(compositor)
{
- wl_display_add_global(compositor->wl_display(),
- &wl_qtkey_extension_interface,
- this,
- QtKeyExtensionGlobal::bind_func);
-}
-
-QtKeyExtensionGlobal::~QtKeyExtensionGlobal()
-{
-}
-
-void QtKeyExtensionGlobal::destroy_resource(wl_resource *resource)
-{
- QtKeyExtensionGlobal *self = static_cast<QtKeyExtensionGlobal *>(resource->data);
- self->m_resources.removeOne(resource);
- free(resource);
-}
-
-void QtKeyExtensionGlobal::bind_func(wl_client *client, void *data, uint32_t version, uint32_t id)
-{
- Q_UNUSED(version);
- wl_resource *resource = wl_client_add_object(client, &wl_qtkey_extension_interface, &qtkey_interface, id, data);
- resource->destroy = destroy_resource;
- QtKeyExtensionGlobal *self = static_cast<QtKeyExtensionGlobal *>(resource->data);
- self->m_resources.append(resource);
}
bool QtKeyExtensionGlobal::postQtKeyEvent(QKeyEvent *event, Surface *surface)
{
wl_client *surfaceClient = surface->base()->resource.client;
- uint32_t time = m_compositor->currentTimeMsecs();
- const int rescount = m_resources.count();
- for (int res = 0; res < rescount; ++res) {
- wl_resource *target = m_resources.at(res);
- if (target->client != surfaceClient)
- continue;
-
- QByteArray textUtf8 = event->text().toUtf8();
+ uint32_t time = m_compositor->currentTimeMsecs();
- wl_qtkey_extension_send_qtkey(target,
- time, event->type(), event->key(), event->modifiers(),
- event->nativeScanCode(),
- event->nativeVirtualKey(),
- event->nativeModifiers(),
- textUtf8.constData(),
- event->isAutoRepeat(),
- event->count());
+ struct wl_resource *target = resourceForClient(resourceList(), surfaceClient);
+
+ if (target) {
+ send_qtkey(target,
+ time, event->type(), event->key(), event->modifiers(),
+ event->nativeScanCode(),
+ event->nativeVirtualKey(),
+ event->nativeModifiers(),
+ event->text(),
+ event->isAutoRepeat(),
+ event->count());
return true;
}
diff --git a/src/compositor/wayland_wrapper/qwlqtkey_p.h b/src/compositor/wayland_wrapper/qwlqtkey_p.h
index bb98f9b88..c9226c0ff 100644
--- a/src/compositor/wayland_wrapper/qwlqtkey_p.h
+++ b/src/compositor/wayland_wrapper/qwlqtkey_p.h
@@ -42,9 +42,11 @@
#define WLQTKEY_H
#include <private/qwlcompositor_p.h>
-#include "wayland-qtkey-extension-server-protocol.h"
+
#include "wayland-util.h"
+#include "qwayland-server-qtkey-extension.h"
+
QT_BEGIN_NAMESPACE
class Compositor;
@@ -53,24 +55,15 @@ class QKeyEvent;
namespace QtWayland {
-class QtKeyExtensionGlobal
+class QtKeyExtensionGlobal : public QtWaylandServer::wl_qtkey_extension
{
public:
QtKeyExtensionGlobal(Compositor *compositor);
- ~QtKeyExtensionGlobal();
bool postQtKeyEvent(QKeyEvent *event, Surface *surface);
private:
- static void bind_func(struct wl_client *client, void *data,
- uint32_t version, uint32_t id);
-
- static void destroy_resource(wl_resource *resource);
-
- static const struct wl_qtkey_extension_interface qtkey_interface;
-
Compositor *m_compositor;
- QList<wl_resource *> m_resources;
};
}
diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp
index f8d6e0c5c..061faccdc 100644
--- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlshellsurface.cpp
@@ -78,20 +78,20 @@ const struct wl_shell_interface Shell::shell_interface = {
};
ShellSurface::ShellSurface(wl_client *client, uint32_t id, Surface *surface)
- : m_surface(surface)
+ : wl_shell_surface(client, id)
+ , m_surface(surface)
, m_resizeGrabber(0)
, m_moveGrabber(0)
, m_transientParent(0)
, m_xOffset(0)
, m_yOffset(0)
{
- m_shellSurface = wl_client_add_object(client,&wl_shell_surface_interface,&shell_surface_interface,id,this);
surface->setShellSurface(this);
}
void ShellSurface::sendConfigure(uint32_t edges, int32_t width, int32_t height)
{
- wl_shell_surface_send_configure(m_shellSurface,edges,width,height);
+ send_configure(edges, width, height);
}
Surface *ShellSurface::surface() const
@@ -148,103 +148,102 @@ void ShellSurface::setOffset(const QPointF &offset)
m_yOffset = offset.y();
}
-void ShellSurface::move(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
+void ShellSurface::shell_surface_destroy_resource(Resource *)
+{
+ delete this;
+}
+
+void ShellSurface::shell_surface_move(Resource *resource,
struct wl_resource *input_device_super,
uint32_t time)
{
- Q_UNUSED(client);
+ Q_UNUSED(resource);
Q_UNUSED(time);
- ShellSurface *self = static_cast<ShellSurface *>(shell_surface_resource->data);
- InputDevice *input_device = static_cast<InputDevice *>(input_device_super->data);
- if (self->m_resizeGrabber || self->m_moveGrabber) {
+
+ if (m_resizeGrabber || m_moveGrabber) {
qDebug() << "invalid state";
return;
}
- self->m_moveGrabber = new ShellSurfaceMoveGrabber(self);
- wl_pointer *pointer = input_device->pointerDevice();
- self->m_moveGrabber->base()->x = pointer->x;
- self->m_moveGrabber->base()->y = pointer->y;
- self->m_moveGrabber->offset_x = wl_fixed_to_int(pointer->x) - self->surface()->pos().x();
- self->m_moveGrabber->offset_y = wl_fixed_to_int(pointer->y) - self->surface()->pos().y();
+ InputDevice *input_device = InputDevice::fromSeatResource(input_device_super);
+ ::wl_pointer *pointer = input_device->pointerDevice();
- wl_pointer_start_grab(pointer, self->m_moveGrabber->base());
+ m_moveGrabber = new ShellSurfaceMoveGrabber(this);
+ m_moveGrabber->base()->x = pointer->x;
+ m_moveGrabber->base()->y = pointer->y;
+ m_moveGrabber->offset_x = wl_fixed_to_int(pointer->x) - surface()->pos().x();
+ m_moveGrabber->offset_y = wl_fixed_to_int(pointer->y) - surface()->pos().y();
+
+ wl_pointer_start_grab(pointer, m_moveGrabber->base());
}
-void ShellSurface::resize(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
+void ShellSurface::shell_surface_resize(Resource *resource,
struct wl_resource *input_device_super,
uint32_t time,
uint32_t edges)
{
- Q_UNUSED(shell_surface_resource);
- Q_UNUSED(client);
+ Q_UNUSED(resource);
Q_UNUSED(time);
Q_UNUSED(edges);
- ShellSurface *self = static_cast<ShellSurface *>(shell_surface_resource->data);
- InputDevice *input_device = static_cast<InputDevice *>(input_device_super->data);
- if (self->m_moveGrabber || self->m_resizeGrabber) {
+
+ if (m_moveGrabber || m_resizeGrabber) {
qDebug() << "invalid state2";
return;
}
- self->m_resizeGrabber = new ShellSurfaceResizeGrabber(self);
- wl_pointer *pointer = input_device->pointerDevice();
- self->m_resizeGrabber->base()->x = pointer->x;
- self->m_resizeGrabber->base()->y = pointer->y;
- self->m_resizeGrabber->resize_edges = wl_shell_surface_resize(edges);
- self->m_resizeGrabber->width = self->surface()->size().width();
- self->m_resizeGrabber->height = self->surface()->size().height();
- wl_pointer_start_grab(pointer, self->m_resizeGrabber->base());
+ m_resizeGrabber = new ShellSurfaceResizeGrabber(this);
+
+ InputDevice *input_device = InputDevice::fromSeatResource(input_device_super);
+ ::wl_pointer *pointer = input_device->pointerDevice();
+
+ m_resizeGrabber->base()->x = pointer->x;
+ m_resizeGrabber->base()->y = pointer->y;
+ m_resizeGrabber->resize_edges = wl_shell_surface_resize(edges);
+ m_resizeGrabber->width = surface()->size().width();
+ m_resizeGrabber->height = surface()->size().height();
+
+ wl_pointer_start_grab(pointer, m_resizeGrabber->base());
}
-void ShellSurface::set_toplevel(struct wl_client *client,
- struct wl_resource *shell_surface_resource)
+void ShellSurface::shell_surface_set_toplevel(Resource *resource)
{
- Q_UNUSED(client);
- ShellSurface *self = static_cast<ShellSurface *>(shell_surface_resource->data);
- self->m_transientParent = 0;
- self->m_xOffset = 0;
- self->m_yOffset = 0;
+ Q_UNUSED(resource);
+ m_transientParent = 0;
+ m_xOffset = 0;
+ m_yOffset = 0;
}
-void ShellSurface::set_transient(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
+void ShellSurface::shell_surface_set_transient(Resource *resource,
struct wl_resource *parent_surface_resource,
int x,
int y,
uint32_t flags)
{
- Q_UNUSED(client);
+ Q_UNUSED(resource);
Q_UNUSED(flags);
- ShellSurface *shell_surface = static_cast<ShellSurface *>(shell_surface_resource->data);
Surface *parent_surface = static_cast<Surface *>(parent_surface_resource->data);
- shell_surface->m_transientParent = parent_surface->shellSurface();
- shell_surface->m_xOffset = x;
- shell_surface->m_yOffset = y;
+ m_transientParent = parent_surface->shellSurface();
+ m_xOffset = x;
+ m_yOffset = y;
if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
- shell_surface->surface()->setTransientInactive(true);
+ surface()->setTransientInactive(true);
}
-void ShellSurface::set_fullscreen(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
+void ShellSurface::shell_surface_set_fullscreen(Resource *resource,
uint32_t method,
uint32_t framerate,
struct wl_resource *output)
{
- Q_UNUSED(client);
- Q_UNUSED(shell_surface_resource);
+ Q_UNUSED(resource);
Q_UNUSED(method);
Q_UNUSED(framerate);
Q_UNUSED(output);
}
-void ShellSurface::set_popup(wl_client *client, wl_resource *resource, wl_resource *input_device, uint32_t time, wl_resource *parent, int32_t x, int32_t y, uint32_t flags)
+void ShellSurface::shell_surface_set_popup(Resource *resource, wl_resource *input_device, uint32_t time, wl_resource *parent, int32_t x, int32_t y, uint32_t flags)
{
- Q_UNUSED(client);
Q_UNUSED(resource);
Q_UNUSED(input_device);
Q_UNUSED(time);
@@ -254,55 +253,34 @@ void ShellSurface::set_popup(wl_client *client, wl_resource *resource, wl_resour
Q_UNUSED(flags);
}
-void ShellSurface::set_maximized(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
+void ShellSurface::shell_surface_set_maximized(Resource *resource,
struct wl_resource *output)
{
- Q_UNUSED(client);
- Q_UNUSED(shell_surface_resource);
+ Q_UNUSED(resource);
Q_UNUSED(output);
}
-void ShellSurface::pong(struct wl_client *client,
- struct wl_resource *resource,
+void ShellSurface::shell_surface_pong(Resource *resource,
uint32_t serial)
{
- Q_UNUSED(client);
Q_UNUSED(resource);
Q_UNUSED(serial);
}
-void ShellSurface::set_title(struct wl_client *client,
- struct wl_resource *resource,
- const char *title)
+void ShellSurface::shell_surface_set_title(Resource *resource,
+ const QString &title)
{
- Q_UNUSED(client);
- ShellSurface *self = static_cast<ShellSurface *>(resource->data);
- self->surface()->setTitle(QString::fromUtf8(title));
+ Q_UNUSED(resource);
+ surface()->setTitle(title);
}
-void ShellSurface::set_class(struct wl_client *client,
- struct wl_resource *resource,
- const char *class_)
+void ShellSurface::shell_surface_set_class(Resource *resource,
+ const QString &className)
{
- Q_UNUSED(client);
- ShellSurface *self = static_cast<ShellSurface *>(resource->data);
- self->surface()->setClassName(QString::fromUtf8(class_));
+ Q_UNUSED(resource);
+ surface()->setClassName(className);
}
-const struct wl_shell_surface_interface ShellSurface::shell_surface_interface = {
- ShellSurface::pong,
- ShellSurface::move,
- ShellSurface::resize,
- ShellSurface::set_toplevel,
- ShellSurface::set_transient,
- ShellSurface::set_fullscreen,
- ShellSurface::set_popup,
- ShellSurface::set_maximized,
- ShellSurface::set_title,
- ShellSurface::set_class
-};
-
Qt::MouseButton toQtButton(uint32_t button)
{
#ifndef BTN_LEFT
diff --git a/src/compositor/wayland_wrapper/qwlshellsurface_p.h b/src/compositor/wayland_wrapper/qwlshellsurface_p.h
index 1bb0c4e42..92820adb6 100644
--- a/src/compositor/wayland_wrapper/qwlshellsurface_p.h
+++ b/src/compositor/wayland_wrapper/qwlshellsurface_p.h
@@ -46,6 +46,8 @@
#include <wayland-server.h>
#include <QPoint>
+#include <qwayland-server-wayland.h>
+
QT_BEGIN_NAMESPACE
namespace QtWayland {
@@ -72,7 +74,7 @@ private:
};
-class ShellSurface
+class ShellSurface : public QtWaylandServer::wl_shell_surface
{
public:
ShellSurface(struct wl_client *client, uint32_t id, Surface *surface);
@@ -89,7 +91,6 @@ public:
void setOffset(const QPointF &offset);
private:
- struct wl_resource *m_shellSurface;
Surface *m_surface;
ShellSurfaceResizeGrabber *m_resizeGrabber;
@@ -100,50 +101,40 @@ private:
int32_t m_xOffset;
int32_t m_yOffset;
- static void move(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
- struct wl_resource *input_device_super,
- uint32_t time);
- static void resize(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
- struct wl_resource *input_device,
- uint32_t time,
- uint32_t edges);
- static void set_toplevel(struct wl_client *client,
- struct wl_resource *shell_surface_resource);
- static void set_transient(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
- struct wl_resource *parent_surface_resource,
- int x,
- int y,
- uint32_t flags);
- static void set_fullscreen(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
- uint32_t method,
- uint32_t framerate,
- struct wl_resource *output);
- static void set_popup(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *input_device,
- uint32_t time,
- struct wl_resource *parent,
- int32_t x,
- int32_t y,
- uint32_t flags);
- static void set_maximized(struct wl_client *client,
- struct wl_resource *shell_surface_resource,
- struct wl_resource *output);
- static void pong(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void set_title(struct wl_client *client,
- struct wl_resource *resource,
- const char *title);
- static void set_class(struct wl_client *client,
- struct wl_resource *resource,
- const char *class_);
-
- static const struct wl_shell_surface_interface shell_surface_interface;
+ void shell_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
+
+ void shell_surface_move(Resource *resource,
+ struct wl_resource *input_device_super,
+ uint32_t time) Q_DECL_OVERRIDE;
+ void shell_surface_resize(Resource *resource,
+ struct wl_resource *input_device,
+ uint32_t time,
+ uint32_t edges) Q_DECL_OVERRIDE;
+ void shell_surface_set_toplevel(Resource *resource) Q_DECL_OVERRIDE;
+ void shell_surface_set_transient(Resource *resource,
+ struct wl_resource *parent_surface_resource,
+ int x,
+ int y,
+ uint32_t flags) Q_DECL_OVERRIDE;
+ void shell_surface_set_fullscreen(Resource *resource,
+ uint32_t method,
+ uint32_t framerate,
+ struct wl_resource *output) Q_DECL_OVERRIDE;
+ void shell_surface_set_popup(Resource *resource,
+ struct wl_resource *input_device,
+ uint32_t time,
+ struct wl_resource *parent,
+ int32_t x,
+ int32_t y,
+ uint32_t flags) Q_DECL_OVERRIDE;
+ void shell_surface_set_maximized(Resource *resource,
+ struct wl_resource *output) Q_DECL_OVERRIDE;
+ void shell_surface_pong(Resource *resource,
+ uint32_t serial) Q_DECL_OVERRIDE;
+ void shell_surface_set_title(Resource *resource,
+ const QString &title) Q_DECL_OVERRIDE;
+ void shell_surface_set_class(Resource *resource,
+ const QString &class_) Q_DECL_OVERRIDE;
};
class ShellSurfaceGrabber : public Object<wl_pointer_grab>
diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
index 34fee627f..8ef0befdb 100644
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurface.cpp
@@ -103,7 +103,6 @@ Surface::~Surface()
delete m_waylandSurface;
delete m_extendedSurface;
delete m_subSurface;
- delete m_shellSurface;
for (int i = 0; i < buffer_pool_size; i++) {
if (!m_bufferPool[i]->pageFlipperHasBuffer())
diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri
index 9bfe957e2..c425e2e5b 100644
--- a/src/compositor/wayland_wrapper/wayland_wrapper.pri
+++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri
@@ -1,10 +1,11 @@
-WAYLANDSOURCES += \
+WAYLANDSERVERSOURCES += \
../extensions/surface-extension.xml \
../extensions/sub-surface-extension.xml \
../extensions/output-extension.xml \
../extensions/touch-extension.xml \
../extensions/qtkey-extension.xml \
- ../extensions/windowmanager.xml
+ ../extensions/windowmanager.xml \
+ ../3rdparty/protocol/wayland.xml
HEADERS += \
wayland_wrapper/qwlcompositor_p.h \