Update to v103r11 release.

byuu says:

Changelog:

  - tomoko: removed "Settings→Video Emulation→Overscan Mask" setting¹
  - tomoko: remove a few unnecessary calls to resizeViewport on startup
  - tomoko: only resize main window from video settings when in adaptive
    or toggling adaptive mode²
  - hiro/windows: add `SWP_NOACTIVATE` flag to prevent focus stealing on
    resizing invisible windows³
  - hiro/windows: suppress spurious API-generated `onSize()` callback
    when calling `setVisible()`

¹: it just seemed like bad design to default to overscan masking
being disabled with overscan masks of 8 horizontal, 8 vertical out of
the box. Users would adjust the sliders and not see anything happening.
Instead, I've set the default masks to zero. If you want to turn off
overscan masking, simply slide those to zero again.

²: I figure the only way we're going to be able to fairly evaluate
Screwtape's suggestion is to try it both ways. And I will admit, I kind
of like the way this works as well ... a lot more so than I thought I
would, so I think it was a great suggestion. Still, now's the time if
people have strong opinions on this. Be sure to try both r10 and r11 to
compare. Barring no other feedback, I'm going to keep it this way.

³: this fixes the blinking of the main window on startup.

Screwtape, thanks again for the improvement suggestions. At this point
though, I am not using a tiling window manager. If you are able to patch
hiro/gtk and/or hiro/qt (I mostly use GTK) to work with tiling window
managers better, I wouldn't mind applying said patches, so long as they
don't break things on my own Xfce desktop with xfwm4.

Also, I noticed one issue with Xfce ... if the window is maximized and I
try to call `Window::setSize()`, it's not actually removing the maximize
flag. We'll need to look into how to add that to GTK, but I don't think
it's a huge issue. A similar glitch happens on windows where the icon
still reflects being maximized, but it does actually shrink, it just
sticks to the top left corner of the screen. So this isn't really a
critical bug, but would be extra polish.
This commit is contained in:
Tim Allen 2017-07-08 11:02:01 +10:00
parent cbbf5ec114
commit ee982f098a
9 changed files with 34 additions and 45 deletions

View File

