提交 db05591b 编写于 作者: T twwang 提交者: night_xiaoye

window: add fullscreen on anbox side.

Add fullscreen on anbox side.
上级 c7ca9981
......@@ -64,6 +64,7 @@ void PlatformApiStub::update_window_state(const WindowStateUpdate &state) {
out->set_frame_bottom(in.frame.bottom);
out->set_task_id(in.task_id);
out->set_stack_id(in.stack_id);
out->set_videofullscreen(false);
};
for (const auto &window : state.updated_windows) {
......
......@@ -84,7 +84,8 @@ void PlatformApiSkeleton::handle_window_state_update_event(const anbox::protobuf
graphics::Rect(window.frame_left(), window.frame_top(),
window.frame_right(), window.frame_bottom()),
window.package_name(), wm::Task::Id(window.task_id()),
wm::Stack::Id(window.stack_id()));
wm::Stack::Id(window.stack_id()),
window.has_videofullscreen() && window.videofullscreen());
};
wm::WindowState::List updated;
......
......@@ -157,6 +157,9 @@ Window::~Window() {
}
bool Window::title_event_filter(int x, int y) {
if (fullscreen_) {
return false;
}
std::vector<graphics::Rect> dis_area;
{
std::lock_guard<std::mutex> l(mutex_);
......@@ -174,6 +177,10 @@ bool Window::title_event_filter(int x, int y) {
SDL_HitTestResult Window::on_window_hit(SDL_Window *window, const SDL_Point *pt, void *data) {
auto platform_window = reinterpret_cast<Window*>(data);
if (platform_window->get_fullscreen()) {
return SDL_HITTEST_NORMAL;
}
int w = 0, h = 0;
SDL_GetWindowSize(window, &w, &h);
......@@ -344,6 +351,19 @@ void Window::setResizing(bool resizing) {
}
void Window::update_state(const wm::WindowState::List &states) {
for (auto ws : states)
{
if (!fullscreen_ && ws.videofullscreen()) {
SDL_SetWindowFullscreen(window_, SDL_WINDOW_FULLSCREEN_DESKTOP);
fullscreen_ = true;
} else if (fullscreen_ && !ws.videofullscreen()) {
SDL_SetWindowFullscreen(window_, 0);
fullscreen_ = false;
}
if (fullscreen_) {
return;
}
}
if (!initialized.load() && !states.empty()) {
int w = 0;
int h = 0;
......
......@@ -83,6 +83,7 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
void setResizing(bool resizing) override;
void restore_window();
bool get_fullscreen() { return fullscreen_; }
Id id() const;
std::uint32_t window_id() const;
Uint32 GetWindowFlags(){return SDL_GetWindowFlags(window_);}
......@@ -111,6 +112,7 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
std::uint32_t visible_property;
std::vector<graphics::Rect> dis_area_;
std::mutex mutex_;
bool fullscreen_ = false;
};
} // namespace sdl
} // namespace platform
......
......@@ -78,6 +78,7 @@ message WindowStateUpdateEvent {
required int32 frame_bottom = 7;
required int32 task_id = 8;
required int32 stack_id = 9;
required bool videoFullscreen = 10;
}
repeated WindowState windows = 1;
repeated WindowState removed_windows = 2;
......
......@@ -44,7 +44,7 @@ void MultiWindowManager::apply_window_state_update(const WindowState::List &upda
for (const auto &window : updated) {
// Ignore all windows which are not part of the freeform task stack
if (window.stack() != Stack::Id::Freeform) continue;
if (window.stack() != Stack::Id::Freeform && window.stack() != Stack::Id::Fullscreen) continue;
// And also those which don't have a surface mapped at the moment
if (!window.has_surface()) continue;
......
......@@ -30,13 +30,15 @@ WindowState::WindowState()
WindowState::WindowState(const Display::Id &display, bool has_surface,
const graphics::Rect &frame,
const std::string &package_name, const Task::Id &task,
const Stack::Id &stack)
const Stack::Id &stack,
const bool videofullscreen)
: display_(display),
has_surface_(has_surface),
frame_(frame),
package_name_(package_name),
task_(task),
stack_(stack) {}
stack_(stack),
videofullscreen_(videofullscreen) {}
WindowState::~WindowState() {}
} // namespace wm
......
......@@ -35,11 +35,12 @@ class WindowState {
WindowState();
WindowState(const Display::Id &display, bool has_surface,
const graphics::Rect &frame, const std::string &package_name,
const Task::Id &task, const Stack::Id &stack);
const Task::Id &task, const Stack::Id &stack, const bool videofullscreen = false);
~WindowState();
Display::Id display() const { return display_; }
bool has_surface() const { return has_surface_; }
bool videofullscreen() const { return videofullscreen_; }
graphics::Rect frame() const { return frame_; }
std::string package_name() const { return package_name_; }
Task::Id task() const { return task_; }
......@@ -52,6 +53,7 @@ class WindowState {
std::string package_name_;
Task::Id task_;
Stack::Id stack_;
bool videofullscreen_;
};
} // namespace wm
} // namespace anbox
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册