{
}
+WaylandInputDevice::~WaylandInputDevice()
+{
+ delete d;
+}
+
void WaylandInputDevice::sendMousePressEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos)
{
d->sendMousePressEvent(button,localPos,globalPos);
{
public:
WaylandInputDevice(WaylandCompositor *compositor);
+ ~WaylandInputDevice();
void sendMousePressEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos = QPoint());
void sendMouseReleaseEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos = QPoint());
{
public:
GraphicsHardwareIntegration(WaylandCompositor *compositor);
+ virtual ~GraphicsHardwareIntegration() { }
virtual void initializeHardware(Wayland::Display *waylandDisplay) = 0;
XCompositeGLXIntegration::XCompositeGLXIntegration(WaylandCompositor *compositor)
: GraphicsHardwareIntegration(compositor)
, mDisplay(0)
+ , mHandler(0)
{
QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
if (nativeInterface) {
mScreen = XDefaultScreen(mDisplay);
}
+XCompositeGLXIntegration::~XCompositeGLXIntegration()
+{
+ delete mHandler;
+}
+
void XCompositeGLXIntegration::initializeHardware(Wayland::Display *waylandDisplay)
{
- XCompositeHandler *handler = new XCompositeHandler(m_compositor->handle(),mDisplay,m_compositor->window());
- wl_display_add_global(waylandDisplay->handle(),&wl_xcomposite_interface,handler,XCompositeHandler::xcomposite_bind_func);
+ mHandler = new XCompositeHandler(m_compositor->handle(),mDisplay,m_compositor->window());
+ wl_display_add_global(waylandDisplay->handle(),&wl_xcomposite_interface,mHandler,XCompositeHandler::xcomposite_bind_func);
QOpenGLContext *glContext = new QOpenGLContext();
glContext->create();
#include <GL/glx.h>
#include <GL/glxext.h>
+class XCompositeHandler;
+
class XCompositeGLXIntegration : public GraphicsHardwareIntegration
{
public:
XCompositeGLXIntegration(WaylandCompositor *compositor);
+ ~XCompositeGLXIntegration();
void initializeHardware(Wayland::Display *waylandDisplay);
Display *mDisplay;
int mScreen;
+ XCompositeHandler *mHandler;
};
#endif // XCOMPOSITEGLXINTEGRATION_H
wl_display_add_global(m_display->handle(),&wl_output_interface, &m_output_global,OutputGlobal::output_bind_func);
- wl_display_add_global(m_display->handle(), &wl_shell_interface, &m_shell, Shell::bind_func);
-
m_shell = new Shell();
+ wl_display_add_global(m_display->handle(), &wl_shell_interface, m_shell, Shell::bind_func);
+
m_outputExtension = new OutputExtensionGlobal(this);
m_surfaceExtension = new SurfaceExtensionGlobal(this);
Compositor::~Compositor()
{
- delete m_default_input_device;
+ delete m_shell;
+ delete m_outputExtension;
+ delete m_surfaceExtension;
+ delete m_subSurfaceExtension;
+ delete m_touchExtension;
+
+ delete m_default_wayland_input_device;
delete m_data_device_manager;
+#ifdef QT_COMPOSITOR_WAYLAND_GL
+ delete m_graphics_hw_integration;
+#endif
+
delete m_display;
}
void Compositor::initializeDefaultInputDevice()
{
- WaylandInputDevice *defaultInput = new WaylandInputDevice(m_qt_compositor);
- m_default_input_device = defaultInput->handle();
+ m_default_wayland_input_device = new WaylandInputDevice(m_qt_compositor);
+ m_default_input_device = m_default_wayland_input_device->handle();
}
void Compositor::initializeWindowManagerProtocol()
#include <wayland-server.h>
class WaylandCompositor;
+class WaylandInputDevice;
class GraphicsHardwareIntegration;
class WindowManagerServerIntegration;
class QMimeData;
Display *m_display;
/* Input */
+ WaylandInputDevice *m_default_wayland_input_device;
InputDevice *m_default_input_device;
/* Output */
wl_display_add_global(compositor->wl_display(),&wl_input_device_interface,this,InputDevice::bind_func);
}
+InputDevice::~InputDevice()
+{
+ qDeleteAll(m_data_devices);
+}
+
void InputDevice::sendMousePressEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos)
{
sendMouseMoveEvent(localPos,globalPos);
localPos.x(), localPos.y());
}
-void InputDevice::cleanupDataDeviceForClient(struct wl_client *client)
+void InputDevice::cleanupDataDeviceForClient(struct wl_client *client, bool destroyDev)
{
for (int i = 0; i < m_data_devices.size(); i++) {
struct wl_resource *data_device_resource =
m_data_devices.at(i)->dataDeviceResource();
if (data_device_resource->client == client) {
+ if (destroyDev)
+ delete m_data_devices.at(i);
m_data_devices.removeAt(i);
break;
}
void InputDevice::clientRequestedDataDevice(DataDeviceManager *data_device_manager, struct wl_client *client, uint32_t id)
{
- cleanupDataDeviceForClient(client);
+ cleanupDataDeviceForClient(client, false);
DataDevice *dataDevice = new DataDevice(data_device_manager,client,id);
m_data_devices.append(dataDevice);
}
input_device->base()->pointer_focus_resource = 0;
}
- input_device->cleanupDataDeviceForClient(resource->client);
+ input_device->cleanupDataDeviceForClient(resource->client, true);
wl_list_remove(&resource->link);
{
public:
InputDevice(WaylandInputDevice *handle, Compositor *compositor);
+ ~InputDevice();
void sendMousePressEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos = QPoint());
void sendMouseReleaseEvent(Qt::MouseButton button, const QPoint &localPos, const QPoint &globalPos = QPoint());
WaylandInputDevice *handle() const;
private:
- void cleanupDataDeviceForClient(struct wl_client *client);
+ void cleanupDataDeviceForClient(struct wl_client *client, bool destroyDev);
WaylandInputDevice *m_handle;
Compositor *m_compositor;
****************************************************************************/
#include "wloutput.h"
+#include "wlextendedoutput.h"
#include <QGuiApplication>
#include <QtGui/QScreen>
#include <QRect>
m_geometry = QRect(QPoint(0, 0), screen->availableGeometry().size());
}
+OutputGlobal::~OutputGlobal()
+{
+ qDeleteAll(m_outputs);
+}
+
void OutputGlobal::setGeometry(const QRect &geometry)
{
m_geometry = geometry;
Output *output = new Output(output_global,client,version,id);
output_global->registerResource(output->handle());
+ output_global->m_outputs.append(output);
}
}
+Output::~Output()
+{
+ delete m_extended_output;
+}
+
ExtendedOutput *Output::extendedOutput() const
{
return m_extended_output;
#include "waylandresourcecollection.h"
#include <QtCore/QRect>
-
+#include <QtCore/QList>
namespace Wayland {
{
public:
OutputGlobal();
+ ~OutputGlobal();
void setGeometry(const QRect &geometry);
QRect geometry() const { return m_geometry; }
QRect m_geometry;
int m_displayId;
int m_numQueued;
+ QList<Output *> m_outputs;
};
{
public:
Output(OutputGlobal *outputGlobal, wl_client *client, uint32_t version, uint32_t id);
+ ~Output();
OutputGlobal *outputGlobal() const;
#include "wlextendedsurface.h"
#include "wlsubsurface.h"
#include "wlsurfacebuffer.h"
+#include "wlshellsurface.h"
#include <QtCore/QDebug>
#include <QTouchEvent>
Surface::~Surface()
{
delete m_waylandSurface;
+ delete m_extendedSurface;
+ delete m_subSurface;
+ delete m_shellSurface;
}
WaylandSurface::Type Surface::type() const
{
}
+WindowManagerServerIntegration::~WindowManagerServerIntegration()
+{
+ qDeleteAll(m_managedClients);
+}
+
void WindowManagerServerIntegration::initialize(Wayland::Display *waylandDisplay)
{
wl_display_add_global(waylandDisplay->handle(),&wl_windowmanager_interface,this,WindowManagerServerIntegration::bind_func);
void WindowManagerServerIntegration::mapClientToProcess(wl_client *client, uint32_t processId)
{
- WaylandManagedClient *managedClient = m_managedClients.value(client, new WaylandManagedClient);
+ WaylandManagedClient *managedClient = m_managedClients.value(client);
+ if (!managedClient)
+ managedClient = new WaylandManagedClient;
managedClient->m_processId = processId;
m_managedClients.insert(client, managedClient);
}
{
Q_ASSERT(token != 0 && *token != 0);
- WaylandManagedClient *managedClient = m_managedClients.value(client, new WaylandManagedClient);
+ WaylandManagedClient *managedClient = m_managedClients.value(client);
+ if (!managedClient)
+ managedClient = new WaylandManagedClient;
managedClient->m_authenticationToken = QByteArray(token);
m_managedClients.insert(client, managedClient);
Q_OBJECT
public:
WindowManagerServerIntegration(QObject *parent = 0);
+ ~WindowManagerServerIntegration();
+
void initialize(Wayland::Display *waylandDisplay);
void removeClient(wl_client *client);