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 #ifndef ANBOX_PLATFORM_SDL_WINDOW_H_
19 #define ANBOX_PLATFORM_SDL_WINDOW_H_
21 #include "anbox/wm/window.h"
22 #include "anbox/platform/sdl/sdl_wrapper.h"
34 class Window : public std::enable_shared_from_this<Window>, public wm::Window {
36 typedef std::int32_t Id;
42 virtual void window_deleted(const Id &id) = 0;
43 virtual void window_wants_focus(const Id &id) = 0;
44 virtual void window_moved(const Id &id, const std::int32_t &x,
45 const std::int32_t &y) = 0;
46 virtual void window_resized(const Id &id, const std::int32_t &x,
47 const std::int32_t &y) = 0;
50 Window(const std::shared_ptr<Renderer> &renderer,
51 const Id &id, const wm::Task::Id &task,
52 const std::shared_ptr<Observer> &observer,
53 const graphics::Rect &frame,
54 const std::string &title,
59 void process_event(const SDL_Event &event);
61 EGLNativeWindowType native_handle() const override;
63 std::uint32_t window_id() const;
66 static SDL_HitTestResult on_window_hit(SDL_Window *window, const SDL_Point *pt, void *data);
69 void switch_window_state();
72 std::shared_ptr<Observer> observer_;
73 EGLNativeDisplayType native_display_;
74 EGLNativeWindowType native_window_;
78 } // namespace platform