~veebers/ubuntu-keyboard/adding_autopilot_tests_and_emulators

« back to all changes in this revision

Viewing changes to src/plugin/ubuntuapplicationapiwrapper.cpp

  • Committer: Christopher Lee
  • Date: 2013-08-23 00:06:00 UTC
  • mfrom: (8.2.12 trunk)
  • Revision ID: chris.lee@canonical.com-20130823000600-885nwornbawsx5ba
Merge Trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU 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 "ubuntuapplicationapiwrapper.h"
 
18
 
 
19
#ifdef QT_OPENGL_ES_2
 
20
#include <ubuntu/ui/ubuntu_ui_session_service.h>
 
21
#include <ubuntu/application/ui/window_properties.h>
 
22
  #define HAVE_UBUNTU_PLATFORM_API
 
23
#endif
 
24
 
 
25
#include <QtGlobal>
 
26
#include <QByteArray>
 
27
 
 
28
UbuntuApplicationApiWrapper::UbuntuApplicationApiWrapper()
 
29
    : m_runningOnMir(false)
 
30
{
 
31
    if (qgetenv("QT_QPA_PLATFORM") == "ubuntumirclient") {
 
32
        m_runningOnMir = false;
 
33
    }
 
34
}
 
35
 
 
36
void UbuntuApplicationApiWrapper::reportOSKVisible(const int x, const int y, const int width, const int height)
 
37
{
 
38
#ifdef HAVE_UBUNTU_PLATFORM_API
 
39
    if (!m_runningOnMir) { // following method not implemented on Mir
 
40
        ubuntu_ui_report_osk_visible(x, y, width, height);
 
41
    }
 
42
#else
 
43
    Q_UNUSED(x)
 
44
    Q_UNUSED(y)
 
45
    Q_UNUSED(width)
 
46
    Q_UNUSED(height)
 
47
#endif
 
48
}
 
49
 
 
50
void UbuntuApplicationApiWrapper::reportOSKInvisible()
 
51
{
 
52
#ifdef HAVE_UBUNTU_PLATFORM_API
 
53
    if (!m_runningOnMir) { // following method not implemented on Mir
 
54
        ubuntu_ui_report_osk_invisible();
 
55
    }
 
56
#endif
 
57
}
 
58
 
 
59
int UbuntuApplicationApiWrapper::oskWindowRole() const
 
60
{
 
61
#ifdef HAVE_UBUNTU_PLATFORM_API
 
62
    return static_cast<int>(U_ON_SCREEN_KEYBOARD_ROLE);
 
63
#else
 
64
    return 7;
 
65
#endif
 
66
}
 
67