Use current display resolution as display size
This commit is contained in:
parent
113a06590a
commit
8c19a8e42b
2 changed files with 12 additions and 3 deletions
|
|
@ -29,12 +29,21 @@ namespace ubuntu {
|
||||||
WindowCreator::WindowCreator(const std::shared_ptr<input::Manager> &input_manager) :
|
WindowCreator::WindowCreator(const std::shared_ptr<input::Manager> &input_manager) :
|
||||||
graphics::WindowCreator(input_manager),
|
graphics::WindowCreator(input_manager),
|
||||||
input_manager_(input_manager),
|
input_manager_(input_manager),
|
||||||
event_thread_running_(false) {
|
event_thread_running_(false),
|
||||||
|
display_info_({1920, 1080}) {
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0)
|
||||||
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to initialize SDL"));
|
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to initialize SDL"));
|
||||||
|
|
||||||
event_thread_ = std::thread(&WindowCreator::process_events, this);
|
event_thread_ = std::thread(&WindowCreator::process_events, this);
|
||||||
|
|
||||||
|
SDL_DisplayMode display_mode;
|
||||||
|
// FIXME statically just check the first (primary) display for its mode;
|
||||||
|
// once we get multi-monitor support we need to do this better.
|
||||||
|
if (SDL_GetCurrentDisplayMode(0, &display_mode) == 0) {
|
||||||
|
display_info_.horizontal_resolution = display_mode.w;
|
||||||
|
display_info_.vertical_resolution = display_mode.h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowCreator::~WindowCreator() {
|
WindowCreator::~WindowCreator() {
|
||||||
|
|
@ -107,8 +116,7 @@ void WindowCreator::destroy_window(EGLNativeWindowType win) {
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowCreator::DisplayInfo WindowCreator::display_info() const {
|
WindowCreator::DisplayInfo WindowCreator::display_info() const {
|
||||||
// FIXME: force for now until we have real detection for this
|
return display_info_;
|
||||||
return {1280, 720};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLNativeDisplayType WindowCreator::native_display() const {
|
EGLNativeDisplayType WindowCreator::native_display() const {
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ private:
|
||||||
std::shared_ptr<Window> current_window_;
|
std::shared_ptr<Window> current_window_;
|
||||||
std::thread event_thread_;
|
std::thread event_thread_;
|
||||||
bool event_thread_running_;
|
bool event_thread_running_;
|
||||||
|
graphics::WindowCreator::DisplayInfo display_info_;
|
||||||
};
|
};
|
||||||
} // namespace bridge
|
} // namespace bridge
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue