2015-11-27 09:33:07 +01:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-11-27 09:33:07 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QWidget>
|
|
|
|
|
2018-04-29 13:35:43 +02:00
|
|
|
class QMouseEvent;
|
2017-07-04 16:58:27 +02:00
|
|
|
class QTimer;
|
|
|
|
|
2015-11-27 09:33:07 +01:00
|
|
|
class RenderWidget final : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-12-22 04:46:03 +01:00
|
|
|
explicit RenderWidget(QWidget* parent = nullptr);
|
2015-11-27 09:33:07 +01:00
|
|
|
|
2017-07-13 21:55:50 +02:00
|
|
|
bool event(QEvent* event) override;
|
2018-03-21 20:53:37 +01:00
|
|
|
void showFullScreen();
|
2019-04-23 05:29:04 +02:00
|
|
|
QPaintEngine* paintEngine() const override;
|
2021-05-09 12:28:04 +02:00
|
|
|
bool IsCursorLocked() const { return m_cursor_locked; }
|
|
|
|
void SetCursorLockedOnNextActivation(bool locked = true);
|
|
|
|
void SetWaitingForMessageBox(bool waiting_for_message_box);
|
|
|
|
void SetCursorLocked(bool locked, bool follow_aspect_ratio = true);
|
2015-11-27 09:33:07 +01:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void EscapePressed();
|
|
|
|
void Closed();
|
|
|
|
void HandleChanged(void* handle);
|
|
|
|
void StateChanged(bool fullscreen);
|
2018-01-26 07:23:24 +01:00
|
|
|
void SizeChanged(int new_width, int new_height);
|
2018-06-08 20:47:15 +02:00
|
|
|
void FocusChanged(bool focus);
|
2017-06-01 08:49:21 +02:00
|
|
|
|
|
|
|
private:
|
2017-07-04 16:58:27 +02:00
|
|
|
void HandleCursorTimer();
|
2024-04-28 03:28:58 +02:00
|
|
|
void OnHandleChanged(void* handle);
|
2017-06-01 08:49:21 +02:00
|
|
|
void OnHideCursorChanged();
|
2021-09-23 05:57:52 +02:00
|
|
|
void OnNeverHideCursorChanged();
|
2021-05-09 12:28:04 +02:00
|
|
|
void OnLockCursorChanged();
|
2018-04-22 10:56:15 +02:00
|
|
|
void OnKeepOnTopChanged(bool top);
|
2021-05-09 12:28:04 +02:00
|
|
|
void UpdateCursor();
|
2023-02-03 07:11:31 +01:00
|
|
|
void PassEventToPresenter(const QEvent* event);
|
|
|
|
void SetPresenterKeyMap();
|
2018-09-22 04:26:26 +02:00
|
|
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
|
|
|
void dropEvent(QDropEvent* event) override;
|
2017-07-04 16:58:27 +02:00
|
|
|
|
|
|
|
static constexpr int MOUSE_HIDE_DELAY = 3000;
|
|
|
|
QTimer* m_mouse_timer;
|
2019-03-09 17:25:41 +01:00
|
|
|
QPoint m_last_mouse{};
|
2023-06-10 09:12:17 +02:00
|
|
|
int m_last_window_width = 0;
|
|
|
|
int m_last_window_height = 0;
|
|
|
|
float m_last_window_scale = 0;
|
2021-05-09 12:28:04 +02:00
|
|
|
bool m_cursor_locked = false;
|
|
|
|
bool m_lock_cursor_on_next_activation = false;
|
|
|
|
bool m_dont_lock_cursor_on_show = false;
|
|
|
|
bool m_waiting_for_message_box = false;
|
2022-10-26 02:38:46 +02:00
|
|
|
bool m_should_unpause_on_focus = false;
|
2015-11-27 09:33:07 +01:00
|
|
|
};
|