fix fullscreen state, fix focus, addressed comments
This commit is contained in:
parent
6d04441cda
commit
d8a4e2227a
5 changed files with 47 additions and 409 deletions
|
@ -26,7 +26,7 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
public bool IsActive { get; set; }
|
public bool IsActive { get; set; }
|
||||||
public bool IsStopped { get; set; }
|
public bool IsStopped { get; set; }
|
||||||
public bool IsFocused { get; set; } = false;
|
public bool IsFocused { get; set; }
|
||||||
|
|
||||||
private double _mouseX;
|
private double _mouseX;
|
||||||
private double _mouseY;
|
private double _mouseY;
|
||||||
|
@ -70,11 +70,13 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
_primaryController = new Input.NpadController(ConfigurationState.Instance.Hid.JoystickControls);
|
_primaryController = new Input.NpadController(ConfigurationState.Instance.Hid.JoystickControls);
|
||||||
|
|
||||||
AddEvents((int)(Gdk.EventMask.ButtonPressMask |
|
AddEvents((int)(Gdk.EventMask.ButtonPressMask
|
||||||
Gdk.EventMask.ButtonReleaseMask |
|
| Gdk.EventMask.ButtonReleaseMask
|
||||||
Gdk.EventMask.PointerMotionMask |
|
| Gdk.EventMask.PointerMotionMask
|
||||||
Gdk.EventMask.KeyPressMask |
|
| Gdk.EventMask.KeyPressMask
|
||||||
Gdk.EventMask.KeyReleaseMask));
|
| Gdk.EventMask.KeyReleaseMask));
|
||||||
|
|
||||||
|
this.Shown += Renderer_Shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Parent_FocusOutEvent(object o, Gtk.FocusOutEventArgs args)
|
private void Parent_FocusOutEvent(object o, Gtk.FocusOutEventArgs args)
|
||||||
|
@ -94,10 +96,16 @@ namespace Ryujinx.Ui
|
||||||
this.Dispose();
|
this.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void Renderer_Shown(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
IsFocused = this.ParentWindow.State.HasFlag(Gdk.WindowState.Focused);
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleScreenState(KeyboardState keyboard)
|
public void HandleScreenState(KeyboardState keyboard)
|
||||||
{
|
{
|
||||||
bool toggleFullscreen = keyboard.IsKeyDown(OpenTK.Input.Key.F11) ||
|
bool toggleFullscreen = keyboard.IsKeyDown(OpenTK.Input.Key.F11)
|
||||||
((keyboard.IsKeyDown(OpenTK.Input.Key.AltLeft) || keyboard.IsKeyDown(OpenTK.Input.Key.AltRight))
|
|| ((keyboard.IsKeyDown(OpenTK.Input.Key.AltLeft)
|
||||||
|
|| keyboard.IsKeyDown(OpenTK.Input.Key.AltRight))
|
||||||
&& keyboard.IsKeyDown(OpenTK.Input.Key.Enter));
|
&& keyboard.IsKeyDown(OpenTK.Input.Key.Enter));
|
||||||
|
|
||||||
if (toggleFullscreen == _toggleFullscreen)
|
if (toggleFullscreen == _toggleFullscreen)
|
||||||
|
@ -107,9 +115,9 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
_toggleFullscreen = toggleFullscreen;
|
_toggleFullscreen = toggleFullscreen;
|
||||||
|
|
||||||
if (IsFocused)
|
Gtk.Application.Invoke(delegate
|
||||||
{
|
{
|
||||||
if (this.ParentWindow.State.HasFlag(Gdk.WindowState.Fullscreen) )
|
if (this.ParentWindow.State.HasFlag(Gdk.WindowState.Fullscreen))
|
||||||
{
|
{
|
||||||
if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape) || _toggleFullscreen)
|
if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape) || _toggleFullscreen)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +138,7 @@ namespace Ryujinx.Ui
|
||||||
(this.Toplevel as MainWindow)?.ToggleExtraWidgets(false);
|
(this.Toplevel as MainWindow)?.ToggleExtraWidgets(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GLRenderer_Initialized(object sender, EventArgs e)
|
private void GLRenderer_Initialized(object sender, EventArgs e)
|
||||||
|
@ -225,7 +233,7 @@ namespace Ryujinx.Ui
|
||||||
IsStopped = true;
|
IsStopped = true;
|
||||||
IsActive = false;
|
IsActive = false;
|
||||||
|
|
||||||
using (ScopedGLContext scopedGLContext = new ScopedGLContext(WindowInfo, GraphicsContext))
|
using (ScopedGlContext scopedGLContext = new ScopedGlContext(WindowInfo, GraphicsContext))
|
||||||
{
|
{
|
||||||
_device.DisposeGpu();
|
_device.DisposeGpu();
|
||||||
}
|
}
|
||||||
|
@ -245,7 +253,7 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
public void Render()
|
public void Render()
|
||||||
{
|
{
|
||||||
using (ScopedGLContext scopedGLContext = new ScopedGLContext(WindowInfo, GraphicsContext))
|
using (ScopedGlContext scopedGLContext = new ScopedGlContext(WindowInfo, GraphicsContext))
|
||||||
{
|
{
|
||||||
_renderer.Initialize();
|
_renderer.Initialize();
|
||||||
|
|
||||||
|
@ -259,7 +267,7 @@ namespace Ryujinx.Ui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (ScopedGLContext scopedGLContext = new ScopedGLContext(WindowInfo, GraphicsContext))
|
using (ScopedGlContext scopedGLContext = new ScopedGlContext(WindowInfo, GraphicsContext))
|
||||||
{
|
{
|
||||||
_ticks += _chrono.ElapsedTicks;
|
_ticks += _chrono.ElapsedTicks;
|
||||||
|
|
||||||
|
@ -318,6 +326,7 @@ namespace Ryujinx.Ui
|
||||||
this.ParentWindow.Title = _newTitle;
|
this.ParentWindow.Title = _newTitle;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsFocused)
|
if (IsFocused)
|
||||||
{
|
{
|
||||||
UpdateFrame();
|
UpdateFrame();
|
||||||
|
@ -424,7 +433,6 @@ namespace Ryujinx.Ui
|
||||||
screenHeight = (AllocatedWidth * TouchScreenHeight) / TouchScreenWidth;
|
screenHeight = (AllocatedWidth * TouchScreenHeight) / TouchScreenWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int startX = (AllocatedWidth - screenWidth) >> 1;
|
int startX = (AllocatedWidth - screenWidth) >> 1;
|
||||||
int startY = (AllocatedHeight - screenHeight) >> 1;
|
int startY = (AllocatedHeight - screenHeight) >> 1;
|
||||||
|
|
||||||
|
|
|
@ -1,375 +0,0 @@
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using OpenTK.Input;
|
|
||||||
using Ryujinx.Configuration;
|
|
||||||
using Ryujinx.Graphics.OpenGL;
|
|
||||||
using Ryujinx.HLE;
|
|
||||||
using Ryujinx.HLE.Input;
|
|
||||||
using System;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
using Stopwatch = System.Diagnostics.Stopwatch;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ui
|
|
||||||
{
|
|
||||||
public class GlScreen : GameWindow
|
|
||||||
{
|
|
||||||
private const int TouchScreenWidth = 1280;
|
|
||||||
private const int TouchScreenHeight = 720;
|
|
||||||
|
|
||||||
private const int TargetFps = 60;
|
|
||||||
|
|
||||||
private Switch _device;
|
|
||||||
|
|
||||||
private Renderer _renderer;
|
|
||||||
|
|
||||||
private HotkeyButtons _prevHotkeyButtons = 0;
|
|
||||||
|
|
||||||
private KeyboardState? _keyboard = null;
|
|
||||||
|
|
||||||
private MouseState? _mouse = null;
|
|
||||||
|
|
||||||
private Input.NpadController _primaryController;
|
|
||||||
|
|
||||||
private Thread _renderThread;
|
|
||||||
|
|
||||||
private bool _resizeEvent;
|
|
||||||
|
|
||||||
private bool _titleEvent;
|
|
||||||
|
|
||||||
private string _newTitle;
|
|
||||||
|
|
||||||
public GlScreen(Switch device)
|
|
||||||
: base(1280, 720,
|
|
||||||
new GraphicsMode(), "Ryujinx", 0,
|
|
||||||
DisplayDevice.Default, 3, 3,
|
|
||||||
GraphicsContextFlags.ForwardCompatible)
|
|
||||||
{
|
|
||||||
_device = device;
|
|
||||||
|
|
||||||
if (!(device.Gpu.Renderer is Renderer))
|
|
||||||
{
|
|
||||||
throw new NotSupportedException($"GPU renderer must be an OpenGL renderer when using GlScreen!");
|
|
||||||
}
|
|
||||||
|
|
||||||
_renderer = (Renderer)device.Gpu.Renderer;
|
|
||||||
|
|
||||||
_primaryController = new Input.NpadController(ConfigurationState.Instance.Hid.JoystickControls);
|
|
||||||
|
|
||||||
Location = new Point(
|
|
||||||
(DisplayDevice.Default.Width / 2) - (Width / 2),
|
|
||||||
(DisplayDevice.Default.Height / 2) - (Height / 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RenderLoop()
|
|
||||||
{
|
|
||||||
MakeCurrent();
|
|
||||||
|
|
||||||
_renderer.Initialize();
|
|
||||||
|
|
||||||
Stopwatch chrono = new Stopwatch();
|
|
||||||
|
|
||||||
chrono.Start();
|
|
||||||
|
|
||||||
long ticksPerFrame = Stopwatch.Frequency / TargetFps;
|
|
||||||
|
|
||||||
long ticks = 0;
|
|
||||||
|
|
||||||
while (Exists && !IsExiting)
|
|
||||||
{
|
|
||||||
if (_device.WaitFifo())
|
|
||||||
{
|
|
||||||
_device.ProcessFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_resizeEvent)
|
|
||||||
{
|
|
||||||
_resizeEvent = false;
|
|
||||||
|
|
||||||
_renderer.Window.SetSize(Width, Height);
|
|
||||||
}
|
|
||||||
|
|
||||||
ticks += chrono.ElapsedTicks;
|
|
||||||
|
|
||||||
chrono.Restart();
|
|
||||||
|
|
||||||
if (ticks >= ticksPerFrame)
|
|
||||||
{
|
|
||||||
RenderFrame();
|
|
||||||
|
|
||||||
// Queue max. 1 vsync
|
|
||||||
ticks = Math.Min(ticks - ticksPerFrame, ticksPerFrame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_device.DisposeGpu();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MainLoop()
|
|
||||||
{
|
|
||||||
VSync = VSyncMode.Off;
|
|
||||||
|
|
||||||
Visible = true;
|
|
||||||
|
|
||||||
Context.MakeCurrent(null);
|
|
||||||
|
|
||||||
// OpenTK doesn't like sleeps in its thread, to avoid this a renderer thread is created
|
|
||||||
_renderThread = new Thread(RenderLoop)
|
|
||||||
{
|
|
||||||
Name = "GUI.RenderThread"
|
|
||||||
};
|
|
||||||
|
|
||||||
_renderThread.Start();
|
|
||||||
|
|
||||||
while (Exists && !IsExiting)
|
|
||||||
{
|
|
||||||
ProcessEvents();
|
|
||||||
|
|
||||||
if (!IsExiting)
|
|
||||||
{
|
|
||||||
UpdateFrame();
|
|
||||||
|
|
||||||
if (_titleEvent)
|
|
||||||
{
|
|
||||||
_titleEvent = false;
|
|
||||||
|
|
||||||
Title = _newTitle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Polling becomes expensive if it's not slept
|
|
||||||
Thread.Sleep(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private new void UpdateFrame()
|
|
||||||
{
|
|
||||||
HotkeyButtons currentHotkeyButtons = 0;
|
|
||||||
ControllerButtons currentButton = 0;
|
|
||||||
JoystickPosition leftJoystick;
|
|
||||||
JoystickPosition rightJoystick;
|
|
||||||
HLE.Input.Keyboard? hidKeyboard = null;
|
|
||||||
|
|
||||||
int leftJoystickDx = 0;
|
|
||||||
int leftJoystickDy = 0;
|
|
||||||
int rightJoystickDx = 0;
|
|
||||||
int rightJoystickDy = 0;
|
|
||||||
|
|
||||||
// Keyboard Input
|
|
||||||
if (_keyboard.HasValue)
|
|
||||||
{
|
|
||||||
KeyboardState keyboard = _keyboard.Value;
|
|
||||||
|
|
||||||
// Normal Input
|
|
||||||
currentHotkeyButtons = KeyboardControls.GetHotkeyButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
|
||||||
currentButton = KeyboardControls.GetButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
|
||||||
|
|
||||||
if (ConfigurationState.Instance.Hid.EnableKeyboard)
|
|
||||||
{
|
|
||||||
hidKeyboard = KeyboardControls.GetKeysDown(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
|
||||||
}
|
|
||||||
|
|
||||||
(leftJoystickDx, leftJoystickDy) = KeyboardControls.GetLeftStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
|
||||||
(rightJoystickDx, rightJoystickDy) = KeyboardControls.GetRightStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hidKeyboard.HasValue)
|
|
||||||
{
|
|
||||||
hidKeyboard = new HLE.Input.Keyboard
|
|
||||||
{
|
|
||||||
Modifier = 0,
|
|
||||||
Keys = new int[0x8]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
currentButton |= _primaryController.GetButtons();
|
|
||||||
|
|
||||||
// Keyboard has priority stick-wise
|
|
||||||
if (leftJoystickDx == 0 && leftJoystickDy == 0)
|
|
||||||
{
|
|
||||||
(leftJoystickDx, leftJoystickDy) = _primaryController.GetLeftStick();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rightJoystickDx == 0 && rightJoystickDy == 0)
|
|
||||||
{
|
|
||||||
(rightJoystickDx, rightJoystickDy) = _primaryController.GetRightStick();
|
|
||||||
}
|
|
||||||
|
|
||||||
leftJoystick = new JoystickPosition
|
|
||||||
{
|
|
||||||
Dx = leftJoystickDx,
|
|
||||||
Dy = leftJoystickDy
|
|
||||||
};
|
|
||||||
|
|
||||||
rightJoystick = new JoystickPosition
|
|
||||||
{
|
|
||||||
Dx = rightJoystickDx,
|
|
||||||
Dy = rightJoystickDy
|
|
||||||
};
|
|
||||||
|
|
||||||
currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick);
|
|
||||||
|
|
||||||
bool hasTouch = false;
|
|
||||||
|
|
||||||
// Get screen touch position from left mouse click
|
|
||||||
// OpenTK always captures mouse events, even if out of focus, so check if window is focused.
|
|
||||||
if (Focused && _mouse?.LeftButton == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
MouseState mouse = _mouse.Value;
|
|
||||||
|
|
||||||
int scrnWidth = Width;
|
|
||||||
int scrnHeight = Height;
|
|
||||||
|
|
||||||
if (Width > (Height * TouchScreenWidth) / TouchScreenHeight)
|
|
||||||
{
|
|
||||||
scrnWidth = (Height * TouchScreenWidth) / TouchScreenHeight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scrnHeight = (Width * TouchScreenHeight) / TouchScreenWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
int startX = (Width - scrnWidth) >> 1;
|
|
||||||
int startY = (Height - scrnHeight) >> 1;
|
|
||||||
|
|
||||||
int endX = startX + scrnWidth;
|
|
||||||
int endY = startY + scrnHeight;
|
|
||||||
|
|
||||||
if (mouse.X >= startX &&
|
|
||||||
mouse.Y >= startY &&
|
|
||||||
mouse.X < endX &&
|
|
||||||
mouse.Y < endY)
|
|
||||||
{
|
|
||||||
int scrnMouseX = mouse.X - startX;
|
|
||||||
int scrnMouseY = mouse.Y - startY;
|
|
||||||
|
|
||||||
int mX = (scrnMouseX * TouchScreenWidth) / scrnWidth;
|
|
||||||
int mY = (scrnMouseY * TouchScreenHeight) / scrnHeight;
|
|
||||||
|
|
||||||
TouchPoint currentPoint = new TouchPoint
|
|
||||||
{
|
|
||||||
X = mX,
|
|
||||||
Y = mY,
|
|
||||||
|
|
||||||
// Placeholder values till more data is acquired
|
|
||||||
DiameterX = 10,
|
|
||||||
DiameterY = 10,
|
|
||||||
Angle = 90
|
|
||||||
};
|
|
||||||
|
|
||||||
hasTouch = true;
|
|
||||||
|
|
||||||
_device.Hid.SetTouchPoints(currentPoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasTouch)
|
|
||||||
{
|
|
||||||
_device.Hid.SetTouchPoints();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ConfigurationState.Instance.Hid.EnableKeyboard && hidKeyboard.HasValue)
|
|
||||||
{
|
|
||||||
_device.Hid.WriteKeyboard(hidKeyboard.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseController controller = _device.Hid.PrimaryController;
|
|
||||||
|
|
||||||
controller.SendInput(currentButton, leftJoystick, rightJoystick);
|
|
||||||
|
|
||||||
// Toggle vsync
|
|
||||||
if (currentHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync) &&
|
|
||||||
!_prevHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync))
|
|
||||||
{
|
|
||||||
_device.EnableDeviceVsync = !_device.EnableDeviceVsync;
|
|
||||||
}
|
|
||||||
|
|
||||||
_prevHotkeyButtons = currentHotkeyButtons;
|
|
||||||
}
|
|
||||||
|
|
||||||
private new void RenderFrame()
|
|
||||||
{
|
|
||||||
_device.PresentFrame(SwapBuffers);
|
|
||||||
|
|
||||||
_device.Statistics.RecordSystemFrameTime();
|
|
||||||
|
|
||||||
double hostFps = _device.Statistics.GetSystemFrameRate();
|
|
||||||
double gameFps = _device.Statistics.GetGameFrameRate();
|
|
||||||
|
|
||||||
string titleNameSection = string.IsNullOrWhiteSpace(_device.System.TitleName) ? string.Empty
|
|
||||||
: " | " + _device.System.TitleName;
|
|
||||||
|
|
||||||
string titleIdSection = string.IsNullOrWhiteSpace(_device.System.TitleIdText) ? string.Empty
|
|
||||||
: " | " + _device.System.TitleIdText.ToUpper();
|
|
||||||
|
|
||||||
_newTitle = $"Ryujinx{titleNameSection}{titleIdSection} | Host FPS: {hostFps:0.0} | Game FPS: {gameFps:0.0} | " +
|
|
||||||
$"Game Vsync: {(_device.EnableDeviceVsync ? "On" : "Off")}";
|
|
||||||
|
|
||||||
_titleEvent = true;
|
|
||||||
|
|
||||||
_device.System.SignalVsync();
|
|
||||||
|
|
||||||
_device.VsyncEvent.Set();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnUnload(EventArgs e)
|
|
||||||
{
|
|
||||||
_renderThread.Join();
|
|
||||||
|
|
||||||
base.OnUnload(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnResize(EventArgs e)
|
|
||||||
{
|
|
||||||
_resizeEvent = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyboardKeyEventArgs e)
|
|
||||||
{
|
|
||||||
bool toggleFullscreen = e.Key == Key.F11 ||
|
|
||||||
(e.Modifiers.HasFlag(KeyModifiers.Alt) && e.Key == Key.Enter);
|
|
||||||
|
|
||||||
if (WindowState == WindowState.Fullscreen)
|
|
||||||
{
|
|
||||||
if (e.Key == Key.Escape || toggleFullscreen)
|
|
||||||
{
|
|
||||||
WindowState = WindowState.Normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (e.Key == Key.Escape)
|
|
||||||
{
|
|
||||||
Exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toggleFullscreen)
|
|
||||||
{
|
|
||||||
WindowState = WindowState.Fullscreen;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_keyboard = e.Keyboard;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnKeyUp(KeyboardKeyEventArgs e)
|
|
||||||
{
|
|
||||||
_keyboard = e.Keyboard;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnMouseDown(MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
_mouse = e.Mouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnMouseUp(MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
_mouse = e.Mouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnMouseMove(MouseMoveEventArgs e)
|
|
||||||
{
|
|
||||||
_mouse = e.Mouse;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -29,7 +29,6 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
private static HLE.Switch _emulationContext;
|
private static HLE.Switch _emulationContext;
|
||||||
|
|
||||||
// private static GlScreen _screen;
|
|
||||||
private static GLRenderer _gLWigdet;
|
private static GLRenderer _gLWigdet;
|
||||||
|
|
||||||
private static AutoResetEvent _screenExitStatus = new AutoResetEvent(false);
|
private static AutoResetEvent _screenExitStatus = new AutoResetEvent(false);
|
||||||
|
@ -51,7 +50,7 @@ namespace Ryujinx.Ui
|
||||||
[GUI] Window _mainWin;
|
[GUI] Window _mainWin;
|
||||||
[GUI] MenuBar _menuBar;
|
[GUI] MenuBar _menuBar;
|
||||||
[GUI] Box _footerBox;
|
[GUI] Box _footerBox;
|
||||||
[GUI] CheckMenuItem _fullScreen;
|
[GUI] MenuItem _fullScreen;
|
||||||
[GUI] MenuItem _stopEmulation;
|
[GUI] MenuItem _stopEmulation;
|
||||||
[GUI] CheckMenuItem _favToggle;
|
[GUI] CheckMenuItem _favToggle;
|
||||||
[GUI] MenuItem _firmwareInstallFile;
|
[GUI] MenuItem _firmwareInstallFile;
|
||||||
|
@ -160,6 +159,8 @@ namespace Ryujinx.Ui
|
||||||
UpdateGameTable();
|
UpdateGameTable();
|
||||||
|
|
||||||
Task.Run(RefreshFirmwareLabel);
|
Task.Run(RefreshFirmwareLabel);
|
||||||
|
|
||||||
|
_fullScreen.Activated += FullScreen_Toggled;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_DEBUGGING
|
#if USE_DEBUGGING
|
||||||
|
@ -411,7 +412,7 @@ namespace Ryujinx.Ui
|
||||||
Application.Invoke(delegate
|
Application.Invoke(delegate
|
||||||
{
|
{
|
||||||
_viewBox.Remove(_gLWigdet);
|
_viewBox.Remove(_gLWigdet);
|
||||||
_gLWigdet.Dispose();
|
_gLWigdet.Exit();
|
||||||
|
|
||||||
if(_gLWigdet.Window != this.Window && _gLWigdet.Window != null)
|
if(_gLWigdet.Window != this.Window && _gLWigdet.Window != null)
|
||||||
{
|
{
|
||||||
|
@ -445,7 +446,6 @@ namespace Ryujinx.Ui
|
||||||
_stopEmulation.Sensitive = false;
|
_stopEmulation.Sensitive = false;
|
||||||
_firmwareInstallFile.Sensitive = true;
|
_firmwareInstallFile.Sensitive = true;
|
||||||
_firmwareInstallDirectory.Sensitive = true;
|
_firmwareInstallDirectory.Sensitive = true;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_screenExitStatus.Set();
|
_screenExitStatus.Set();
|
||||||
|
@ -453,7 +453,7 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
public void ToggleExtraWidgets(bool show)
|
public void ToggleExtraWidgets(bool show)
|
||||||
{
|
{
|
||||||
Gtk.Application.Invoke(delegate
|
if (_gLWigdet != null)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
|
@ -465,7 +465,11 @@ namespace Ryujinx.Ui
|
||||||
_menuBar.Hide();
|
_menuBar.Hide();
|
||||||
_footerBox.Hide();
|
_footerBox.Hide();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
bool fullScreenToggled = this.Window.State.HasFlag(Gdk.WindowState.Fullscreen);
|
||||||
|
|
||||||
|
_fullScreen.Label = !fullScreenToggled ? "Exit Fullscreen" : "Enter Fullscreen";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateGameMetadata(string titleId)
|
private static void UpdateGameMetadata(string titleId)
|
||||||
|
@ -864,16 +868,22 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
private void FullScreen_Toggled(object o, EventArgs args)
|
private void FullScreen_Toggled(object o, EventArgs args)
|
||||||
{
|
{
|
||||||
if (_fullScreen.Active)
|
bool fullScreenToggled = this.Window.State.HasFlag(Gdk.WindowState.Fullscreen);
|
||||||
|
|
||||||
|
if (!fullScreenToggled)
|
||||||
{
|
{
|
||||||
Fullscreen();
|
Fullscreen();
|
||||||
|
|
||||||
|
_fullScreen.Label = "Exit Fullscreen";
|
||||||
|
|
||||||
ToggleExtraWidgets(false);
|
ToggleExtraWidgets(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Unfullscreen();
|
Unfullscreen();
|
||||||
|
|
||||||
|
_fullScreen.Label = "Enter Fullscreen";
|
||||||
|
|
||||||
ToggleExtraWidgets(true);
|
ToggleExtraWidgets(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,13 +97,11 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckMenuItem" id="_fullScreen">
|
<object class="GtkMenuItem" id="_fullScreen">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="tooltip_text" translatable="yes">Fullscreens the window</property>
|
<property name="label" translatable="yes">Enter Fullscreen</property>
|
||||||
<property name="label" translatable="yes">Fullscreen</property>
|
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="toggled" handler="FullScreen_Toggled" swapped="no"/>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -405,9 +403,6 @@
|
||||||
<object class="GtkBox" id="_footerBox">
|
<object class="GtkBox" id="_footerBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="_listStatusBox">
|
<object class="GtkBox" id="_listStatusBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -5,13 +5,13 @@ using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.Ui
|
namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
class ScopedGLContext : IDisposable
|
class ScopedGlContext : IDisposable
|
||||||
{
|
{
|
||||||
private IGraphicsContext _graphicsContext;
|
private IGraphicsContext _graphicsContext;
|
||||||
|
|
||||||
private static readonly object _lock = new object();
|
private static readonly object _lock = new object();
|
||||||
|
|
||||||
public ScopedGLContext(IWindowInfo windowInfo, IGraphicsContext graphicsContext)
|
public ScopedGlContext(IWindowInfo windowInfo, IGraphicsContext graphicsContext)
|
||||||
{
|
{
|
||||||
_graphicsContext = graphicsContext;
|
_graphicsContext = graphicsContext;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue