This will be necessary to introduce a third value.
Change-Id: I27d79cf6f647bfcd87418f7eaabc08a56aea35b8
#include <QOpenGLContext>
#include <qpa/qplatformnativeinterface.h>
#include "config-host.h"
+#include "qt5_supplement.h"
#include "vigs_qt5.h"
-extern bool qt5IsOnscreen;
+extern maru_display_type display_type;
extern QApplication *qt5App;
extern QOpenGLContext *qt5GLContext;
bool vigs_qt5_onscreen_enabled(void)
{
- if (qt5App != NULL && qt5IsOnscreen) {
+ if (qt5App != NULL && display_type == MARU_DISPLAY_TYPE_ONSCREEN) {
return true;
}
return false;
void qemu_system_graceful_shutdown_request(unsigned int sec);
}
-MainWindow::MainWindow(UiInformation *uiInfo, bool useGL, QWidget *parent) :
+MainWindow::MainWindow(UiInformation *uiInfo, maru_display_type display_type, QWidget *parent) :
QWidget(parent)
{
/* initialize */
/* display */
updateDisplayTransform();
- createDisplay(useGL);
+ createDisplay(display_type);
/* set HW Key shortcut */
keyboardShortcut = new KeyboardShortcut(this);
SLOT(slotContextMenu(const QPoint&)));
}
-void MainWindow::createDisplay(bool useGL)
+void MainWindow::createDisplay(maru_display_type display_type)
{
qDebug("create a display");
+ DisplaySWWidget *widget;
- if (useGL) { /* on-screen rendering */
+ switch (display_type) {
+ case MARU_DISPLAY_TYPE_ONSCREEN:
this->display = new DisplayGLWidget(this,
uiInfo->getMainFormDpyType(), uiInfo->getResolution(), getUiState()->getScaleFactor());
- } else { /* off-screen rendering */
- DisplaySWWidget *widget = new DisplaySWWidget(this,
+ break;
+ case MARU_DISPLAY_TYPE_OFFSCREEN:
+ widget = new DisplaySWWidget(this,
uiInfo->getMainFormDpyType(), uiInfo->getResolution(), getUiState()->getScaleFactor());
this->screenWidget = widget;
this->display = widget;
+ break;
}
}
#include "menu/contextmenu.h"
#include "mainview.h"
#include "displaybase.h"
+#include "qt5_supplement.h"
#include "rotaryview.h"
#include "uiinformation.h"
#include "controller/dockingcontroller.h"
bool isMovingMode;
explicit MainWindow(UiInformation *uiInfo,
- bool useGL,
+ maru_display_type display_type,
QWidget *parent = 0);
~MainWindow();
QLabel *screenWidget;
private:
- void createDisplay(bool useGL);
+ void createDisplay(maru_display_type display_type);
RotaryView *createRotary();
UiInformation *uiInfo;
.dpy_cursor_define = qt5_mouse_define,
};
-void maru_early_qt5_display_init(bool isOnscreen)
+void maru_early_qt5_display_init(enum maru_display_type display_type)
{
#ifdef CONFIG_DARWIN
- ns_run_in_event_loop_with_int(&qt5_early_prepare, isOnscreen);
+ ns_run_in_event_loop_with_int(&qt5_early_prepare, display_type);
/* set emulator icon */
const int path_len = strlen(get_bin_path()) +
set_application_icon(icon_path);
g_free(icon_path);
#else
- qt5_early_prepare(isOnscreen);
+ qt5_early_prepare(display_type);
#endif
- if (isOnscreen) {
+ switch (display_type) {
+ case MARU_DISPLAY_TYPE_ONSCREEN:
LOG_INFO("Display Type: QT5 Onscreen\n");
- } else {
+ break;
+ case MARU_DISPLAY_TYPE_OFFSCREEN:
LOG_INFO("Display Type: QT5 Offscreen\n");
+ break;
}
}
#include "qemu/osdep.h"
#include "sysemu/sysemu.h"
+#include "qt5_supplement.h"
-void maru_early_qt5_display_init(bool isOnscreen);
+void maru_early_qt5_display_init(enum maru_display_type);
void maru_qt5_display_init(DisplayState *ds, int full_screen);
void maru_qt5_display_fini(void);
}
//using namespace std;
-bool qt5IsOnscreen;
+maru_display_type display_type;
QApplication *qt5App = NULL;
QOpenGLContext *qt5GLContext;
bool isForceLegacy;
/* GUI */
qDebug("start!");
- mainwindow = new MainWindow(uiInfo, qt5IsOnscreen);
+ mainwindow = new MainWindow(uiInfo, display_type);
mainwindow->setCaptureRequestHandler(captureRequestListener, captureRequestHandler);
/* position */
isForceLegacy = isLegacy;
}
-void qt5_early_prepare(bool isOnscreen)
+void qt5_early_prepare(enum maru_display_type _display_type)
{
- qt5IsOnscreen = isOnscreen;
+ display_type = _display_type;
Q_INIT_RESOURCE(resource);
- if (qt5IsOnscreen) {
+ if (display_type == MARU_DISPLAY_TYPE_ONSCREEN) {
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
eventFilter = new EventFilter();
qt5App->installNativeEventFilter(eventFilter);
#endif
- if (qt5IsOnscreen) {
+ if (display_type == MARU_DISPLAY_TYPE_ONSCREEN) {
qt5GLContext = QOpenGLContext::globalShareContext();
qDebug("* Qt global share context: OpenGL %d.%d(Profile:%d)",
qt5GLContext->format().majorVersion(),
#ifdef __cplusplus
extern "C" {
#endif
+
+enum maru_display_type {
+ MARU_DISPLAY_TYPE_ONSCREEN,
+ MARU_DISPLAY_TYPE_OFFSCREEN,
+};
+
void qt5_graphic_hw_invalidate(void);
void qt5_graphic_hw_update(void);
int qt5_graphic_hw_display(void);
-void qt5_early_prepare(bool isOnscreen);
+void qt5_early_prepare(enum maru_display_type);
void qt5_prepare(void);
void qt5_destroy(void);
#ifdef CONFIG_MARU
# if defined(CONFIG_QT)
if (display_type == DT_MARU_QT_ONSCREEN) {
- maru_early_qt5_display_init(true);
+ maru_early_qt5_display_init(MARU_DISPLAY_TYPE_ONSCREEN);
} else if (display_type == DT_MARU_QT_OFFSCREEN) {
- maru_early_qt5_display_init(false);
+ maru_early_qt5_display_init(MARU_DISPLAY_TYPE_OFFSCREEN);
}
# endif
#endif