[Spice-devel] [PATCH 2/3] detaching the screen when the primary surface is destoryed and closing the window if the primary surface is not recreated (the monitor has been detached).

Yonit Halperin yhalperi at redhat.com
Sun Jun 27 02:45:12 PDT 2010


---
 client/display_channel.cpp |   25 +++++++++++++++----------
 client/display_channel.h   |    1 +
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index 95840b5..1bf0744 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -1220,25 +1220,31 @@ void DisplayChannel::handle_mark(RedPeer::InMessage *message)
     set_rect_area(area);
 }
 
-void DisplayChannel::handle_reset(RedPeer::InMessage *message)
+void DisplayChannel::reset_screen()
 {
+    AutoRef<UnlockScreenEvent> unlock_event(new UnlockScreenEvent(screen()));
+    get_client().push_event(*unlock_event);
+
     screen()->set_update_interrupt_trigger(NULL);
+    AutoRef<ResetTimer> reset_timer(new ResetTimer(screen()->ref(), get_client()));
 
+    detach_from_screen(get_client().get_application());
+    
+    get_client().activate_interval_timer(*reset_timer, RESET_TIMEOUT);
+}
+
+
+void DisplayChannel::handle_reset(RedPeer::InMessage *message)
+{
     if (surfaces_mngr.is_present_canvas(0)) {
         Canvas *canvas;
         canvas = surfaces_mngr.get_canvas(0);
         canvas->clear();
     }
 
-    AutoRef<ResetTimer> reset_timer(new ResetTimer(screen()->ref(), get_client()));
-
-    AutoRef<UnlockScreenEvent> unlock_event(new UnlockScreenEvent(screen()));
-    get_client().push_event(*unlock_event);
-
-    detach_from_screen(get_client().get_application());
     _palette_cache.clear();
 
-    get_client().activate_interval_timer(*reset_timer, RESET_TIMEOUT);
+    reset_screen();
 }
 
 void DisplayChannel::handle_inval_list(RedPeer::InMessage* message)
@@ -1464,8 +1470,7 @@ void DisplayChannel::destroy_primary_surface()
         }
 #endif
 
-        AutoRef<UnlockScreenEvent> unlock_event(new UnlockScreenEvent(screen()));
-        get_client().push_event(*unlock_event);
+        reset_screen();
     }
 
     AutoRef<DestroyPrimarySurfaceEvent> event(new DestroyPrimarySurfaceEvent(*this));
diff --git a/client/display_channel.h b/client/display_channel.h
index c56adf6..e6cd227 100644
--- a/client/display_channel.h
+++ b/client/display_channel.h
@@ -188,6 +188,7 @@ private:
     void streams_time();
     void activate_streams_timer();
     void stream_update_request(uint32_t update_time);
+    void reset_screen();
 
     static void set_clip_rects(const SpiceClip& clip, uint32_t& num_clip_rects, SpiceRect*& clip_rects);
 private:
-- 
1.6.6.1



More information about the Spice-devel mailing list