From 1e168fd4aa1764878f1b82c5f4c0ea31c77b0f3e Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Tue, 15 Nov 2016 08:51:17 +0100 Subject: [PATCH] Add basic infrastructure for our window manager --- src/CMakeLists.txt | 7 +- src/anbox/bridge/platform_api_skeleton.cpp | 55 ++++++++++- src/anbox/bridge/platform_api_skeleton.h | 22 +++-- src/anbox/cmds/run.cpp | 7 +- src/anbox/graphics/rect.cpp | 25 +++++ src/anbox/graphics/rect.h | 101 +++++++++++++++++++++ src/anbox/ubuntu/platform_api_skeleton.cpp | 64 ------------- src/anbox/ubuntu/platform_api_skeleton.h | 56 ------------ src/anbox/wm/display.cpp | 25 +++++ src/anbox/wm/display.h | 38 ++++++++ src/anbox/wm/manager.cpp | 37 ++++++++ src/anbox/wm/manager.h | 38 ++++++++ src/anbox/wm/task.cpp | 24 +++++ src/anbox/wm/task.h | 37 ++++++++ src/anbox/wm/window_state.cpp | 45 +++++++++ src/anbox/wm/window_state.h | 59 ++++++++++++ 16 files changed, 508 insertions(+), 132 deletions(-) create mode 100644 src/anbox/graphics/rect.cpp create mode 100644 src/anbox/graphics/rect.h delete mode 100644 src/anbox/ubuntu/platform_api_skeleton.cpp delete mode 100644 src/anbox/ubuntu/platform_api_skeleton.h create mode 100644 src/anbox/wm/display.cpp create mode 100644 src/anbox/wm/display.h create mode 100644 src/anbox/wm/manager.cpp create mode 100644 src/anbox/wm/manager.h create mode 100644 src/anbox/wm/task.cpp create mode 100644 src/anbox/wm/task.h create mode 100644 src/anbox/wm/window_state.cpp create mode 100644 src/anbox/wm/window_state.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f452f6f..91035db 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -95,6 +95,12 @@ set(SOURCES anbox/graphics/gl_renderer_server.cpp anbox/graphics/window_creator.cpp anbox/graphics/density.h + anbox/graphics/rect.cpp + + anbox/wm/display.cpp + anbox/wm/task.cpp + anbox/wm/manager.cpp + anbox/wm/window_state.cpp anbox/input/manager.cpp anbox/input/device.cpp @@ -116,7 +122,6 @@ set(SOURCES anbox/bridge/platform_api_skeleton.cpp anbox/bridge/android_api_stub.cpp - anbox/ubuntu/platform_api_skeleton.cpp anbox/ubuntu/window_creator.cpp anbox/ubuntu/window.cpp anbox/ubuntu/keycode_converter.cpp diff --git a/src/anbox/bridge/platform_api_skeleton.cpp b/src/anbox/bridge/platform_api_skeleton.cpp index e9e53e8..34d87fb 100644 --- a/src/anbox/bridge/platform_api_skeleton.cpp +++ b/src/anbox/bridge/platform_api_skeleton.cpp @@ -16,17 +16,68 @@ */ #include "anbox/bridge/platform_api_skeleton.h" +#include "anbox/wm/manager.h" +#include "anbox/wm/window_state.h" #include "anbox/logger.h" #include "anbox_bridge.pb.h" namespace anbox { namespace bridge { -PlatformApiSkeleton::PlatformApiSkeleton(const std::shared_ptr &pending_calls) : - pending_calls_(pending_calls) { +PlatformApiSkeleton::PlatformApiSkeleton(const std::shared_ptr &pending_calls, + const std::shared_ptr &window_manager) : + pending_calls_(pending_calls), + window_manager_(window_manager) { } PlatformApiSkeleton::~PlatformApiSkeleton() { } + +void PlatformApiSkeleton::boot_finished(anbox::protobuf::rpc::Void const *request, + anbox::protobuf::rpc::Void *response, + google::protobuf::Closure *done) { + (void) request; + (void) response; + + if (on_boot_finished_action_) + on_boot_finished_action_(); + + done->Run(); +} + +void PlatformApiSkeleton::update_window_state(anbox::protobuf::bridge::WindowStateUpdate const *request, + anbox::protobuf::rpc::Void *response, + google::protobuf::Closure *done) { + (void) response; + + auto convert_window_state = [](const ::anbox::protobuf::bridge::WindowStateUpdate_WindowState &window) { + return wm::WindowState( + wm::Display::Id(window.display_id()), + window.has_surface(), + graphics::Rect(window.frame_left(), window.frame_top(), window.frame_right(), window.frame_bottom()), + window.package_name(), + wm::Task::Id(window.task_id())); + }; + + wm::WindowState::List updated; + for (int n = 0; n < request->windows_size(); n++) { + const auto window = request->windows(n); + updated.push_back(convert_window_state(window)); + } + + wm::WindowState::List removed; + for (int n = 0; n < request->removed_windows_size(); n++) { + const auto window = request->removed_windows(n); + updated.push_back(convert_window_state(window)); + } + + window_manager_->apply_window_state_update(updated, removed); + + done->Run(); +} + +void PlatformApiSkeleton::on_boot_finished(const std::function &action) { + on_boot_finished_action_ = action; +} } // namespace bridge } // namespace anbox diff --git a/src/anbox/bridge/platform_api_skeleton.h b/src/anbox/bridge/platform_api_skeleton.h index 57cc93a..e18f42e 100644 --- a/src/anbox/bridge/platform_api_skeleton.h +++ b/src/anbox/bridge/platform_api_skeleton.h @@ -39,22 +39,30 @@ class WindowStateUpdate; namespace rpc { class PendingCallCache; } // namespace rpc +namespace wm { +class Manager; +} // namespace wm namespace bridge { class PlatformApiSkeleton { public: - PlatformApiSkeleton(const std::shared_ptr &pending_calls); + PlatformApiSkeleton(const std::shared_ptr &pending_calls, + const std::shared_ptr &window_manager); virtual ~PlatformApiSkeleton(); - virtual void boot_finished(anbox::protobuf::rpc::Void const *request, - anbox::protobuf::rpc::Void *response, - google::protobuf::Closure *done) = 0; + void boot_finished(anbox::protobuf::rpc::Void const *request, + anbox::protobuf::rpc::Void *response, + google::protobuf::Closure *done); - virtual void update_window_state(anbox::protobuf::bridge::WindowStateUpdate const *request, - anbox::protobuf::rpc::Void *response, - google::protobuf::Closure *done) = 0; + void update_window_state(anbox::protobuf::bridge::WindowStateUpdate const *request, + anbox::protobuf::rpc::Void *response, + google::protobuf::Closure *done); + + void on_boot_finished(const std::function &action); private: std::shared_ptr pending_calls_; + std::shared_ptr window_manager_; + std::function on_boot_finished_action_; }; } // namespace bridge } // namespace anbox diff --git a/src/anbox/cmds/run.cpp b/src/anbox/cmds/run.cpp index 7fffe26..e65ce28 100644 --- a/src/anbox/cmds/run.cpp +++ b/src/anbox/cmds/run.cpp @@ -32,10 +32,11 @@ #include "anbox/rpc/channel.h" #include "anbox/bridge/platform_message_processor.h" #include "anbox/bridge/android_api_stub.h" -#include "anbox/ubuntu/platform_api_skeleton.h" +#include "anbox/bridge/platform_api_skeleton.h" #include "anbox/ubuntu/window_creator.h" #include "anbox/dbus/skeleton/service.h" #include "anbox/container/client.h" +#include "anbox/wm/manager.h" #include @@ -88,6 +89,8 @@ anbox::cmds::Run::Run(const BusFactory& bus_factory) auto input_manager = std::make_shared(rt); + auto window_manager = std::make_shared(); + auto window_creator = std::make_shared(input_manager); auto renderer = std::make_shared(window_creator); renderer->start(); @@ -123,7 +126,7 @@ anbox::cmds::Run::Run(const BusFactory& bus_factory) // more than one one day we need proper dispatching to the right one. android_api_stub->set_rpc_channel(rpc_channel); - auto server = std::make_shared(pending_calls); + auto server = std::make_shared(pending_calls, window_manager); server->on_boot_finished([&]() { dispatcher->dispatch([&]() { // FIXME make this configurable or once we have a bridge let the host diff --git a/src/anbox/graphics/rect.cpp b/src/anbox/graphics/rect.cpp new file mode 100644 index 0000000..62d3e75 --- /dev/null +++ b/src/anbox/graphics/rect.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#include "anbox/graphics/rect.h" + +namespace anbox { +namespace graphics { +const Rect Rect::Invalid{-1,-1,-1,-1}; +const Rect Rect::Empty{0,0,0,0}; +} // namespace graphics +} // namespace anbox diff --git a/src/anbox/graphics/rect.h b/src/anbox/graphics/rect.h new file mode 100644 index 0000000..a9c994e --- /dev/null +++ b/src/anbox/graphics/rect.h @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#ifndef ANBOX_GRAPHICS_RECT_H_ +#define ANBOX_GRAPHICS_RECT_H_ + +#include + +namespace anbox { +namespace graphics { +class Rect { +public: + static const Rect Invalid; + static const Rect Empty; + + inline Rect() : Rect(Empty) {} + + inline Rect(const std::int32_t &left, + const std::int32_t &top, + const std::int32_t &right, + const std::int32_t &bottom) : + left_(left), + top_(top), + right_(right), + bottom_(bottom) { + } + + inline Rect(const std::int32_t &width, const std::int32_t &height) : + left_(0), + top_(0), + right_(width), + bottom_(height) { + } + + inline void clear() { + left_ = top_ = right_ = bottom_ = 0; + } + + inline bool valid() const { + return width() >= 0 && height() >= 0; + } + + inline std::int32_t width() const { + return right_ - left_; + } + + inline std::int32_t height() const { + return bottom_ - top_; + } + + inline std::int32_t left() const { + return left_; + } + + inline std::int32_t top() const { + return top_; + } + + inline std::int32_t right() const { + return right_; + } + + inline std::int32_t bottom() const { + return bottom_; + } + + inline bool operator == (const Rect &rhs) const { + return (left_ == rhs.left() && + top_ == rhs.top() && + right_ == rhs.right() && + bottom_ == rhs.bottom()); + } + + inline bool operator != (const Rect &rhs) const { + return !operator == (rhs); + } + +private: + std::int32_t left_; + std::int32_t top_; + std::int32_t right_; + std::int32_t bottom_; +}; +} // namespace graphics +} // namespace anbox + +#endif diff --git a/src/anbox/ubuntu/platform_api_skeleton.cpp b/src/anbox/ubuntu/platform_api_skeleton.cpp deleted file mode 100644 index 459ae17..0000000 --- a/src/anbox/ubuntu/platform_api_skeleton.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2016 Simon Fels - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - * - */ - -#include "anbox/ubuntu/platform_api_skeleton.h" -#include "anbox/common/dispatcher.h" -#include "anbox/bridge/android_api_stub.h" -#include "anbox/rpc/pending_call_cache.h" -#include "anbox/logger.h" - -#include "anbox_rpc.pb.h" -#include "anbox_bridge.pb.h" - -namespace anbox { -namespace ubuntu { -PlatformApiSekeleton::PlatformApiSekeleton(const std::shared_ptr &pending_calls) : - bridge::PlatformApiSkeleton(pending_calls) { -} - -PlatformApiSekeleton::~PlatformApiSekeleton() { -} - -void PlatformApiSekeleton::boot_finished(anbox::protobuf::rpc::Void const *request, - anbox::protobuf::rpc::Void *response, - google::protobuf::Closure *done) { - (void) request; - (void) response; - - if (on_boot_finished_action_) - on_boot_finished_action_(); - - done->Run(); -} - -void PlatformApiSekeleton::update_window_state(anbox::protobuf::bridge::WindowStateUpdate const *request, - anbox::protobuf::rpc::Void *response, - google::protobuf::Closure *done) { - (void) request; - (void) response; - - DEBUG(""); - - - done->Run(); -} - -void PlatformApiSekeleton::on_boot_finished(const std::function &action) { - on_boot_finished_action_ = action; -} -} // namespace ubuntu -} // namespace anbox diff --git a/src/anbox/ubuntu/platform_api_skeleton.h b/src/anbox/ubuntu/platform_api_skeleton.h deleted file mode 100644 index 338760e..0000000 --- a/src/anbox/ubuntu/platform_api_skeleton.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2016 Simon Fels - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - * - */ - -#ifndef ANBOX_UBUNTU_PLATFORM_SERVER_H_ -#define ANBOX_UBUNTU_PLATFORM_SERVER_H_ - -#include "anbox/bridge/platform_api_skeleton.h" - -namespace anbox { -namespace common { -class Dispatcher; -} // namespace common -namespace bridge { -class AndroidApiStub; -class WindowStateUpdate; -} // namespace bridge -namespace rpc { -class PendingCallCache; -} // namespace rpc; -namespace ubuntu { -class PlatformApiSekeleton : public bridge::PlatformApiSkeleton { -public: - PlatformApiSekeleton(const std::shared_ptr &pending_calls); - virtual ~PlatformApiSekeleton(); - - void boot_finished(anbox::protobuf::rpc::Void const *request, - anbox::protobuf::rpc::Void *response, - google::protobuf::Closure *done) override; - - void update_window_state(anbox::protobuf::bridge::WindowStateUpdate const *request, - anbox::protobuf::rpc::Void *response, - google::protobuf::Closure *done) override; - - void on_boot_finished(const std::function &action); - -private: - std::function on_boot_finished_action_; -}; -} // namespace bridge -} // namespace anbox - -#endif diff --git a/src/anbox/wm/display.cpp b/src/anbox/wm/display.cpp new file mode 100644 index 0000000..671a166 --- /dev/null +++ b/src/anbox/wm/display.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#include "anbox/wm/display.h" + +namespace anbox { +namespace wm { +Display::Id Display::Invalid = -1; +Display::Id Display::Default = 0; +} // namespace wm +} // namespace anbox diff --git a/src/anbox/wm/display.h b/src/anbox/wm/display.h new file mode 100644 index 0000000..6b53baf --- /dev/null +++ b/src/anbox/wm/display.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#ifndef ANBOX_WM_DISPLAY_H_ +#define ANBOX_WM_DISPLAY_H_ + +#include + +namespace anbox { +namespace wm { +class Display { +public: + typedef std::int32_t Id; + + static Id Invalid; + static Id Default; + + Display() = delete; + Display(const Display&) = delete; +}; +} // namespace wm +} // namespace anbox + +#endif diff --git a/src/anbox/wm/manager.cpp b/src/anbox/wm/manager.cpp new file mode 100644 index 0000000..9e40895 --- /dev/null +++ b/src/anbox/wm/manager.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#include "anbox/wm/manager.h" +#include "anbox/logger.h" + +namespace anbox { +namespace wm { +Manager::Manager() { +} + +Manager::~Manager() { +} + +void Manager::apply_window_state_update(const WindowState::List &updated, + const WindowState::List &removed) { + (void) updated; + (void) removed; + + DEBUG("updated %d removed %d", updated.size(), removed.size()); +} +} // namespace wm +} // namespace anbox diff --git a/src/anbox/wm/manager.h b/src/anbox/wm/manager.h new file mode 100644 index 0000000..d882321 --- /dev/null +++ b/src/anbox/wm/manager.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#ifndef ANBOX_WM_MANAGER_H_ +#define ANBOX_WM_MANAGER_H_ + +#include "anbox/wm/window_state.h" + +namespace anbox { +namespace wm { +class Manager { +public: + Manager(); + ~Manager(); + + void apply_window_state_update(const WindowState::List &updated, + const WindowState::List &removed); + +private: +}; +} // namespace wm +} // namespace anbox + +#endif diff --git a/src/anbox/wm/task.cpp b/src/anbox/wm/task.cpp new file mode 100644 index 0000000..46cecee --- /dev/null +++ b/src/anbox/wm/task.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#include "anbox/wm/task.h" + +namespace anbox { +namespace wm { +Task::Id Task::Invalid = -1; +} // namespace wm +} // namespace anbox diff --git a/src/anbox/wm/task.h b/src/anbox/wm/task.h new file mode 100644 index 0000000..fa7e8f7 --- /dev/null +++ b/src/anbox/wm/task.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#ifndef ANBOX_WM_TASK_H_ +#define ANBOX_WM_TASK_H_ + +#include + +namespace anbox { +namespace wm { +class Task { +public: + typedef std::int32_t Id; + + static Id Invalid; + + Task() = delete; + Task(const Task&) = delete; +}; +} // namespace wm +} // namespace anbox + +#endif diff --git a/src/anbox/wm/window_state.cpp b/src/anbox/wm/window_state.cpp new file mode 100644 index 0000000..1b357f8 --- /dev/null +++ b/src/anbox/wm/window_state.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#include "anbox/wm/window_state.h" + +namespace anbox { +namespace wm { +WindowState::WindowState() : + display_(Display::Invalid), + has_surface_(false), + frame_(graphics::Rect::Invalid), + package_name_(""), + task_(Task::Invalid) { +} + +WindowState::WindowState(const Display::Id &display, + bool has_surface, + const graphics::Rect &frame, + const std::string &package_name, + const Task::Id &task) : + display_(display), + has_surface_(has_surface), + frame_(frame), + package_name_(package_name), + task_(task) { +} + +WindowState::~WindowState() { +} +} // namespace wm +} // namespace anbox diff --git a/src/anbox/wm/window_state.h b/src/anbox/wm/window_state.h new file mode 100644 index 0000000..f0c2ed0 --- /dev/null +++ b/src/anbox/wm/window_state.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#ifndef ANBOX_WM_WINDOW_STATE_H_ +#define ANBOX_WM_WINDOW_STATE_H_ + +#include "anbox/graphics/rect.h" +#include "anbox/wm/display.h" +#include "anbox/wm/task.h" + +#include +#include + +namespace anbox { +namespace wm { +class WindowState { +public: + typedef std::vector List; + + WindowState(); + WindowState(const Display::Id &display, + bool has_surface, + const graphics::Rect &frame, + const std::string &package_name, + const Task::Id &task); + ~WindowState(); + + Display::Id display() const { return display_; } + bool has_surface() const { return has_surface_; } + graphics::Rect frame() const { return frame_; } + std::string package_name() const { return package_name_; } + Task::Id task() const { return task_; } + +private: + Display::Id display_; + bool has_surface_; + graphics::Rect frame_; + std::string package_name_; + Task::Id task_; + +}; +} // namespace wm +} // namespace anbox + +#endif