From 3ca28ddf284acb9f1a90e3a1dbf020754db820b8 Mon Sep 17 00:00:00 2001 From: Yonit Halperin Date: Sun, 27 Jun 2010 12:45:12 +0300 Subject: [PATCH] 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). --- client/display_channel.cpp | 27 ++++++++++++++++----------- client/display_channel.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/client/display_channel.cpp b/client/display_channel.cpp index 95840b57..1bf0744b 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::reset_screen() +{ + AutoRef unlock_event(new UnlockScreenEvent(screen())); + get_client().push_event(*unlock_event); + + screen()->set_update_interrupt_trigger(NULL); + AutoRef 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) { - screen()->set_update_interrupt_trigger(NULL); - if (surfaces_mngr.is_present_canvas(0)) { Canvas *canvas; canvas = surfaces_mngr.get_canvas(0); canvas->clear(); } - AutoRef reset_timer(new ResetTimer(screen()->ref(), get_client())); - - AutoRef 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 unlock_event(new UnlockScreenEvent(screen())); - get_client().push_event(*unlock_event); + reset_screen(); } AutoRef event(new DestroyPrimarySurfaceEvent(*this)); diff --git a/client/display_channel.h b/client/display_channel.h index c56adf6f..e6cd227e 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: