GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(infra): create service for subscribing to display setting changes and raising corresponding event
Lars Berger2361ec3a2eeb
diff --git a/GlazeWM.Infrastructure/WindowsApi/SystemEventService.cs b/GlazeWM.Infrastructure/WindowsApi/SystemEventService.csnew file mode 100644index 00000000..f4b131c0--- /dev/null+++ b/GlazeWM.Infrastructure/WindowsApi/SystemEventService.cs@@ -0,0 +1,28 @@+using GlazeWM.Infrastructure.Bussing;+using System;+using Microsoft.Win32;+using GlazeWM.Infrastructure.WindowsApi.Events;++namespace GlazeWM.Infrastructure.WindowsApi+{+ public class SystemEventService+ {+ private Bus _bus;++ public SystemEventService(Bus bus)+ {+ _bus = bus;+ }++ public void Start()+ {+ // TODO: Unsubscribe on application exit.+ SystemEvents.DisplaySettingsChanged += new EventHandler(OnDisplaySettingsChanged);+ }++ private void OnDisplaySettingsChanged(object sender, EventArgs e)+ {+ _bus.RaiseEvent(new DisplaySettingsChangedEvent());+ }+ }+}