summaryrefslogtreecommitdiffstats
path: root/client/display_channel.cpp
diff options
context:
space:
mode:
authorYaniv Kamay <ykamay@redhat.com>2009-12-28 00:17:42 +0200
committerYaniv Kamay <ykamay@redhat.com>2009-12-28 12:35:32 +0200
commitcced1b1cff4002e2402936ff033ce985668e59e5 (patch)
tree002c66212e423c5536080e5dd6f6d046501919df /client/display_channel.cpp
parent941ba9bf5ca9a8812e7893848943c2cec6a5e6a6 (diff)
downloadspice-cced1b1cff4002e2402936ff033ce985668e59e5.tar.gz
spice-cced1b1cff4002e2402936ff033ce985668e59e5.tar.xz
spice-cced1b1cff4002e2402936ff033ce985668e59e5.zip
client: improve screen resizing
Screen now have to modes locked and unlocked. In unlocked mode, the application can change screen size and so reduce resolution changing. The application can also choose to change window size while not in full screen mode. In locked mode the application must ewtain locker screen size setting.
Diffstat (limited to 'client/display_channel.cpp')
-rw-r--r--client/display_channel.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index 9f8fba80..0050a21c 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -60,7 +60,8 @@ public:
{
Application* app = (Application*)events_loop.get_owner();
_channel.destroy_canvas();
- _channel.screen()->set_mode(_width, _height, _depth);
+ _channel.screen()->lock_size();
+ _channel.screen()->resize(_width, _height);
_channel.create_canvas(app->get_canvas_types(), _width, _height, _depth);
}
@@ -71,6 +72,22 @@ private:
int _depth;
};
+class UnlockScreenEvent: public Event {
+public:
+ UnlockScreenEvent(RedScreen* screen)
+ : _screen (screen->ref())
+ {
+ }
+
+ virtual void response(AbstractProcessLoop& events_loop)
+ {
+ (*_screen)->unlock_size();
+ }
+
+private:
+ AutoRef<RedScreen> _screen;
+};
+
class DisplayMarkEvent: public Event {
public:
DisplayMarkEvent(int screen_id)
@@ -1088,9 +1105,14 @@ void DisplayChannel::on_disconnect()
if (screen()) {
screen()->set_update_interrupt_trigger(NULL);
}
+
AutoRef<DetachChannelsEvent> detach_channels(new DetachChannelsEvent(*this));
get_client().push_event(*detach_channels);
- detach_from_screen(get_client().get_application());
+ if (screen()) {
+ AutoRef<UnlockScreenEvent> unlock_event(new UnlockScreenEvent(screen()));
+ get_client().push_event(*unlock_event);
+ detach_from_screen(get_client().get_application());
+ }
get_client().deactivate_interval_timer(*_streams_timer);
AutoRef<SyncEvent> sync_event(new SyncEvent());
get_client().push_event(*sync_event);
@@ -1280,7 +1302,12 @@ void DisplayChannel::handle_reset(RedPeer::InMessage *message)
if (_canvas.get()) {
_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();