summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2012-03-05 09:58:32 +0100
committerSamuel Rødal <samuel.rodal@nokia.com>2012-03-05 10:03:46 +0100
commit6200e672a24d7d61e53b46ddb4ef5e0c3733516f (patch)
tree1ba752022e01fa69347743835f25ec7ffed73f22 /src
parentd61d5176ce7f90710d53edcc3a176cc9a2e05e90 (diff)
Use the new cool event wrapper functions generated by wayland-scanner
This gives us some more static typechecking which is cool.. This fixes actually a couple of minor bugs we had, one where we didn't send a value for the refreshrate of a screen, and a couple in selection. Change-Id: I2b4193b488784885d7cce27f7f5b2d2df45c6c83 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/compositor/wayland_wrapper/wldatadevice.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wldatadevicemanager.cpp8
-rw-r--r--src/compositor/wayland_wrapper/wldataoffer.cpp4
-rw-r--r--src/compositor/wayland_wrapper/wldatasource.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wlextendedoutput.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wlextendedsurface.cpp4
-rw-r--r--src/compositor/wayland_wrapper/wlinputdevice.cpp38
-rw-r--r--src/compositor/wayland_wrapper/wloutput.cpp6
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wlsurfacebuffer.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wltouch.cpp4
-rw-r--r--src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp4
-rw-r--r--src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp13
13 files changed, 46 insertions, 45 deletions
diff --git a/src/compositor/wayland_wrapper/wldatadevice.cpp b/src/compositor/wayland_wrapper/wldatadevice.cpp
index abcf67b45..be9ca8c40 100644
--- a/src/compositor/wayland_wrapper/wldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/wldatadevice.cpp
@@ -113,7 +113,7 @@ void DataDevice::sendSelectionFocus()
wl_resource *client_resource =
data_offer->addDataDeviceResource(m_data_device_resource);
qDebug() << "sending data_offer for source" << source;
- wl_resource_post_event(m_data_device_resource,WL_DATA_DEVICE_SELECTION,client_resource);
+ wl_data_device_send_selection(m_data_device_resource,client_resource);
m_sent_selection_time = source->time();
}
}
diff --git a/src/compositor/wayland_wrapper/wldatadevicemanager.cpp b/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
index 04214ef8b..78e79b0f2 100644
--- a/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
@@ -95,6 +95,7 @@ void DataDeviceManager::setCurrentSelectionSource(DataSource *source)
void DataDeviceManager::sourceDestroyed(DataSource *source)
{
+ Q_UNUSED(source);
if (m_current_selection_source == source)
finishReadFromClient();
}
@@ -123,6 +124,7 @@ void DataDeviceManager::retain()
void DataDeviceManager::finishReadFromClient(bool exhausted)
{
+ Q_UNUSED(exhausted);
if (m_retainedReadNotifier) {
if (exhausted) {
int fd = m_retainedReadNotifier->socket();
@@ -252,12 +254,12 @@ bool DataDeviceManager::offerFromCompositorToClient(wl_resource *clientDataDevic
struct wl_resource *selectionOffer =
wl_client_new_object(client, &wl_data_offer_interface, &compositor_offer_interface, this);
- wl_resource_post_event(clientDataDeviceResource, WL_DATA_DEVICE_DATA_OFFER, selectionOffer);
+ wl_data_device_send_data_offer(clientDataDeviceResource, selectionOffer);
foreach (const QString &format, m_retainedData.formats()) {
QByteArray ba = format.toLatin1();
- wl_resource_post_event(selectionOffer, WL_DATA_OFFER_OFFER, ba.constData());
+ wl_data_offer_send_offer(selectionOffer, ba.constData());
}
- wl_resource_post_event(clientDataDeviceResource, WL_DATA_DEVICE_SELECTION, selectionOffer);
+ wl_data_device_send_selection(clientDataDeviceResource, selectionOffer);
return true;
}
diff --git a/src/compositor/wayland_wrapper/wldataoffer.cpp b/src/compositor/wayland_wrapper/wldataoffer.cpp
index e8fc1c7f7..5b1f9695c 100644
--- a/src/compositor/wayland_wrapper/wldataoffer.cpp
+++ b/src/compositor/wayland_wrapper/wldataoffer.cpp
@@ -69,12 +69,12 @@ struct wl_resource *DataOffer::addDataDeviceResource(struct wl_resource *data_de
}
struct wl_resource *new_object =
wl_client_new_object(data_device_resource->client,&wl_data_offer_interface,&data_interface,this);
- wl_resource_post_event(data_device_resource,WL_DATA_DEVICE_DATA_OFFER,new_object);
+ wl_data_device_send_data_offer(data_device_resource, new_object);
registerResource(new_object);
QList<QByteArray> offer_list = m_data_source->offerList();
for (int i = 0; i < offer_list.size(); i++) {
- wl_resource_post_event(new_object, WL_DATA_OFFER_OFFER, offer_list.at(i).constData());
+ wl_data_offer_send_offer(new_object, offer_list.at(i).constData());
}
return new_object;
}
diff --git a/src/compositor/wayland_wrapper/wldatasource.cpp b/src/compositor/wayland_wrapper/wldatasource.cpp
index 1f5730975..7c9f2cc35 100644
--- a/src/compositor/wayland_wrapper/wldatasource.cpp
+++ b/src/compositor/wayland_wrapper/wldatasource.cpp
@@ -114,7 +114,7 @@ DataOffer * DataSource::dataOffer() const
void DataSource::postSendEvent(const QByteArray &mimeType, int fd)
{
if (m_data_source_resource) {
- wl_resource_post_event(m_data_source_resource,WL_DATA_SOURCE_SEND,mimeType.constData(),fd);
+ wl_data_source_send_send(m_data_source_resource, mimeType.constData(), fd);
}
}
diff --git a/src/compositor/wayland_wrapper/wlextendedoutput.cpp b/src/compositor/wayland_wrapper/wlextendedoutput.cpp
index a610da242..c395e67e3 100644
--- a/src/compositor/wayland_wrapper/wlextendedoutput.cpp
+++ b/src/compositor/wayland_wrapper/wlextendedoutput.cpp
@@ -100,7 +100,7 @@ void ExtendedOutput::sendOutputOrientation(Qt::ScreenOrientation orientation)
default:
sendOpperation = WL_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION;
}
- wl_resource_post_event(m_extended_output_resource,WL_EXTENDED_OUTPUT_SET_SCREEN_ROTATION,sendOpperation);
+ wl_extended_output_send_set_screen_rotation(m_extended_output_resource, sendOpperation);
}
diff --git a/src/compositor/wayland_wrapper/wlextendedsurface.cpp b/src/compositor/wayland_wrapper/wlextendedsurface.cpp
index 948990484..3b46abc9d 100644
--- a/src/compositor/wayland_wrapper/wlextendedsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlextendedsurface.cpp
@@ -104,14 +104,14 @@ void ExtendedSurface::sendGenericProperty(const QString &name, const QVariant &v
data.size = byteValue.size();
data.data = (void*) byteValue.constData();
data.alloc = 0;
- wl_resource_post_event(m_extended_surface_resource,WL_EXTENDED_SURFACE_SET_GENERIC_PROPERTY, qPrintable(name), &data);
+ wl_extended_surface_send_set_generic_property(m_extended_surface_resource, qPrintable(name), &data);
}
void ExtendedSurface::sendOnScreenVisibility(bool visible)
{
int32_t visibleInt = visible;
- wl_resource_post_event(m_extended_surface_resource,WL_EXTENDED_SURFACE_ONSCREEN_VISIBILITY,visibleInt);
+ wl_extended_surface_send_onscreen_visibility(m_extended_surface_resource, visibleInt);
}
diff --git a/src/compositor/wayland_wrapper/wlinputdevice.cpp b/src/compositor/wayland_wrapper/wlinputdevice.cpp
index e9d879766..198c2ba09 100644
--- a/src/compositor/wayland_wrapper/wlinputdevice.cpp
+++ b/src/compositor/wayland_wrapper/wlinputdevice.cpp
@@ -73,8 +73,8 @@ void InputDevice::sendMousePressEvent(Qt::MouseButton button, const QPoint &loca
uint32_t time = m_compositor->currentTimeMsecs();
struct wl_resource *pointer_focus_resource = base()->pointer_focus_resource;
if (pointer_focus_resource) {
- wl_resource_post_event(pointer_focus_resource,
- WL_INPUT_DEVICE_BUTTON, time, toWaylandButton(button), 1);
+ wl_input_device_send_button(pointer_focus_resource,
+ time, toWaylandButton(button), 1);
}
}
@@ -85,22 +85,20 @@ void InputDevice::sendMouseReleaseEvent(Qt::MouseButton button, const QPoint &lo
uint32_t time = m_compositor->currentTimeMsecs();
struct wl_resource *pointer_focus_resource = base()->pointer_focus_resource;
if (pointer_focus_resource) {
- wl_resource_post_event(pointer_focus_resource,
- WL_INPUT_DEVICE_BUTTON, time, toWaylandButton(button), 0);
+ wl_input_device_send_button(pointer_focus_resource,
+ time, toWaylandButton(button), 0);
}
}
void InputDevice::sendMouseMoveEvent(const QPoint &localPos, const QPoint &globalPos)
{
+ Q_UNUSED(globalPos);
uint32_t time = m_compositor->currentTimeMsecs();
struct wl_resource *pointer_focus_resource = base()->pointer_focus_resource;
if (pointer_focus_resource) {
- QPoint validGlobalPos = globalPos.isNull()?localPos:globalPos;
- wl_resource_post_event(pointer_focus_resource,
- WL_INPUT_DEVICE_MOTION,
- time,
- validGlobalPos.x(), validGlobalPos.y(), //wayland sends globals before locals
- localPos.x(), localPos.y());
+ wl_input_device_send_motion(pointer_focus_resource,
+ time,
+ localPos.x(), localPos.y());
}
}
@@ -116,8 +114,8 @@ void InputDevice::sendKeyPressEvent(uint code)
{
if (base()->keyboard_focus_resource != NULL) {
uint32_t time = m_compositor->currentTimeMsecs();
- wl_resource_post_event(base()->keyboard_focus_resource,
- WL_INPUT_DEVICE_KEY, time, code - 8, 1);
+ wl_input_device_send_key(base()->keyboard_focus_resource,
+ time, code - 8, 1);
}
}
@@ -125,8 +123,8 @@ void InputDevice::sendKeyReleaseEvent(uint code)
{
if (base()->keyboard_focus_resource != NULL) {
uint32_t time = m_compositor->currentTimeMsecs();
- wl_resource_post_event(base()->keyboard_focus_resource,
- WL_INPUT_DEVICE_KEY, time, code - 8, 0);
+ wl_input_device_send_key(base()->keyboard_focus_resource,
+ time, code - 8, 0);
}
}
@@ -138,13 +136,13 @@ void InputDevice::sendTouchPointEvent(int id, int x, int y, Qt::TouchPointState
return;
switch (state) {
case Qt::TouchPointPressed:
- wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_DOWN, time, base()->pointer_focus, id, x, y);
+ wl_input_device_send_touch_down(resource, time, &base()->pointer_focus->resource, id, x, y);
break;
case Qt::TouchPointMoved:
- wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_MOTION, time, id, x, y);
+ wl_input_device_send_touch_motion(resource, time, id, x, y);
break;
case Qt::TouchPointReleased:
- wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_UP, time, id);
+ wl_input_device_send_touch_up(resource, time, id);
break;
case Qt::TouchPointStationary:
// stationary points are not sent through wayland, the client must cache them
@@ -158,8 +156,7 @@ void InputDevice::sendTouchFrameEvent()
{
struct wl_resource *resource = base()->pointer_focus_resource;
if (resource) {
- wl_resource_post_event(resource,
- WL_INPUT_DEVICE_TOUCH_FRAME);
+ wl_input_device_send_touch_frame(resource);
}
}
@@ -167,8 +164,7 @@ void InputDevice::sendTouchCancelEvent()
{
struct wl_resource *resource = base()->pointer_focus_resource;
if (resource) {
- wl_resource_post_event(resource,
- WL_INPUT_DEVICE_TOUCH_CANCEL);
+ wl_input_device_send_touch_cancel(resource);
}
}
diff --git a/src/compositor/wayland_wrapper/wloutput.cpp b/src/compositor/wayland_wrapper/wloutput.cpp
index deae56d6e..57d073de6 100644
--- a/src/compositor/wayland_wrapper/wloutput.cpp
+++ b/src/compositor/wayland_wrapper/wloutput.cpp
@@ -88,11 +88,11 @@ Output::Output(OutputGlobal *outputGlobal, wl_client *client, uint32_t version,
{
Q_UNUSED(version);
m_output_resource = wl_client_add_object(client,&wl_output_interface,0,id,this);
- wl_resource_post_event(m_output_resource, WL_OUTPUT_GEOMETRY, 0, 0,
+ wl_output_send_geometry(m_output_resource, 0, 0,
m_output_global->size().width(), m_output_global->size().height(),0,"","");
- wl_resource_post_event(m_output_resource,WL_OUTPUT_MODE, WL_OUTPUT_MODE_CURRENT|WL_OUTPUT_MODE_PREFERRED,
- m_output_global->size().width(),m_output_global->size().height());
+ 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(), 60);
}
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp
index 4bfe521a4..af37d04a9 100644
--- a/src/compositor/wayland_wrapper/wlsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsurface.cpp
@@ -224,7 +224,7 @@ void Surface::sendFrameCallback()
uint time = Compositor::currentTimeMsecs();
struct wl_resource *frame_callback;
wl_list_for_each(frame_callback, &m_frame_callback_list, link) {
- wl_resource_post_event(frame_callback,WL_CALLBACK_DONE,time);
+ wl_callback_send_done(frame_callback, time);
wl_resource_destroy(frame_callback,Compositor::currentTimeMsecs());
}
wl_list_init(&m_frame_callback_list);
diff --git a/src/compositor/wayland_wrapper/wlsurfacebuffer.cpp b/src/compositor/wayland_wrapper/wlsurfacebuffer.cpp
index 01d4c1201..7d3fe9a29 100644
--- a/src/compositor/wayland_wrapper/wlsurfacebuffer.cpp
+++ b/src/compositor/wayland_wrapper/wlsurfacebuffer.cpp
@@ -103,7 +103,7 @@ void SurfaceBuffer::destructBufferState()
void SurfaceBuffer::sendRelease()
{
Q_ASSERT(m_buffer);
- wl_resource_post_event(&m_buffer->resource, WL_BUFFER_RELEASE);
+ wl_buffer_send_release(&m_buffer->resource);
}
void SurfaceBuffer::setPageFlipperHasBuffer(bool owns)
diff --git a/src/compositor/wayland_wrapper/wltouch.cpp b/src/compositor/wayland_wrapper/wltouch.cpp
index 06499b1ae..9038d5982 100644
--- a/src/compositor/wayland_wrapper/wltouch.cpp
+++ b/src/compositor/wayland_wrapper/wltouch.cpp
@@ -87,7 +87,7 @@ void TouchExtensionGlobal::bind_func(wl_client *client, void *data, uint32_t ver
resource->destroy = destroy_resource;
TouchExtensionGlobal *self = static_cast<TouchExtensionGlobal *>(resource->data);
self->m_resources.append(resource);
- wl_resource_post_event(resource, WL_TOUCH_EXTENSION_CONFIGURE, self->m_flags);
+ wl_touch_extension_send_configure(resource, self->m_flags);
}
static inline int toFixed(qreal f)
@@ -160,7 +160,7 @@ void TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, Surface *surface)
}
}
- wl_resource_post_event(target, WL_TOUCH_EXTENSION_TOUCH,
+ wl_touch_extension_send_touch(target,
time, id, state,
x, y, nx, ny, w, h,
pressure, vx, vy,
diff --git a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp
index 75c633244..eed6dc690 100644
--- a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp
+++ b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp
@@ -100,7 +100,7 @@ void WindowManagerServerIntegration::setShowIsFullScreen(bool value)
m_showIsFullScreen = value;
struct wl_resource *resource;
wl_list_for_each(resource,&client_resources, link) {
- wl_resource_post_event(resource, WL_WINDOWMANAGER_HINTS, int32_t(m_showIsFullScreen));
+ wl_windowmanager_send_hints(resource, int32_t(m_showIsFullScreen));
}
}
@@ -111,7 +111,7 @@ void WindowManagerServerIntegration::bind_func(struct wl_client *client, void *d
WindowManagerServerIntegration *win_mgr = static_cast<WindowManagerServerIntegration *>(data);
wl_resource *resource = wl_client_add_object(client,&wl_windowmanager_interface,&windowmanager_interface,id,data);
win_mgr->registerResource(resource);
- wl_resource_post_event(resource, WL_WINDOWMANAGER_HINTS, int32_t(win_mgr->m_showIsFullScreen));
+ wl_windowmanager_send_hints(resource, int32_t(win_mgr->m_showIsFullScreen));
}
diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp
index 5f5c13682..b9c2c67d5 100644
--- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp
+++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp
@@ -83,7 +83,10 @@ void QWaylandDataDeviceManager::enter(void *data,
int32_t y,
struct wl_data_offer *id)
{
+
Q_UNUSED(wl_data_device);
+ Q_UNUSED(x);
+ Q_UNUSED(y);
QWaylandDataDeviceManager *data_device_manager = static_cast<QWaylandDataDeviceManager *>(data);
if (time < data_device_manager->m_drag_last_event_time)
return;
@@ -96,8 +99,8 @@ void QWaylandDataDeviceManager::enter(void *data,
if (!offer)
return;
- QPoint point(x,y);
- Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
+// QPoint point(x,y);
+// Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
// QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(data_device_manager->m_drag_current_event_window->window(),
// offer,point,allActions);
// data_device_manager->m_drag_can_drop = response.accepted();
@@ -135,7 +138,7 @@ void QWaylandDataDeviceManager::motion(void *data,
return;
data_device_manager->m_drag_position = QPoint(x,y);
- Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
+// Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
// QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(data_device_manager->m_drag_current_event_window->window(),
// data_device_manager->m_drag_data_offer, data_device_manager->m_drag_position ,allActions);
// data_device_manager->m_drag_can_drop = response.accepted();
@@ -153,8 +156,8 @@ void QWaylandDataDeviceManager::drop(void *data,
QWaylandDataDeviceManager *data_device_manager = static_cast<QWaylandDataDeviceManager *>(data);
QWindow *window = data_device_manager->m_drag_current_event_window->window();
QMimeData *mime = data_device_manager->m_drag_data_offer;
- QPoint point = data_device_manager->m_drag_position;
- Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
+// QPoint point = data_device_manager->m_drag_position;
+// Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
Q_UNUSED(window);
Q_UNUSED(mime);