From 03940be6710facca5f5a947d44c2de0f5e80e90f Mon Sep 17 00:00:00 2001 From: wangpeiqiang Date: Tue, 8 Sep 2020 22:00:36 +0800 Subject: [PATCH] window: revert code of cover titlebar. The code of solving cover titlebar will input new problem. Revert it. Revert code commit id: cee74968 --- .../multi_window_composer_strategy.cpp | 9 +----- src/anbox/graphics/rect.h | 11 ------- src/anbox/platform/sdl/window.cpp | 32 ++----------------- src/anbox/platform/sdl/window.h | 3 -- src/anbox/wm/window.h | 1 - 5 files changed, 3 insertions(+), 53 deletions(-) diff --git a/src/anbox/graphics/multi_window_composer_strategy.cpp b/src/anbox/graphics/multi_window_composer_strategy.cpp index 03ff56e6..3680d4fe 100644 --- a/src/anbox/graphics/multi_window_composer_strategy.cpp +++ b/src/anbox/graphics/multi_window_composer_strategy.cpp @@ -102,7 +102,7 @@ std::map, RenderableList> MultiWindowComposerStrateg auto it = last_renderables.find(w.first); if (it != last_renderables.end()) { for (auto &rt : it->second) { - if (max_old_area < rt.screen_position().width() * rt.screen_position().height()) { + if (max_old_area <= rt.screen_position().width() * rt.screen_position().height()) { max_old_area = rt.screen_position().width() * rt.screen_position().height(); max_old_rect = rt.screen_position(); } @@ -115,13 +115,6 @@ std::map, RenderableList> MultiWindowComposerStrateg w.first->setResizing(false); } } - else { - std::vector rects; - for (auto &r : final_renderables) { - rects.push_back(r.screen_position()); - } - w.first->set_dis_area(rects); - } if(!changed) { w.second = final_renderables; diff --git a/src/anbox/graphics/rect.h b/src/anbox/graphics/rect.h index f695a19e..39037270 100644 --- a/src/anbox/graphics/rect.h +++ b/src/anbox/graphics/rect.h @@ -59,17 +59,6 @@ class Rect { bottom_ == rhs.bottom()); } - Rect operator&(const Rect &rhs) const { - int left = left_ > rhs.left() ? left_ : rhs.left(); - int right = right_ < rhs.right() ? right_ : rhs.right(); - int top = top_ > rhs.top() ? top_ : rhs.top(); - int bottom = bottom_ < rhs.bottom() ? bottom_ : rhs.bottom(); - if (right <= left || bottom <= top) { - return Rect(0, 0, 0, 0); - } - return Rect(left, top, right, bottom); - } - inline bool operator!=(const Rect &rhs) const { return !operator==(rhs); } void merge(const Rect &rhs); diff --git a/src/anbox/platform/sdl/window.cpp b/src/anbox/platform/sdl/window.cpp index d2492380..e6e0400a 100755 --- a/src/anbox/platform/sdl/window.cpp +++ b/src/anbox/platform/sdl/window.cpp @@ -157,21 +157,8 @@ Window::~Window() { } bool Window::title_event_filter(int x, int y) { - if (fullscreen_) { - return false; - } - std::vector dis_area; - { - std::lock_guard l(mutex_); - dis_area = dis_area_; - } - int cnt = 0; - for (auto &r : dis_area) { - if (x >= r.left() && x <= r.right() && y >= r.top() && y <= r.bottom()) { - cnt++; - } - } - return cnt == 1; + const auto top_drag_area_height = graphics::dp_to_pixel(button_size + (button_margin << 1)); + return !fullscreen_ && y <= top_drag_area_height; } SDL_HitTestResult Window::on_window_hit(SDL_Window *window, const SDL_Point *pt, void *data) { @@ -413,21 +400,6 @@ void Window::restore_window() { } } -void Window::set_dis_area(const std::vector &rects) { - const auto top_drag_area_height = graphics::dp_to_pixel(button_size + (button_margin << 1)); - auto title = graphics::Rect{0, 0, frame().width(), top_drag_area_height}; - std::vector dis_area; - for (auto r : rects) { - auto tmp = r & title; - if (tmp.width() > 0 && tmp.height() > 0) { - dis_area.push_back(tmp); - } - } - { - std::lock_guard l(mutex_); - dis_area_.swap(dis_area); - } -} } // namespace sdl } // namespace platform } // namespace anbox diff --git a/src/anbox/platform/sdl/window.h b/src/anbox/platform/sdl/window.h index 40b25556..51e39858 100755 --- a/src/anbox/platform/sdl/window.h +++ b/src/anbox/platform/sdl/window.h @@ -90,7 +90,6 @@ class Window : public std::enable_shared_from_this, public wm::Window { inline std::uint32_t get_property() { return visible_property; } - void set_dis_area(const std::vector &rects) override; private: static SDL_HitTestResult on_window_hit(SDL_Window *window, const SDL_Point *pt, void *data); @@ -110,8 +109,6 @@ class Window : public std::enable_shared_from_this, public wm::Window { int last_wnd_x{ 0 }; int last_wnd_y{ 0 }; std::uint32_t visible_property; - std::vector dis_area_; - std::mutex mutex_; bool fullscreen_ = false; }; } // namespace sdl diff --git a/src/anbox/wm/window.h b/src/anbox/wm/window.h index cd1587f6..9a28ff60 100644 --- a/src/anbox/wm/window.h +++ b/src/anbox/wm/window.h @@ -65,7 +65,6 @@ class Window { std::string title() const; virtual bool checkResizeable() { return resizing_; } virtual void setResizing(bool resizing) { resizing_ = resizing; } - virtual void set_dis_area(const std::vector &rects) {}; protected: graphics::Rect last_frame_; bool resizing_{false}; -- GitLab