~lukas-kde/miral/shellchrome-windowinfo

« back to all changes in this revision

Viewing changes to miral-qt/src/platforms/mirserver/windowcontroller.cpp

  • Committer: Larry Price
  • Date: 2016-09-13 16:19:29 UTC
  • mto: (330.4.1 miral)
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: larry.price@canonical.com-20160913161929-vs9ka1capmljq1es
Removing miral-qt from release branch, updating copyright file, and adding GPL3 license to root dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2016 Canonical, Ltd.
3
 
 *
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.
7
 
 *
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.
12
 
 *
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/>.
15
 
 */
16
 
 
17
 
#include "windowcontroller.h"
18
 
 
19
 
#include "windowmanagementpolicy.h"
20
 
#include "mirqtconversion.h"
21
 
 
22
 
using namespace qtmir;
23
 
 
24
 
 
25
 
WindowController::WindowController()
26
 
    : m_policy(nullptr)
27
 
{
28
 
}
29
 
 
30
 
void WindowController::focus(const miral::Window &window)
31
 
{
32
 
    if (m_policy) {
33
 
        m_policy->focus(window);
34
 
    }
35
 
}
36
 
 
37
 
void WindowController::resize(const miral::Window &window, const QSize &size)
38
 
{
39
 
    if (m_policy) {
40
 
        m_policy->resize(window, toMirSize(size));
41
 
    }
42
 
}
43
 
 
44
 
void WindowController::move(const miral::Window &window, const QPoint &topLeft)
45
 
{
46
 
    if (m_policy) {
47
 
        m_policy->move(window, toMirPoint(topLeft));
48
 
    }
49
 
}
50
 
 
51
 
void WindowController::requestClose(const miral::Window &window)
52
 
{
53
 
    if (m_policy) {
54
 
        m_policy->ask_client_to_close(window);
55
 
    }
56
 
}
57
 
 
58
 
void WindowController::setActiveFocus(const miral::Window &/*window*/, const bool /*activeFocus*/)
59
 
{
60
 
 
61
 
}
62
 
 
63
 
void WindowController::setState(const miral::Window &/*window*/, const MirSurfaceState /*state*/)
64
 
{
65
 
 
66
 
}
67
 
 
68
 
void WindowController::deliverKeyboardEvent(const miral::Window &window, const MirKeyboardEvent *event)
69
 
{
70
 
    if (m_policy) {
71
 
        m_policy->deliver_keyboard_event(event, window);
72
 
    }
73
 
}
74
 
 
75
 
void WindowController::deliverTouchEvent(const miral::Window &window, const MirTouchEvent *event)
76
 
{
77
 
    if (m_policy) {
78
 
        m_policy->deliver_touch_event(event, window);
79
 
    }
80
 
}
81
 
 
82
 
void WindowController::deliverPointerEvent(const miral::Window &window, const MirPointerEvent *event)
83
 
{
84
 
    if (m_policy) {
85
 
        m_policy->deliver_pointer_event(event, window);
86
 
    }
87
 
}
88
 
 
89
 
void WindowController::setPolicy(WindowManagementPolicy * const policy)
90
 
{
91
 
    m_policy = policy;
92
 
}