Browse Source

Add SDL restore window event which is required by some applications (such as NewPipe) when restoring minimized window. This ensures that the application window contents will be rendered after restoration.

master
Pekka Helenius 3 years ago
parent
commit
266246b72c
2 changed files with 58 additions and 3 deletions
  1. +5
    -3
      anbox_files/PKGBUILD
  2. +53
    -0
      anbox_files/patch_window-restored.patch

+ 5
- 3
anbox_files/PKGBUILD View File

@ -27,12 +27,13 @@ source=("git+https://github.com/anbox/anbox.git"
'patch_cm-privileged-warn.patch'
'patch_bytesize-to-bytesizelong.patch'
'patch_remove-unknown-opt.patch'
'patch_window-restored.patch'
)
sha256sums=('SKIP'
'SKIP'
'fc86c104381c3a6dd442ca7c60f4172d70a13528252475f592fced4e4722951a'
'08b50aa85859715fdb6835a26c6e6efceab0ef8746fd5053a0e04fc0cb742c7f'
'aefae0f50ccaa66b291bb4636f06103f25deee8d6f64e3e6b9e414a5a6cec2a0'
'210eb93342228168f7bb632c8b93d9bfda6f53f62459a6b74987fa1e17530475'
'ff4b449950916925c6d3bdfa55a81a0a944deaeb020de9bffc5f3ec923fdf396'
'3e07dc524a827c1651857cce28a06c1565bc5188101c140ed213bbafedc5abff'
'7332d09865be553a259a53819cebddd21f661c7a251d78c2f46acd75c66676b6'
'2186a2a1c445b0eef40b96b508a3b158931bad2677fd4adbbe5c3a9db05553df'
@ -43,7 +44,8 @@ sha256sums=('SKIP'
'5d6184f4e2f8b680a176fe9125bf7e1d34bfdc0f3a114ade94bb1d9269cf9c79'
'7430e889f1a882b7393896baaaf1a22650d770ed810182def364fde9d8682223'
'bf751d44500c3689a3fd56c757d59632441bee78d1857bef84319f38da1a33ba'
'b96eedc64972c671a57052c53760b60aac00e95c80a7020818582957d247558f')
'b96eedc64972c671a57052c53760b60aac00e95c80a7020818582957d247558f'
'926e13e113baf307cc1556e11e0b621e5fae455f9a02eb3cc0a75c6584dd27a2')
pkgver() {
cd "$srcdir/$_pkgname"


+ 53
- 0
anbox_files/patch_window-restored.patch View File

@ -0,0 +1,53 @@
--- a/src/anbox/platform/sdl/platform.cpp 2020-06-30 13:15:49.448320901 +0300
+++ b/src/anbox/platform/sdl/platform.cpp 2020-06-30 13:39:02.464989017 +0300
@@ -446,6 +446,17 @@ void Platform::window_wants_focus(const
}
}
+void Platform::window_restored(const Window::Id &id) {
+ auto w = windows_.find(id);
+ if (w == windows_.end()) return;
+
+ if (auto window = w->second.lock()) {
+ auto new_frame = window->frame();
+ window->update_frame(new_frame);
+ window_manager_->resize_task(window->task(), new_frame, 3);
+ }
+}
+
void Platform::window_moved(const Window::Id &id, const std::int32_t &x,
const std::int32_t &y) {
auto w = windows_.find(id);
--- a/src/anbox/platform/sdl/platform.h 2020-06-30 13:16:06.144987589 +0300
+++ b/src/anbox/platform/sdl/platform.h 2020-06-30 13:39:35.294989051 +0300
@@ -54,6 +54,7 @@ class Platform : public std::enable_shar
void window_deleted(const Window::Id &id) override;
void window_wants_focus(const Window::Id &id) override;
+ void window_restored(const Window::Id &id) override;
void window_moved(const Window::Id &id, const std::int32_t &x,
const std::int32_t &y) override;
void window_resized(const Window::Id &id, const std::int32_t &width,
--- a/src/anbox/platform/sdl/window.cpp 2020-06-30 12:25:01.078318019 +0300
+++ b/src/anbox/platform/sdl/window.cpp 2020-06-30 13:40:04.924989082 +0300
@@ -193,6 +193,10 @@ void Window::process_event(const SDL_Eve
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
break;
+ case SDL_WINDOWEVENT_RESTORED:
+ if (observer_)
+ observer_->window_restored(id_);
+ break;
// Not need to listen for SDL_WINDOWEVENT_RESIZED here as the
// SDL_WINDOWEVENT_SIZE_CHANGED is always sent.
case SDL_WINDOWEVENT_SIZE_CHANGED:
--- a/src/anbox/platform/sdl/window.h 2020-06-30 13:14:34.174987490 +0300
+++ b/src/anbox/platform/sdl/window.h 2020-06-30 13:40:24.711655769 +0300
@@ -41,6 +41,7 @@ class Window : public std::enable_shared
virtual ~Observer();
virtual void window_deleted(const Id &id) = 0;
virtual void window_wants_focus(const Id &id) = 0;
+ virtual void window_restored(const Id &id) = 0;
virtual void window_moved(const Id &id, const std::int32_t &x,
const std::int32_t &y) = 0;
virtual void window_resized(const Id &id, const std::int32_t &x,

Loading…
Cancel
Save