homescreenhandler: Avoid using a stale wl_output 48/28648/1 octopus sandbox/mvlad/update-homescreen
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 15 Feb 2023 16:40:03 +0000 (18:40 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Fri, 14 Apr 2023 19:44:52 +0000 (22:44 +0300)
Rather than storing wl_output when creating a HomeScreenHandler object,
retrieve the output at activation. Presumably, we could use Screen and
from there get it but seems to be easier this way.

Re-plugging the connector back and forth would result in a stale wl_output,
so this would retrieve it always as the currently enabled/active one.

Bug-AGL: SPEC-4705
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Id54c1f253b094e196c6bd367c7419c0ec5860d5f
(cherry picked from commit 4c7852e6ff7fde510f4f11c21bec817583397951)

homescreen/src/homescreenhandler.cpp
homescreen/src/homescreenhandler.h

index e61f0de..e7d6a39 100644 (file)
@@ -28,7 +28,6 @@ HomescreenHandler::HomescreenHandler(Shell *_aglShell, ApplicationLauncher *laun
        mp_launcher = launcher;
        mp_applauncher_client = new AppLauncherClient();
        QPlatformNativeInterface *native = qApp->platformNativeInterface();
-       m_output = getWlOutput(native, qApp->screens().first());
 
        //
        // The "started" event is received any time a start request is made to applaunchd,
@@ -93,13 +92,16 @@ void HomescreenHandler::addAppToStack(const QString& app_id)
 void HomescreenHandler::activateApp(const QString& app_id)
 {
        struct agl_shell *agl_shell = aglShell->shell.get();
+       QPlatformNativeInterface *native = qApp->platformNativeInterface();
+       struct wl_output *mm_output = getWlOutput(native, qApp->screens().first());
 
        if (mp_launcher) {
                mp_launcher->setCurrent(app_id);
        }
 
        HMI_DEBUG("HomeScreen", "Activating application %s", app_id.toStdString().c_str());
-       agl_shell_activate_app(agl_shell, app_id.toStdString().c_str(), m_output);
+
+       agl_shell_activate_app(agl_shell, app_id.toStdString().c_str(), mm_output);
 }
 
 void HomescreenHandler::deactivateApp(const QString& app_id)
index 751457e..a2baeb2 100644 (file)
@@ -40,7 +40,6 @@ public slots:
 private:
        ApplicationLauncher *mp_launcher;
        AppLauncherClient *mp_applauncher_client;
-       struct wl_output *m_output;
 
        Shell *aglShell;