[Spice-commits] 3 commits - client/x11

Christophe Fergau teuf at kemper.freedesktop.org
Fri Oct 7 07:43:55 PDT 2011


 client/x11/platform.cpp |   26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

New commits:
commit bc9306852d145916a199176cf54967b590897ac0
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Oct 4 15:05:43 2011 +0200

    client/x11: reset screen positions in XMonitor::do_restore
    
    XMonitor::do_restore (called for example when going out of
    fullscreen) restore the screen resolution to its previous state,
    but it doesn't take care of repositioning the screen to their
    previous position, which is one of the advantages of using randr
    1.2.
    Since MultyMonScreen::restore handles all of this for us, just call
    it to restore the monitor position/resolutions to their previous
    settings. Before doing any changes, MultyMonScreen::restore checks
    if there's something to do, so calling it once per monitor won't be
    an issue, the resolution/position will only be set the first time.
    
    This has the side-effect of fixing bug #693431. This bug occurs when
    closing the client after the client went in and out of fullscreen.
    MultyMonScreen::~MultyMonScreen calls MultyMonScreen::restore, which
    decides to change the screen positions since they were lost when going
    to fullscreen because XMonitor::restore didn't restore the positions.
    After this change, the positions will be properly restored and
    MultyMonScreen::restore won't be needlessly called upon client
    shutdown.

diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 57410a4..aef6870 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -1080,6 +1080,7 @@ public:
 
     void disable();
     void enable();
+    void restore();
 
     bool set_monitor_mode(XMonitor& monitor, const XRRModeInfo& mode_info);
 
@@ -1092,7 +1093,6 @@ private:
 
     XMonitor* crtc_overlap_test(int x, int y, int width, int height);
     void monitors_cleanup();
-    void restore();
 
 private:
     int _min_width;
@@ -2232,7 +2232,7 @@ void XMonitor::do_restore()
     if (!mode_changed()) {
         return;
     }
-    do_set_mode(_saved_size.x, _saved_size.y);
+    _container.restore();
 }
 
 int XMonitor::get_depth()
commit e3e04b0a2a712ed40e8be47a3be3992a97ecfc28
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Oct 4 13:52:22 2011 +0200

    client/x11: fix mode setting in MultyMonScreen::restore
    
    MultyMonScreen::restore changes the X11 Screen resolution, but it
    doesn't use MultyMonScreen::set_size. This means
    MultyMonScreen::_width and MultyMonScreen::_height don't get
    updated to reflect the new resolution settings, which could cause
    issues later on. Until now this was safe since the only caller of
    MultyMonScreen::restore was MultyMonScreen destructor.

diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index f7f72cd..57410a4 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -1356,13 +1356,7 @@ void MultyMonScreen::restore()
     X_DEBUG_SYNC(get_display());
     XMonitor::inc_change_ref();
     disable();
-    Window root_window = RootWindow(get_display(), get_screen());
-
-    XLockDisplay(get_display());
-    XRRSetScreenSize(get_display(), root_window, _saved_width,
-                     _saved_height,
-                     _saved_width_mm, _saved_height_mm);
-    XUnlockDisplay(get_display());
+    set_size(_saved_width, _saved_height);
     XMonitorsList::iterator iter = _monitors.begin();
     for (; iter != _monitors.end(); iter++) {
         (*iter)->revert();
commit ae3e63a9d8efe6311270c53150c2a79b632aaa07
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Oct 4 10:20:56 2011 +0200

    client/x11: fix typos (finde => find)

diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 670912c..f7f72cd 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -1147,8 +1147,8 @@ protected:
 
 private:
     void update_position();
-    bool finde_mode_in_outputs(RRMode mode, int start_index, XRRScreenResources* res);
-    bool finde_mode_in_clones(RRMode mode, XRRScreenResources* res);
+    bool find_mode_in_outputs(RRMode mode, int start_index, XRRScreenResources* res);
+    bool find_mode_in_clones(RRMode mode, XRRScreenResources* res);
     XRRModeInfo* find_mode(int width, int height, XRRScreenResources* res);
 
 private:
@@ -2041,7 +2041,7 @@ void XMonitor::update_position()
     X_DEBUG_SYNC(display);
 }
 
-bool XMonitor::finde_mode_in_outputs(RRMode mode, int start_index, XRRScreenResources* res)
+bool XMonitor::find_mode_in_outputs(RRMode mode, int start_index, XRRScreenResources* res)
 {
     int i, j;
     bool retval = true;
@@ -2065,11 +2065,11 @@ bool XMonitor::finde_mode_in_outputs(RRMode mode, int start_index, XRRScreenReso
     return retval;
 }
 
-bool XMonitor::finde_mode_in_clones(RRMode mode, XRRScreenResources* res)
+bool XMonitor::find_mode_in_clones(RRMode mode, XRRScreenResources* res)
 {
     XMonitorsList::iterator iter = _clones.begin();
     for (; iter != _clones.end(); iter++) {
-        if (!(*iter)->finde_mode_in_outputs(mode, 0, res)) {
+        if (!(*iter)->find_mode_in_outputs(mode, 0, res)) {
             return false;
         }
     }
@@ -2114,12 +2114,12 @@ XRRModeInfo* XMonitor::find_mode(int width, int height, XRRScreenResources* res)
     while (!modes_set.empty()) {
         ModesSet::iterator iter = modes_set.begin();
 
-        if (!finde_mode_in_outputs((*iter).info->id, 1, res)) {
+        if (!find_mode_in_outputs((*iter).info->id, 1, res)) {
             modes_set.erase(iter);
             continue;
         }
 
-        if (!finde_mode_in_clones((*iter).info->id, res)) {
+        if (!find_mode_in_clones((*iter).info->id, res)) {
             modes_set.erase(iter);
             continue;
         }


More information about the Spice-commits mailing list