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).

This commit is contained in:
Yonit Halperin 2010-06-27 12:45:12 +03:00 committed by Alexander Larsson
parent 8d21bce435
commit 3ca28ddf28
2 changed files with 17 additions and 11 deletions

View File

@ -1220,25 +1220,31 @@ void DisplayChannel::handle_mark(RedPeer::InMessage *message)
set_rect_area(area);
}
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)
{
screen()->set_update_interrupt_trigger(NULL);
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));

View File

@ -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: