Skip to content

Commit

Permalink
#44 Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 26, 2023
1 parent ef52117 commit d8f916a
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
using System.Windows;
using SMC = Sucrose.Memory.Constant;
Expand Down Expand Up @@ -53,6 +54,7 @@ public Application(string Application, string Arguments)

SSEEH.ApplicationLoaded(SSEAMI.ApplicationProcess);
SSEEH.ApplicationRendered(SSEAMI.ApplicationProcess);
SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(SSEAMI.ApplicationProcess, SSEAMI.ApplicationHandle);

SSEAHA.SetVolume(SSEHD.GetVolume());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSECSEG = Sucrose.Shared.Engine.CefSharp.Event.Gif;
using SSECSHCCM = Sucrose.Shared.Engine.CefSharp.Handler.CustomContextMenu;
using SSECSHG = Sucrose.Shared.Engine.CefSharp.Helper.Gif;
Expand All @@ -19,6 +20,8 @@ public Gif(string Gif)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

SSECSMI.CefEngine.MenuHandler = new SSECSHCCM();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSECSEU = Sucrose.Shared.Engine.CefSharp.Event.Url;
using SSECSHCCM = Sucrose.Shared.Engine.CefSharp.Handler.CustomContextMenu;
using SSECSHU = Sucrose.Shared.Engine.CefSharp.Helper.Url;
Expand All @@ -19,6 +20,8 @@ public Url(string Url)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

SSECSMI.CefEngine.MenuHandler = new SSECSHCCM();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSECSEV = Sucrose.Shared.Engine.CefSharp.Event.Video;
using SSECSHCCM = Sucrose.Shared.Engine.CefSharp.Handler.CustomContextMenu;
using SSECSHV = Sucrose.Shared.Engine.CefSharp.Helper.Video;
Expand All @@ -20,6 +21,8 @@ public Video(string Video)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

SSECSMI.CefEngine.MenuHandler = new SSECSHCCM();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSECSEW = Sucrose.Shared.Engine.CefSharp.Event.Web;
using SSECSHCCM = Sucrose.Shared.Engine.CefSharp.Handler.CustomContextMenu;
using SSECSHW = Sucrose.Shared.Engine.CefSharp.Helper.Web;
Expand All @@ -19,6 +20,8 @@ public Web(string Web)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

SSECSMI.CefEngine.MenuHandler = new SSECSHCCM();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSECSEYT = Sucrose.Shared.Engine.CefSharp.Event.YouTube;
using SSECSHCCM = Sucrose.Shared.Engine.CefSharp.Handler.CustomContextMenu;
using SSECSHYT = Sucrose.Shared.Engine.CefSharp.Helper.YouTube;
Expand All @@ -19,6 +20,8 @@ public YouTube(string YouTube)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

SSECSMI.CefEngine.MenuHandler = new SSECSHCCM();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using System.Windows.Media;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
Expand All @@ -19,6 +20,8 @@ public Video(string Video)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

SSEMPMI.Source = SSEHS.GetSource(Video).ToString();

