mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-30 17:49:02 +00:00
spicec: Don't show a white screen if guest resolution does not fit fullscreen
Currently when going / starting fullscreen if the guest resolution for one of the monitors is higher then that monitor on the client can handle, we show a white screen. Leaving the user stuck (unless they know the fullscreen key switch combi) with a white screen when starting the client fullscreen from the XPI. This patch changes the client to fall back to windowed mode in this case instead.
This commit is contained in:
parent
eb3efa3cbb
commit
aa3e19bfa4
@ -348,6 +348,7 @@ Application::Application()
|
||||
, _active (false)
|
||||
, _full_screen (false)
|
||||
, _changing_screens (false)
|
||||
, _out_of_sync (false)
|
||||
, _exit_code (0)
|
||||
, _active_screen (NULL)
|
||||
, _num_keys_pressed (0)
|
||||
@ -674,6 +675,12 @@ RedScreen* Application::get_screen(int id)
|
||||
prepare_monitors();
|
||||
position_screens();
|
||||
screen->show_full_screen();
|
||||
if (screen->is_out_of_sync()) {
|
||||
_out_of_sync = true;
|
||||
/* If the client monitor cannot handle the guest resolution
|
||||
drop back to windowed mode */
|
||||
exit_full_screen();
|
||||
}
|
||||
|
||||
if (capture) {
|
||||
_main_screen->activate();
|
||||
@ -1492,6 +1499,9 @@ void Application::show_full_screen()
|
||||
for (int i = 0; i < (int)_screens.size(); i++) {
|
||||
if (_screens[i]) {
|
||||
_screens[i]->show_full_screen();
|
||||
if (_screens[i]->is_out_of_sync()) {
|
||||
_out_of_sync = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1512,6 +1522,11 @@ void Application::enter_full_screen()
|
||||
}
|
||||
_changing_screens = false;
|
||||
_full_screen = true;
|
||||
/* If the client monitor cannot handle the guest resolution drop back
|
||||
to windowed mode */
|
||||
if (_out_of_sync) {
|
||||
exit_full_screen();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::restore_screens_size()
|
||||
@ -1529,6 +1544,9 @@ void Application::exit_full_screen()
|
||||
if (!_full_screen) {
|
||||
return;
|
||||
}
|
||||
if (_out_of_sync) {
|
||||
LOG_WARN("Falling back to windowed mode (guest resolution too large for client?)");
|
||||
}
|
||||
LOG_INFO("");
|
||||
_changing_screens = true;
|
||||
release_capture();
|
||||
@ -1544,6 +1562,7 @@ void Application::exit_full_screen()
|
||||
}
|
||||
}
|
||||
_full_screen = false;
|
||||
_out_of_sync = false;
|
||||
restore_screens_size();
|
||||
show();
|
||||
_main_screen->activate();
|
||||
@ -1560,6 +1579,17 @@ bool Application::toggle_full_screen()
|
||||
return _full_screen;
|
||||
}
|
||||
|
||||
void Application::resize_screen(RedScreen *screen, int width, int height)
|
||||
{
|
||||
screen->resize(width, height);
|
||||
if (screen->is_out_of_sync()) {
|
||||
_out_of_sync = true;
|
||||
/* If the client monitor cannot handle the guest resolution
|
||||
drop back to windowed mode */
|
||||
exit_full_screen();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::minimize()
|
||||
{
|
||||
for (int i = 0; i < (int)_screens.size(); i++) {
|
||||
|
||||
@ -217,6 +217,7 @@ public:
|
||||
void enter_full_screen();
|
||||
void exit_full_screen();
|
||||
bool toggle_full_screen();
|
||||
void resize_screen(RedScreen *screen, int width, int height);
|
||||
void minimize();
|
||||
void set_title(const std::string& title);
|
||||
void hide();
|
||||
@ -352,6 +353,7 @@ private:
|
||||
bool _active;
|
||||
bool _full_screen;
|
||||
bool _changing_screens;
|
||||
bool _out_of_sync;
|
||||
int _exit_code;
|
||||
RedScreen* _active_screen;
|
||||
bool _keyboard_state[REDKEY_NUM_KEYS];
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
{
|
||||
Application* app = (Application*)events_loop.get_owner();
|
||||
_channel.screen()->lock_size();
|
||||
_channel.screen()->resize(_width, _height);
|
||||
app->resize_screen(_channel.screen(), _width, _height);
|
||||
_channel.create_canvas(0, app->get_canvas_types(), _width, _height, _format);
|
||||
}
|
||||
|
||||
|
||||
@ -78,6 +78,7 @@ public:
|
||||
void set_monitor(Monitor *monitor) { _monitor = monitor;}
|
||||
Monitor* get_monitor() { return _monitor;}
|
||||
RedWindow* get_window() { return &_window;}
|
||||
bool is_out_of_sync() { return _out_of_sync;}
|
||||
void set_cursor(LocalCursor* cursor);
|
||||
void hide_cursor();
|
||||
void exit_full_screen();
|
||||
@ -118,7 +119,6 @@ private:
|
||||
void notify_new_size();
|
||||
void adjust_window_rect(int x, int y);
|
||||
void save_position();
|
||||
bool is_out_of_sync() { return _out_of_sync;}
|
||||
void __show_full_screen();
|
||||
|
||||
bool _invalidate(const SpiceRect& rect, bool urgent, uint64_t& update_mark);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user