Wayland fixes (#5979)

* Linux/PAD: only attempt to reset X screensaver on X11

This would previously crash PCSX2 after 4096 frames on Wayland.

* Linux: only grab pointer on X11

This silently disables the functionality on Wayland, but that's one
step better than the previous behaviour: PCSX2 would crash when
Shift-F12 was pressed.
This commit is contained in:
Linus Heckemann 2022-05-04 08:24:47 +02:00 committed by GitHub
parent d1117aafac
commit 8c9ae90753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@
#include "wx_dialog/dialog.h"
#ifndef __APPLE__
Display* GSdsp;
Display* GSdsp = nullptr;
Window GSwin;
#endif
@ -263,7 +263,7 @@ void PADupdate(int pad)
// Emulate an user activity
static int count = 0;
count++;
if ((count & 0xFFF) == 0)
if (GSdsp && (count & 0xFFF) == 0)
{
// 1 call every 4096 Vsync is enough
XResetScreenSaver(GSdsp);

View File

@ -194,7 +194,7 @@ void AnalyzeKeyEvent(HostKeyEvent& evt)
#ifdef __unix__
if (evt.key == XK_Shift_R || evt.key == XK_Shift_L)
s_Shift = true;
if (evt.key == XK_F12 && s_Shift)
if (evt.key == XK_F12 && s_Shift && GSdsp)
{
if (!s_grab_input)
{

View File

@ -73,7 +73,7 @@ HWND gsWnd = nullptr;
#include "gtk.h"
#include <gdk/gdkx.h>
#include <X11/X.h>
Display* g_GSdsp;
Display* g_GSdsp = nullptr;
Window g_GSwin;
#endif

View File

@ -206,7 +206,7 @@ namespace usb_hid
if (event.code == KEY_LEFTSHIFT || event.code == KEY_RIGHTSHIFT)
shift = (event.value > 0);
if (event.code == KEY_F12 && (event.value == 1) && shift)
if (event.code == KEY_F12 && (event.value == 1) && shift && g_GSdsp)
{
if (!grabbed)
{