X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=plugins%2FFullscreen.cs;fp=plugins%2FFullscreen.cs;h=fcb617b7f77afc615e9b6fc448155a6a3e6b0733;hb=fc831a2ef0ae342cc73dee301e051bcfbbbeb82c;hp=0000000000000000000000000000000000000000;hpb=02acfc22dbfa3d145d265157fdf616a950fa30c6;p=WebThing.git diff --git a/plugins/Fullscreen.cs b/plugins/Fullscreen.cs new file mode 100644 index 0000000..fcb617b --- /dev/null +++ b/plugins/Fullscreen.cs @@ -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; + } +}