ContentRendered += (s, e) => SSEEH.ContentRendered(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using System.Windows.Media;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
Expand All @@ -20,6 +21,8 @@ public Video(string Video)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

Content = SSENMI.MediaEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using System.Windows.Media;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
Expand All @@ -21,6 +22,8 @@ public Gif(string Gif)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

Content = SSEVMI.ImageEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
Expand All @@ -18,6 +19,8 @@ public Gif(string Gif)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

Content = SSEWVMI.WebEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
Expand All @@ -18,6 +19,8 @@ public Url(string Url)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

Content = SSEWVMI.WebEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
Expand All @@ -18,6 +19,8 @@ public Video(string Video)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

Content = SSEWVMI.WebEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
Expand All @@ -18,6 +19,8 @@ public Web(string Web)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

Content = SSEWVMI.WebEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.Win32;
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
Expand All @@ -18,6 +19,8 @@ public YouTube(string YouTube)
{
InitializeComponent();

SystemEvents.DisplaySettingsChanged += (s, e) => SSEEH.DisplaySettingsChanged(this);

ContentRendered += (s, e) => SSEEH.ContentRendered(this);

Content = SSEWVMI.WebEngine;
Expand Down
61 changes: 46 additions & 15 deletions src/Shared/Engine/Sucrose.Shared.Engine/Event/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using SWHWI = Skylark.Wing.Helper.WindowInterop;
using SWHWO = Skylark.Wing.Helper.WindowOperations;
using SWNM = Skylark.Wing.Native.Methods;
using SWUS = Skylark.Wing.Utility.Screene;

namespace Sucrose.Shared.Engine.Event
{
Expand All @@ -24,21 +25,6 @@ public static void WindowLoaded(Window Window)
Window.ShowInTaskbar = false;
}

public static void ApplicationLoaded(Process Process)
{
IntPtr Handle = SWHPI.MainWindowHandle(Process);

//ShowInTaskbar = false : causing issue with Windows10-Windows11 Taskview.
SWHWO.RemoveWindowFromTaskbar(Handle);

SWNM.ShowWindow(Handle, (int)SWNM.SHOWWINDOW.SW_HIDE);

int currentStyle = SWNM.GetWindowLong(Handle, (int)SWNM.GWL.GWL_STYLE);
SWNM.SetWindowLong(Handle, (int)SWNM.GWL.GWL_STYLE, currentStyle & ~((int)SWNM.WindowStyles.WS_CAPTION | (int)SWNM.WindowStyles.WS_THICKFRAME | (int)SWNM.WindowStyles.WS_MINIMIZE | (int)SWNM.WindowStyles.WS_MAXIMIZE | (int)SWNM.WindowStyles.WS_SYSMENU | (int)SWNM.WindowStyles.WS_DLGFRAME | (int)SWNM.WindowStyles.WS_BORDER | (int)SWNM.WindowStyles.WS_EX_CLIENTEDGE));

SWHWO.BorderlessWinStyle(Handle);
}

public static void ContentRendered(Window Window)
{
switch (SSEHD.GetDisplayType())
Expand All @@ -55,6 +41,21 @@ public static void ContentRendered(Window Window)
}
}

public static void ApplicationLoaded(Process Process)
{
IntPtr Handle = SWHPI.MainWindowHandle(Process);

//ShowInTaskbar = false : causing issue with Windows10-Windows11 Taskview.
SWHWO.RemoveWindowFromTaskbar(Handle);

SWNM.ShowWindow(Handle, (int)SWNM.SHOWWINDOW.SW_HIDE);

int currentStyle = SWNM.GetWindowLong(Handle, (int)SWNM.GWL.GWL_STYLE);
SWNM.SetWindowLong(Handle, (int)SWNM.GWL.GWL_STYLE, currentStyle & ~((int)SWNM.WindowStyles.WS_CAPTION | (int)SWNM.WindowStyles.WS_THICKFRAME | (int)SWNM.WindowStyles.WS_MINIMIZE | (int)SWNM.WindowStyles.WS_MAXIMIZE | (int)SWNM.WindowStyles.WS_SYSMENU | (int)SWNM.WindowStyles.WS_DLGFRAME | (int)SWNM.WindowStyles.WS_BORDER | (int)SWNM.WindowStyles.WS_EX_CLIENTEDGE));

SWHWO.BorderlessWinStyle(Handle);
}

public static void ApplicationRendered(Process Process)
{
switch (SSEHD.GetDisplayType())
Expand All @@ -72,5 +73,35 @@ public static void ApplicationRendered(Process Process)

SWNM.ShowWindow(SWHPI.MainWindowHandle(Process), (int)SWNM.SHOWWINDOW.SW_SHOW);
}

public static async void DisplaySettingsChanged(Window Window)
{
Window.Hide();

await Task.Delay(1000);

SWUS.Initialize();

await Task.Delay(500);

ContentRendered(Window);

Window.Show();
}

public static async void DisplaySettingsChanged(Process Process, IntPtr Handle)
{
SWNM.ShowWindow(Handle, (int)SWNM.SHOWWINDOW.SW_HIDE);

await Task.Delay(1000);

SWUS.Initialize();

await Task.Delay(500);

ApplicationRendered(Process);

SWNM.ShowWindow(Handle, (int)SWNM.SHOWWINDOW.SW_SHOW);
}
}
}

0 comments on commit d8f916a

Please sign in to comment.