[gnome-documents/wip/ui-changes] embed: switch to fullscreen preview automatically when maximized



commit 0e6b1afb66129247c7c7b0ee39a92b2162ff2650
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 6084ed5..ebc0d27 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -480,7 +480,6 @@ const Embed = new Lang.Class({
         this._preview.widget.grab_focus();
 
         this._spinnerBox.moveOut();
-        Global.modeController.setCanFullscreen(true);
     },
 
     _onLoadError: function(manager, doc, message, exception) {
diff --git a/src/windowMode.js b/src/windowMode.js
index d1d4992..870a71e 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 Global = imports.global;
+
 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 = Global.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]