Update issue #600
Status: Fixed Applied patch from jenlehma git-svn-id: https://duplicati.googlecode.com/svn/branches/1.3.x@1324 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
Generated
+1
@@ -73,6 +73,7 @@
|
||||
this.quitToolStripMenuItem});
|
||||
this.TrayMenu.Name = "TrayMenu";
|
||||
resources.ApplyResources(this.TrayMenu, "TrayMenu");
|
||||
this.TrayMenu.LocationChanged += new System.EventHandler(this.TrayMenu_LocationChanged);
|
||||
//
|
||||
// statusToolStripMenuItem
|
||||
//
|
||||
|
||||
@@ -754,5 +754,41 @@ namespace Duplicati.GUI
|
||||
{
|
||||
ShowStatus();
|
||||
}
|
||||
|
||||
private void TrayMenu_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
// This is a workaround by Jenlehma for not displaying the context menu on the right screen:
|
||||
// http://code.google.com/p/duplicati/issues/detail?id=600
|
||||
|
||||
// We assume that only Windows is broken here
|
||||
if (!Duplicati.Library.Utility.Utility.IsClientLinux)
|
||||
{
|
||||
// First we get the top/left position of the TrayMenu and the current mouse position
|
||||
Point TrayMenuTopLeft = new Point(TrayMenu.Left, TrayMenu.Top);
|
||||
Point mousePos = Cursor.Position;
|
||||
|
||||
// Now get the screen objects of both coordinates (mouse / traymenu)
|
||||
Screen ScrContextMenu = Screen.FromPoint(TrayMenuTopLeft);
|
||||
Screen ScrCursor = Screen.FromPoint(mousePos);
|
||||
|
||||
// if the mouse and the tray menu is on different screens ...
|
||||
if (ScrContextMenu.DeviceName != ScrCursor.DeviceName)
|
||||
{
|
||||
// if the mouse sits exactly on the top or the bottom of the menu, the menu might have an offset on the x-axis
|
||||
if (TrayMenuTopLeft.Y + TrayMenu.Height == mousePos.Y || TrayMenuTopLeft.Y == mousePos.Y)
|
||||
{
|
||||
if (TrayMenuTopLeft.X < mousePos.X)
|
||||
TrayMenu.Left = mousePos.X;
|
||||
else if (TrayMenuTopLeft.X > mousePos.X)
|
||||
TrayMenu.Left = mousePos.X - TrayMenu.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the y-axis is off .. just move that.
|
||||
TrayMenu.Top = mousePos.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user