2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "anbox/wm/window.h"
19 #include "anbox/graphics/emugl/Renderer.h"
20 #include "anbox/logger.h"
24 Window::Window(const std::shared_ptr<Renderer> &renderer, const Task::Id &task, const graphics::Rect &frame, const std::string &title)
25 : renderer_(renderer), task_(task), frame_(frame), title_(title) {}
31 void Window::update_state(const WindowState::List &states) {
35 void Window::update_frame(const graphics::Rect &frame) {
36 if (frame == frame_) return;
41 Task::Id Window::task() const { return task_; }
43 graphics::Rect Window::frame() const { return frame_; }
45 EGLNativeWindowType Window::native_handle() const { return 0; }
47 std::string Window::title() const { return title_; }
49 bool Window::attach() {
52 attached_ = renderer_->createNativeWindow(native_handle());
56 void Window::release() {
57 if (!renderer_ || !attached_)
59 renderer_->destroyNativeWindow(native_handle());