diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2023-12-28 22:59:29 +0200 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2024-01-03 23:24:37 +0000 |
commit | 6d6323abe05920c1225f41ae71431c47a4431cc3 (patch) | |
tree | 3a482b43ca1163a0f5c982150d55fe49ff8eaa2e | |
parent | 5ea74929e0cc276eda3f69737097c0903d771e95 (diff) |
flutter-auto: Add support for width/height activation area
Bug-AGL: SPEC-5038
Change-Id: I9d775fee5f806069982718c2b3247ce1fac3241d
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
4 files changed, 256 insertions, 1 deletions
diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0001-activation_area-Add-missing-width-and-height.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0001-activation_area-Add-missing-width-and-height.patch new file mode 100644 index 00000000..fb3a5b3f --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0001-activation_area-Add-missing-width-and-height.patch @@ -0,0 +1,190 @@ +From 2c55093cda17dd16d98a8fb0d26717b29d5d0e75 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Thu, 28 Dec 2023 19:20:31 +0200 +Subject: [PATCH 1/2] activation_area: Add missing width and height + +Setting up an activation area can also require a different rectangle +size, so allow to set-up one. + +Note that there's no actual check if the values are invalid, for +instance like exceeding the output's dimensions. + +Bug-AGL: SPEC-5038 +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + shell/configuration/configuration.cc | 8 ++++++++ + shell/configuration/configuration.h | 2 ++ + shell/view/flutter_view.cc | 3 ++- + shell/wayland/display.cc | 10 +++++----- + shell/wayland/display.h | 8 +++++++- + shell/wayland/window.cc | 13 +++++++++---- + shell/wayland/window.h | 4 ++++ + 7 files changed, 37 insertions(+), 11 deletions(-) + +diff --git a/shell/configuration/configuration.cc b/shell/configuration/configuration.cc +index 2cec924..63b7a82 100644 +--- a/shell/configuration/configuration.cc ++++ b/shell/configuration/configuration.cc +@@ -104,9 +104,17 @@ void Configuration::getViewParameters( + + instance.view.activation_area_x = static_cast<uint32_t>(val["x"].GetInt()); + instance.view.activation_area_y = static_cast<uint32_t>(val["y"].GetInt()); ++ instance.view.activation_area_width = ++ static_cast<uint32_t>(val["width"].GetInt()); ++ instance.view.activation_area_height = ++ static_cast<uint32_t>(val["height"].GetInt()); + + SPDLOG_DEBUG("activation area x {}", instance.view.activation_area_x); + SPDLOG_DEBUG("activation area y {}", instance.view.activation_area_y); ++ SPDLOG_DEBUG("activation area width {}", ++ instance.view.activation_area_width); ++ SPDLOG_DEBUG("activation area height {}", ++ instance.view.activation_area_height); + } + } + +diff --git a/shell/configuration/configuration.h b/shell/configuration/configuration.h +index 0e3d721..b0ccbc9 100644 +--- a/shell/configuration/configuration.h ++++ b/shell/configuration/configuration.h +@@ -44,6 +44,8 @@ class Configuration { + uint32_t height; + uint32_t activation_area_x; + uint32_t activation_area_y; ++ uint32_t activation_area_width; ++ uint32_t activation_area_height; + bool fullscreen; + bool fullscreen_set; + double pixel_ratio; +diff --git a/shell/view/flutter_view.cc b/shell/view/flutter_view.cc +index ca51f4e..7b48b85 100644 +--- a/shell/view/flutter_view.cc ++++ b/shell/view/flutter_view.cc +@@ -67,9 +67,10 @@ FlutterView::FlutterView(Configuration::Config config, + m_wayland_window = std::make_shared<WaylandWindow>( + m_index, display, m_config.view.window_type, + m_wayland_display->GetWlOutput(m_config.view.wl_output_index), +- m_config.view.wl_output_index, m_config.app_id, m_config.view.fullscreen, ++ m_config.view.wl_output_index, m_config.app_id, m_config.view.fullscreen, + m_config.view.width, m_config.view.height, m_config.view.pixel_ratio, + m_config.view.activation_area_x, m_config.view.activation_area_y, ++ m_config.view.activation_area_width, m_config.view.activation_area_height, + m_backend.get(), m_config.view.ivi_surface_id); + } + +diff --git a/shell/wayland/display.cc b/shell/wayland/display.cc +index aba050a..0b97954 100644 +--- a/shell/wayland/display.cc ++++ b/shell/wayland/display.cc +@@ -857,16 +857,16 @@ void Display::AglShellDoReady() const { + + void Display::AglShellDoSetupActivationArea(uint32_t x, + uint32_t y, ++ uint32_t width, ++ uint32_t height, + uint32_t index) { +- uint32_t width = m_all_outputs[index]->width; +- uint32_t height = m_all_outputs[index]->height - (2 * y); +- + if (!m_agl.shell) + return; + + if (m_all_outputs[index]->transform == WL_OUTPUT_TRANSFORM_90) { +- width = m_all_outputs[index]->height; +- height = m_all_outputs[index]->width - (2 * y); ++ uint32_t tmp_width = width; ++ width = height; ++ height = tmp_width; + } + + SPDLOG_DEBUG("Using custom rectangle [{}x{}+{}x{}] for activation", width, +diff --git a/shell/wayland/display.h b/shell/wayland/display.h +index b919047..a792ad7 100644 +--- a/shell/wayland/display.h ++++ b/shell/wayland/display.h +@@ -172,6 +172,8 @@ class Display { + * @return void + * @param[in] x the x position for the activation rectangle + * @param[in] y the y position for the activation rectangle ++ * @param[in] width the width position for the activation rectangle ++ * @param[in] height the height position for the activation rectangle + * @param[index] the output, as a number + * @relation + * +@@ -193,7 +195,11 @@ class Display { + * | | + * -------------------- + */ +- void AglShellDoSetupActivationArea(uint32_t x, uint32_t y, uint32_t index); ++ void AglShellDoSetupActivationArea(uint32_t x, ++ uint32_t y, ++ uint32_t width, ++ uint32_t height, ++ uint32_t index); + + /** + * @brief Set Engine +diff --git a/shell/wayland/window.cc b/shell/wayland/window.cc +index 373b0a2..f816e58 100644 +--- a/shell/wayland/window.cc ++++ b/shell/wayland/window.cc +@@ -31,6 +31,8 @@ WaylandWindow::WaylandWindow(size_t index, + double pixel_ratio, + uint32_t activation_area_x, + uint32_t activation_area_y, ++ uint32_t activation_area_width, ++ uint32_t activation_area_height, + Backend* backend, + uint32_t ivi_surface_id) + : m_index(index), +@@ -42,7 +44,8 @@ WaylandWindow::WaylandWindow(size_t index, + m_geometry({width, height}), + m_window_size({width, height}), + m_pixel_ratio(pixel_ratio), +- m_activation_area({activation_area_x, activation_area_y}), ++ m_activation_area({activation_area_x, activation_area_y, ++ activation_area_width, activation_area_height}), + m_type(get_window_type(type)), + m_app_id(std::move(app_id)), + m_ivi_surface_id(ivi_surface_id), +@@ -98,10 +101,12 @@ WaylandWindow::WaylandWindow(size_t index, + case WINDOW_BG: + m_display->AglShellDoBackground(m_base_surface, 0); + if (m_activation_area.x > 0 && m_activation_area.y > 0) +- m_display->AglShellDoSetupActivationArea(m_activation_area.x, +- m_activation_area.y, 0); ++ m_display->AglShellDoSetupActivationArea( ++ m_activation_area.x, m_activation_area.y, m_activation_area.width, ++ m_activation_area.height, 0); + else +- m_display->AglShellDoSetupActivationArea(0, 160, 0); ++ m_display->AglShellDoSetupActivationArea(0, 160, m_activation_area.width, ++ m_activation_area.height, 0); + break; + case WINDOW_PANEL_TOP: + m_display->AglShellDoPanel(m_base_surface, AGL_SHELL_EDGE_TOP, 0); +diff --git a/shell/wayland/window.h b/shell/wayland/window.h +index 998a1c8..f66f70a 100644 +--- a/shell/wayland/window.h ++++ b/shell/wayland/window.h +@@ -67,6 +67,8 @@ class WaylandWindow { + double pixel_ratio, + uint32_t activation_area_x, + uint32_t activation_area_y, ++ uint32_t activation_area_width, ++ uint32_t activation_area_height, + Backend* backend, + uint32_t ivi_surface_id); + +@@ -166,6 +168,8 @@ class WaylandWindow { + struct { + uint32_t x; + uint32_t y; ++ uint32_t width; ++ uint32_t height; + } m_activation_area; + struct { + int32_t width; +-- +2.35.1 + diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0002-activation_area-Allow-x-and-y-values-be-zero-for-the.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0002-activation_area-Allow-x-and-y-values-be-zero-for-the.patch new file mode 100644 index 00000000..f0cf9ddb --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0002-activation_area-Allow-x-and-y-values-be-zero-for-the.patch @@ -0,0 +1,28 @@ +From 641ca7ca26c1bfc11e7d0c0f30b731f53467bf1f Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Thu, 28 Dec 2023 20:28:12 +0200 +Subject: [PATCH 2/2] activation_area: Allow x and y values be zero for the + activation area + +Bug-AGL: SPEC-5038 +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + shell/wayland/window.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/shell/wayland/window.cc b/shell/wayland/window.cc +index f816e58..929b9af 100644 +--- a/shell/wayland/window.cc ++++ b/shell/wayland/window.cc +@@ -100,7 +100,7 @@ WaylandWindow::WaylandWindow(size_t index, + break; + case WINDOW_BG: + m_display->AglShellDoBackground(m_base_surface, 0); +- if (m_activation_area.x > 0 && m_activation_area.y > 0) ++ if (m_activation_area.x >= 0 && m_activation_area.y >= 0) + m_display->AglShellDoSetupActivationArea( + m_activation_area.x, m_activation_area.y, m_activation_area.width, + m_activation_area.height, 0); +-- +2.35.1 + diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0003-activation_area-Remove-the-implicit-width-height-swa.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0003-activation_area-Remove-the-implicit-width-height-swa.patch new file mode 100644 index 00000000..f59add5a --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0003-activation_area-Remove-the-implicit-width-height-swa.patch @@ -0,0 +1,33 @@ +From b247f63441f75c47cebd6edd00ecc0c5f94728b6 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Tue, 2 Jan 2024 15:00:13 +0200 +Subject: [PATCH 3/3] activation_area: Remove the implicit width/height swap + +This does more harm than being useful so remove it. + +Bug-AGL: SPEC-5038 +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + shell/wayland/display.cc | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/shell/wayland/display.cc b/shell/wayland/display.cc +index 0b97954..9452dbf 100644 +--- a/shell/wayland/display.cc ++++ b/shell/wayland/display.cc +@@ -863,12 +863,6 @@ void Display::AglShellDoSetupActivationArea(uint32_t x, + if (!m_agl.shell) + return; + +- if (m_all_outputs[index]->transform == WL_OUTPUT_TRANSFORM_90) { +- uint32_t tmp_width = width; +- width = height; +- height = tmp_width; +- } +- + SPDLOG_DEBUG("Using custom rectangle [{}x{}+{}x{}] for activation", width, + height, x, y); + +-- +2.35.1 + diff --git a/meta-agl-flutter/recipes-graphics/toyota/flutter-auto_aglflutter.inc b/meta-agl-flutter/recipes-graphics/toyota/flutter-auto_aglflutter.inc index e074b522..c75cdc00 100644 --- a/meta-agl-flutter/recipes-graphics/toyota/flutter-auto_aglflutter.inc +++ b/meta-agl-flutter/recipes-graphics/toyota/flutter-auto_aglflutter.inc @@ -2,4 +2,8 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRC_URI:append:use-nxp-bsp = " file://0001-Disable-on_frame_base_surface-wl_surface_commit.patch" SRC_URI:append: = " file://0001-display-Add-support-for-wl_output-version-4.patch \ - file://0002-display-Add-support-for-agl_shell-version-8.patch" + file://0002-display-Add-support-for-agl_shell-version-8.patch \ + file://0001-activation_area-Add-missing-width-and-height.patch \ + file://0002-activation_area-Allow-x-and-y-values-be-zero-for-the.patch \ + file://0003-activation_area-Remove-the-implicit-width-height-swa.patch \ + " |