Merge lp:~albaguirre/qtubuntu/use-mir-surface-apis into lp:qtubuntu
| Status: | Merged |
|---|---|
| Approved by: | Daniel d'Andrada on 2015-10-28 |
| Approved revision: | 302 |
| Merged at revision: | 290 |
| Proposed branch: | lp:~albaguirre/qtubuntu/use-mir-surface-apis |
| Merge into: | lp:qtubuntu |
| Prerequisite: | lp:~dandrader/qtubuntu/busySwap-lp1473720 |
| Diff against target: |
1390 lines (+587/-421) 9 files modified
src/ubuntumirclient/glcontext.cpp (+1/-13) src/ubuntumirclient/input.cpp (+37/-10) src/ubuntumirclient/input.h (+10/-5) src/ubuntumirclient/integration.cpp (+16/-19) src/ubuntumirclient/nativeinterface.cpp (+5/-5) src/ubuntumirclient/screen.cpp (+9/-6) src/ubuntumirclient/screen.h (+2/-0) src/ubuntumirclient/window.cpp (+491/-350) src/ubuntumirclient/window.h (+16/-13) |
| To merge this branch: | bzr merge lp:~albaguirre/qtubuntu/use-mir-surface-apis |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Daniel d'Andrada (community) | Approve on 2015-10-28 | ||
| PS Jenkins bot | continuous-integration | 2015-08-06 | Approve on 2015-10-27 |
| Gerry Boland | 2015-08-06 | Abstain on 2015-10-21 | |
| Alberto Aguirre | Abstain on 2015-10-16 | ||
|
Review via email:
|
|||
This proposal supersedes a proposal from 2015-06-17.
Commit Message
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(
- 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 (propagateSizeH
- 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.
Description of the Change
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(
- 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 (propagateSizeH
- 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.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:271
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:273
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:274
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| Gerry Boland (gerboland) wrote : | # |
+++ src/ubuntumircl
+ MirSurface * const mirSurface_;
+ EGLSurface eglSurface_;
Class members are named mSomething in qtubuntu, please adopt that naming scheme.
+MirPixelFormat defaultPixelFor
....
+ return format;
+}
+}
That last brace is the end of the namespace, would you please stick a comment like "// namespace" after it, helps me see the namespace end more clearly.
+ if (state == Qt::WindowFullS
+ auto displayConfig = mir_connection_
+ if (displayConfig-
+ auto outputId = displayConfig-
Think we should add a FIXME here, as we're guessing there's only 1 display at the moment.
+void UbuntuWindowPri
+{
+ mir_wait_
Does this need to be sync?
+ geom.setY(
/me wants to kill this so badly! :)
#if !defined(
- LOG("panelHeight: '%d'", panelHeight);
+ DLOG("[
The QT_NO_DEBUG should do the same things as DLOG - only print when compiled in debug mode. So can probably drop the !defined(
The fun part is testing, I'll be at that soon. While I know we're missing the window management side of things, should I give some real apps a try? What would you consider fair testing?
| Alberto Aguirre (albaguirre) wrote : | # |
@Gerry, yeah any real apps. I tried QtCreator in the desktop and mir_demo_server. It's not quite there yet - the big one is the relative positioning for the embedded window.
| Alberto Aguirre (albaguirre) wrote : | # |
>+ geom.setY(
>/me wants to kill this so badly! :)
Can we? We added a debug mirclient library to support autopilot testing a while back (mir_toolkit/
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:275
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
| Alberto Aguirre (albaguirre) wrote : | # |
>+void UbuntuWindowPri
>+{
>+ mir_wait_
>Does this need to be sync?
As in does the call really need to wait for the wait handle? or call a mir_surface_
In any case the wait for set_state is pre-existing, so I didn't change it.
The rest should be fixed now.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:276
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:277
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| Gerry Boland (gerboland) wrote : | # |
Just tested, no regressions on touch, let's go with it
| Gerry Boland (gerboland) wrote : | # |
Hmm crashing on startup. Seems expose event happening before the GL context is set up
| Alberto Aguirre (albaguirre) wrote : | # |
OK, will retest. Startup of touch? Or startup of an app?
| Gerry Boland (gerboland) wrote : | # |
Startup of app
| Alberto Aguirre (albaguirre) wrote : | # |
> Hmm crashing on startup. Seems expose event happening before the GL context is
> set up
Fixed - I made a typo during the variable renaming, I was returning the mir surface instead of the EGL surface.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:278
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| Alberto Aguirre (albaguirre) wrote : | # |
Actually this looks like it will need some more work. After the rebase and mir 0.14 things are not working quite right...
There's some issues:
- Displaying a menu (http://
-- No rendering is done (looks grey) until the mouse hovers the menu area - adding a handleExposeEvent during setGeometry helps but I don't think that's the right place for it.
-- Qt destroys the menu window immediately after shown - mir sends a focus false event for the parent surface and focus true event for the menu surface which is translated to handleWindowAct
Since the menu surface is already visible the first call makes Qt destroy the menu surface.
-- mir is not destroying submenu surfaces when they lose focus
Visibility and window state are both linked to the mir surface state - if a window is made invisible, this makes the mir surface always stay in the minimized state.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:281
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| Alberto Aguirre (albaguirre) wrote : | # |
Updated it to address issues mentioned above.
| Daniel d'Andrada (dandrader) wrote : | # |
Not the easiest diff to follow as you also do a lot of refactoring along with it.
| Daniel d'Andrada (dandrader) wrote : | # |
There are some tab characters in UbuntuWindow:
----
Could you please bring back the frameNumber debug variable?
| Daniel d'Andrada (dandrader) wrote : | # |
"""
if (!focused) {
// Mir will send a pair of events when a new surface is focused, one for the surface
// that was unfocused and one for the surface what just gained focus. There is no
// equivalent Qt API to "unfocus" a single window only handleWindowAct
// which has different semantics (all windows lose focus) which is problematic for popups.
// Hence unfocused events are ignored.
return;
}
"""
This is a true regression, will break current behavior and create bugs.
Look at these scenarios:
Scenario 1 (focus then unfocus):
* Application creates top level window A
* Window A gets focused.
- qtubuntu sees that A is not active[1] and thus calls handleWindowAct
* Application creates pop-up window B
* Window B gets focused
- qtubuntu sees that B is not active and thus calls handleWindowAct
* Window A gets unfocused.
- qtbuntu sees that A is not active already, so no need to do anything
Scenario 2 (unfocus then focus):
* Application creates top level window A
* Window A gets focused.
- qtubuntu sees that A is not active and thus calls handleWindowAct
* Application creates pop-up window B
* Window A gets unfocused.
- qtbuntu sees that A is active and thus calls handleWindowAct
* Window B gets focused
- qtubuntu sees that B is not active and thus calls handleWindowAct
Could you make it work that way?
[1] see QGuiApplication
| Daniel d'Andrada (dandrader) wrote : | # |
There's a rogue tab char also in UbuntuWindow:
| Daniel d'Andrada (dandrader) wrote : | # |
"""
// TODO: Use the new mir_surface_
// Will have to change qtmir and unity8 for that.
"""
Could you please keep that comment somewhere?
- 282. By Alberto Aguirre on 2015-10-21
-
Remove tab chars
- 283. By Alberto Aguirre on 2015-10-21
-
Do not remove framenumber debug logs
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:283
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| Alberto Aguirre (albaguirre) wrote : | # |
"This is a true regression, will break current behavior and create bugs."
Why would that be the case? Can you elaborate or describe a test case I can run?
handleSurfaceFo
- 284. By Alberto Aguirre on 2015-10-21
-
Restore TODO to use mir_surface_
state_hidden - 285. By Alberto Aguirre on 2015-10-21
-
Send expose event if Qt resizes a window after its visible.
Some window types created in QML are made visible before their final geometry is set. If the content of the window does not update, the first frame will be grey unless we inform Qt of the new exposed size.
- 286. By Alberto Aguirre on 2015-10-21
-
When a window is made visible expose the correct region in local coordinates.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:286
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| Daniel d'Andrada (dandrader) wrote : | # |
On 21/10/2015 17:47, Alberto Aguirre wrote:
> "This is a true regression, will break current behavior and create bugs."
>
> Why would that be the case? Can you elaborate or describe a test case I can run?
>
> handleSurfaceFo
>
>
Switching focus between applications. The application that lost focus
would still think it's active.
- 287. By Alberto Aguirre on 2015-10-22
-
Track the last surface to receive input.
The last surface to receive input can be used as a parent when QT decides to create popups without parent information (such as the menubar menus in qtcreator).
- 288. By Alberto Aguirre on 2015-10-22
-
More cleanup.
Go back to creating surfaces at window creation time. On older QT releases, some menu surfaces
did not have transientParent information at create time. - 289. By Alberto Aguirre on 2015-10-22
-
Fix usage of mutex to protect private state.
Previously "QMutexLocker(
&d->mMutex) " was used which is just a temporary that gets immedietely deleted so there was no mutex protection. - 290. By Alberto Aguirre on 2015-10-22
-
Initialize egl surface at construction time.
Windows are created at construction time again, so eglsurfaces are safe to be constructed there too.
- 291. By Alberto Aguirre on 2015-10-23
-
More cleanup
- 292. By Alberto Aguirre on 2015-10-23
-
Fix resize handling behavior.
We discard old accumulated resize events to avoid issuing too many redraw events greatly
improving resize performance. - 293. By Alberto Aguirre on 2015-10-23
-
Use screen output id when creating a fullscreen mir surface.
- 294. By Alberto Aguirre on 2015-10-24
-
Avoid telling Qt that no windows have focus when receiving a focus lost/gained pair.
Mir may send a focus lost/gained pair of events whenever a new surface gains focus (previous surface loses focus).
Qt's handleWindowActivated API however only supports focusing a single window or not focusing anything.
When processing the surface focus lost message we need to peek into the pending events to check for any posted focus gained event so that only a single handleWindowActivated call is made. - 295. By Alberto Aguirre on 2015-10-25
-
Support morphing non-modal to modal dialog.
QML dialogs are not parented when created. The transientParent will be set after creation but before the window is made visible.
Update the mir surface with the new parent information when the window is made visible - 296. By Alberto Aguirre on 2015-10-25
-
Support updating title
- 297. By Alberto Aguirre on 2015-10-25
-
Add support for propagateSizeHints
- 298. By Alberto Aguirre on 2015-10-25
-
Update log message
- 299. By Alberto Aguirre on 2015-10-25
-
Slight cleanup
- 300. By Alberto Aguirre on 2015-10-26
-
Fix resize corner case
- 301. By Alberto Aguirre on 2015-10-26
-
merge lp:qtubuntu, fix conflicts
| Alberto Aguirre (albaguirre) wrote : | # |
> On 21/10/2015 17:47, Alberto Aguirre wrote:
> > "This is a true regression, will break current behavior and create bugs."
> >
> > Why would that be the case? Can you elaborate or describe a test case I can
> run?
> >
> > handleSurfaceFo
> >
> >
> Switching focus between applications. The application that lost focus
> would still think it's active.
OK I've fixed that now.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:301
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| Daniel d'Andrada (dandrader) wrote : | # |
In UbuntuWindow:
"""
auto const numRepaints = mSurface-
DLOG(
for (int i = 0; i < numRepaints; i++) {
}
"""
You sure this works as you expect?
From what I understand, if you queue two expose events for processing, they will both be processed on the same event loop iteration and the second one will be pretty much a NO-OP as a redraw will already be scheduled at that point (ie, window will already be dirty/exposed).
| Daniel d'Andrada (dandrader) wrote : | # |
Since this is quite a big change, the commit message deserves more information. Copy-pasted the description text into it.
| Daniel d'Andrada (dandrader) wrote : | # |
Didn't stop any regressions on the phone or desktop.
Trying out qtcreator with mir_proving_server is mostly ok. Although I did get a crash when selecting text and dragging. Maybe during the creation some popup/tooltip I guess...
http://
But it's is a major improvement over the current situation where qtcreator wouldn't run at all.
| Daniel d'Andrada (dandrader) wrote : | # |
s/Didn't stop/Didn't spot/
| Alberto Aguirre (albaguirre) wrote : | # |
@Daniel, I would suggest using mir_demo_server instead as that has the window management rules that are in mir core.
We consider mir_proving_server experimental.
| Alberto Aguirre (albaguirre) wrote : | # |
> In UbuntuWindow:
>
> """
> auto const numRepaints = mSurface-
> DLOG("[
> times", window(), numRepaints);
> for (int i = 0; i < numRepaints; i++) {
> DLOG("[
> width=%d, height=%d", window(), geometry(
> geometry(
> QWindowSystemIn
> geometry(
> }
> """
>
> You sure this works as you expect?
>
> From what I understand, if you queue two expose events for processing, they
> will both be processed on the same event loop iteration and the second one
> will be pretty much a NO-OP as a redraw will already be scheduled at that
> point (ie, window will already be dirty/exposed).
Yeah you can see the output logs that the two redraw events are handled and it makes
sense because this is the callstack for an expose event for a QQuickWindow:
QSGGuiThreadRen
QSGGuiThreadRen
QQuickWindow:
QGuiApplication
QWindowSystemIn
The main checks through out that call stack are:
- QWindow::isExposed, QPlatformWindow
In QSGGuiThreadRen
- QQuickWindowPri
--- which does: (https:/
- and another isVisible check before issuing a swapBuffers (https:/
The end result is that issuing the two calls, the first event waits for swapBuffers, which can then update the geometry (and that geometry change event I suppose is prioritized because it's generated by the rendering thread) - in the second event, then the scengraph should render with the new geometry.
- 302. By Alberto Aguirre on 2015-10-27
-
Don't create 0x0 mir surfaces
Seems to be a bug in the pixmap window that is created for the drag and drop default platform implementation.
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:302
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
| Daniel d'Andrada (dandrader) wrote : | # |
"""
QSGGuiThreadRen
QSGGuiThreadRen
QQuickWindow:
QGuiApplication
QWindowSystemIn
"""
I think that call stack will only happen if event delivery is synchronous (synchronousWin
But anyway, if you checked and did see the results you expected than that's enough for me. Won't delve into it.
| Alberto Aguirre (albaguirre) wrote : | # |
>
> """
> QSGGuiThreadRen
> QSGGuiThreadRen
> QQuickWindow:
> QGuiApplication
> QWindowSystemIn
> """
>
> I think that call stack will only happen if event delivery is synchronous
> (synchronousWin
>
> But anyway, if you checked and did see the results you expected than that's
> enough for me. Won't delve into it.
Yeah sorry, it was more of a "logical" call stack. Yeah handleExposeEVent will queue into the event queue. Then the event queue dispatcher will then eventually call QGuiApplication
| Gerry Boland (gerboland) wrote : | # |
I think you've removed a hack that was added to work around the fact qt has no idea of the window position on screen, which Autopilot relied on to calculate absolute input coordinates.
I'm working on correctly fixing this (i.e. removing the hack, using the mir-client-debug API), so please hold off landing this until my branch is ready
| Alberto Aguirre (albaguirre) wrote : | # |
@Gerry,
Yes I did.. though I didn't remove the offset in the input coordinates which mentions the same workaround - I wasn't sure how it helped there.
"I'm working on correctly fixing this"
Awesome!
"please hold off landing this until my branch is ready"
Will do.
| Daniel d'Andrada (dandrader) wrote : | # |
Could you please merge lp:~dandrader/qtubuntu/fix-use-mir-surface-apis ?
That will allow us to merge this branch right away
| Daniel d'Andrada (dandrader) wrote : | # |
Because of that, more specifically: http://
- 303. By Alberto Aguirre on 2015-11-16
| Daniel d'Andrada (dandrader) wrote : | # |
And we should set size hints also on window creation:
http://
Otherwise size hints that the user set before showing the window (which is the moment the backing QPlatformWindow gets created) will be ignored.
- 304. By Alberto Aguirre on 2015-11-16

PASSED: Continuous integration, rev:269 jenkins. qa.ubuntu. com/job/ qtubuntu- ci/215/ jenkins. qa.ubuntu. com/job/ qtubuntu- wily-armhf- ci/6 jenkins. qa.ubuntu. com/job/ qtubuntu- wily-armhf- ci/6/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/qtubuntu- ci/215/ rebuild
http://