qt: Enable and make VNC work properly
This commit is contained in:
@@ -51,6 +51,8 @@ plat_vidapi(char* api) {
|
||||
return 4;
|
||||
} else if (!strcasecmp(api, "qt_d3d9")) {
|
||||
return 5;
|
||||
} else if (!strcasecmp(api, "vnc")) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -78,6 +80,9 @@ char* plat_vidapi_name(int api) {
|
||||
case 5:
|
||||
name = "qt_d3d9";
|
||||
break;
|
||||
case 6:
|
||||
name = "vnc";
|
||||
break;
|
||||
default:
|
||||
fatal("Unknown renderer: %i\n", api);
|
||||
break;
|
||||
|
||||
@@ -46,6 +46,10 @@ extern "C" {
|
||||
#include <86box/vid_ega.h>
|
||||
#include <86box/version.h>
|
||||
|
||||
#ifdef USE_VNC
|
||||
#include <86box/vnc.h>
|
||||
#endif
|
||||
|
||||
extern int qt_nvr_save(void);
|
||||
|
||||
#ifdef MTR_ENABLED
|
||||
@@ -141,6 +145,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
((BWindow*)this->winId())->AddFilter(filter);
|
||||
#endif
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
extern MainWindow* main_window;
|
||||
main_window = this;
|
||||
ui->setupUi(this);
|
||||
ui->stackedWidget->setMouseTracking(true);
|
||||
statusBar()->setVisible(!hide_status_bar);
|
||||
@@ -308,6 +314,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
if (vid_api == 5) vid_api = 0;
|
||||
#endif
|
||||
|
||||
#ifndef USE_VNC
|
||||
if (vid_api == 6) vid_api = 0;
|
||||
ui->actionVNC->setVisible(false);
|
||||
#endif
|
||||
|
||||
#if !QT_CONFIG(vulkan)
|
||||
if (vid_api == 4) vid_api = 0;
|
||||
ui->actionVulkan->setVisible(false);
|
||||
@@ -322,10 +333,20 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
actGroup->addAction(ui->actionOpenGL_3_0_Core);
|
||||
actGroup->addAction(ui->actionVulkan);
|
||||
actGroup->addAction(ui->actionDirect3D_9);
|
||||
actGroup->addAction(ui->actionVNC);
|
||||
actGroup->setExclusive(true);
|
||||
|
||||
connect(actGroup, &QActionGroup::triggered, [this](QAction* action) {
|
||||
vid_api = action->property("vid_api").toInt();
|
||||
#ifdef USE_VNC
|
||||
if (vnc_enabled && vid_api != 6) {
|
||||
startblit();
|
||||
vnc_enabled = 0;
|
||||
vnc_close();
|
||||
video_setblit(qt_blit);
|
||||
endblit();
|
||||
}
|
||||
#endif
|
||||
RendererStack::Renderer newVidApi = RendererStack::Renderer::Software;
|
||||
switch (vid_api)
|
||||
{
|
||||
@@ -347,6 +368,15 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
case 5:
|
||||
newVidApi = (RendererStack::Renderer::Direct3D9);
|
||||
break;
|
||||
#ifdef USE_VNC
|
||||
case 6:
|
||||
{
|
||||
newVidApi = RendererStack::Renderer::Software;
|
||||
startblit();
|
||||
vnc_enabled = vnc_init(nullptr);
|
||||
endblit();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ui->stackedWidget->switchRenderer(newVidApi);
|
||||
if (!show_second_monitors) return;
|
||||
@@ -469,7 +499,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionCtrl_Alt_Del->setShortcutVisibleInContextMenu(true);
|
||||
ui->actionTake_screenshot->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
video_setblit(qt_blit);
|
||||
if (!vnc_enabled) video_setblit(qt_blit);
|
||||
|
||||
if (start_in_fullscreen) {
|
||||
connect(ui->stackedWidget, &RendererStack::blit, this, [this] () {
|
||||
|
||||
@@ -144,6 +144,7 @@ private:
|
||||
bool send_keyboard_input = true;
|
||||
bool shownonce = false;
|
||||
bool resizableonce = false;
|
||||
bool vnc_enabled = false;
|
||||
|
||||
friend class SpecifyDimensions;
|
||||
friend class ProgSettings;
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
<addaction name="actionOpenGL_3_0_Core"/>
|
||||
<addaction name="actionVulkan"/>
|
||||
<addaction name="actionDirect3D_9"/>
|
||||
<addaction name="actionVNC"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuWindow_scale_factor">
|
||||
<property name="title">
|
||||
@@ -766,6 +767,17 @@
|
||||
<string>Show non-primary monitors</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionVNC">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>VNC</string>
|
||||
</property>
|
||||
<property name="vid_api" stdset="0">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
@@ -172,8 +172,10 @@ vnc_blit(int x, int y, int w, int h, int monitor_index)
|
||||
uint32_t *p;
|
||||
int yy;
|
||||
|
||||
if (monitor_index || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL))
|
||||
if (monitor_index || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL)) {
|
||||
video_blit_complete_monitor(monitor_index);
|
||||
return;
|
||||
}
|
||||
|
||||
for (yy=0; yy<h; yy++) {
|
||||
p = (uint32_t *)&(((uint32_t *)rfb->frameBuffer)[yy*VNC_MAX_X]);
|
||||
@@ -185,7 +187,7 @@ vnc_blit(int x, int y, int w, int h, int monitor_index)
|
||||
if (screenshots)
|
||||
video_screenshot((uint32_t *) rfb->frameBuffer, 0, 0, VNC_MAX_X);
|
||||
|
||||
video_blit_complete();
|
||||
video_blit_complete_monitor(monitor_index);
|
||||
|
||||
if (! updatingSize)
|
||||
rfbMarkRectAsModified(rfb, 0,0, allowedX,allowedY);
|
||||
@@ -210,7 +212,7 @@ vnc_init(UNUSED(void *arg))
|
||||
32, 32, 0, 1, 255,255,255, 16, 8, 0, 0, 0
|
||||
};
|
||||
|
||||
cgapal_rebuild();
|
||||
cgapal_rebuild_monitor(0);
|
||||
|
||||
if (rfb == NULL) {
|
||||
wcstombs(title, ui_window_title(NULL), sizeof(title));
|
||||
|
||||
Reference in New Issue
Block a user