trying to fix window issues
This commit is contained in:
@@ -82,8 +82,8 @@ namespace mpvnet
|
|||||||
|
|
||||||
InitTheme();
|
InitTheme();
|
||||||
|
|
||||||
Core.Shutdown += Shutdown;
|
Core.Shutdown += Core_Shutdown;
|
||||||
Core.Initialized += Initialized;
|
Core.Initialized += Core_Initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InitTheme()
|
public static void InitTheme()
|
||||||
@@ -153,7 +153,7 @@ namespace mpvnet
|
|||||||
InvokeOnMainThread(() => Msg.ShowError(title, msg));
|
InvokeOnMainThread(() => Msg.ShowError(title, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Initialized()
|
static void Core_Initialized()
|
||||||
{
|
{
|
||||||
if (RememberVolume)
|
if (RememberVolume)
|
||||||
{
|
{
|
||||||
@@ -162,7 +162,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Shutdown()
|
static void Core_Shutdown()
|
||||||
{
|
{
|
||||||
Settings.Volume = Core.get_property_int("volume");
|
Settings.Volume = Core.get_property_int("volume");
|
||||||
Settings.Mute = Core.get_property_string("mute");
|
Settings.Mute = Core.get_property_string("mute");
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ namespace mpvnet
|
|||||||
|
|
||||||
public event Action Initialized;
|
public event Action Initialized;
|
||||||
public event Action InitializedAsync;
|
public event Action InitializedAsync;
|
||||||
|
|
||||||
public event Action VideoSizeChanged;
|
public event Action VideoSizeChanged;
|
||||||
public event Action VideoSizeChangedAsync;
|
public event Action VideoSizeChangedAsync;
|
||||||
public event Action<float> ScaleWindow;
|
public event Action<float> ScaleWindow;
|
||||||
@@ -349,8 +348,6 @@ namespace mpvnet
|
|||||||
if (WindowHandle == IntPtr.Zero)
|
if (WindowHandle == IntPtr.Zero)
|
||||||
WindowHandle = Native.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
|
WindowHandle = Native.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
|
||||||
|
|
||||||
//System.Diagnostics.Debug.WriteLine(evt.event_id.ToString());
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (evt.event_id)
|
switch (evt.event_id)
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ namespace mpvnet
|
|||||||
Hwnd = Handle;
|
Hwnd = Handle;
|
||||||
Core.Init();
|
Core.Init();
|
||||||
|
|
||||||
Core.Shutdown += Shutdown;
|
Core.Shutdown += Core_Shutdown;
|
||||||
Core.VideoSizeChanged += VideoSizeChanged;
|
Core.VideoSizeChanged += Core_VideoSizeChanged;
|
||||||
Core.ScaleWindow += ScaleWindow;
|
Core.ScaleWindow += Core_ScaleWindow;
|
||||||
Core.WindowScale += WindowScale;
|
Core.WindowScale += Core_WindowScale;
|
||||||
Core.FileLoaded += FileLoaded;
|
Core.FileLoaded += Core_FileLoaded;
|
||||||
Core.Idle += Idle;
|
Core.Idle += Core_Idle;
|
||||||
Core.Seek += () => UpdateProgressBar();
|
Core.Seek += () => UpdateProgressBar();
|
||||||
|
|
||||||
Core.observe_property("window-maximized", PropChangeWindowMaximized);
|
Core.observe_property("window-maximized", PropChangeWindowMaximized);
|
||||||
@@ -129,7 +129,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScaleWindow(float scale) {
|
void Core_ScaleWindow(float scale) {
|
||||||
BeginInvoke(new Action(() => {
|
BeginInvoke(new Action(() => {
|
||||||
int w = (int)(ClientSize.Width * scale);
|
int w = (int)(ClientSize.Width * scale);
|
||||||
int h = (int)Math.Ceiling(w * Core.VideoSize.Height / (double)Core.VideoSize.Width);
|
int h = (int)Math.Ceiling(w * Core.VideoSize.Height / (double)Core.VideoSize.Width);
|
||||||
@@ -137,7 +137,7 @@ namespace mpvnet
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScale(float scale)
|
void Core_WindowScale(float scale)
|
||||||
{
|
{
|
||||||
BeginInvoke(new Action(() => {
|
BeginInvoke(new Action(() => {
|
||||||
SetSize(
|
SetSize(
|
||||||
@@ -150,15 +150,15 @@ namespace mpvnet
|
|||||||
|
|
||||||
public MenuItem FindMenuItem(string text) => FindMenuItem(text, ContextMenu.Items);
|
public MenuItem FindMenuItem(string text) => FindMenuItem(text, ContextMenu.Items);
|
||||||
|
|
||||||
void Shutdown() => BeginInvoke(new Action(() => Close()));
|
void Core_Shutdown() => BeginInvoke(new Action(() => Close()));
|
||||||
|
|
||||||
void Idle() => SetTitle();
|
void Core_Idle() => SetTitle();
|
||||||
|
|
||||||
bool WasShown() => ShownTickCount != 0 && Environment.TickCount > ShownTickCount + 500;
|
bool WasShown() => ShownTickCount != 0 && Environment.TickCount > ShownTickCount + 500;
|
||||||
|
|
||||||
void CM_Popup(object sender, EventArgs e) => CursorHelp.Show();
|
void CM_Popup(object sender, EventArgs e) => CursorHelp.Show();
|
||||||
|
|
||||||
void VideoSizeChanged() => BeginInvoke(new Action(() => SetFormPosAndSize()));
|
void Core_VideoSizeChanged() => BeginInvoke(new Action(() => SetFormPosAndSize()));
|
||||||
|
|
||||||
void PropChangeFullscreen(bool value) => BeginInvoke(new Action(() => CycleFullscreen(value)));
|
void PropChangeFullscreen(bool value) => BeginInvoke(new Action(() => CycleFullscreen(value)));
|
||||||
|
|
||||||
@@ -403,7 +403,6 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetSize(width, height, screen, checkAutofit);
|
SetSize(width, height, screen, checkAutofit);
|
||||||
SaveWindowProperties();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSize(int width, int height, Screen screen, bool checkAutofit = true)
|
void SetSize(int width, int height, Screen screen, bool checkAutofit = true)
|
||||||
@@ -593,7 +592,7 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileLoaded()
|
void Core_FileLoaded()
|
||||||
{
|
{
|
||||||
string path = Core.get_property_string("path");
|
string path = Core.get_property_string("path");
|
||||||
|
|
||||||
@@ -938,15 +937,12 @@ namespace mpvnet
|
|||||||
App.RunTask(() => App.Extension = new Extension());
|
App.RunTask(() => App.Extension = new Extension());
|
||||||
CSharpScriptHost.ExecuteScriptsInFolder(Core.ConfigFolder + "scripts-cs");
|
CSharpScriptHost.ExecuteScriptsInFolder(Core.ConfigFolder + "scripts-cs");
|
||||||
ShownTickCount = Environment.TickCount;
|
ShownTickCount = Environment.TickCount;
|
||||||
|
|
||||||
//if (Debugger.IsAttached)
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResize(EventArgs e)
|
protected override void OnResize(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnResize(e);
|
base.OnResize(e);
|
||||||
|
SaveWindowProperties();
|
||||||
|
|
||||||
if (Core.IsLogoVisible)
|
if (Core.IsLogoVisible)
|
||||||
Core.ShowLogo();
|
Core.ShowLogo();
|
||||||
@@ -1004,6 +1000,12 @@ namespace mpvnet
|
|||||||
Core.commandv("quit");
|
Core.commandv("quit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnMove(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnMove(e);
|
||||||
|
SaveWindowProperties();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnDragEnter(DragEventArgs e)
|
protected override void OnDragEnter(DragEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnDragEnter(e);
|
base.OnDragEnter(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user