Merge lp:~dandrader/qtubuntu/resizeToolTip into lp:qtubuntu

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Michał Sawicz
Approved revision: 367
Merged at revision: 364
Proposed branch: lp:~dandrader/qtubuntu/resizeToolTip
Merge into: lp:qtubuntu
Prerequisite: lp:~gerboland/qtubuntu/fix-ftbfs-mir0.25
Diff against target: 71 lines (+26/-22)
1 file modified
src/ubuntumirclient/window.cpp (+26/-22)
To merge this branch: bzr merge lp:~dandrader/qtubuntu/resizeToolTip
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Gerry Boland (community) Approve
Review via email: mp+313799@code.launchpad.net

Commit message

Resize menus and toolips when told to do so

Description of the change

Fixes the following bug that you can see when running the childWindows branches + https://code.launchpad.net/~alan-griffiths/miral/fix-1652109/+merge/313782

1 - launch Kate
2 - Open some big text file (at least hundreds of lines long)
3 - scroll to the very top
4 - shorten the Kate window so that it doesn't not show many lines at once
5 - press and hold the down arrow on the scroll bar
6 - see the tooltip displaying some line numbers

expected outcome:
tooltip gets wider once it starts diplaying numbers bigger than 99

actual outcome:
numbers get squeezed once they get past 99

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:364
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/165/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3630
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3658
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3504
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3504/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3504
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3504/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3504
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3504/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3504
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3504/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3504
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3504/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3504
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3504/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/165/rebuild

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

You're removing the ability for Qt to reposition an existing surface. I believe I've seen some Qt apps doing that for tooltips, resize & reposition a single surface which it used for all tooltips.

Thus I'm not happy with this, but the core point is correct (not setting the new geometry in the surface spec if surface also moved)

review: Needs Information
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 05/01/2017 15:32, Gerry Boland wrote:
> Review: Needs Information
>
> You're removing the ability for Qt to reposition an existing surface. I believe I've seen some Qt apps doing that for tooltips, resize & reposition a single surface which it used for all tooltips.
>
> Thus I'm not happy with this, but the core point is correct (not setting the new geometry in the surface spec if surface also moved)

I'm not seeing the original code doing anything with the geometry
received from Qt (including position) for the so-called movable types.
How come the original code resizes and repositions "movable" types? Am I
missing something?

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 17/01/2017 17:15, Daniel d'Andrada wrote:
> On 05/01/2017 15:32, Gerry Boland wrote:
>> Review: Needs Information
>>
>> You're removing the ability for Qt to reposition an existing surface. I believe I've seen some Qt apps doing that for tooltips, resize & reposition a single surface which it used for all tooltips.
>>
>> Thus I'm not happy with this, but the core point is correct (not setting the new geometry in the surface spec if surface also moved)
> I'm not seeing the original code doing anything with the geometry
> received from Qt (including position) for the so-called movable types.
> How come the original code resizes and repositions "movable" types? Am I
> missing something?
>
>
Got it now. Fixed.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:365
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/171/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3839
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3867
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3710
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3710/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3710
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3710/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3710
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3710/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3710
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3710/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3710
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3710/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3710
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3710/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/171/rebuild

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

/me wonders what happens if a client asks to move & resize a surface type that mir considered not-movable. Does it still get resized?

I guess we'll figure that out when we hit an example of that.

But confirmed this works ok with Kate and a few Qt demos

review: Approve
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 18/01/2017 12:26, Gerry Boland wrote:
> Review: Approve
>
> /me wonders what happens if a client asks to move & resize a surface type that mir considered not-movable. Does it still get resized?
>

It's just a client request, server not obliged to comply. Furthermore,
movement requests only happens for child windows.

Revision history for this message
Gerry Boland (gerboland) wrote :

Testing this with silo 2313, with Kate, try opening the popup menus from the bottom-right panel (tabs style, text encoding..)

With this, the surface positions are incorrect, usually 0,0
Without this, the surface positions are more correct, just sized wrong.

