Add plugin for F11 full-screen toggle
authorChip Black <bytex64@bytex64.net>
Wed, 10 Jun 2009 08:41:22 +0000 (03:41 -0500)
committerChip Black <bytex64@bytex64.net>
Wed, 10 Jun 2009 08:41:22 +0000 (03:41 -0500)
plugins/Fullscreen.cs [new file with mode: 0644]
plugins/Makefile

diff --git a/plugins/Fullscreen.cs b/plugins/Fullscreen.cs
new file mode 100644 (file)
index 0000000..fcb617b
--- /dev/null
@@ -0,0 +1,33 @@
+using System;
+using Gtk;
+using Gdk;
+using bytex64.WebThing;
+
+public class Fullscreen : WebThingPlugin {
+    private bool IsFullscreen = false;
+    private Gtk.Window Win;
+
+    public override void Init(WebThing wt) {
+        Win = wt.Window;
+        Win.KeyPressEvent += Win_KeyPress;
+        Win.WindowStateEvent += Win_WindowState;
+    }
+
+    private void Win_KeyPress(object o, KeyPressEventArgs e) {
+        if (e.Event.State == Gdk.ModifierType.None) {
+            switch(e.Event.Key) {
+            case Gdk.Key.F11:
+                if (IsFullscreen) {
+                    Win.Unfullscreen();
+                } else {
+                    Win.Fullscreen();
+                }
+                break;
+            }
+        }
+    }
+
+    private void Win_WindowState(object o, WindowStateEventArgs e) {
+        IsFullscreen = (e.Event.NewWindowState & WindowState.Fullscreen) != 0;
+    }
+}
index 105e807..2f78065 100644 (file)
@@ -1,7 +1,7 @@
 CSFLAGS = -debug
 references = -r:../webkit-sharp.dll -pkg:gtk-sharp-2.0
 
-all: Vimish.dll FFNav.dll DefaultPage.dll LoadProgress.dll MiddleClickOpen.dll QuickSearch.dll Session.dll
+all: Vimish.dll FFNav.dll DefaultPage.dll LoadProgress.dll MiddleClickOpen.dll QuickSearch.dll Session.dll Fullscreen.dll
 
 clean:
        rm -f *.dll *.mdb *.so