mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 11:25:27 +00:00
Merge pull request #567 from Frassle/issue259
Wait for XEvents when changing window size
This commit is contained in:
commit
0c585b685c
|
@ -147,6 +147,12 @@ namespace OpenTK.Platform.X11
|
||||||
readonly int xi2_version;
|
readonly int xi2_version;
|
||||||
#pragma warning restore 414
|
#pragma warning restore 414
|
||||||
|
|
||||||
|
// Used to wait for a specific type of event in ProcessEvents.
|
||||||
|
// Currently this is just used by ClientSize to wait for a
|
||||||
|
// ConfigureNotify event to ensure our size change has actually taken
|
||||||
|
// effect, see issue #259.
|
||||||
|
XEventName _waitForEvent = (XEventName)0;
|
||||||
|
|
||||||
public X11GLNative(int x, int y, int width, int height, string title,
|
public X11GLNative(int x, int y, int width, int height, string title,
|
||||||
GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
||||||
: this()
|
: this()
|
||||||
|
@ -801,7 +807,21 @@ namespace OpenTK.Platform.X11
|
||||||
if (!Functions.XCheckWindowEvent(window.Display, window.Handle, window.EventMask, ref e) &&
|
if (!Functions.XCheckWindowEvent(window.Display, window.Handle, window.EventMask, ref e) &&
|
||||||
!Functions.XCheckTypedWindowEvent(window.Display, window.Handle, XEventName.ClientMessage, ref e) &&
|
!Functions.XCheckTypedWindowEvent(window.Display, window.Handle, XEventName.ClientMessage, ref e) &&
|
||||||
!Functions.XCheckTypedWindowEvent(window.Display, window.Handle, XEventName.SelectionNotify, ref e))
|
!Functions.XCheckTypedWindowEvent(window.Display, window.Handle, XEventName.SelectionNotify, ref e))
|
||||||
break;
|
{
|
||||||
|
if (_waitForEvent != (XEventName)0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_waitForEvent == e.type)
|
||||||
|
{
|
||||||
|
_waitForEvent = (XEventName)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Respond to the event e
|
// Respond to the event e
|
||||||
|
@ -1212,25 +1232,25 @@ namespace OpenTK.Platform.X11
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
bool is_size_changed = client_rectangle.Size != value;
|
bool is_size_changed = client_rectangle.Size != value;
|
||||||
|
if (is_size_changed)
|
||||||
int width = value.Width;
|
|
||||||
int height = value.Height;
|
|
||||||
|
|
||||||
if (WindowBorder != WindowBorder.Resizable)
|
|
||||||
{
|
{
|
||||||
SetWindowMinMax(width, height, width, height);
|
int width = value.Width;
|
||||||
}
|
int height = value.Height;
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
if (WindowBorder != WindowBorder.Resizable)
|
||||||
{
|
{
|
||||||
if (is_size_changed)
|
SetWindowMinMax(width, height, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XResizeWindow(window.Display, window.Handle,
|
Functions.XResizeWindow(window.Display, window.Handle,
|
||||||
width, height);
|
width, height);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ProcessEvents();
|
_waitForEvent = XEventName.ConfigureNotify;
|
||||||
|
ProcessEvents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue