X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=WebThing.cs;h=ff5135467b97ddbbd81d411c4e787fd0e61fe450;hb=2744fefc32dbe9b59a570f6515d51121b8fcfbe3;hp=5e2000b0882e720d020f11dc479dbba746fe45ce;hpb=11835c28c3407f9bbd4aa68b875a528d13ff0d73;p=WebThing.git diff --git a/WebThing.cs b/WebThing.cs index 5e2000b..ff51354 100644 --- a/WebThing.cs +++ b/WebThing.cs @@ -65,6 +65,21 @@ namespace bytex64.WebThing { // based on the executable name, which I don't like. _Window.SetWmclass("webthing", "WebThing"); _Window.Role = "browser"; + { + int w, h; + + if (Config.Options.ContainsKey("Width")) + w = Convert.ToInt32(Config.Options["Width"]); + else + w = 640; + + if (Config.Options.ContainsKey("Height")) + h = Convert.ToInt32(Config.Options["Height"]); + else + h = 480; + + _Window.DefaultSize = new Gdk.Size(w, h); + } _Window.Destroyed += delegate { Quit(); }; // Initialize WidgetGrid @@ -210,5 +225,18 @@ namespace bytex64.WebThing { wtv.WebView.Open(uri); return true; } + + public void Scroll(double x, double y) { + ScrolledWindow.Hadjustment.Value += x; + if (ScrolledWindow.Hadjustment.Value > ScrolledWindow.Hadjustment.Upper - ScrolledWindow.Hadjustment.PageSize) + ScrolledWindow.Hadjustment.Value = ScrolledWindow.Hadjustment.Upper - ScrolledWindow.Hadjustment.PageSize; + ScrolledWindow.Vadjustment.Value += y; + if (ScrolledWindow.Vadjustment.Value > ScrolledWindow.Vadjustment.Upper - ScrolledWindow.Vadjustment.PageSize) + ScrolledWindow.Vadjustment.Value = ScrolledWindow.Vadjustment.Upper - ScrolledWindow.Vadjustment.PageSize; + } + + public void Bump(int x, int y) { + Scroll(x * ScrolledWindow.Hadjustment.StepIncrement, y * ScrolledWindow.Vadjustment.StepIncrement); + } } }