@ -12,7 +12,7 @@ using namespace nall;
namespace Emulator {
static const string Name = "higan";
static const string Version = "103.10";
static const string Version = "103.11";
static const string Author = "byuu";
static const string License = "GPLv3";
static const string Website = "http://byuu.org/";

View File

@ -25,9 +25,8 @@ Settings::Settings() {
set("Video/Gamma", 100);
set("Video/Luminance", 100);
set("Video/Overscan/Mask", false);
set("Video/Overscan/Horizontal", 8);
set("Video/Overscan/Vertical", 8);
set("Video/Overscan/Horizontal", 0);
set("Video/Overscan/Vertical", 0);
set("Video/Windowed/AspectCorrection", true);
set("Video/Windowed/IntegralScaling", true);

View File

@ -72,10 +72,6 @@ Presentation::Presentation() {
settings["Video/ScanlineEmulation"].setValue(scanlineEmulation.checked());
if(emulator) emulator->set("Scanline Emulation", scanlineEmulation.checked());
});
maskOverscan.setText("Mask Overscan").setChecked(settings["Video/Overscan/Mask"].boolean()).onToggle([&] {
settings["Video/Overscan/Mask"].setValue(maskOverscan.checked());
resizeViewport();
});
videoShaderMenu.setText("Video Shader");
videoShaderNone.setText("None").onActivate([&] {
settings["Video/Shader"].setValue("None");
@ -153,7 +149,7 @@ Presentation::Presentation() {
});
onSize([&] {
resizeViewport(true);
resizeViewport(false);
});
onClose([&] {
@ -237,10 +233,7 @@ auto Presentation::clearViewport() -> void {
}
}
//onSize is true only for events generated from window resizing
//it will suppress automatic viewport scaling, and disable adaptive scaling
//it does this so that the main window can always be resizable
auto Presentation::resizeViewport(bool onSize) -> void {
auto Presentation::resizeViewport(bool resizeWindow) -> void {
//clear video area before resizing to avoid seeing distorted video momentarily
clearViewport();
@ -255,7 +248,7 @@ auto Presentation::resizeViewport(bool onSize) -> void {
emulatorWidth = resolution.width;
emulatorHeight = resolution.height;
aspectCorrection = resolution.aspectCorrection;
if(emulator->information.overscan && settings["Video/Overscan/Mask"].boolean()) {
if(emulator->information.overscan) {
uint overscanHorizontal = settings["Video/Overscan/Horizontal"].natural();
uint overscanVertical = settings["Video/Overscan/Vertical"].natural();
emulatorWidth -= overscanHorizontal * 2;
@ -266,7 +259,7 @@ auto Presentation::resizeViewport(bool onSize) -> void {
if(!fullScreen()) {
if(settings["Video/Windowed/AspectCorrection"].boolean()) emulatorWidth *= aspectCorrection;
if(!onSize) {
if(resizeWindow) {
string viewportScale = "640x480";
if(settings["Video/Windowed/Scale"].text() == "Small") viewportScale = settings["Video/Windowed/Scale/Small"].text();
if(settings["Video/Windowed/Scale"].text() == "Medium") viewportScale = settings["Video/Windowed/Scale/Medium"].text();
@ -276,7 +269,7 @@ auto Presentation::resizeViewport(bool onSize) -> void {
viewportHeight = resolution(1).natural();
}
if(settings["Video/Windowed/AdaptiveSizing"].boolean() && !onSize) {
if(settings["Video/Windowed/AdaptiveSizing"].boolean() && resizeWindow) {
uint multiplier = min(viewportWidth / emulatorWidth, viewportHeight / emulatorHeight);
emulatorWidth *= multiplier;
emulatorHeight *= multiplier;
@ -285,12 +278,12 @@ auto Presentation::resizeViewport(bool onSize) -> void {
uint multiplier = min(viewportWidth / emulatorWidth, viewportHeight / emulatorHeight);
emulatorWidth *= multiplier;
emulatorHeight *= multiplier;
if(!onSize) setSize({viewportWidth, viewportHeight});
if(resizeWindow) setSize({viewportWidth, viewportHeight});
} else {
double multiplier = min(viewportWidth / emulatorWidth, viewportHeight / emulatorHeight);
emulatorWidth *= multiplier;
emulatorHeight *= multiplier;
if(!onSize) setSize({viewportWidth, viewportHeight});
if(resizeWindow) setSize({viewportWidth, viewportHeight});
}
} else {
if(settings["Video/Fullscreen/AspectCorrection"].boolean()) emulatorWidth *= aspectCorrection;

View File

@ -12,7 +12,7 @@ struct Presentation : Window {
Presentation();
auto updateEmulator() -> void;
auto clearViewport() -> void;
auto resizeViewport(bool onSize = false) -> void;
auto resizeViewport(bool resizeWindow = true) -> void;
auto toggleFullScreen() -> void;
auto loadShaders() -> void;
@ -30,12 +30,10 @@ struct Presentation : Window {
MenuItem videoScaleSmall{&videoScaleMenu};
MenuItem videoScaleMedium{&videoScaleMenu};
MenuItem videoScaleLarge{&videoScaleMenu};
//Group videoScales{&videoScaleSmall, &videoScaleMedium, &videoScaleLarge};
Menu videoEmulationMenu{&settingsMenu};
MenuCheckItem blurEmulation{&videoEmulationMenu};
MenuCheckItem colorEmulation{&videoEmulationMenu};
MenuCheckItem scanlineEmulation{&videoEmulationMenu};
MenuCheckItem maskOverscan{&videoEmulationMenu};
Menu videoShaderMenu{&settingsMenu};
MenuRadioItem videoShaderNone{&videoShaderMenu};
MenuRadioItem videoShaderBlur{&videoShaderMenu};

View File

@ -55,7 +55,7 @@ auto Program::videoRefresh(const uint32* data, uint pitch, uint width, uint heig
pitch >>= 2;
if(emulator->information.overscan && settings["Video/Overscan/Mask"].boolean()) {
if(emulator->information.overscan) {
uint overscanHorizontal = settings["Video/Overscan/Horizontal"].natural();
uint overscanVertical = settings["Video/Overscan/Vertical"].natural();
auto resolution = emulator->videoResolution();

View File

@ -59,8 +59,6 @@ Program::Program(string_vector args) {
new ToolsManager;
new AboutWindow;
presentation->setFocused();
updateVideoShader();
updateAudioDriver();
updateAudioEffects();

View File

@ -34,9 +34,8 @@ struct VideoSettings : TabFrameItem {
CheckLabel fullscreenModeAspectCorrection{&fullscreenModeLayout, Size{0, 0}};
CheckLabel fullscreenModeIntegralScaling{&fullscreenModeLayout, Size{0, 0}};
auto updateColor() -> void;
auto updateOverscan() -> void;
auto updateViewport() -> void;
auto updateColor(bool initializing = false) -> void;
auto updateViewport(bool initializing = false) -> void;
};
struct AudioSettings : TabFrameItem {

View File

@ -18,10 +18,10 @@ VideoSettings::VideoSettings(TabFrame* parent) : TabFrameItem(parent) {
overscanMaskLabel.setFont(Font().setBold()).setText("Overscan Mask");
horizontalMaskLabel.setText("Horizontal:");
horizontalMaskValue.setAlignment(0.5);
horizontalMaskSlider.setLength(25).setPosition(settings["Video/Overscan/Horizontal"].natural()).onChange([&] { updateOverscan(); });
horizontalMaskSlider.setLength(25).setPosition(settings["Video/Overscan/Horizontal"].natural()).onChange([&] { updateViewport(); });
verticalMaskLabel.setText("Vertical:");
verticalMaskValue.setAlignment(0.5);
verticalMaskSlider.setLength(25).setPosition(settings["Video/Overscan/Vertical"].natural()).onChange([&] { updateOverscan(); });
verticalMaskSlider.setLength(25).setPosition(settings["Video/Overscan/Vertical"].natural()).onChange([&] { updateViewport(); });
windowedModeLabel.setFont(Font().setBold()).setText("Windowed Mode");
windowedModeAspectCorrection.setText("Aspect correction").setChecked(settings["Video/Windowed/AspectCorrection"].boolean()).onToggle([&] { updateViewport(); });
@ -32,34 +32,34 @@ VideoSettings::VideoSettings(TabFrame* parent) : TabFrameItem(parent) {
fullscreenModeAspectCorrection.setText("Aspect correction").setChecked(settings["Video/Fullscreen/AspectCorrection"].boolean()).onToggle([&] { updateViewport(); });
fullscreenModeIntegralScaling.setText("Integral scaling").setChecked(settings["Video/Fullscreen/IntegralScaling"].boolean()).onToggle([&] { updateViewport(); });
updateColor();
updateOverscan();
updateViewport();
updateColor(true);
updateViewport(true);
}
auto VideoSettings::updateColor() -> void {
auto VideoSettings::updateColor(bool initializing) -> void {
settings["Video/Saturation"].setValue(saturationSlider.position());
settings["Video/Gamma"].setValue(100 + gammaSlider.position());
settings["Video/Luminance"].setValue(luminanceSlider.position());
saturationValue.setText({saturationSlider.position(), "%"});
gammaValue.setText({100 + gammaSlider.position(), "%"});
luminanceValue.setText({luminanceSlider.position(), "%"});
program->updateVideoPalette();
if(!initializing) program->updateVideoPalette();
}
auto VideoSettings::updateOverscan() -> void {
auto VideoSettings::updateViewport(bool initializing) -> void {
bool wasAdaptive = settings["Video/Windowed/AdaptiveSizing"].boolean();
bool isAdaptive = windowedModeAdaptiveSizing.checked();
settings["Video/Overscan/Horizontal"].setValue(horizontalMaskSlider.position());
settings["Video/Overscan/Vertical"].setValue(verticalMaskSlider.position());
horizontalMaskValue.setText({horizontalMaskSlider.position()});
verticalMaskValue.setText({verticalMaskSlider.position()});
presentation->resizeViewport();
}
auto VideoSettings::updateViewport() -> void {
settings["Video/Windowed/AspectCorrection"].setValue(windowedModeAspectCorrection.checked());
settings["Video/Windowed/IntegralScaling"].setValue(windowedModeIntegralScaling.checked());
settings["Video/Windowed/AdaptiveSizing"].setValue(windowedModeAdaptiveSizing.checked());
settings["Video/Fullscreen/AspectCorrection"].setValue(fullscreenModeAspectCorrection.checked());
settings["Video/Fullscreen/IntegralScaling"].setValue(fullscreenModeIntegralScaling.checked());
presentation->resizeViewport();
horizontalMaskValue.setText({horizontalMaskSlider.position()});
verticalMaskValue.setText({verticalMaskSlider.position()});
if(!initializing) presentation->resizeViewport(isAdaptive || wasAdaptive != isAdaptive);
}

View File

@ -120,11 +120,11 @@ auto pWindow::setGeometry(Geometry geometry) -> void {
hwnd, nullptr,
geometry.x() - margin.x(), geometry.y() - margin.y(),
geometry.width() + margin.width(), geometry.height() + margin.height(),
SWP_NOZORDER | SWP_FRAMECHANGED
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED
);
if(auto statusBar = state().statusBar) {
if(auto self = statusBar->self()) {
SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_FRAMECHANGED);
SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
}
if(auto layout = state().layout) {
@ -159,12 +159,14 @@ auto pWindow::setTitle(string text) -> void {
}
auto pWindow::setVisible(bool visible) -> void {
lock();
ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE);
if(!visible) setModal(false);
if(auto layout = state().layout) {
if(auto self = layout->self()) self->setVisible(layout->visible(true));
}
unlock();
}
//
@ -209,7 +211,7 @@ auto pWindow::onSize() -> void {
if(locked()) return;
if(auto statusBar = state().statusBar) {
if(auto self = statusBar->self()) {
SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_FRAMECHANGED);
SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
}
state().geometry.setSize(_geometry().size());