diff -r a35a89a35532 -r d4798e7f4388 GUI/SensorGadget.cs --- a/GUI/SensorGadget.cs Sun May 15 21:43:40 2011 +0000 +++ b/GUI/SensorGadget.cs Mon May 16 22:04:04 2011 +0000 @@ -201,6 +201,20 @@ Redraw(); }; + VisibleChanged += delegate(object sender, EventArgs e) { + Rectangle bounds = new Rectangle(Location, Size); + Screen screen = Screen.FromRectangle(bounds); + Rectangle intersection = + Rectangle.Intersect(screen.WorkingArea, bounds); + if (intersection.Width < Math.Min(16, bounds.Width) || + intersection.Height < Math.Min(16, bounds.Height)) + { + Location = new Point( + screen.WorkingArea.Width / 2 - bounds.Width / 2, + screen.WorkingArea.Height / 2 - bounds.Height / 2); + } + }; + MouseDoubleClick += delegate(object obj, MouseEventArgs args) { SendHideShowCommand(); };