mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-22 20:37:19 -08:00
fix<*>: PerMonitorDpiAwareV2 not working for ContextMenus on multi-displays with difference DPIs
This commit is contained in:
parent
611d3c7db0
commit
c6606fee88
9 changed files with 17 additions and 17 deletions
|
@ -229,8 +229,8 @@ namespace SourceGit.Views.Widgets {
|
|||
});
|
||||
}
|
||||
|
||||
private void OpenChangeContextMenu(Models.Change change) {
|
||||
var menu = new ContextMenu();
|
||||
private void OpenChangeContextMenu(Models.Change change, UIElement placement) {
|
||||
var menu = new ContextMenu() { PlacementTarget = placement };
|
||||
var path = change.Path;
|
||||
|
||||
if (change.Index != Models.Change.Status.Deleted) {
|
||||
|
@ -329,7 +329,7 @@ namespace SourceGit.Views.Widgets {
|
|||
var node = item.DataContext as ChangeNode;
|
||||
if (node == null || node.IsFolder) return;
|
||||
|
||||
OpenChangeContextMenu(node.Change);
|
||||
OpenChangeContextMenu(node.Change, item);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ namespace SourceGit.Views.Widgets {
|
|||
var change = row.Item as Models.Change;
|
||||
if (change == null) return;
|
||||
|
||||
OpenChangeContextMenu(change);
|
||||
OpenChangeContextMenu(change, row);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace SourceGit.Views.Widgets {
|
|||
}
|
||||
|
||||
var selectedCount = changeList.SelectedItems.Count;
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = row };
|
||||
if (selectedCount == 1) {
|
||||
var change = changeList.SelectedItems[0] as Models.Change;
|
||||
if (change == null) return;
|
||||
|
|
|
@ -614,7 +614,7 @@ namespace SourceGit.Views.Widgets {
|
|||
var node = item.DataContext as BranchNode;
|
||||
if (node == null || node.Type == BranchNodeType.Folder) return;
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = item };
|
||||
if (node.Type == BranchNodeType.Remote) {
|
||||
FillRemoteContextMenu(menu, node.Data as Models.Remote);
|
||||
} else {
|
||||
|
@ -1049,7 +1049,7 @@ namespace SourceGit.Views.Widgets {
|
|||
ev.Handled = true;
|
||||
};
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = sender as UIElement };
|
||||
menu.Items.Add(createBranch);
|
||||
menu.Items.Add(new Separator());
|
||||
menu.Items.Add(pushTag);
|
||||
|
@ -1096,7 +1096,7 @@ namespace SourceGit.Views.Widgets {
|
|||
ev.Handled = true;
|
||||
};
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = sender as UIElement };
|
||||
menu.Items.Add(copy);
|
||||
menu.Items.Add(rm);
|
||||
menu.IsOpen = true;
|
||||
|
@ -1158,7 +1158,7 @@ namespace SourceGit.Views.Widgets {
|
|||
ev.Handled = true;
|
||||
};
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = sender as UIElement };
|
||||
menu.Items.Add(edit);
|
||||
menu.Items.Add(unlink);
|
||||
menu.Items.Add(new Separator());
|
||||
|
|
|
@ -475,7 +475,7 @@ namespace SourceGit.Views.Widgets {
|
|||
var grid = sender as DataGrid;
|
||||
if (grid == null) return;
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = grid };
|
||||
|
||||
var copyIcon = new Path();
|
||||
copyIcon.Data = FindResource("Icon.Copy") as Geometry;
|
||||
|
|
|
@ -248,7 +248,7 @@ namespace SourceGit.Views.Widgets {
|
|||
if (current == null) return;
|
||||
|
||||
var merged = commit.IsMerged;
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = row };
|
||||
var tags = new List<string>();
|
||||
|
||||
// Decorators
|
||||
|
|
|
@ -309,7 +309,7 @@ namespace SourceGit.Views.Widgets {
|
|||
var tab = (sender as ListBoxItem).DataContext as Tab;
|
||||
if (tab == null) return;
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = sender as UIElement };
|
||||
|
||||
var close = new MenuItem();
|
||||
close.Header = App.Text("PageTabBar.Tab.Close");
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace SourceGit.Views.Widgets {
|
|||
var grid = sender as DataGrid;
|
||||
if (grid == null) return;
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = grid };
|
||||
|
||||
var copyIcon = new System.Windows.Shapes.Path();
|
||||
copyIcon.Data = FindResource("Icon.Copy") as Geometry;
|
||||
|
@ -328,7 +328,7 @@ namespace SourceGit.Views.Widgets {
|
|||
ev.Handled = true;
|
||||
};
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = item };
|
||||
menu.Items.Add(history);
|
||||
menu.Items.Add(blame);
|
||||
menu.Items.Add(explore);
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace SourceGit.Views.Widgets {
|
|||
delete.Header = App.Text("StashCM.Drop");
|
||||
delete.Click += (o, e) => new Popups.StashDropConfirm(repo, stash.Name, stash.Message).Show();
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = sender as UIElement };
|
||||
menu.Items.Add(apply);
|
||||
menu.Items.Add(pop);
|
||||
menu.Items.Add(delete);
|
||||
|
|
|
@ -868,7 +868,7 @@ namespace SourceGit.Views.Widgets {
|
|||
GetChangesFromNode(o as ChangeNode, changes);
|
||||
}
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = sender as UIElement };
|
||||
if (IsUnstaged) {
|
||||
OpenUnstagedContextMenuByNodes(menu, nodes, changes);
|
||||
} else {
|
||||
|
@ -900,7 +900,7 @@ namespace SourceGit.Views.Widgets {
|
|||
}
|
||||
}
|
||||
|
||||
var menu = new ContextMenu();
|
||||
var menu = new ContextMenu() { PlacementTarget = row };
|
||||
if (IsUnstaged) {
|
||||
OpenUnstagedContextMenuByChanges(menu, changes);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue