X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=plugins%2FFFNav.cs;h=588f432011231644483aca998cec1a3d575e15a1;hb=02acfc22dbfa3d145d265157fdf616a950fa30c6;hp=f8ba39c6d6e41937eccbc9d0ed6e097b9b4a9fcc;hpb=80865e6b884a4bb289cb4a835a6fa66b3529c872;p=WebThing.git diff --git a/plugins/FFNav.cs b/plugins/FFNav.cs index f8ba39c..588f432 100644 --- a/plugins/FFNav.cs +++ b/plugins/FFNav.cs @@ -1,29 +1,65 @@ using System; using Gtk; +using WebKit; using bytex64.WebThing; public class FFNav : WebThingPlugin { WebThing wt; - public void Init(WebThing wt) { + public override void Init(WebThing wt) { this.wt = wt; - wt.WebView.KeyPressEvent += WebView_KeyPress; + + wt.Window.KeyPressEvent += Window_KeyPress; + } + + public override void InitWebView(WebView wv) { + wv.KeyPressEvent += WebView_KeyPress; + } + + private void Window_KeyPress(object o, KeyPressEventArgs e) { + if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) { + switch(e.Event.Key) { + case Gdk.Key.t: + wt.NewTab(); + wt.Tabs.CurrentPage = wt.Tabs.NPages - 1; + break; + case Gdk.Key.w: + wt.CloseTab(); + break; + } + } } private void WebView_KeyPress(object o, KeyPressEventArgs e) { + WebView wv = (WebView) o; if ((e.Event.State & Gdk.ModifierType.Mod1Mask) != 0) { switch(e.Event.Key) { case Gdk.Key.Left: - wt.WebView.GoBack(); + wv.GoBack(); break; case Gdk.Key.Right: - wt.WebView.GoForward(); + wv.GoForward(); + break; + } + } else if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) { + switch(e.Event.Key) { + case Gdk.Key.ISO_Left_Tab: + if (wt.Tabs.CurrentPage == 0) + wt.Tabs.CurrentPage = wt.Tabs.NPages - 1; + else + wt.Tabs.PrevPage(); + break; + case Gdk.Key.Tab: + if (wt.Tabs.CurrentPage == wt.Tabs.NPages - 1) + wt.Tabs.CurrentPage = 0; + else + wt.Tabs.NextPage(); break; } } else { switch(e.Event.Key) { case Gdk.Key.BackSpace: - wt.WebView.GoBack(); + wv.GoBack(); break; } }