Use dynamic_cast to convert QWindow m_target to gs_frame

Used to access get_mouse_lock_state rather than going through the QWindow property tables.

Modify mouse hide and lock to default OFF when entering Windowed mode, and to default ON when entering Fullscreen unless 'show cursor in fullscreen' is configured
This commit is contained in:
Bevan Weiss 2020-08-31 00:09:38 +10:00 committed by Megamouse
parent ca3ee019cc
commit ae0e454fc2
5 changed files with 22 additions and 25 deletions

View file

@ -2,6 +2,7 @@
#include "pad_thread.h"
#include "Emu/Io/pad_config.h"
#include "Input/product_info.h"
#include "rpcs3qt/gs_frame.h"
#include <QApplication>
@ -315,13 +316,8 @@ void keyboard_pad_handler::mouseReleaseEvent(QMouseEvent* event)
bool keyboard_pad_handler::get_mouse_lock_state()
{
if (m_target)
{
auto mouse_locked = m_target->property("mouse_locked");
if (mouse_locked.isValid())
return mouse_locked.toBool();
return false;
}
if (auto game_frame = dynamic_cast<gs_frame*>(m_target))
return game_frame->get_mouse_lock_state();
return false;
}