* Turned the software renderer into a window as well

* Fix inability to move window on GNOME
* Fix status bar icons being frozen after icon set switch
This commit is contained in:
Cacodemon345
2021-12-29 23:49:09 +06:00
parent 6b07e10947
commit 1bdff37e38
11 changed files with 65 additions and 36 deletions

View File

@@ -1,7 +1,10 @@
#include "qt_renderercomon.hpp"
#include "qt_mainwindow.hpp"
#include <QPainter>
#include <QWidget>
#include <QEvent>
#include <QApplication>
#include <cmath>
@@ -12,6 +15,7 @@ extern "C" {
RendererCommon::RendererCommon() = default;
extern MainWindow* main_window;
void RendererCommon::onPaint(QPaintDevice* device) {
QPainter painter(device);
painter.setRenderHint(QPainter::SmoothPixmapTransform, video_filter_method > 0 ? true : false);
@@ -86,3 +90,25 @@ void RendererCommon::onResize(int width, int height) {
break;
}
}
bool RendererCommon::eventDelegate(QEvent *event, bool& result)
{
switch (event->type())
{
default:
return false;
case QEvent::KeyPress:
case QEvent::KeyRelease:
result = QApplication::sendEvent(main_window, event);
return true;
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
case QEvent::MouseButtonRelease:
case QEvent::Wheel:
case QEvent::Enter:
case QEvent::Leave:
result = QApplication::sendEvent(parentWidget, event);
return true;
}
return false;
}