Compositor memory leak fixes
[profile/ivi/qtwayland.git] / src / compositor / wayland_wrapper / wlcompositor.h
index 2c22670..d8acad2 100644 (file)
@@ -1,28 +1,26 @@
 /****************************************************************************
 **
-** This file is part of QtCompositor**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
 **
-** Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-**
-** Contact:  Nokia Corporation qt-info@nokia.com
+** 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
+** "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.
+**   * 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
@@ -34,7 +32,9 @@
 ** 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.
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
 **
 ****************************************************************************/
 
 #include "wloutput.h"
 #include "wldisplay.h"
 #include "wlshmbuffer.h"
-#include "wlshell.h"
 
 #include <wayland-server.h>
 
 class WaylandCompositor;
+class WaylandInputDevice;
 class GraphicsHardwareIntegration;
 class WindowManagerServerIntegration;
 class QMimeData;
@@ -65,6 +65,8 @@ class DataDeviceManager;
 class OutputExtensionGlobal;
 class SurfaceExtensionGlobal;
 class SubSurfaceExtensionGlobal;
+class Shell;
+class TouchExtensionGlobal;
 
 class Q_COMPOSITOR_EXPORT Compositor : public QObject
 {
@@ -75,20 +77,15 @@ public:
     ~Compositor();
 
     void frameFinished(Surface *surface = 0);
-    void setInputFocus(Surface *surface);
-    void setKeyFocus(Surface *surface);
-    Surface *keyFocus() const;
-    void setPointerFocus(Surface *surface, const QPoint &point = QPoint());
-    Surface *pointerFocus() const;
 
+    //these 3 functions will be removed if noone steps up soon.
     Surface *getSurfaceFromWinId(uint winId) const;
     struct wl_client *getClientFromWinId(uint winId) const;
     QImage image(uint winId) const;
 
-    InputDevice *inputDevice() { return m_input; }
-    InputDevice *defaultInputDevice();
+    InputDevice *defaultInputDevice(); //we just have 1 default device for now (since QPA doesn't give us anything else)
 
-    void createSurface(struct wl_client *client, int id);
+    void createSurface(struct wl_client *client, uint32_t id);
     void surfaceDestroyed(Surface *surface);
     void markSurfaceAsDirty(Surface *surface);
 
@@ -100,6 +97,7 @@ public:
 
     GraphicsHardwareIntegration *graphicsHWIntegration() const;
     void initializeHardwareIntegration();
+    void initializeDefaultInputDevice();
     void initializeWindowManagerProtocol();
     void enableSubSurfaceExtension();
     bool setDirectRenderSurface(Surface *surface);
@@ -107,7 +105,7 @@ public:
 
     QList<Surface*> surfacesForClient(wl_client* client);
 
-    WaylandCompositor *qtCompositor() const { return m_qt_compositor; }
+    WaylandCompositor *waylandCompositor() const { return m_qt_compositor; }
 
     struct wl_display *wl_display() const { return m_display->handle(); }
 
@@ -120,6 +118,11 @@ public:
     void setScreenOrientation(Qt::ScreenOrientation orientation);
     Qt::ScreenOrientation screenOrientation() const;
     void setOutputGeometry(const QRect &geometry);
+    QRect outputGeometry() const;
+
+    void enableTouchExtension();
+    TouchExtensionGlobal *touchExtension() { return m_touchExtension; }
+    void configureTouchExtension(int flags);
 
     bool isDragging() const;
     void sendDragMoveEvent(const QPoint &global, const QPoint &local, Surface *surface);
@@ -142,14 +145,12 @@ private:
     Display *m_display;
 
     /* Input */
-    InputDevice *m_input;
+    WaylandInputDevice *m_default_wayland_input_device;
+    InputDevice *m_default_input_device;
 
     /* Output */
     //make this a list of the available screens
     OutputGlobal m_output_global;
-
-    Shell m_shell;
-
     /* shm/*/
     ShmHandler m_shm;
 
@@ -167,8 +168,6 @@ private:
     WaylandCompositor *m_qt_compositor;
     Qt::ScreenOrientation m_orientation;
 
-    Surface *m_pointerFocusSurface;
-    Surface *m_keyFocusSurface;
     Surface *m_directRenderSurface;
 
 #ifdef QT_COMPOSITOR_WAYLAND_GL
@@ -178,9 +177,12 @@ private:
     //extensions
     WindowManagerServerIntegration *m_windowManagerIntegration;
 
+
+    Shell *m_shell;
     OutputExtensionGlobal *m_outputExtension;
     SurfaceExtensionGlobal *m_surfaceExtension;
     SubSurfaceExtensionGlobal *m_subSurfaceExtension;
+    TouchExtensionGlobal *m_touchExtension;
 
     static void bind_func(struct wl_client *client, void *data,
                           uint32_t version, uint32_t id);