mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-06-25 00:41:32 +00:00
Added code to raise all available events. Removed unused events from old OpenTK versions. Fixed potential race condition when raising events (an event might become null between the null check and the actual raising).
This commit is contained in:
parent
b7a0a7c800
commit
e13a8e25ae
|
@ -144,6 +144,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
DisposeUPP();
|
DisposeUPP();
|
||||||
|
|
||||||
|
Disposed(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
~CarbonGLNative()
|
~CarbonGLNative()
|
||||||
|
@ -419,11 +420,16 @@ namespace OpenTK.Platform.MacOS
|
||||||
case WindowEventKind.WindowBoundsChanged:
|
case WindowEventKind.WindowBoundsChanged:
|
||||||
int thisWidth = Width;
|
int thisWidth = Width;
|
||||||
int thisHeight = Height;
|
int thisHeight = Height;
|
||||||
|
int thisX = X;
|
||||||
|
int thisY = Y;
|
||||||
|
|
||||||
LoadSize();
|
LoadSize();
|
||||||
|
|
||||||
|
if (thisX != X || thisY != Y)
|
||||||
|
Move(this, EventArgs.Empty);
|
||||||
|
|
||||||
if (thisWidth != Width || thisHeight != Height)
|
if (thisWidth != Width || thisHeight != Height)
|
||||||
OnResize();
|
Resize(this, EventArgs.Empty);
|
||||||
|
|
||||||
return OSStatus.EventNotHandled;
|
return OSStatus.EventNotHandled;
|
||||||
|
|
||||||
|
@ -661,15 +667,6 @@ namespace OpenTK.Platform.MacOS
|
||||||
API.SizeWindow(window.WindowRef, width, height, true);
|
API.SizeWindow(window.WindowRef, width, height, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnResize()
|
|
||||||
{
|
|
||||||
LoadSize();
|
|
||||||
|
|
||||||
if (Resize != null)
|
|
||||||
{
|
|
||||||
Resize(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadSize()
|
private void LoadSize()
|
||||||
{
|
{
|
||||||
|
@ -733,10 +730,16 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
public Icon Icon
|
public Icon Icon
|
||||||
{
|
{
|
||||||
get { return mIcon; }
|
get { return mIcon; }
|
||||||
set {
|
set
|
||||||
SetIcon(value);
|
{
|
||||||
}
|
if (value != Icon)
|
||||||
|
{
|
||||||
|
SetIcon(value);
|
||||||
|
mIcon = value;
|
||||||
|
IconChanged(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetIcon(Icon icon)
|
private void SetIcon(Icon icon)
|
||||||
|
@ -798,8 +801,12 @@ namespace OpenTK.Platform.MacOS
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
API.SetWindowTitle(window.WindowRef, value);
|
if (value != Title)
|
||||||
title = value;
|
{
|
||||||
|
API.SetWindowTitle(window.WindowRef, value);
|
||||||
|
title = value;
|
||||||
|
TitleChanged(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,10 +815,15 @@ namespace OpenTK.Platform.MacOS
|
||||||
get { return API.IsWindowVisible(window.WindowRef); }
|
get { return API.IsWindowVisible(window.WindowRef); }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value && Visible == false)
|
if (value != Visible)
|
||||||
Show();
|
{
|
||||||
else
|
if (value)
|
||||||
Hide();
|
Show();
|
||||||
|
else
|
||||||
|
Hide();
|
||||||
|
|
||||||
|
VisibleChanged(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,7 +929,8 @@ namespace OpenTK.Platform.MacOS
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
API.SizeWindow(window.WindowRef, (short)value.Width, (short)value.Height, true);
|
API.SizeWindow(window.WindowRef, (short)value.Width, (short)value.Height, true);
|
||||||
OnResize();
|
LoadSize();
|
||||||
|
Resize(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1019,9 +1032,9 @@ namespace OpenTK.Platform.MacOS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OnWindowStateChanged();
|
WindowStateChanged(this, EventArgs.Empty);
|
||||||
|
LoadSize();
|
||||||
OnResize();
|
Resize(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowBorder WindowBorder
|
public WindowBorder WindowBorder
|
||||||
|
@ -1048,8 +1061,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
WindowAttributes.Resizable | WindowAttributes.FullZoom);
|
WindowAttributes.Resizable | WindowAttributes.FullZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WindowBorderChanged != null)
|
WindowBorderChanged(this, EventArgs.Empty);
|
||||||
WindowBorderChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1057,76 +1069,65 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
private void OnKeyPress(KeyPressEventArgs keyPressArgs)
|
private void OnKeyPress(KeyPressEventArgs keyPressArgs)
|
||||||
{
|
{
|
||||||
if (KeyPress != null)
|
KeyPress(this, keyPressArgs);
|
||||||
KeyPress(this, keyPressArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnWindowStateChanged()
|
private void OnWindowStateChanged()
|
||||||
{
|
{
|
||||||
if (WindowStateChanged != null)
|
WindowStateChanged(this, EventArgs.Empty);
|
||||||
WindowStateChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnClosing(CancelEventArgs e)
|
protected virtual void OnClosing(CancelEventArgs e)
|
||||||
{
|
{
|
||||||
if (Closing != null)
|
Closing(this, e);
|
||||||
Closing(this, e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnClosed()
|
protected virtual void OnClosed()
|
||||||
{
|
{
|
||||||
if (Closed != null)
|
Closed(this, EventArgs.Empty);
|
||||||
Closed(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnMouseLeave()
|
private void OnMouseLeave()
|
||||||
{
|
{
|
||||||
if (MouseLeave != null)
|
MouseLeave(this, EventArgs.Empty);
|
||||||
MouseLeave(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMouseEnter()
|
private void OnMouseEnter()
|
||||||
{
|
{
|
||||||
if (MouseEnter != null)
|
MouseEnter(this, EventArgs.Empty);
|
||||||
MouseEnter(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnActivate()
|
private void OnActivate()
|
||||||
{
|
{
|
||||||
mIsActive = true;
|
mIsActive = true;
|
||||||
if (FocusedChanged != null)
|
FocusedChanged(this, EventArgs.Empty);
|
||||||
FocusedChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
private void OnDeactivate()
|
private void OnDeactivate()
|
||||||
{
|
{
|
||||||
mIsActive = false;
|
mIsActive = false;
|
||||||
if (FocusedChanged != null)
|
FocusedChanged(this, EventArgs.Empty);
|
||||||
FocusedChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Idle;
|
public event EventHandler<EventArgs> Load = delegate { };
|
||||||
public event EventHandler<EventArgs> Load;
|
public event EventHandler<EventArgs> Unload = delegate { };
|
||||||
public event EventHandler<EventArgs> Unload;
|
public event EventHandler<EventArgs> Move = delegate { };
|
||||||
public event EventHandler<EventArgs> Move;
|
public event EventHandler<EventArgs> Resize = delegate { };
|
||||||
public event EventHandler<EventArgs> Resize;
|
public event EventHandler<CancelEventArgs> Closing = delegate { };
|
||||||
public event EventHandler<CancelEventArgs> Closing;
|
public event EventHandler<EventArgs> Closed = delegate { };
|
||||||
public event EventHandler<EventArgs> Closed;
|
public event EventHandler<EventArgs> Disposed = delegate { };
|
||||||
public event EventHandler<EventArgs> Disposed;
|
public event EventHandler<EventArgs> IconChanged = delegate { };
|
||||||
public event EventHandler<EventArgs> IconChanged;
|
public event EventHandler<EventArgs> TitleChanged = delegate { };
|
||||||
public event EventHandler<EventArgs> TitleChanged;
|
public event EventHandler<EventArgs> VisibleChanged = delegate { };
|
||||||
public event EventHandler<EventArgs> ClientSizeChanged;
|
public event EventHandler<EventArgs> FocusedChanged = delegate { };
|
||||||
public event EventHandler<EventArgs> VisibleChanged;
|
public event EventHandler<EventArgs> WindowBorderChanged = delegate { };
|
||||||
public event EventHandler<EventArgs> WindowInfoChanged;
|
public event EventHandler<EventArgs> WindowStateChanged = delegate { };
|
||||||
public event EventHandler<EventArgs> FocusedChanged;
|
public event EventHandler<KeyPressEventArgs> KeyPress = delegate { };
|
||||||
public event EventHandler<EventArgs> WindowBorderChanged;
|
public event EventHandler<EventArgs> MouseEnter = delegate { };
|
||||||
public event EventHandler<EventArgs> WindowStateChanged;
|
public event EventHandler<EventArgs> MouseLeave = delegate { };
|
||||||
public event EventHandler<KeyPressEventArgs> KeyPress;
|
|
||||||
public event EventHandler<EventArgs> MouseEnter;
|
|
||||||
public event EventHandler<EventArgs> MouseLeave;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace OpenTK.Platform.Windows
|
||||||
else
|
else
|
||||||
focused = (wParam.ToInt64() & 0xFFFF) != 0;
|
focused = (wParam.ToInt64() & 0xFFFF) != 0;
|
||||||
|
|
||||||
if (new_focused_state != Focused && FocusedChanged != null)
|
if (new_focused_state != Focused)
|
||||||
FocusedChanged(this, EventArgs.Empty);
|
FocusedChanged(this, EventArgs.Empty);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -188,8 +188,7 @@ namespace OpenTK.Platform.Windows
|
||||||
if (Location != new_location)
|
if (Location != new_location)
|
||||||
{
|
{
|
||||||
bounds.Location = new_location;
|
bounds.Location = new_location;
|
||||||
if (Move != null)
|
Move(this, EventArgs.Empty);
|
||||||
Move(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Size new_size = new Size(pos->cx, pos->cy);
|
Size new_size = new Size(pos->cx, pos->cy);
|
||||||
|
@ -206,7 +205,7 @@ namespace OpenTK.Platform.Windows
|
||||||
SetWindowPosFlags.NOZORDER | SetWindowPosFlags.NOOWNERZORDER |
|
SetWindowPosFlags.NOZORDER | SetWindowPosFlags.NOOWNERZORDER |
|
||||||
SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSENDCHANGING);
|
SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSENDCHANGING);
|
||||||
|
|
||||||
if (suppress_resize <= 0 && Resize != null)
|
if (suppress_resize <= 0)
|
||||||
Resize(this, EventArgs.Empty);
|
Resize(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,8 +253,7 @@ namespace OpenTK.Platform.Windows
|
||||||
if (new_state != windowState)
|
if (new_state != windowState)
|
||||||
{
|
{
|
||||||
windowState = new_state;
|
windowState = new_state;
|
||||||
if (WindowStateChanged != null)
|
WindowStateChanged(this, EventArgs.Empty);
|
||||||
WindowStateChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure cursor remains grabbed
|
// Ensure cursor remains grabbed
|
||||||
|
@ -274,8 +272,7 @@ namespace OpenTK.Platform.Windows
|
||||||
else
|
else
|
||||||
key_press.KeyChar = (char)wParam.ToInt64();
|
key_press.KeyChar = (char)wParam.ToInt64();
|
||||||
|
|
||||||
if (KeyPress != null)
|
KeyPress(this, key_press);
|
||||||
KeyPress(this, key_press);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WindowMessage.MOUSEMOVE:
|
case WindowMessage.MOUSEMOVE:
|
||||||
|
@ -291,8 +288,7 @@ namespace OpenTK.Platform.Windows
|
||||||
mouse_outside_window = false;
|
mouse_outside_window = false;
|
||||||
EnableMouseTracking();
|
EnableMouseTracking();
|
||||||
|
|
||||||
if (MouseEnter != null)
|
MouseEnter(this, EventArgs.Empty);
|
||||||
MouseEnter(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -300,8 +296,7 @@ namespace OpenTK.Platform.Windows
|
||||||
mouse_outside_window = true;
|
mouse_outside_window = true;
|
||||||
// Mouse tracking is disabled automatically by the OS
|
// Mouse tracking is disabled automatically by the OS
|
||||||
|
|
||||||
if (MouseLeave != null)
|
MouseLeave(this, EventArgs.Empty);
|
||||||
MouseLeave(this, EventArgs.Empty);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WindowMessage.MOUSEWHEEL:
|
case WindowMessage.MOUSEWHEEL:
|
||||||
|
@ -453,13 +448,11 @@ namespace OpenTK.Platform.Windows
|
||||||
case WindowMessage.CLOSE:
|
case WindowMessage.CLOSE:
|
||||||
System.ComponentModel.CancelEventArgs e = new System.ComponentModel.CancelEventArgs();
|
System.ComponentModel.CancelEventArgs e = new System.ComponentModel.CancelEventArgs();
|
||||||
|
|
||||||
if (Closing != null)
|
Closing(this, e);
|
||||||
Closing(this, e);
|
|
||||||
|
|
||||||
if (!e.Cancel)
|
if (!e.Cancel)
|
||||||
{
|
{
|
||||||
if (Unload != null)
|
Unload(this, EventArgs.Empty);
|
||||||
Unload(this, EventArgs.Empty);
|
|
||||||
|
|
||||||
DestroyWindow();
|
DestroyWindow();
|
||||||
break;
|
break;
|
||||||
|
@ -474,8 +467,7 @@ namespace OpenTK.Platform.Windows
|
||||||
window.Dispose();
|
window.Dispose();
|
||||||
child_window.Dispose();
|
child_window.Dispose();
|
||||||
|
|
||||||
if (Closed != null)
|
Closed(this, EventArgs.Empty);
|
||||||
Closed(this, EventArgs.Empty);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -795,11 +787,15 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
icon = value;
|
if (value != icon)
|
||||||
if (window.WindowHandle != IntPtr.Zero)
|
|
||||||
{
|
{
|
||||||
Functions.SendMessage(window.WindowHandle, WindowMessage.SETICON, (IntPtr)0, icon == null ? IntPtr.Zero : value.Handle);
|
icon = value;
|
||||||
Functions.SendMessage(window.WindowHandle, WindowMessage.SETICON, (IntPtr)1, icon == null ? IntPtr.Zero : value.Handle);
|
if (window.WindowHandle != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Functions.SendMessage(window.WindowHandle, WindowMessage.SETICON, (IntPtr)0, icon == null ? IntPtr.Zero : value.Handle);
|
||||||
|
Functions.SendMessage(window.WindowHandle, WindowMessage.SETICON, (IntPtr)1, icon == null ? IntPtr.Zero : value.Handle);
|
||||||
|
}
|
||||||
|
IconChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -829,8 +825,12 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!Functions.SetWindowText(window.WindowHandle, value))
|
if (Title != value)
|
||||||
Debug.Print("Failed to change window title (window:{0}, new title:{1}, reason:{2}).", window.WindowHandle, value, Marshal.GetLastWin32Error());
|
{
|
||||||
|
if (!Functions.SetWindowText(window.WindowHandle, value))
|
||||||
|
Debug.Print("Failed to change window title (window:{0}, new title:{1}, reason:{2}).", window.WindowHandle, value, Marshal.GetLastWin32Error());
|
||||||
|
TitleChanged(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,18 +846,23 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value)
|
if (value != Visible)
|
||||||
{
|
{
|
||||||
Functions.ShowWindow(window.WindowHandle, ShowWindowCommand.SHOW);
|
if (value)
|
||||||
if (invisible_since_creation)
|
|
||||||
{
|
{
|
||||||
Functions.BringWindowToTop(window.WindowHandle);
|
Functions.ShowWindow(window.WindowHandle, ShowWindowCommand.SHOW);
|
||||||
Functions.SetForegroundWindow(window.WindowHandle);
|
if (invisible_since_creation)
|
||||||
|
{
|
||||||
|
Functions.BringWindowToTop(window.WindowHandle);
|
||||||
|
Functions.SetForegroundWindow(window.WindowHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (!value)
|
||||||
else if (!value)
|
{
|
||||||
{
|
Functions.ShowWindow(window.WindowHandle, ShowWindowCommand.HIDE);
|
||||||
Functions.ShowWindow(window.WindowHandle, ShowWindowCommand.HIDE);
|
}
|
||||||
|
|
||||||
|
VisibleChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1076,8 +1081,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
WindowState = state;
|
WindowState = state;
|
||||||
|
|
||||||
if (WindowBorderChanged != null)
|
WindowBorderChanged(this, EventArgs.Empty);
|
||||||
WindowBorderChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1113,43 +1117,37 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Idle;
|
public event EventHandler<EventArgs> Load =delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Load;
|
public event EventHandler<EventArgs> Unload = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Unload;
|
public event EventHandler<EventArgs> Move = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Move;
|
public event EventHandler<EventArgs> Resize = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Resize;
|
public event EventHandler<System.ComponentModel.CancelEventArgs> Closing = delegate { };
|
||||||
|
|
||||||
public event EventHandler<System.ComponentModel.CancelEventArgs> Closing;
|
public event EventHandler<EventArgs> Closed = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Closed;
|
public event EventHandler<EventArgs> Disposed = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Disposed;
|
public event EventHandler<EventArgs> IconChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> IconChanged;
|
public event EventHandler<EventArgs> TitleChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> TitleChanged;
|
public event EventHandler<EventArgs> VisibleChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> ClientSizeChanged;
|
public event EventHandler<EventArgs> FocusedChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> VisibleChanged;
|
public event EventHandler<EventArgs> WindowBorderChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> WindowInfoChanged;
|
public event EventHandler<EventArgs> WindowStateChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> FocusedChanged;
|
public event EventHandler<KeyPressEventArgs> KeyPress = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> WindowBorderChanged;
|
public event EventHandler<EventArgs> MouseEnter = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> WindowStateChanged;
|
public event EventHandler<EventArgs> MouseLeave = delegate { };
|
||||||
|
|
||||||
public event EventHandler<KeyPressEventArgs> KeyPress;
|
|
||||||
|
|
||||||
public event EventHandler<EventArgs> MouseEnter;
|
|
||||||
|
|
||||||
public event EventHandler<EventArgs> MouseLeave;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1280,6 +1278,7 @@ namespace OpenTK.Platform.Windows
|
||||||
Debug.Print("[Warning] INativeWindow leaked ({0}). Did you forget to call INativeWindow.Dispose()?", this);
|
Debug.Print("[Warning] INativeWindow leaked ({0}). Did you forget to call INativeWindow.Dispose()?", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Disposed(this, EventArgs.Empty);
|
||||||
disposed = true;
|
disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -659,8 +659,7 @@ namespace OpenTK.Platform.X11
|
||||||
if (Location != new_location)
|
if (Location != new_location)
|
||||||
{
|
{
|
||||||
bounds.Location = new_location;
|
bounds.Location = new_location;
|
||||||
if (Move != null)
|
Move(this, EventArgs.Empty);
|
||||||
Move(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: width and height denote the internal (client) size.
|
// Note: width and height denote the internal (client) size.
|
||||||
|
@ -673,11 +672,7 @@ namespace OpenTK.Platform.X11
|
||||||
bounds.Size = new_size;
|
bounds.Size = new_size;
|
||||||
client_rectangle.Size = new Size(e.ConfigureEvent.width, e.ConfigureEvent.height);
|
client_rectangle.Size = new Size(e.ConfigureEvent.width, e.ConfigureEvent.height);
|
||||||
|
|
||||||
if (this.Resize != null)
|
Resize(this, EventArgs.Empty);
|
||||||
{
|
|
||||||
//Debug.WriteLine(new System.Diagnostics.StackTrace());
|
|
||||||
Resize(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,8 +718,7 @@ namespace OpenTK.Platform.X11
|
||||||
bool previous_visible = visible;
|
bool previous_visible = visible;
|
||||||
visible = true;
|
visible = true;
|
||||||
if (visible != previous_visible)
|
if (visible != previous_visible)
|
||||||
if (VisibleChanged != null)
|
VisibleChanged(this, EventArgs.Empty);
|
||||||
VisibleChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -733,8 +727,7 @@ namespace OpenTK.Platform.X11
|
||||||
bool previous_visible = visible;
|
bool previous_visible = visible;
|
||||||
visible = false;
|
visible = false;
|
||||||
if (visible != previous_visible)
|
if (visible != previous_visible)
|
||||||
if (VisibleChanged != null)
|
VisibleChanged(this, EventArgs.Empty);
|
||||||
VisibleChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -747,8 +740,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Exit message received.");
|
Debug.WriteLine("Exit message received.");
|
||||||
CancelEventArgs ce = new CancelEventArgs();
|
CancelEventArgs ce = new CancelEventArgs();
|
||||||
if (Closing != null)
|
Closing(this, ce);
|
||||||
Closing(this, ce);
|
|
||||||
|
|
||||||
if (!ce.Cancel)
|
if (!ce.Cancel)
|
||||||
{
|
{
|
||||||
|
@ -769,8 +761,7 @@ namespace OpenTK.Platform.X11
|
||||||
Debug.WriteLine("Window destroyed");
|
Debug.WriteLine("Window destroyed");
|
||||||
exists = false;
|
exists = false;
|
||||||
|
|
||||||
if (Closed != null)
|
Closed(this, EventArgs.Empty);
|
||||||
Closed(this, EventArgs.Empty);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -813,8 +804,7 @@ namespace OpenTK.Platform.X11
|
||||||
bool previous_focus = has_focus;
|
bool previous_focus = has_focus;
|
||||||
has_focus = true;
|
has_focus = true;
|
||||||
if (has_focus != previous_focus)
|
if (has_focus != previous_focus)
|
||||||
if (FocusedChanged != null)
|
FocusedChanged(this, EventArgs.Empty);
|
||||||
FocusedChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -823,19 +813,16 @@ namespace OpenTK.Platform.X11
|
||||||
bool previous_focus = has_focus;
|
bool previous_focus = has_focus;
|
||||||
has_focus = false;
|
has_focus = false;
|
||||||
if (has_focus != previous_focus)
|
if (has_focus != previous_focus)
|
||||||
if (FocusedChanged != null)
|
FocusedChanged(this, EventArgs.Empty);
|
||||||
FocusedChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XEventName.LeaveNotify:
|
case XEventName.LeaveNotify:
|
||||||
if (MouseLeave != null)
|
MouseLeave(this, EventArgs.Empty);
|
||||||
MouseLeave(this, EventArgs.Empty);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XEventName.EnterNotify:
|
case XEventName.EnterNotify:
|
||||||
if (MouseEnter != null)
|
MouseEnter(this, EventArgs.Empty);
|
||||||
MouseEnter(this, EventArgs.Empty);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XEventName.MappingNotify:
|
case XEventName.MappingNotify:
|
||||||
|
@ -850,8 +837,7 @@ namespace OpenTK.Platform.X11
|
||||||
case XEventName.PropertyNotify:
|
case XEventName.PropertyNotify:
|
||||||
if (e.PropertyEvent.atom == _atom_net_wm_state)
|
if (e.PropertyEvent.atom == _atom_net_wm_state)
|
||||||
{
|
{
|
||||||
if (WindowStateChanged != null)
|
WindowStateChanged(this, EventArgs.Empty);
|
||||||
WindowStateChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (e.PropertyEvent.atom == _atom_net_frame_extents)
|
//if (e.PropertyEvent.atom == _atom_net_frame_extents)
|
||||||
|
@ -1078,8 +1064,7 @@ namespace OpenTK.Platform.X11
|
||||||
}
|
}
|
||||||
|
|
||||||
icon = value;
|
icon = value;
|
||||||
if (IconChanged != null)
|
IconChanged(this, EventArgs.Empty);
|
||||||
IconChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,8 +1262,7 @@ namespace OpenTK.Platform.X11
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WindowBorderChanged != null)
|
WindowBorderChanged(this, EventArgs.Empty);
|
||||||
WindowBorderChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1286,37 +1270,37 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Load;
|
public event EventHandler<EventArgs> Load = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Unload;
|
public event EventHandler<EventArgs> Unload = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Move;
|
public event EventHandler<EventArgs> Move = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Resize;
|
public event EventHandler<EventArgs> Resize = delegate { };
|
||||||
|
|
||||||
public event EventHandler<System.ComponentModel.CancelEventArgs> Closing;
|
public event EventHandler<System.ComponentModel.CancelEventArgs> Closing = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Closed;
|
public event EventHandler<EventArgs> Closed = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> Disposed;
|
public event EventHandler<EventArgs> Disposed = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> IconChanged;
|
public event EventHandler<EventArgs> IconChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> TitleChanged;
|
public event EventHandler<EventArgs> TitleChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> VisibleChanged;
|
public event EventHandler<EventArgs> VisibleChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> FocusedChanged;
|
public event EventHandler<EventArgs> FocusedChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> WindowBorderChanged;
|
public event EventHandler<EventArgs> WindowBorderChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> WindowStateChanged;
|
public event EventHandler<EventArgs> WindowStateChanged = delegate { };
|
||||||
|
|
||||||
public event EventHandler<KeyPressEventArgs> KeyPress;
|
public event EventHandler<KeyPressEventArgs> KeyPress = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> MouseEnter;
|
public event EventHandler<EventArgs> MouseEnter = delegate { };
|
||||||
|
|
||||||
public event EventHandler<EventArgs> MouseLeave;
|
public event EventHandler<EventArgs> MouseLeave = delegate { };
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1427,8 +1411,7 @@ namespace OpenTK.Platform.X11
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TitleChanged != null)
|
TitleChanged(this, EventArgs.Empty);
|
||||||
TitleChanged(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue