2
* Copyright (C) 2014-2015 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 3, as published by
6
* the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
#ifndef SESSIONOBSERVER_H
18
#define SESSIONOBSERVER_H
26
#include <mir/scene/surface_observer.h>
33
class SurfaceSpecification;
37
class SurfaceObserver : public QObject, public mir::scene::SurfaceObserver
43
virtual ~SurfaceObserver();
45
void setListener(QObject *listener);
47
void attrib_changed(MirSurfaceAttrib, int) override;
48
void resized_to(mir::geometry::Size const&) override;
49
void moved_to(mir::geometry::Point const&) override {}
50
void hidden_set_to(bool) override {}
52
// Get new frame notifications from Mir, called from a Mir thread.
53
void frame_posted(int frames_available, mir::geometry::Size const& size ) override;
55
void alpha_set_to(float) override {}
56
void transformation_set_to(glm::mat4 const&) override {}
57
void reception_mode_set_to(mir::input::InputReceptionMode) override {}
58
void cursor_image_set_to(mir::graphics::CursorImage const&) override;
59
void orientation_set_to(MirOrientation) override {}
60
void client_surface_close_requested() override {}
61
void keymap_changed(MirInputDeviceId, std::string const& model, std::string const& layout,
62
std::string const& variant, std::string const& options) override;
63
void renamed(char const * name) override;
64
void cursor_image_removed() override;
66
void notifySurfaceModifications(const mir::shell::SurfaceSpecification&);
68
static SurfaceObserver *observerForSurface(const mir::scene::Surface *surface);
69
static void registerObserverForSurface(SurfaceObserver *observer, const mir::scene::Surface *surface);
73
void attributeChanged(const MirSurfaceAttrib attribute, const int value);
75
void resized(const QSize &size);
76
void keymapChanged(const QString &rules, const QString &variant);
77
void nameChanged(const QString &name);
78
void cursorChanged(const QCursor &cursor);
80
void minimumWidthChanged(int);
81
void minimumHeightChanged(int);
82
void maximumWidthChanged(int);
83
void maximumHeightChanged(int);
84
void widthIncrementChanged(int);
85
void heightIncrementChanged(int);
86
void shellChromeChanged(MirShellChrome);
89
QCursor createQCursorFromMirCursorImage(const mir::graphics::CursorImage &cursorImage);
92
QMap<QByteArray, Qt::CursorShape> m_cursorNameToShape;
93
static QMap<const mir::scene::Surface*, SurfaceObserver*> m_surfaceToObserverMap;