[Merge] lp:~unity-team/qtubuntu/screen-info-without-dpr into lp:qtubuntu

Gerry Boland gerry.boland at canonical.com
Mon Apr 25 09:49:02 UTC 2016


All comments addressed

Diff comments:

> 
> === modified file 'src/ubuntumirclient/screen.cpp'
> --- src/ubuntumirclient/screen.cpp	2015-12-09 13:01:28 +0000
> +++ src/ubuntumirclient/screen.cpp	2016-04-22 17:11:03 +0000
> @@ -104,34 +106,18 @@
>  const QEvent::Type OrientationChangeEvent::mType =
>          static_cast<QEvent::Type>(QEvent::registerEventType());
>  
> -static const MirDisplayOutput *find_active_output(
> -    const MirDisplayConfiguration *conf)
> -{
> -    const MirDisplayOutput *output = NULL;
> -    for (uint32_t d = 0; d < conf->num_outputs; d++)
> -    {
> -        const MirDisplayOutput *out = conf->outputs + d;
> -
> -        if (out->used &&
> -            out->connected &&
> -            out->num_modes &&
> -            out->current_mode < out->num_modes)
> -        {
> -            output = out;
> -            break;
> -        }
> -    }
> -
> -    return output;
> -}
> -
> -UbuntuScreen::UbuntuScreen(MirConnection *connection)
> -    : mFormat(QImage::Format_RGB32)
> +
> +UbuntuScreen::UbuntuScreen(const MirOutput *output, MirConnection *connection)
> +    : mDevicePixelRatio(1.0)

We don't want any DPR != 1. I just added this to be explicit we fix DPR as 1 everywhere.

> +    , mFormat(QImage::Format_RGB32)
>      , mDepth(32)
> +    , mDpi{0}
> +    , mFormFactor{mir_form_factor_unknown}
> +    , mScale{1.0}
>      , mOutputId(0)
> -    , mSurfaceFormat()
>      , mEglDisplay(EGL_NO_DISPLAY)
>      , mEglConfig(nullptr)
> +    , mSurfaceFormat()
>      , mCursor(connection)
>  {
>      // Initialize EGL.
> 
> === added file 'src/ubuntumirclient/screenobserver.h'
> --- src/ubuntumirclient/screenobserver.h	1970-01-01 00:00:00 +0000
> +++ src/ubuntumirclient/screenobserver.h	2016-04-22 17:11:03 +0000
> @@ -0,0 +1,54 @@
> +/*
> + * Copyright (C) 2015 Canonical, Ltd.
> + *
> + * This program is free software: you can redistribute it and/or modify it under
> + * the terms of the GNU Lesser General Public License version 3, as published by
> + * the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
> + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef UBUNTU_SCREEN_OBSERVER_H
> +#define UBUNTU_SCREEN_OBSERVER_H
> +
> +#include <QObject>
> +
> +#include <mir_toolkit/mir_connection.h>

I needed to include something that declares MirFormFactor, and since I also needed MirConnection here I just included this.

> +
> +class UbuntuScreen;
> +
> +class UbuntuScreenObserver : public QObject
> +{
> +    Q_OBJECT
> +
> +public:
> +    UbuntuScreenObserver(MirConnection *connection);
> +
> +    QList<UbuntuScreen*> screens() const { return mScreenList; }
> +    UbuntuScreen *findScreenWithId(int id);
> +
> +    void handleScreenPropertiesChange(UbuntuScreen *screen, int dpi,
> +                                      MirFormFactor formFactor, float scale);
> +
> +Q_SIGNALS:
> +    void screenAdded(UbuntuScreen *screen);
> +    void screenRemoved(UbuntuScreen *screen);
> +
> +private Q_SLOTS:
> +    void update();
> +
> +private:
> +    UbuntuScreen *findScreenWithId(const QList<UbuntuScreen *> &list, int id);
> +    void removeScreen(UbuntuScreen *screen);
> +
> +    MirConnection *mMirConnection;
> +    QList<UbuntuScreen*> mScreenList;
> +};
> +
> +#endif // UBUNTU_SCREEN_OBSERVER_H


-- 
https://code.launchpad.net/~unity-team/qtubuntu/screen-info-without-dpr/+merge/292410
Your team Ubuntu Phablet Team is subscribed to branch lp:qtubuntu.



More information about the Ubuntu-reviews mailing list