From 2c55093cda17dd16d98a8fb0d26717b29d5d0e75 Mon Sep 17 00:00:00 2001 From: Marius Vlad 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 --- 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(val["x"].GetInt()); instance.view.activation_area_y = static_cast(val["y"].GetInt()); + instance.view.activation_area_width = + static_cast(val["width"].GetInt()); + instance.view.activation_area_height = + static_cast(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( 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