diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2011-08-21 09:21:50 +0300 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2011-08-25 14:27:24 +0300 |
commit | c5b6bacee17387136f73591857c77184ddff74a7 (patch) | |
tree | 9116e558b927ddacf231e772751f66b6800803ea /client/application.cpp | |
parent | 51ac99dbf4b270ab70a78b361cc34ff7077012c8 (diff) | |
download | spice-c5b6bacee17387136f73591857c77184ddff74a7.tar.gz spice-c5b6bacee17387136f73591857c77184ddff74a7.tar.xz spice-c5b6bacee17387136f73591857c77184ddff74a7.zip |
client: setting monitors resolution before resizing screens, RHBZ #728252
fix for "client: fix endless recursion in rearrange_monitors, RHBZ #692976"
Diffstat (limited to 'client/application.cpp')
-rw-r--r-- | client/application.cpp | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/client/application.cpp b/client/application.cpp index 97014f82..115f28bf 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -1373,7 +1373,8 @@ void Application::on_screen_unlocked(RedScreen& screen) void Application::rearrange_monitors(bool force_capture, bool enter_full_screen, - RedScreen* screen) + RedScreen* screen, + std::vector<SpicePoint> *sizes) { bool capture; bool toggle_full_screen; @@ -1391,7 +1392,7 @@ void Application::rearrange_monitors(bool force_capture, hide(); } #endif - prepare_monitors(); + prepare_monitors(sizes); position_screens(); if (enter_full_screen) { // toggling to full screen @@ -1450,16 +1451,19 @@ void Application::assign_monitors() } } -void Application::prepare_monitors() +void Application::prepare_monitors(std::vector<SpicePoint> *sizes) { //todo: test match of monitors size/position against real world size/position for (int i = 0; i < (int)_screens.size(); i++) { Monitor* mon; if (_screens[i] && (mon = _screens[i]->get_monitor())) { - if (_screens[i]->is_size_locked()) { - SpicePoint size = _screens[i]->get_size(); - mon->set_mode(size.x, size.y); + if (sizes) { + mon->set_mode((*sizes)[i].x, (*sizes)[i].y); + } else { + SpicePoint size = _screens[i]->get_size(); + mon->set_mode(size.x, size.y); + } } else { SpicePoint size = mon->get_size(); _screens[i]->resize(size.x, size.y); @@ -1595,15 +1599,31 @@ bool Application::toggle_full_screen() void Application::resize_screen(RedScreen *screen, int width, int height) { - Monitor* mon; + std::vector<SpicePoint> sizes; + std::vector<SpicePoint> *p_sizes = NULL; + bool capture = false; if (_full_screen) { - if ((mon = screen->get_monitor())) { - mon->set_mode(width, height); + capture = (_main_screen == screen) && _active_screen && + _active_screen->is_mouse_captured(); + sizes.resize(_screens.size()); + for (int i = 0; i < (int)_screens.size(); i++) { + if (_screens[i]) { + if (_screens[i] == screen) { + sizes[i].x = width; + sizes[i].y = height; + } else { + sizes[i] = _screens[i]->get_size(); + } + } } + p_sizes = &sizes; } + rearrange_monitors(false, false, NULL, p_sizes); screen->resize(width, height); - rearrange_monitors(false, false); + if (capture) { + screen->capture_mouse(); + } if (screen->is_out_of_sync()) { _out_of_sync = true; /* If the client monitor cannot handle the guest resolution |