QT changes, fixed 4:3 integer stretch.
This commit is contained in:
@@ -555,6 +555,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
actGroup->addAction(ui->actionFullScreen_43);
|
actGroup->addAction(ui->actionFullScreen_43);
|
||||||
actGroup->addAction(ui->actionFullScreen_keepRatio);
|
actGroup->addAction(ui->actionFullScreen_keepRatio);
|
||||||
actGroup->addAction(ui->actionFullScreen_int);
|
actGroup->addAction(ui->actionFullScreen_int);
|
||||||
|
actGroup->addAction(ui->actionFullScreen_int43);
|
||||||
switch (video_grayscale) {
|
switch (video_grayscale) {
|
||||||
case 0:
|
case 0:
|
||||||
ui->actionRGB_Color->setChecked(true);
|
ui->actionRGB_Color->setChecked(true);
|
||||||
@@ -1534,10 +1535,11 @@ MainWindow::on_actionLinear_triggered()
|
|||||||
static void
|
static void
|
||||||
update_fullscreen_scale_checkboxes(Ui::MainWindow *ui, QAction *selected)
|
update_fullscreen_scale_checkboxes(Ui::MainWindow *ui, QAction *selected)
|
||||||
{
|
{
|
||||||
ui->actionFullScreen_stretch->setChecked(ui->actionFullScreen_stretch == selected);
|
ui->actionFullScreen_stretch->setChecked(selected == ui->actionFullScreen_stretch);
|
||||||
ui->actionFullScreen_43->setChecked(ui->actionFullScreen_43 == selected);
|
ui->actionFullScreen_43->setChecked(selected == ui->actionFullScreen_43);
|
||||||
ui->actionFullScreen_keepRatio->setChecked(ui->actionFullScreen_keepRatio == selected);
|
ui->actionFullScreen_keepRatio->setChecked(selected == ui->actionFullScreen_keepRatio);
|
||||||
ui->actionFullScreen_int->setChecked(ui->actionFullScreen_int == selected);
|
ui->actionFullScreen_int->setChecked(selected == ui->actionFullScreen_int);
|
||||||
|
ui->actionFullScreen_int43->setChecked(selected == ui->actionFullScreen_int43);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto widget = ui->stackedWidget->currentWidget();
|
auto widget = ui->stackedWidget->currentWidget();
|
||||||
@@ -1546,7 +1548,8 @@ update_fullscreen_scale_checkboxes(Ui::MainWindow *ui, QAction *selected)
|
|||||||
|
|
||||||
for (int i = 1; i < MONITORS_NUM; i++) {
|
for (int i = 1; i < MONITORS_NUM; i++) {
|
||||||
if (main_window->renderers[i])
|
if (main_window->renderers[i])
|
||||||
main_window->renderers[i]->onResize(main_window->renderers[i]->width(), main_window->renderers[i]->height());
|
main_window->renderers[i]->onResize(main_window->renderers[i]->width(),
|
||||||
|
main_window->renderers[i]->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
device_force_redraw();
|
device_force_redraw();
|
||||||
|
|||||||
@@ -73,14 +73,12 @@ RendererCommon::onResize(int width, int height)
|
|||||||
double gw = source.width();
|
double gw = source.width();
|
||||||
double gh = source.height();
|
double gh = source.height();
|
||||||
double hsr = hw / hh;
|
double hsr = hw / hh;
|
||||||
|
double r43 = 4.0 / 3.0;
|
||||||
|
|
||||||
switch (video_fullscreen_scale) {
|
switch (video_fullscreen_scale) {
|
||||||
case FULLSCR_SCALE_INT:
|
case FULLSCR_SCALE_INT:
|
||||||
case FULLSCR_SCALE_INT43:
|
case FULLSCR_SCALE_INT43:
|
||||||
if (video_fullscreen_scale == FULLSCR_SCALE_INT43)
|
gsr = gw / gh;
|
||||||
gsr = 4.0 / 3.0;
|
|
||||||
else
|
|
||||||
gsr = gw / gh;
|
|
||||||
|
|
||||||
if (gsr <= hsr) {
|
if (gsr <= hsr) {
|
||||||
dw = hh * gsr;
|
dw = hh * gsr;
|
||||||
@@ -89,8 +87,20 @@ RendererCommon::onResize(int width, int height)
|
|||||||
dw = hw;
|
dw = hw;
|
||||||
dh = hw / gsr;
|
dh = hw / gsr;
|
||||||
}
|
}
|
||||||
|
|
||||||
integer_scale(&dw, &gw);
|
integer_scale(&dw, &gw);
|
||||||
integer_scale(&dh, &gh);
|
integer_scale(&dh, &gh);
|
||||||
|
|
||||||
|
if (video_fullscreen_scale == FULLSCR_SCALE_INT43) {
|
||||||
|
if (r43 <= gsr) {
|
||||||
|
dw = dh * r43;
|
||||||
|
dh = dh;
|
||||||
|
} else {
|
||||||
|
dh = dw / r43;
|
||||||
|
dw = dw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dx = (hw - dw) / 2.0;
|
dx = (hw - dw) / 2.0;
|
||||||
dy = (hh - dh) / 2.0;
|
dy = (hh - dh) / 2.0;
|
||||||
destination.setRect((int) dx, (int) dy, (int) dw, (int) dh);
|
destination.setRect((int) dx, (int) dy, (int) dw, (int) dh);
|
||||||
@@ -98,7 +108,7 @@ RendererCommon::onResize(int width, int height)
|
|||||||
case FULLSCR_SCALE_43:
|
case FULLSCR_SCALE_43:
|
||||||
case FULLSCR_SCALE_KEEPRATIO:
|
case FULLSCR_SCALE_KEEPRATIO:
|
||||||
if (video_fullscreen_scale == FULLSCR_SCALE_43)
|
if (video_fullscreen_scale == FULLSCR_SCALE_43)
|
||||||
gsr = 4.0 / 3.0;
|
gsr = r43;
|
||||||
else
|
else
|
||||||
gsr = gw / gh;
|
gsr = gw / gh;
|
||||||
|
|
||||||
|
|||||||
@@ -174,9 +174,6 @@ void
|
|||||||
WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
||||||
{
|
{
|
||||||
USHORT scancode;
|
USHORT scancode;
|
||||||
static int recv_lalt = 0;
|
|
||||||
static int recv_ralt = 0;
|
|
||||||
static int recv_tab = 0;
|
|
||||||
|
|
||||||
RAWKEYBOARD rawKB = raw->data.keyboard;
|
RAWKEYBOARD rawKB = raw->data.keyboard;
|
||||||
scancode = rawKB.MakeCode;
|
scancode = rawKB.MakeCode;
|
||||||
@@ -185,7 +182,18 @@ WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* If it's not a scan code that starts with 0xE1 */
|
/* If it's not a scan code that starts with 0xE1 */
|
||||||
if (!(rawKB.Flags & RI_KEY_E1)) {
|
if ((rawKB.Flags & RI_KEY_E1)) {
|
||||||
|
if (rawKB.MakeCode == 0x1D) {
|
||||||
|
scancode = scancode_map[0x100]; /* Translate E1 1D to 0x100 (which would
|
||||||
|
otherwise be E0 00 but that is invalid
|
||||||
|
anyway).
|
||||||
|
Also, take a potential mapping into
|
||||||
|
account. */
|
||||||
|
} else
|
||||||
|
scancode = 0xFFFF;
|
||||||
|
if (scancode != 0xFFFF)
|
||||||
|
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
||||||
|
} else {
|
||||||
if (rawKB.Flags & RI_KEY_E0)
|
if (rawKB.Flags & RI_KEY_E0)
|
||||||
scancode |= 0x100;
|
scancode |= 0x100;
|
||||||
|
|
||||||
@@ -198,70 +206,22 @@ WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
|||||||
scancode = scancode_map[scancode];
|
scancode = scancode_map[scancode];
|
||||||
|
|
||||||
/* If it's not 0xFFFF, send it to the emulated
|
/* If it's not 0xFFFF, send it to the emulated
|
||||||
keyboard.
|
keyboard.
|
||||||
We use scan code 0xFFFF to mean a mapping that
|
We use scan code 0xFFFF to mean a mapping that
|
||||||
has a prefix other than E0 and that is not E1 1D,
|
has a prefix other than E0 and that is not E1 1D,
|
||||||
which is, for our purposes, invalid. */
|
which is, for our purposes, invalid. */
|
||||||
if ((scancode == 0x00f) && !(rawKB.Flags & RI_KEY_BREAK) && (recv_lalt || recv_ralt) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received a TAB while ALT was pressed, while the mouse
|
|
||||||
is not captured, suppress the TAB and send an ALT key up. */
|
|
||||||
if (recv_lalt) {
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x038);
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
recv_lalt = 0;
|
|
||||||
}
|
|
||||||
if (recv_ralt) {
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x138);
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
recv_ralt = 0;
|
|
||||||
}
|
|
||||||
} else if (((scancode == 0x038) || (scancode == 0x138)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_tab && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an ALT while TAB was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
keyboard_input(0, 0x00f);
|
|
||||||
recv_tab = 0;
|
|
||||||
} else {
|
|
||||||
switch (scancode) {
|
|
||||||
case 0x00f:
|
|
||||||
recv_tab = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
case 0x038:
|
|
||||||
recv_lalt = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
case 0x138:
|
|
||||||
recv_ralt = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Translate right CTRL to left ALT if the user has so
|
/* Translate right CTRL to left ALT if the user has so
|
||||||
chosen. */
|
chosen. */
|
||||||
if ((scancode == 0x11d) && rctrl_is_lalt)
|
if ((scancode == 0x11d) && rctrl_is_lalt)
|
||||||
scancode = 0x038;
|
scancode = 0x038;
|
||||||
|
|
||||||
/* Normal scan code pass through, pass it through as is if
|
/* Normal scan code pass through, pass it through as is if
|
||||||
it's not an invalid scan code. */
|
it's not an invalid scan code. */
|
||||||
if (scancode != 0xFFFF)
|
|
||||||
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
|
||||||
|
|
||||||
window->checkFullscreenHotkey();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (rawKB.MakeCode == 0x1D) {
|
|
||||||
scancode = scancode_map[0x100]; /* Translate E1 1D to 0x100 (which would
|
|
||||||
otherwise be E0 00 but that is invalid
|
|
||||||
anyway).
|
|
||||||
Also, take a potential mapping into
|
|
||||||
account. */
|
|
||||||
} else
|
|
||||||
scancode = 0xFFFF;
|
|
||||||
if (scancode != 0xFFFF)
|
if (scancode != 0xFFFF)
|
||||||
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
||||||
|
|
||||||
|
window->checkFullscreenHotkey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user