~unity-2d-team/unity-2d/window-focus-fixes

« back to all changes in this revision

Viewing changes to libunity-2d-private/src/dashclient.cpp

  • Committer: Tarmac
  • Author(s): Gerry Boland, Michał Sawicz
  • Date: 2012-02-28 11:30:52 UTC
  • mfrom: (915.1.61 hud-qml)
  • Revision ID: tarmac-20120228113052-ko3v4z076cq2aanr
Add HUD to Unity 2D

Known issue:
- on switching between Dash & Hud (tap Alt, then Super, then Alt...) blurred background image will contain Hud/Dash.. Fixes: https://bugs.launchpad.net/bugs/942045. Approved by Albert Astals Cid.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
: QObject(parent)
45
45
, m_dashDbusIface(0)
46
46
, m_dashActive(false)
 
47
, m_hudActive(false)
47
48
, m_alwaysFullScreen(false)
48
49
{
49
50
    /* Check if the dash is already up and running by asking the bus instead of
75
76
                                         QDBusConnection::sessionBus(), this);
76
77
    connect(m_dashDbusIface, SIGNAL(activeChanged(bool)),
77
78
            SLOT(slotDashActiveChanged(bool)));
 
79
    connect(m_dashDbusIface, SIGNAL(hudActiveChanged(bool)),
 
80
            SLOT(slotHudActiveChanged(bool)));
78
81
    connect(m_dashDbusIface, SIGNAL(alwaysFullScreenChanged(bool)),
79
82
            SLOT(slotAlwaysFullScreenChanged(bool)));
80
83
 
91
94
    } else {
92
95
        UQ_WARNING << "Fetching Dash.alwaysFullScreen property failed";
93
96
    }
 
97
 
 
98
    value = m_dashDbusIface->property("hudActive");
 
99
    if (value.isValid()) {
 
100
        m_hudActive = value.toBool();
 
101
    } else {
 
102
        UQ_WARNING << "Fetching Dash.hudActive property failed";
 
103
    }
94
104
}
95
105
 
96
106
DashClient* DashClient::instance()
107
117
    Q_EMIT activeChanged(value);
108
118
}
109
119
 
 
120
void DashClient::slotHudActiveChanged(bool value)
 
121
{
 
122
    if (m_hudActive != value) {
 
123
        m_hudActive = value;
 
124
    }
 
125
    Q_EMIT hudActiveChanged(value);
 
126
}
 
127
 
110
128
bool DashClient::active() const
111
129
{
112
130
    return m_dashActive;
113
131
}
114
132
 
 
133
bool DashClient::hudActive() const
 
134
{
 
135
    return m_hudActive;
 
136
}
 
137
 
115
138
void DashClient::setActive(bool active)
116
139
{
117
140
    if (!active) {
125
148
    }
126
149
}
127
150
 
 
151
void DashClient::setHudActive(bool active)
 
152
{
 
153
    if (!active) {
 
154
        // Use m_dashDbusIface only if the shell is running
 
155
        if (m_dashDbusIface) {
 
156
            m_dashDbusIface->setProperty("hudActive", false);
 
157
        }
 
158
    } else {
 
159
        QDBusInterface iface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);
 
160
        iface.setProperty("hudActive", true);
 
161
    }
 
162
}
 
163
 
128
164
void DashClient::slotAlwaysFullScreenChanged(bool value)
129
165
{
130
166
    if (m_alwaysFullScreen != value) {