Example #1
0
        void HandleCursorPositionChanged(object sender, CursorPostionChangedArgs e)
        {
            Gdk.Point cursor  = Owner.CursorTracker.Cursor;
            int       monitor = Owner.Screen.GetMonitorAtPoint(cursor.X, cursor.Y);

            Gdk.Rectangle geo = Owner.Screen.GetMonitorGeometry(monitor);

            int activeRegion = Math.Min(geo.Height / 3, geo.Width / 3);

            Gdk.Rectangle left   = new Gdk.Rectangle(geo.X, geo.Y + activeRegion, activeRegion, geo.Height - activeRegion * 2);
            Gdk.Rectangle top    = new Gdk.Rectangle(geo.X + activeRegion, geo.Y, geo.Width - activeRegion * 2, activeRegion);
            Gdk.Rectangle right  = new Gdk.Rectangle(geo.X + geo.Width - activeRegion, geo.Y + activeRegion, activeRegion, geo.Height - activeRegion * 2);
            Gdk.Rectangle bottom = new Gdk.Rectangle(geo.X + activeRegion, geo.Y + geo.Height - activeRegion, geo.Width - activeRegion * 2, activeRegion);

            DockPosition target;

            if (top.Contains(cursor))
            {
                target = DockPosition.Top;
            }
            else if (bottom.Contains(cursor))
            {
                target = DockPosition.Bottom;
            }
            else if (left.Contains(cursor))
            {
                target = DockPosition.Left;
            }
            else if (right.Contains(cursor))
            {
                target = DockPosition.Right;
            }
            else
            {
                return;
            }

            IDockPreferences prefs = Owner.Preferences;

            if (prefs.Position != target || prefs.MonitorNumber != monitor)
            {
                Dock d = Docky.Controller.DocksForMonitor(monitor).FirstOrDefault(dock => dock.Preferences.Position == target);
                if (d == null)
                {
                    prefs.MonitorNumber = monitor;
                    prefs.Position      = target;
                }
                else
                {
                    d.Preferences.MonitorNumber = prefs.MonitorNumber;
                    d.Preferences.Position      = prefs.Position;
                    prefs.MonitorNumber         = monitor;
                    prefs.Position = target;
                }
            }
        }
Example #2
0
        void OnCursorPositionChanged(Gdk.Point oldPoint)
        {
            if (CursorPositionChanged != null)
            {
                CursorPostionChangedArgs args = new CursorPostionChangedArgs {
                    LastPosition = oldPoint,
                };

                CursorPositionChanged(this, args);
            }
        }
		void OnCursorPositionChanged (Gdk.Point oldPoint)
		{
			if (CursorPositionChanged != null) {
				CursorPostionChangedArgs args = new CursorPostionChangedArgs {
					LastPosition = oldPoint,
				};
				
				CursorPositionChanged (this, args);
			}
		}
Example #4
0
 void HandleCursorPositionChanged(object sender, CursorPostionChangedArgs args)
 {
     SetDockHovered();
     SetHidden();
 }
		void HandleCursorPositionChanged (object sender, CursorPostionChangedArgs e)
		{
			Gdk.Point cursor = Owner.CursorTracker.Cursor;
			int monitor = Owner.Screen.GetMonitorAtPoint (cursor.X, cursor.Y);
			
			Gdk.Rectangle geo = Owner.Screen.GetMonitorGeometry (monitor);
			
			int activeRegion = Math.Min (geo.Height / 3, geo.Width / 3);
			Gdk.Rectangle left = new Gdk.Rectangle (geo.X, geo.Y + activeRegion, activeRegion, geo.Height - activeRegion * 2);
			Gdk.Rectangle top = new Gdk.Rectangle (geo.X + activeRegion, geo.Y, geo.Width - activeRegion * 2, activeRegion);
			Gdk.Rectangle right = new Gdk.Rectangle (geo.X + geo.Width - activeRegion, geo.Y + activeRegion, activeRegion, geo.Height - activeRegion * 2);
			Gdk.Rectangle bottom = new Gdk.Rectangle (geo.X + activeRegion, geo.Y + geo.Height - activeRegion, geo.Width - activeRegion * 2, activeRegion);
			
			DockPosition target;
			if (top.Contains (cursor))
				target = DockPosition.Top;
			else if (bottom.Contains (cursor))
				target = DockPosition.Bottom;
			else if (left.Contains (cursor))
				target = DockPosition.Left;
			else if (right.Contains (cursor))
				target = DockPosition.Right;
			else
				return;
			
			IDockPreferences prefs = Owner.Preferences;
			if (prefs.Position != target || prefs.MonitorNumber != monitor) {
				Dock d = Docky.Controller.DocksForMonitor (monitor).FirstOrDefault (dock => dock.Preferences.Position == target);
				if (d == null) {
					prefs.MonitorNumber = monitor;
					prefs.Position = target;
				} else {
					d.Preferences.MonitorNumber = prefs.MonitorNumber;
					d.Preferences.Position = prefs.Position;
					prefs.MonitorNumber = monitor;
					prefs.Position = target;
				}
			}
		}
Example #6
0
		void HandleCursorPositionChanged (object sender, CursorPostionChangedArgs e)
		{
			if (DockHovered && e.LastPosition != Cursor)
				AnimatedDraw ();
			DragTracker.EnsureDragAndDropProxy ();
			
			UpdateMonitorGeometry ();
			int distance;
			switch (Position) {
			default:
			case DockPosition.Top:
				distance = e.LastPosition.Y - ZoomedDockHeight;
				break;
			case DockPosition.Left:
				distance = e.LastPosition.X - ZoomedDockHeight;
				break;
			case DockPosition.Bottom:
				distance = monitor_geo.Height - ZoomedDockHeight - e.LastPosition.Y;
				break;
			case DockPosition.Right:
				distance = monitor_geo.Width - ZoomedDockHeight - e.LastPosition.X;
				break;
			}
			if (distance > 0.3 * DockHeight)
				HidePainter ();
		}
		void HandleCursorPositionChanged (object sender, CursorPostionChangedArgs args)
		{
			SetDockHovered ();
			SetHidden ();
		}