mirror of
https://github.com/libretro/MesenCE.git
synced 2026-11-10 17:25:07 -10:00
Also fixes DX11.0 support (for Win7 PCs that aren't fully updated), which stopped working after the recent variable refresh rate changes
27 lines
540 B
C#
27 lines
540 B
C#
using Avalonia.Controls;
|
|
using Avalonia.VisualTree;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mesen.Utilities
|
|
{
|
|
static class ControlExtensions
|
|
{
|
|
public static bool IsParentWindowFocused(this Control ctrl)
|
|
{
|
|
return ctrl.GetWindow()?.IsKeyboardFocusWithin == true;
|
|
}
|
|
|
|
public static Window? GetWindow(this Control ctrl)
|
|
{
|
|
if(ctrl.GetPresentationSource()?.RootVisual?.Parent is Window wnd) {
|
|
return wnd;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|