[gnome-documents] embed: switch to fullscreen preview automatically when maximized



commit 0c2927c3075e6a27e9b8b0ba4bbd7596a417ebfc
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Nov 30 18:31:24 2012 -0500

    embed: switch to fullscreen preview automatically when maximized

 src/embed.js      |    1 -
 src/windowMode.js |   18 +++++++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index 572a4f0..790b3c3 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -484,7 +484,6 @@ const Embed = new Lang.Class({
         this._preview.widget.grab_focus();
 
         this._spinnerBox.moveOut();
-        Application.modeController.setCanFullscreen(true);
     },
 
     _onLoadError: function(manager, doc, message, exception) {
diff --git a/src/windowMode.js b/src/windowMode.js
index d1d4992..63c73eb 100644
--- a/src/windowMode.js
+++ b/src/windowMode.js
@@ -19,9 +19,13 @@
  *
  */
 
+const Gdk = imports.gi.Gdk;
+
 const Lang = imports.lang;
 const Signals = imports.signals;
 
+const Application = imports.application;
+
 const WindowMode = {
     NONE: 0,
     OVERVIEW: 1,
@@ -43,11 +47,19 @@ const ModeController = new Lang.Class({
         if (oldMode == mode)
             return;
 
-        if (mode == WindowMode.OVERVIEW)
-            this.setCanFullscreen(false);
-
+        this.setCanFullscreen(mode == WindowMode.PREVIEW);
         this._mode = mode;
+
         this.emit('window-mode-changed', this._mode, oldMode);
+
+        if (mode == WindowMode.PREVIEW) {
+            let window = Application.application.get_active_window();
+            let gdkWindow = window.get_window();
+            let windowState = gdkWindow.get_state();
+
+            if (windowState & Gdk.WindowState.MAXIMIZED)
+                this.setFullscreen(true);
+        }
     },
 
     getWindowMode: function() {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]