aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-flutter/recipes-graphics/toyota/files/0001-activation_area-Add-missing-width-and-height.patch
blob: fb3a5b3f7777520e56d9f8355edf65979318b4f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
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