summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2012-01-09 18:53:22 +0100
committerSamuel Rødal <samuel.rodal@nokia.com>2012-01-10 15:49:25 +0100
commite35d1a00541f3f2a1ed692a910b86f9344d12085 (patch)
tree8fc73c50288f6d958496f9973754f6005a3856e0 /src
parenta1001e818426209574a9db62532dabcd880c06f7 (diff)
Create a ShellSurface class
so that we can actually do something usefull in the callbacks Change-Id: Ie8e85757bf5c90caa40db34df1b8bc642ba09962 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/compositor/wayland_wrapper/wayland_wrapper.pri4
-rw-r--r--src/compositor/wayland_wrapper/wlcompositor.cpp3
-rw-r--r--src/compositor/wayland_wrapper/wlcompositor.h7
-rw-r--r--src/compositor/wayland_wrapper/wlshellsurface.cpp (renamed from src/compositor/wayland_wrapper/wlshell.cpp)60
-rw-r--r--src/compositor/wayland_wrapper/wlshellsurface.h (renamed from src/compositor/wayland_wrapper/wlshell.h)32
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.cpp14
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.h4
7 files changed, 80 insertions, 44 deletions
diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri
index 6340f5c3f..8bb7b172b 100644
--- a/src/compositor/wayland_wrapper/wayland_wrapper.pri
+++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri
@@ -10,7 +10,7 @@ HEADERS += \
$$PWD/wloutput.h \
$$PWD/wlshmbuffer.h \
$$PWD/wlsurface.h \
- $$PWD/wlshell.h \
+ $$PWD/wlshellsurface.h \
$$PWD/wlinputdevice.h \
$$PWD/wldatadevicemanager.h \
$$PWD/wldatadevice.h \
@@ -26,7 +26,7 @@ SOURCES += \
$$PWD/wloutput.cpp \
$$PWD/wlshmbuffer.cpp \
$$PWD/wlsurface.cpp \
- $$PWD/wlshell.cpp \
+ $$PWD/wlshellsurface.cpp \
$$PWD/wlinputdevice.cpp \
$$PWD/wldatadevicemanager.cpp \
$$PWD/wldatadevice.cpp \
diff --git a/src/compositor/wayland_wrapper/wlcompositor.cpp b/src/compositor/wayland_wrapper/wlcompositor.cpp
index 067263cc4..d777921a2 100644
--- a/src/compositor/wayland_wrapper/wlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/wlcompositor.cpp
@@ -50,6 +50,7 @@
#include "wlextendedoutput.h"
#include "wlextendedsurface.h"
#include "wlsubsurface.h"
+#include "wlshellsurface.h"
#include <QWindow>
#include <QSocketNotifier>
@@ -106,7 +107,6 @@ Compositor *Compositor::instance()
Compositor::Compositor(WaylandCompositor *qt_compositor)
: m_display(new Display)
- , m_shell(this)
, m_shm(m_display)
, m_current_frame(0)
, m_last_queued_buf(-1)
@@ -141,6 +141,7 @@ Compositor::Compositor(WaylandCompositor *qt_compositor)
wl_display_add_global(m_display->handle(), &wl_shell_interface, &m_shell, Shell::bind_func);
+ m_shell = new Shell(this);
m_outputExtension = new OutputExtensionGlobal(this);
m_surfaceExtension = new SurfaceExtensionGlobal(this);
diff --git a/src/compositor/wayland_wrapper/wlcompositor.h b/src/compositor/wayland_wrapper/wlcompositor.h
index 828df0976..60b0f02d6 100644
--- a/src/compositor/wayland_wrapper/wlcompositor.h
+++ b/src/compositor/wayland_wrapper/wlcompositor.h
@@ -48,7 +48,6 @@
#include "wloutput.h"
#include "wldisplay.h"
#include "wlshmbuffer.h"
-#include "wlshell.h"
#include <wayland-server.h>
@@ -65,6 +64,7 @@ class DataDeviceManager;
class OutputExtensionGlobal;
class SurfaceExtensionGlobal;
class SubSurfaceExtensionGlobal;
+class Shell;
class Q_COMPOSITOR_EXPORT Compositor : public QObject
{
@@ -147,9 +147,6 @@ private:
/* Output */
//make this a list of the available screens
OutputGlobal m_output_global;
-
- Shell m_shell;
-
/* shm/*/
ShmHandler m_shm;
@@ -176,6 +173,8 @@ private:
//extensions
WindowManagerServerIntegration *m_windowManagerIntegration;
+
+ Shell *m_shell;
OutputExtensionGlobal *m_outputExtension;
SurfaceExtensionGlobal *m_surfaceExtension;
SubSurfaceExtensionGlobal *m_subSurfaceExtension;
diff --git a/src/compositor/wayland_wrapper/wlshell.cpp b/src/compositor/wayland_wrapper/wlshellsurface.cpp
index c395ae950..3b7e29e43 100644
--- a/src/compositor/wayland_wrapper/wlshell.cpp
+++ b/src/compositor/wayland_wrapper/wlshellsurface.cpp
@@ -38,11 +38,11 @@
**
****************************************************************************/
-#include "wlshell.h"
-
-#include "wlcompositor.h"
+#include "wlshellsurface.h"
#include "wlcompositor.h"
+#include "wlsurface.h"
+#include "wlinputdevice.h"
#include <QtCore/qglobal.h>
#include <QtCore/QDebug>
@@ -63,17 +63,25 @@ void Shell::bind_func(struct wl_client *client, void *data,
void Shell::get_shell_surface(struct wl_client *client,
struct wl_resource *shell_resource,
uint32_t id,
- struct wl_resource *surface)
+ struct wl_resource *surface_super)
{
- Q_UNUSED(surface);
- wl_client_add_object(client,&wl_shell_surface_interface,&shell_surface_interface,id,shell_resource->data);
+ Q_UNUSED(shell_resource);
+ Surface *surface = reinterpret_cast<Surface *>(surface_super);
+ new ShellSurface(client,id,surface);
}
const struct wl_shell_interface Shell::shell_interface = {
Shell::get_shell_surface
};
-void Shell::shell_surface_move(struct wl_client *client,
+ShellSurface::ShellSurface(wl_client *client, uint32_t id, Surface *surface)
+{
+ m_shellSurface = wl_client_add_object(client,&wl_shell_surface_interface,&shell_surface_interface,id,this);
+ surface->setShellSurface(this);
+
+}
+
+void ShellSurface::move(struct wl_client *client,
struct wl_resource *shell_surface_resource,
struct wl_resource *input_device,
uint32_t time)
@@ -84,55 +92,53 @@ void Shell::shell_surface_move(struct wl_client *client,
Q_UNUSED(time);
}
-void Shell::shell_surface_resize(struct wl_client *client,
+void ShellSurface::resize(struct wl_client *client,
struct wl_resource *shell_surface_resource,
- struct wl_resource *input_device,
+ struct wl_resource *input_device_super,
uint32_t time,
uint32_t edges)
{
- Q_UNUSED(client);
Q_UNUSED(shell_surface_resource);
- Q_UNUSED(input_device);
- Q_UNUSED(time);
- Q_UNUSED(edges);
+ ShellSurface *shell_surface = static_cast<ShellSurface *>(shell_surface_resource->data);
+ InputDevice *input_device = static_cast<InputDevice *>(input_device_super->data);
}
-void Shell::shell_surface_set_toplevel(struct wl_client *client,
+void ShellSurface::set_toplevel(struct wl_client *client,
struct wl_resource *shell_surface_resource)
{
Q_UNUSED(client);
Q_UNUSED(shell_surface_resource);
}
-void Shell::shell_surface_set_transient(struct wl_client *client,
+void ShellSurface::set_transient(struct wl_client *client,
struct wl_resource *shell_surface_resource,
- struct wl_resource *parent,
+ struct wl_resource *parent_shell_surface_resource,
int x,
int y,
uint32_t flags)
{
Q_UNUSED(client);
- Q_UNUSED(shell_surface_resource);
- Q_UNUSED(parent);
- Q_UNUSED(x);
- Q_UNUSED(y);
Q_UNUSED(flags);
+ ShellSurface *shell_surface = static_cast<ShellSurface *>(shell_surface_resource->data);
+ ShellSurface *parent_shell_surface = static_cast<ShellSurface *>(parent_shell_surface_resource->data);
+ QPointF point = parent_shell_surface->m_surface->pos() + QPoint(x,y);
+ shell_surface->m_surface->setPos(point);
}
-void Shell::shell_surface_set_fullscreen(struct wl_client *client,
+void ShellSurface::set_fullscreen(struct wl_client *client,
struct wl_resource *shell_surface_resource)
{
Q_UNUSED(client);
Q_UNUSED(shell_surface_resource);
}
-const struct wl_shell_surface_interface Shell::shell_surface_interface = {
- Shell::shell_surface_move,
- Shell::shell_surface_resize,
- Shell::shell_surface_set_toplevel,
- Shell::shell_surface_set_transient,
- Shell::shell_surface_set_fullscreen
+const struct wl_shell_surface_interface ShellSurface::shell_surface_interface = {
+ ShellSurface::move,
+ ShellSurface::resize,
+ ShellSurface::set_toplevel,
+ ShellSurface::set_transient,
+ ShellSurface::set_fullscreen
};
}
diff --git a/src/compositor/wayland_wrapper/wlshell.h b/src/compositor/wayland_wrapper/wlshellsurface.h
index 981c31f02..a97d079d4 100644
--- a/src/compositor/wayland_wrapper/wlshell.h
+++ b/src/compositor/wayland_wrapper/wlshellsurface.h
@@ -38,14 +38,15 @@
**
****************************************************************************/
-#ifndef WLSHELL_H
-#define WLSHELL_H
+#ifndef WLSHELLSURFACE_H
+#define WLSHELLSURFACE_H
-#include "waylandresourcecollection.h"
+#include <wayland-server.h>
namespace Wayland {
class Compositor;
+class Surface;
class Shell
{
@@ -61,24 +62,35 @@ private:
struct wl_resource *surface);
static const struct wl_shell_interface shell_interface;
- static void shell_surface_move(struct wl_client *client,
+};
+
+class ShellSurface
+{
+public:
+ ShellSurface(struct wl_client *client, uint32_t id, Surface *surface);
+
+private:
+ struct wl_resource *m_shellSurface;
+ Surface *m_surface;
+
+ static void move(struct wl_client *client,
struct wl_resource *shell_surface_resource,
- struct wl_resource *input_device,
+ struct wl_resource *input_device_super,
uint32_t time);
- static void shell_surface_resize(struct wl_client *client,
+ 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 shell_surface_set_toplevel(struct wl_client *client,
+ static void set_toplevel(struct wl_client *client,
struct wl_resource *shell_surface_resource);
- static void shell_surface_set_transient(struct wl_client *client,
+ static void set_transient(struct wl_client *client,
struct wl_resource *shell_surface_resource,
struct wl_resource *parent,
int x,
int y,
uint32_t flags);
- static void shell_surface_set_fullscreen(struct wl_client *client,
+ static void set_fullscreen(struct wl_client *client,
struct wl_resource *shell_surface_resource);
static const struct wl_shell_surface_interface shell_surface_interface;
@@ -87,4 +99,4 @@ private:
}
-#endif // WLSHELL_H
+#endif // WLSHELLSURFACE_H
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp
index fdfd14bf8..591619d3f 100644
--- a/src/compositor/wayland_wrapper/wlsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsurface.cpp
@@ -235,6 +235,7 @@ public:
, processId(0)
, extendedSurface(0)
, subSurface(0)
+ , shellSurface(0)
, q_ptr(surface)
{
@@ -352,6 +353,7 @@ public:
ExtendedSurface *extendedSurface;
SubSurface *subSurface;
+ ShellSurface *shellSurface;
SurfaceBuffer bufferPool[buffer_pool_size];
@@ -653,6 +655,18 @@ SubSurface *Surface::subSurface() const
return d->subSurface;
}
+void Surface::setShellSurface(ShellSurface *shellSurface)
+{
+ Q_D(Surface);
+ d->shellSurface = shellSurface;
+}
+
+ShellSurface *Surface::shellSurface() const
+{
+ Q_D(const Surface);
+ return d->shellSurface;
+}
+
void Surface::sendMousePressEvent(int x, int y, Qt::MouseButton button)
{
Q_D(Surface);
diff --git a/src/compositor/wayland_wrapper/wlsurface.h b/src/compositor/wayland_wrapper/wlsurface.h
index e784c6cf5..c7f139320 100644
--- a/src/compositor/wayland_wrapper/wlsurface.h
+++ b/src/compositor/wayland_wrapper/wlsurface.h
@@ -67,6 +67,7 @@ class Compositor;
class Buffer;
class ExtendedSurface;
class SubSurface;
+class ShellSurface;
class SurfacePrivate;
@@ -135,6 +136,9 @@ public:
void setSubSurface(SubSurface *subSurface);
SubSurface *subSurface() const;
+ void setShellSurface(ShellSurface *shellSurface);
+ ShellSurface *shellSurface() const;
+
static const struct wl_surface_interface surface_interface;
protected:
QScopedPointer<SurfacePrivate> d_ptr;