提交 03940be6 编写于 作者: W wangpeiqiang

window: revert code of cover titlebar.

The code of solving cover titlebar will input new problem. Revert it.
Revert code commit id: cee74968
上级 dffba606
...@@ -102,7 +102,7 @@ std::map<std::shared_ptr<wm::Window>, RenderableList> MultiWindowComposerStrateg ...@@ -102,7 +102,7 @@ std::map<std::shared_ptr<wm::Window>, RenderableList> MultiWindowComposerStrateg
auto it = last_renderables.find(w.first); auto it = last_renderables.find(w.first);
if (it != last_renderables.end()) { if (it != last_renderables.end()) {
for (auto &rt : it->second) { 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_area = rt.screen_position().width() * rt.screen_position().height();
max_old_rect = rt.screen_position(); max_old_rect = rt.screen_position();
} }
...@@ -115,13 +115,6 @@ std::map<std::shared_ptr<wm::Window>, RenderableList> MultiWindowComposerStrateg ...@@ -115,13 +115,6 @@ std::map<std::shared_ptr<wm::Window>, RenderableList> MultiWindowComposerStrateg
w.first->setResizing(false); w.first->setResizing(false);
} }
} }
else {
std::vector<Rect> rects;
for (auto &r : final_renderables) {
rects.push_back(r.screen_position());
}
w.first->set_dis_area(rects);
}
if(!changed) { if(!changed) {
w.second = final_renderables; w.second = final_renderables;
......
...@@ -59,17 +59,6 @@ class Rect { ...@@ -59,17 +59,6 @@ class Rect {
bottom_ == rhs.bottom()); 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); } inline bool operator!=(const Rect &rhs) const { return !operator==(rhs); }
void merge(const Rect &rhs); void merge(const Rect &rhs);
......
...@@ -157,21 +157,8 @@ Window::~Window() { ...@@ -157,21 +157,8 @@ Window::~Window() {
} }
bool Window::title_event_filter(int x, int y) { bool Window::title_event_filter(int x, int y) {
if (fullscreen_) { const auto top_drag_area_height = graphics::dp_to_pixel(button_size + (button_margin << 1));
return false; return !fullscreen_ && y <= top_drag_area_height;
}
std::vector<graphics::Rect> dis_area;
{
std::lock_guard<std::mutex> 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;
} }
SDL_HitTestResult Window::on_window_hit(SDL_Window *window, const SDL_Point *pt, void *data) { SDL_HitTestResult Window::on_window_hit(SDL_Window *window, const SDL_Point *pt, void *data) {
...@@ -413,21 +400,6 @@ void Window::restore_window() { ...@@ -413,21 +400,6 @@ void Window::restore_window() {
} }
} }
void Window::set_dis_area(const std::vector<graphics::Rect> &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<graphics::Rect> 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<std::mutex> l(mutex_);
dis_area_.swap(dis_area);
}
}
} // namespace sdl } // namespace sdl
} // namespace platform } // namespace platform
} // namespace anbox } // namespace anbox
...@@ -90,7 +90,6 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window { ...@@ -90,7 +90,6 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
inline std::uint32_t get_property() { inline std::uint32_t get_property() {
return visible_property; return visible_property;
} }
void set_dis_area(const std::vector<graphics::Rect> &rects) override;
private: private:
static SDL_HitTestResult on_window_hit(SDL_Window *window, const SDL_Point *pt, void *data); 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<Window>, public wm::Window { ...@@ -110,8 +109,6 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
int last_wnd_x{ 0 }; int last_wnd_x{ 0 };
int last_wnd_y{ 0 }; int last_wnd_y{ 0 };
std::uint32_t visible_property; std::uint32_t visible_property;
std::vector<graphics::Rect> dis_area_;
std::mutex mutex_;
bool fullscreen_ = false; bool fullscreen_ = false;
}; };
} // namespace sdl } // namespace sdl
......
...@@ -65,7 +65,6 @@ class Window { ...@@ -65,7 +65,6 @@ class Window {
std::string title() const; std::string title() const;
virtual bool checkResizeable() { return resizing_; } virtual bool checkResizeable() { return resizing_; }
virtual void setResizing(bool resizing) { resizing_ = resizing; } virtual void setResizing(bool resizing) { resizing_ = resizing; }
virtual void set_dis_area(const std::vector<graphics::Rect> &rects) {};
protected: protected:
graphics::Rect last_frame_; graphics::Rect last_frame_;
bool resizing_{false}; bool resizing_{false};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册