~ci-train-bot/qtubuntu/qtubuntu-ubuntu-xenial-landing-057

« back to all changes in this revision

Viewing changes to src/ubuntumirclient/integration.cpp

  • Committer: CI Train Bot
  • Author(s): Alberto Aguirre
  • Date: 2015-11-17 14:49:21 UTC
  • mfrom: (258.6.46 use-mir-surface-apis)
  • Revision ID: ci-train-bot@canonical.com-20151117144921-nrpn5zal5ncrjxvt
Add support for Qt popups and dialog windows.

I have done some refactoring, cleanup and some bug fixing.

- An UbuntuWindow internally creates UbuntuSurface
- UbuntuSurface is responsible for creating the mir surfaces and calling mir apis
- Fix mutex locking (now really protecting access to mSurface) was not locked properly (QMutexLocker temporaries were created : QMutexLocker(&d->mutex) instead of QMutexLocker lock(&d->mutex).
- Handling resize events from the server has been improved.
-- Old resize events are dropped - meaning no redraw requests are issued if we know there are newer resize events in the queue
-- Redraw requests are never issued through the rendering thread only through the Qt event dispatch thread.
-- No flushing of event queue which leads to fewer interruptions in other surfaces (specially noticeable on surfaces that do animations).
- Workaround QtCreator not assigning a parent to its menu bar menus
-- The last focused window is tracked and used if a Qt popup is created without a parent
- Client requested resizes (through setGeometry) is now supported
- Resizing constraints are supported (propagateSizeHints)
- Visibility and window state are tracked separately
- Better focusing event handling
-- When an app has multiple windows, mir will send focus lost/gain pairs,
   in which case we need to peek into the queue to avoid telling Qt to unfocus all windows prematurely.
Approved by: PS Jenkins bot, Daniel d'Andrada

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
 */
16
16
 
17
 
// Qt
18
 
#include <QGuiApplication>
19
 
#include <private/qguiapplication_p.h>
20
 
#include <qpa/qplatformnativeinterface.h>
21
 
#include <qpa/qplatforminputcontextfactory_p.h>
22
 
#include <qpa/qplatforminputcontext.h>
23
 
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
24
 
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
25
 
#include <QOpenGLContext>
26
 
 
27
17
// Local
 
18
#include "integration.h"
28
19
#include "backingstore.h"
29
20
#include "clipboard.h"
30
21
#include "glcontext.h"
31
22
#include "input.h"
32
 
#include "integration.h"
33
23
#include "logging.h"
34
24
#include "nativeinterface.h"
35
25
#include "screen.h"
36
26
#include "theme.h"
37
27
#include "window.h"
38
28
 
 
29
// Qt
 
30
#include <QGuiApplication>
 
31
#include <private/qguiapplication_p.h>
 
32
#include <qpa/qplatformnativeinterface.h>
 
33
#include <qpa/qplatforminputcontextfactory_p.h>
 
34
#include <qpa/qplatforminputcontext.h>
 
35
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
 
36
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
 
37
#include <QOpenGLContext>
 
38
 
39
39
// platform-api
40
40
#include <ubuntu/application/lifecycle_delegate.h>
41
41
#include <ubuntu/application/id.h>
162
162
 
163
163
QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window)
164
164
{
165
 
    QPlatformWindow* platformWindow = new UbuntuWindow(
166
 
            window, mClipboard, static_cast<UbuntuScreen*>(mScreen), mInput, u_application_instance_get_mir_connection(mInstance));
167
 
    platformWindow->requestActivateWindow();
168
 
    return platformWindow;
 
165
    return new UbuntuWindow(window, mClipboard, static_cast<UbuntuScreen*>(mScreen),
 
166
                            mInput, u_application_instance_get_mir_connection(mInstance));
169
167
}
170
168
 
171
169
bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const
173
171
    switch (cap) {
174
172
    case ThreadedPixmaps:
175
173
        return true;
176
 
        break;
177
174
 
178
175
    case OpenGL:
179
176
        return true;
180
 
        break;
181
177
 
182
178
    case ThreadedOpenGL:
183
179
        if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_THREADED_OPENGL")) {
186
182
            DLOG("ubuntumirclient: disabled threaded OpenGL");
187
183
            return false;
188
184
        }
189
 
        break;
190
 
 
 
185
    case MultipleWindows:
 
186
    case NonFullScreenWindows:
 
187
        return true;
191
188
    default:
192
189
        return QPlatformIntegration::hasCapability(cap);
193
190
    }