I think the parent check is problematic here

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 19/01/2017 12:41, Gerry Boland wrote:
> Review: Needs Fixing
>
> Testing this with silo 2313, with Kate, try opening the popup menus from the bottom-right panel (tabs style, text encoding..)
>
> With this, the surface positions are incorrect, usually 0,0
> Without this, the surface positions are more correct, just sized wrong.
>
> I think the parent check is problematic here

Yes, fixed.

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Would like to see the CI run after the recent changes (top approval changed)

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:366
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/172/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3867
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3895
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3740
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3740/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3740
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3740/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3740
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3740/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3740
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3740/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3740
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3740/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3740
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3740/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/172/rebuild

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

Yes, better

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:367
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/173/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3882
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3910
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3754/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3754
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3754/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/173/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntumirclient/window.cpp'
2--- src/ubuntumirclient/window.cpp 2016-12-09 17:02:57 +0000
3+++ src/ubuntumirclient/window.cpp 2017-01-19 18:27:48 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright (C) 2014-2016 Canonical, Ltd.
7+ * Copyright (C) 2014-2017 Canonical, Ltd.
8 *
9 * This program is free software: you can redistribute it and/or modify it under
10 * the terms of the GNU Lesser General Public License version 3, as published by
11@@ -222,18 +222,6 @@
12 return requiresParent(qtWindowTypeToMirSurfaceType(type));
13 }
14
15-bool isMovable(const Qt::WindowType type)
16-{
17- auto mirType = qtWindowTypeToMirSurfaceType(type);
18- switch (mirType) {
19- case mir_surface_type_menu:
20- case mir_surface_type_tip:
21- return true;
22- default:
23- return false;
24- }
25-}
26-
27 Spec makeSurfaceSpec(QWindow *window, MirPixelFormat pixelFormat, UbuntuWindow *parentWindowHandle,
28 MirConnection *connection)
29 {
30@@ -534,17 +522,33 @@
31
32 void UbuntuSurface::updateGeometry(const QRect &newGeometry)
33 {
34- qCDebug(ubuntumirclient,"updateGeometry(window=%p, width=%d, height=%d)", mWindow,
35- newGeometry.width(), newGeometry.height());
36-
37- Spec spec;
38- if (isMovable(mWindow->type())) {
39- spec = Spec{makeSurfaceSpec(mWindow, mPixelFormat, mParentWindowHandle, mConnection)};
40+
41+ auto spec = Spec{mir_connection_create_spec_for_changes(mConnection)};
42+
43+ mir_surface_spec_set_width(spec.get(), newGeometry.width());
44+ mir_surface_spec_set_height(spec.get(), newGeometry.height());
45+
46+ MirRectangle mirRect {0,0,0,0};
47+
48+ if (mParentWindowHandle) {
49+ qCDebug(ubuntumirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, child)", mWindow,
50+ newGeometry.x(), newGeometry.y(), newGeometry.width(), newGeometry.height());
51+
52+ mirRect.left = newGeometry.x() - mParentWindowHandle->window()->x();
53+ mirRect.top = newGeometry.y() - mParentWindowHandle->window()->y();
54+
55 } else {
56- spec = Spec{mir_connection_create_spec_for_changes(mConnection)};
57- mir_surface_spec_set_width(spec.get(), newGeometry.width());
58- mir_surface_spec_set_height(spec.get(), newGeometry.height());
59+ qCDebug(ubuntumirclient,"updateGeometry(window=%p, x=%d, y=%d, width=%d, height=%d, top-level)", mWindow,
60+ newGeometry.x(), newGeometry.y(), newGeometry.width(), newGeometry.height());
61+
62+ mirRect.left = newGeometry.x();
63+ mirRect.top = newGeometry.y();
64 }
65+
66+ mir_surface_spec_set_placement(spec.get(), &mirRect,
67+ mir_placement_gravity_northwest /* rect_gravity */, mir_placement_gravity_northwest /* surface_gravity */,
68+ (MirPlacementHints)0, 0 /* offset_dx */, 0 /* offset_dy */);
69+
70 mir_surface_apply_spec(mMirSurface, spec.get());
71 }
72

Subscribers

People subscribed via source and target branches