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

« back to all changes in this revision

Viewing changes to src/ubuntumirclient/glcontext.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:
109
109
    ASSERT(eglSwapBuffers(mEglDisplay, eglSurface) == EGL_TRUE);
110
110
#endif
111
111
 
112
 
    // "Technique" copied from mir, in examples/eglapp.c around line 96
113
 
    EGLint newBufferWidth = -1;
114
 
    EGLint newBufferHeight = -1;
115
 
    /*
116
 
     * Querying the surface (actually the current buffer) dimensions here is
117
 
     * the only truly safe way to be sure that the dimensions we think we
118
 
     * have are those of the buffer being rendered to. But this should be
119
 
     * improved in future; https://bugs.launchpad.net/mir/+bug/1194384
120
 
     */
121
 
    eglQuerySurface(mEglDisplay, eglSurface, EGL_WIDTH, &newBufferWidth);
122
 
    eglQuerySurface(mEglDisplay, eglSurface, EGL_HEIGHT, &newBufferHeight);
123
 
 
124
 
    ubuntuWindow->onBuffersSwapped_threadSafe(newBufferWidth, newBufferHeight);
 
112
    ubuntuWindow->onSwapBuffersDone();
125
113
}
126
114
 
127
115
void (*UbuntuOpenGLContext::getProcAddress(const QByteArray& procName)) ()