summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-02-29 16:36:05 +0100
committerJørgen Lind <jorgen.lind@nokia.com>2012-03-05 08:55:30 +0100
commitd36a08d97f03888ffcb77950708195474e7e30d9 (patch)
treeef8804d51b56393565f5284c0236e009f6a7fafd /src/compositor
parentedd424d1ed41434f979abe42428ed74c664d59a2 (diff)
Upgrade to newer wayland SHA-1.
Change-Id: If0c1d86a3011e266cafabeb875bc5616191a8cf4 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/wayland_wrapper/wayland_wrapper.pri6
-rw-r--r--src/compositor/wayland_wrapper/wlcompositor.cpp11
-rw-r--r--src/compositor/wayland_wrapper/wldatadevice.cpp20
-rw-r--r--src/compositor/wayland_wrapper/wldatadevice.h7
-rw-r--r--src/compositor/wayland_wrapper/wlinputdevice.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wlregion.cpp90
-rw-r--r--src/compositor/wayland_wrapper/wlregion.h80
-rw-r--r--src/compositor/wayland_wrapper/wlshellsurface.cpp21
-rw-r--r--src/compositor/wayland_wrapper/wlshellsurface.h8
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.cpp41
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.h10
11 files changed, 260 insertions, 36 deletions
diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri
index 9e4f99e58..abf4d649f 100644
--- a/src/compositor/wayland_wrapper/wayland_wrapper.pri
+++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri
@@ -22,7 +22,8 @@ HEADERS += \
$$PWD/wlsubsurface.h \
$$PWD/wltouch.h \
$$PWD/../../shared/qwaylandmimehelper.h \
- $$PWD/wlsurfacebuffer.h
+ $$PWD/wlsurfacebuffer.h \
+ $$PWD/wlregion.h
SOURCES += \
$$PWD/wlcompositor.cpp \
@@ -41,7 +42,8 @@ SOURCES += \
$$PWD/wlsubsurface.cpp \
$$PWD/wltouch.cpp \
$$PWD/../../shared/qwaylandmimehelper.cpp \
- $$PWD/wlsurfacebuffer.cpp
+ $$PWD/wlsurfacebuffer.cpp \
+ $$PWD/wlregion.cpp
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/../../shared
diff --git a/src/compositor/wayland_wrapper/wlcompositor.cpp b/src/compositor/wayland_wrapper/wlcompositor.cpp
index 46bb1138f..6cd9a3dcb 100644
--- a/src/compositor/wayland_wrapper/wlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/wlcompositor.cpp
@@ -53,6 +53,7 @@
#include "wlshellsurface.h"
#include "wltouch.h"
#include "wlinputdevice.h"
+#include "wlregion.h"
#include <QWindow>
#include <QSocketNotifier>
@@ -89,8 +90,16 @@ void compositor_create_surface(struct wl_client *client,
static_cast<Compositor *>(resource->data)->createSurface(client,id);
}
+void compositor_create_region(struct wl_client *client,
+ struct wl_resource *compositor, uint32_t id)
+{
+ Q_UNUSED(compositor);
+ new Region(client, id);
+}
+
const static struct wl_compositor_interface compositor_interface = {
- compositor_create_surface
+ compositor_create_surface,
+ compositor_create_region
};
void Compositor::bind_func(struct wl_client *client, void *data,
diff --git a/src/compositor/wayland_wrapper/wldatadevice.cpp b/src/compositor/wayland_wrapper/wldatadevice.cpp
index 06c036ec6..abcf67b45 100644
--- a/src/compositor/wayland_wrapper/wldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/wldatadevice.cpp
@@ -54,34 +54,19 @@ void DataDevice::start_drag(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *source,
struct wl_resource *surface,
+ struct wl_resource *icon,
uint32_t time)
{
Q_UNUSED(client);
Q_UNUSED(surface);
+ Q_UNUSED(icon);
Q_UNUSED(time);
-
DataDevice *data_device = static_cast<DataDevice *>(resource->data);
DataSource *data_source = static_cast<DataSource *>(source->data);
-
Q_UNUSED(data_device);
Q_UNUSED(data_source);
}
-void DataDevice::attach(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t time,
- struct wl_resource *buffer,
- int32_t x,
- int32_t y)
-{
- Q_UNUSED(client);
- Q_UNUSED(resource);
- Q_UNUSED(time);
- Q_UNUSED(buffer);
- Q_UNUSED(x);
- Q_UNUSED(y);
-}
-
void DataDevice::set_selection(struct wl_client *client,
struct wl_resource *data_device_resource,
struct wl_resource *source,
@@ -98,7 +83,6 @@ void DataDevice::set_selection(struct wl_client *client,
const struct wl_data_device_interface DataDevice::data_device_interface = {
DataDevice::start_drag,
- DataDevice::attach,
DataDevice::set_selection
};
diff --git a/src/compositor/wayland_wrapper/wldatadevice.h b/src/compositor/wayland_wrapper/wldatadevice.h
index 8cdec5233..373820c29 100644
--- a/src/compositor/wayland_wrapper/wldatadevice.h
+++ b/src/compositor/wayland_wrapper/wldatadevice.h
@@ -69,13 +69,8 @@ private:
struct wl_resource *resource,
struct wl_resource *source,
struct wl_resource *surface,
+ struct wl_resource *icon,
uint32_t time);
- static void attach(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t time,
- struct wl_resource *buffer,
- int32_t x,
- int32_t y);
static void set_selection(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *source,
diff --git a/src/compositor/wayland_wrapper/wlinputdevice.cpp b/src/compositor/wayland_wrapper/wlinputdevice.cpp
index 57d1e3d9a..e9d879766 100644
--- a/src/compositor/wayland_wrapper/wlinputdevice.cpp
+++ b/src/compositor/wayland_wrapper/wlinputdevice.cpp
@@ -223,10 +223,10 @@ Surface *InputDevice::mouseFocus() const
void InputDevice::setMouseFocus(Surface *surface, const QPoint &globalPos, const QPoint &localPos)
{
+ Q_UNUSED(globalPos);
wl_input_device_set_pointer_focus(base(),
surface ? surface->base() : 0,
m_compositor->currentTimeMsecs(),
- globalPos.x(), globalPos.y(),
localPos.x(), localPos.y());
}
diff --git a/src/compositor/wayland_wrapper/wlregion.cpp b/src/compositor/wayland_wrapper/wlregion.cpp
new file mode 100644
index 000000000..7553da7af
--- /dev/null
+++ b/src/compositor/wayland_wrapper/wlregion.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "wlregion.h"
+
+#include "wlcompositor.h"
+
+namespace Wayland {
+
+void destroy_region(struct wl_resource *resource)
+{
+ delete resolve<Region>(resource);
+}
+
+Region::Region(struct wl_client *client, uint32_t id)
+{
+ addClientResource(client, base(), id, &wl_region_interface,
+ &region_interface, destroy_region);
+}
+
+Region::~Region()
+{
+}
+
+const struct wl_region_interface Region::region_interface = {
+ region_destroy,
+ region_add,
+ region_subtract
+};
+
+void Region::region_destroy(wl_client *client, wl_resource *region)
+{
+ Q_UNUSED(client);
+ wl_resource_destroy(region, Compositor::currentTimeMsecs());
+}
+
+void Region::region_add(wl_client *client, wl_resource *region,
+ int32_t x, int32_t y, int32_t w, int32_t h)
+{
+ Q_UNUSED(client);
+ resolve<Region>(region)->m_region += QRect(x, y, w, h);
+}
+
+void Region::region_subtract(wl_client *client, wl_resource *region,
+ int32_t x, int32_t y, int32_t w, int32_t h)
+{
+ Q_UNUSED(client);
+ resolve<Region>(region)->m_region -= QRect(x, y, w, h);
+}
+
+}
+
+
diff --git a/src/compositor/wayland_wrapper/wlregion.h b/src/compositor/wayland_wrapper/wlregion.h
new file mode 100644
index 000000000..d2f083a44
--- /dev/null
+++ b/src/compositor/wayland_wrapper/wlregion.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WL_REGION_H
+#define WL_REGION_H
+
+#include "waylandexport.h"
+#include "waylandobject.h"
+
+#include <QRegion>
+
+#include <wayland-util.h>
+
+namespace Wayland {
+
+class Q_COMPOSITOR_EXPORT Region : public Object<wl_resource>
+{
+public:
+ Region(struct wl_client *client, uint32_t id);
+ ~Region();
+
+ uint id() const { return base()->object.id; }
+
+ QRegion region() const { return m_region; }
+
+ static const struct wl_region_interface region_interface;
+
+private:
+ Q_DISABLE_COPY(Region)
+
+ QRegion m_region;
+
+ static void region_destroy(wl_client *client, wl_resource *region);
+ static void region_add(wl_client *client, wl_resource *region,
+ int32_t x, int32_t y, int32_t w, int32_t h);
+ static void region_subtract(wl_client *client, wl_resource *region,
+ int32_t x, int32_t y, int32_t w, int32_t h);
+};
+
+}
+
+#endif // WL_REGION_H
+
diff --git a/src/compositor/wayland_wrapper/wlshellsurface.cpp b/src/compositor/wayland_wrapper/wlshellsurface.cpp
index 39c60a2ee..ea4b54b62 100644
--- a/src/compositor/wayland_wrapper/wlshellsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlshellsurface.cpp
@@ -134,10 +134,16 @@ void ShellSurface::set_transient(struct wl_client *client,
}
void ShellSurface::set_fullscreen(struct wl_client *client,
- struct wl_resource *shell_surface_resource)
+ struct wl_resource *shell_surface_resource,
+ uint32_t method,
+ uint32_t framerate,
+ struct wl_resource *output)
{
Q_UNUSED(client);
Q_UNUSED(shell_surface_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)
@@ -152,14 +158,23 @@ 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,
+ struct wl_resource *output)
+{
+ Q_UNUSED(client);
+ Q_UNUSED(shell_surface_resource);
+ Q_UNUSED(output);
+}
+
const struct wl_shell_surface_interface ShellSurface::shell_surface_interface = {
ShellSurface::move,
ShellSurface::resize,
ShellSurface::set_toplevel,
ShellSurface::set_transient,
ShellSurface::set_fullscreen,
- ShellSurface::set_popup
-
+ ShellSurface::set_popup,
+ ShellSurface::set_maximized
};
}
diff --git a/src/compositor/wayland_wrapper/wlshellsurface.h b/src/compositor/wayland_wrapper/wlshellsurface.h
index 0f2469c57..a4eacd7b1 100644
--- a/src/compositor/wayland_wrapper/wlshellsurface.h
+++ b/src/compositor/wayland_wrapper/wlshellsurface.h
@@ -91,7 +91,10 @@ private:
int y,
uint32_t flags);
static void set_fullscreen(struct wl_client *client,
- struct wl_resource *shell_surface_resource);
+ 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,
@@ -100,6 +103,9 @@ private:
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 const struct wl_shell_surface_interface shell_surface_interface;
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp
index f7721c1a7..4bfe521a4 100644
--- a/src/compositor/wayland_wrapper/wlsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsurface.cpp
@@ -47,6 +47,7 @@
#include "wlshmbuffer.h"
#include "wlinputdevice.h"
#include "wlextendedsurface.h"
+#include "wlregion.h"
#include "wlsubsurface.h"
#include "wlsurfacebuffer.h"
#include "wlshellsurface.h"
@@ -83,6 +84,8 @@ Surface::Surface(struct wl_client *client, uint32_t id, Compositor *compositor)
, m_extendedSurface(0)
, m_subSurface(0)
, m_shellSurface(0)
+ , m_inputRegion(0)
+ , m_opaqueRegion(0)
{
wl_list_init(&m_frame_callback_list);
addClientResource(client, &base()->resource, id, &wl_surface_interface,
@@ -164,10 +167,22 @@ QSize Surface::size() const
void Surface::setSize(const QSize &size)
{
- bool emitChange = size != m_size;
- m_size = size;
- if (emitChange)
+ if (size != m_size) {
+ m_opaqueRegion = QRegion();
+ m_inputRegion = QRegion(QRect(QPoint(), size));
+ m_size = size;
m_waylandSurface->sizeChanged();
+ }
+}
+
+QRegion Surface::inputRegion() const
+{
+ return m_inputRegion;
+}
+
+QRegion Surface::opaqueRegion() const
+{
+ return m_opaqueRegion;
}
QImage Surface::image() const
@@ -403,7 +418,9 @@ const struct wl_surface_interface Surface::surface_interface = {
Surface::surface_destroy,
Surface::surface_attach,
Surface::surface_damage,
- Surface::surface_frame
+ Surface::surface_frame,
+ Surface::surface_set_opaque_region,
+ Surface::surface_set_input_region
};
void Surface::surface_destroy(struct wl_client *, struct wl_resource *surface_resource)
@@ -436,5 +453,21 @@ void Surface::surface_frame(struct wl_client *client,
wl_list_insert(&surface->m_frame_callback_list,&frame_callback->link);
}
+void Surface::surface_set_opaque_region(struct wl_client *client, struct wl_resource *surfaceResource,
+ struct wl_resource *region)
+{
+ Q_UNUSED(client);
+ Surface *surface = resolve<Surface>(surfaceResource);
+ surface->m_opaqueRegion = region ? resolve<Region>(region)->region() : QRegion();
+}
+
+void Surface::surface_set_input_region(struct wl_client *client, struct wl_resource *surfaceResource,
+ struct wl_resource *region)
+{
+ Q_UNUSED(client);
+ Surface *surface = resolve<Surface>(surfaceResource);
+ surface->m_inputRegion = region ? resolve<Region>(region)->region() : QRegion(QRect(QPoint(), surface->size()));
+}
+
} // namespace Wayland
diff --git a/src/compositor/wayland_wrapper/wlsurface.h b/src/compositor/wayland_wrapper/wlsurface.h
index 7ad0bcd53..0d917cbd8 100644
--- a/src/compositor/wayland_wrapper/wlsurface.h
+++ b/src/compositor/wayland_wrapper/wlsurface.h
@@ -91,6 +91,9 @@ public:
QSize size() const;
void setSize(const QSize &size);
+ QRegion inputRegion() const;
+ QRegion opaqueRegion() const;
+
QImage image() const;
#ifdef QT_COMPOSITOR_WAYLAND_GL
@@ -138,6 +141,9 @@ private:
SubSurface *m_subSurface;
ShellSurface *m_shellSurface;
+ QRegion m_inputRegion;
+ QRegion m_opaqueRegion;
+
static const int buffer_pool_size = 3;
SurfaceBuffer *m_bufferPool[buffer_pool_size];
@@ -161,6 +167,10 @@ private:
int32_t x, int32_t y, int32_t width, int32_t height);
static void surface_frame(struct wl_client *client, struct wl_resource *resource,
uint32_t callback);
+ static void surface_set_opaque_region(struct wl_client *client, struct wl_resource *resource,
+ struct wl_resource *region);
+ static void surface_set_input_region(struct wl_client *client, struct wl_resource *resource,
+ struct wl_resource *region);
};