Windows 11のスナップ レイアウト機能が使用できない

Issue #1183 closed
udaken created an issue

NeeViewの最大化ボタンにホバーした際、Windows 11の機能であるスナップ レイアウトが表示されません。

参考: Windows 11 上でデスクトップ アプリのスナップ レイアウトをサポート - Windows apps | Microsoft Docs

Comments (9)

  1. udaken reporter

    手元で修正したところ、スナップレイアウト機能は使えるようになりましたが、最大化ボタンをクリックした時に一瞬表示がおかしくなってしまいました(OS側の最大化ボタンが表示されている?)

    ご参考までに。

  2. udaken reporter

    対応お疲れ様です。

    手元で修正済みのブランチ c75c214070ad7638152b16fa6636eb79f8e9d9e5 をビルドして起動したところ、起動直後にエラーになりました。

    OS Version: Microsoft Windows NT 10.0.22621.0 (64bit)
    NeeView Version: 39.4 (.dev)
    
    System.InvalidOperationException: This Visual is not connected to a PresentationSource.
       at System.Windows.Media.Visual.PointToScreen(Point point)
       at NeeView.Windows.Controls.SnapLayoutPresenter.HitTest(FrameworkElement element, IntPtr lParam) in D:\tmp\NeeView\NeeView.Runtime\NeeView\Windows\Controls\SnapLayoutPresenter.cs:line 141
       at NeeView.Windows.Controls.SnapLayoutPresenter.OnNCHitTest(IntPtr lParam, Boolean& handled) in D:\tmp\NeeView\NeeView.Runtime\NeeView\Windows\Controls\SnapLayoutPresenter.cs:line 89
       at NeeView.Windows.Controls.SnapLayoutPresenter.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in D:\tmp\NeeView\NeeView.Runtime\NeeView\Windows\Controls\SnapLayoutPresenter.cs:line 68
       at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    

    [メニューを自動的に隠す] をONにしていると発生しているように思えます。

  3. udaken reporter
    if (!element.IsVisible)
    {
      return false;
    }
    // ...
    

    のようなガードが必要かもしれません。

  4. Log in to comment