main: Add activate_by_default ini option 67/25867/1
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 6 Jan 2021 16:24:01 +0000 (18:24 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 6 Jan 2021 21:53:58 +0000 (23:53 +0200)
Displaying the application surface as soon as started required
activating the surface by default. With this patch, we give the
possibility to do it conditionally, as it helps CI with cases where we
don't really want other applications change the active surface.

With applications that start by default, this interferes with the
ability to take a screenshot with just the background.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I6e826a6715b9a348181df80ed53ffaa6b65b7d2b

src/ivi-compositor.h
src/layout.c
src/main.c

index efa6373..b2342eb 100644 (file)
@@ -54,6 +54,7 @@ struct ivi_compositor {
 
        bool init_failed;
        bool hide_cursor;
+       bool activate_by_default;
 
        /*
         * Options parsed from command line arugments.
index 0363af7..b1d8b3d 100644 (file)
@@ -328,6 +328,12 @@ ivi_layout_desktop_committed(struct ivi_surface *surf)
                        return;
                }
 
+               if (!surf->ivi->activate_by_default) {
+                       weston_log("Refusing to activate surface role %d, app_id %s\n",
+                                       surf->role, app_id);
+                       return;
+               }
+
                /* use the output of the bg to activate the app on start-up by
                 * default */
                if (surf->view && r_output) {
index 4a2ffca..482558a 100644 (file)
@@ -1527,6 +1527,7 @@ int main(int argc, char *argv[])
        }
        /* from [core] */
        weston_config_section_get_bool(section, "hide-cursor", &ivi.hide_cursor, false);
+       weston_config_section_get_bool(section, "activate-by-default", &ivi.activate_by_default, true);
 
        display = wl_display_create();
        loop = wl_display_get_event_loop(display);