From 55427459f5801f6900e8b73ebd2b9cf30d2f1a70 Mon Sep 17 00:00:00 2001 From: yu_qinfei <878919698@qq.com> Date: Wed, 29 Jul 2020 16:07:43 +0800 Subject: [PATCH] SDL: Whe minimum window size is added solve the problem of the application window can be drawn as a line. resloved the WeChat button overlapping problem. --- src/anbox/platform/sdl/window.cpp | 14 +++++++++++++- src/anbox/platform/sdl/window.h | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/anbox/platform/sdl/window.cpp b/src/anbox/platform/sdl/window.cpp index 24b4c797..430cd27e 100755 --- a/src/anbox/platform/sdl/window.cpp +++ b/src/anbox/platform/sdl/window.cpp @@ -44,12 +44,19 @@ static const std::uint32_t HIDE_MINIMIZE = 0x02; static const std::uint32_t HIDE_MAXIMIZE = 0x04; static const std::uint32_t HIDE_CLOSE = 0x08; static const std::uint32_t SHOW_ALL = 0x00; +static const std::uint32_t MINI_WIDTH = 540; +static const std::uint32_t MINI_HEIGHT = 700; +static const std::uint32_t WX_MINI_WIDTH = 730; const std::map Window::property_map = { {"喜马拉雅", HIDE_MAXIMIZE}, {"i深圳", HIDE_MAXIMIZE} }; +const std::mapWindow::custom_window_map = { + {"微信", {WX_MINI_WIDTH, MINI_HEIGHT}} +}; + Window::Id Window::Invalid{-1}; Window::Observer::~Observer() {} @@ -134,7 +141,12 @@ Window::Window(const std::shared_ptr &renderer, gettimeofday(&now, NULL); last_update_time = USEC_PER_SEC * (now.tv_sec) + now.tv_usec; lastClickTime = last_update_time; - + auto window_size_ptr = custom_window_map.find(title); + if (window_size_ptr != custom_window_map.end()) { + SDL_SetWindowMinimumSize(window_, window_size_ptr->second.minimum_width, window_size_ptr->second.minimum_height); + } else { + SDL_SetWindowMinimumSize(window_, MINI_WIDTH, MINI_HEIGHT); + } SDL_ShowWindow(window_); } diff --git a/src/anbox/platform/sdl/window.h b/src/anbox/platform/sdl/window.h index 0afdf233..c424276b 100755 --- a/src/anbox/platform/sdl/window.h +++ b/src/anbox/platform/sdl/window.h @@ -42,6 +42,12 @@ class Window : public std::enable_shared_from_this, public wm::Window { static const long long APP_START_MAX_TIME = 15 * USEC_PER_SEC; static const long long timespan_db_click = 500000; + struct mini_size { + int minimum_width; + int minimum_height; + }; + + static const std::map custom_window_map; static const std::map property_map; class Observer { -- GitLab