Browse Source

hopefully fixed SD-1720

pull/1/head
Siegfried Pammer 15 years ago
parent
commit
c9b8391201
  1. 4
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsPopupBase.cs
  2. 62
      src/Main/ICSharpCode.Core.Presentation/ExtendedPopup.cs

4
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsPopupBase.cs

@ -4,7 +4,7 @@
using System; using System;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Windows.Input; using System.Windows.Input;
using ICSharpCode.Core.Presentation;
using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.SharpDevelop.Refactoring namespace ICSharpCode.SharpDevelop.Refactoring
@ -12,7 +12,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
/// <summary> /// <summary>
/// Description of ContextActionsPopupBase. /// Description of ContextActionsPopupBase.
/// </summary> /// </summary>
public abstract class ContextActionsPopupBase : Popup public abstract class ContextActionsPopupBase : ExtendedPopup
{ {
protected ContextActionsPopupBase() protected ContextActionsPopupBase()
{ {

62
src/Main/ICSharpCode.Core.Presentation/ExtendedPopup.cs

@ -14,41 +14,45 @@ namespace ICSharpCode.Core.Presentation
/// </summary> /// </summary>
public class ExtendedPopup : Popup public class ExtendedPopup : Popup
{ {
RoutedEventHandler lostFocus; Visibility oldState;
RoutedEventHandler gotFocus; IntPtr hwnd;
// protected override void OnOpened(EventArgs e) protected override void OnOpened(EventArgs e)
// { {
// IntPtr hwnd = ((HwndSource)PresentationSource.FromVisual(Child)).Handle; hwnd = ((HwndSource)PresentationSource.FromVisual(Child)).Handle;
// SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
// lostFocus = new RoutedEventHandler(MainWindowLostFocus);
// gotFocus = new RoutedEventHandler(MainWindowGotFocus); Application.Current.Activated += ApplicationActivated;
// AddHandler(Window., lostFocus); Application.Current.Deactivated += ApplicationDeactivated;
// AddHandler(Window.GotFocusEvent, gotFocus); }
//
// } protected override void OnClosed(EventArgs e)
// {
// protected override void OnClosed(EventArgs e) Application.Current.Activated -= ApplicationActivated;
// { Application.Current.Deactivated -= ApplicationDeactivated;
// RemoveHandler(Window.LostFocusEvent, lostFocus); }
// RemoveHandler(Window.GotFocusEvent, gotFocus);
// } void ApplicationActivated(object sender, EventArgs e)
// {
// void MainWindowLostFocus(object sender, RoutedEventArgs e) Visibility = oldState;
// { SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
// Visibility = Visibility.Collapsed; }
// }
// void ApplicationDeactivated(object sender, EventArgs e)
// void MainWindowGotFocus(object sender, RoutedEventArgs e) {
// { oldState = Visibility;
// Visibility = Visibility.Visible; Visibility = Visibility.Hidden;
// } }
#region Win32 API
const int SWP_NOMOVE = 0x002; const int SWP_NOMOVE = 0x002;
const int SWP_NOSIZE = 0x001; const int SWP_NOSIZE = 0x001;
static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2); static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
static readonly IntPtr HWND_TOP = new IntPtr(0);
[DllImport("user32", EntryPoint="SetWindowPos")] [DllImport("user32", EntryPoint="SetWindowPos")]
static extern int SetWindowPos(IntPtr hWnd, IntPtr hwndInsertAfter, int x, int y, int cx, int cy, uint uFlags); static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
#endregion
} }
} }

Loading…
Cancel
Save