Clean up window frame settings somewhat

Another rat's nest; I'm still not entirely satisfied.

This introduces "frame personalities": one for embedded frames (emscripten), one for handheld devices and everything else that doesn't really work with windows (android), and one for everything else. For now these affect which frame options are configurable by the user and what values they are forced to take if they are not configurable, and whether optimal scale is guessed based on screen size.

Also introduce a future TouchUI config node to allow switching between normal and touch-optimized UI on android. Again, because chromebooks and other android devices with mouse and keyboard support are a thing.

Also enable debugging of debug builds of android. It took me hours to attach a stupid debugger to the process; see:

 - https://www.sh-zam.com/2019/05/debugging-krita-on-android.html
 - https://source.android.com/docs/core/tests/debug/gdb#app-startup

I also had to adb forward the port that lldb was supposedly talking to lldb-server over because otherwise it wouldn't attach; I don't get it either.
This commit is contained in:
Tamás Bálint Misius 2023-10-04 15:51:39 +02:00
parent d04768fa0e
commit 8cfe7cdd93
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
16 changed files with 156 additions and 98 deletions

View File

@ -40,6 +40,7 @@
android:allowBackup="true" android:allowBackup="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
@ANDROID_PROPERTIES@
> >
<activity <activity
android:name=".PowderActivity" android:name=".PowderActivity"

View File

@ -20,10 +20,18 @@ constexpr bool SECURE_CIPHERS_ONLY = @SECURE_CIPHERS_ONLY@;
constexpr bool USE_SYSTEM_CERT_PROVIDER = @USE_SYSTEM_CERT_PROVIDER@; constexpr bool USE_SYSTEM_CERT_PROVIDER = @USE_SYSTEM_CERT_PROVIDER@;
constexpr bool FFTW_PLAN_MEASURE = @FFTW_PLAN_MEASURE@; constexpr bool FFTW_PLAN_MEASURE = @FFTW_PLAN_MEASURE@;
constexpr bool ALLOW_QUIT = @ALLOW_QUIT@; constexpr bool ALLOW_QUIT = @ALLOW_QUIT@;
constexpr bool ALLOW_WINDOW_FRAME_OPS = @ALLOW_WINDOW_FRAME_OPS@; constexpr bool DEFAULT_TOUCH_UI = @DEFAULT_TOUCH_UI@;
constexpr bool ALLOW_DATA_FOLDER = @ALLOW_DATA_FOLDER@; constexpr bool ALLOW_DATA_FOLDER = @ALLOW_DATA_FOLDER@;
constexpr char PATH_SEP_CHAR = '@PATH_SEP_CHAR@'; constexpr char PATH_SEP_CHAR = '@PATH_SEP_CHAR@';
enum ForceWindowFrameOps
{
forceWindowFrameOpsNone, // usual behaviour
forceWindowFrameOpsEmbedded, // e.g. into a webpage; this sweeps a few emscripten limitations under the rug
forceWindowFrameOpsHandheld, // e.g. the system doesn't support windowed mode; includes odd setups like chromebooks
};
constexpr ForceWindowFrameOps FORCE_WINDOW_FRAME_OPS = @FORCE_WINDOW_FRAME_OPS@;
constexpr char SERVER[] = "@SERVER@"; constexpr char SERVER[] = "@SERVER@";
constexpr char STATICSERVER[] = "@STATICSERVER@"; constexpr char STATICSERVER[] = "@STATICSERVER@";
constexpr char UPDATESERVER[] = "@UPDATESERVER@"; constexpr char UPDATESERVER[] = "@UPDATESERVER@";

View File

@ -287,10 +287,6 @@ int Main(int argc, char *argv[])
auto &prefs = GlobalPrefs::Ref(); auto &prefs = GlobalPrefs::Ref();
scale = prefs.Get("Scale", 1); scale = prefs.Get("Scale", 1);
auto graveExitsConsole = prefs.Get("GraveExitsConsole", true); auto graveExitsConsole = prefs.Get("GraveExitsConsole", true);
resizable = prefs.Get("Resizable", false);
fullscreen = prefs.Get("Fullscreen", false);
altFullscreen = prefs.Get("AltFullscreen", false);
forceIntegerScaling = prefs.Get("ForceIntegerScaling", true);
momentumScroll = prefs.Get("MomentumScroll", true); momentumScroll = prefs.Get("MomentumScroll", true);
showAvatars = prefs.Get("ShowAvatars", true); showAvatars = prefs.Get("ShowAvatars", true);
@ -311,8 +307,8 @@ int Main(int argc, char *argv[])
auto kioskArg = arguments["kiosk"]; auto kioskArg = arguments["kiosk"];
if (kioskArg.has_value()) if (kioskArg.has_value())
{ {
fullscreen = true_string(kioskArg.value()); currentFrameOps.fullscreen = true_string(kioskArg.value());
prefs.Set("Fullscreen", fullscreen); prefs.Set("Fullscreen", currentFrameOps.fullscreen);
} }
if (true_arg(arguments["redirect"])) if (true_arg(arguments["redirect"]))
@ -375,31 +371,35 @@ int Main(int argc, char *argv[])
SDLOpen(); SDLOpen();
if (Client::Ref().IsFirstRun())
{
scale = GuessBestScale();
if (scale > 1)
{
prefs.Set("Scale", scale);
SDL_SetWindowSize(sdl_window, WINDOWW * scale, WINDOWH * scale);
showLargeScreenDialog = true;
}
}
StopTextInput(); StopTextInput();
auto &engine = ui::Engine::Ref(); auto &engine = ui::Engine::Ref();
engine.g = new Graphics(); engine.g = new Graphics();
engine.Scale = scale; engine.Scale = scale;
engine.GraveExitsConsole = graveExitsConsole; engine.GraveExitsConsole = graveExitsConsole;
engine.SetResizable(resizable); engine.SetWindowFrameOps(currentFrameOps);
engine.Fullscreen = fullscreen;
engine.SetAltFullscreen(altFullscreen);
engine.SetForceIntegerScaling(forceIntegerScaling);
engine.MomentumScroll = momentumScroll; engine.MomentumScroll = momentumScroll;
engine.ShowAvatars = showAvatars; engine.ShowAvatars = showAvatars;
engine.Begin(); engine.Begin();
engine.SetFastQuit(prefs.Get("FastQuit", true)); engine.SetFastQuit(prefs.Get("FastQuit", true));
engine.TouchUI = prefs.Get("TouchUI", DEFAULT_TOUCH_UI);
if (Client::Ref().IsFirstRun() && FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsNone)
{
scale = GuessBestScale();
if (scale > 1)
{
prefs.Set("Scale", scale);
showLargeScreenDialog = true;
}
}
SDLSetScreen(scale, {
prefs.Get("Resizable", false),
prefs.Get("Fullscreen", false),
prefs.Get("AltFullscreen", false),
prefs.Get("ForceIntegerScaling", true),
}, vsyncHint);
bool enableBluescreen = USE_BLUESCREEN && !true_arg(arguments["disable-bluescreen"]); bool enableBluescreen = USE_BLUESCREEN && !true_arg(arguments["disable-bluescreen"]);
if (enableBluescreen) if (enableBluescreen)

View File

@ -51,10 +51,6 @@ int main(int argc, char * argv[])
scale = buf; scale = buf;
} }
} }
resizable = false;
fullscreen = false;
altFullscreen = false;
forceIntegerScaling = true;
// TODO: maybe bind the maximum allowed scale to screen size somehow // TODO: maybe bind the maximum allowed scale to screen size somehow
if(scale < 1 || scale > 10) if(scale < 1 || scale > 10)
@ -69,10 +65,7 @@ int main(int argc, char * argv[])
auto &engine = ui::Engine::Ref(); auto &engine = ui::Engine::Ref();
engine.g = new Graphics(); engine.g = new Graphics();
engine.Scale = scale; engine.Scale = scale;
engine.SetResizable(resizable); engine.SetWindowFrameOps({ false, false, false, false });
engine.Fullscreen = fullscreen;
engine.SetAltFullscreen(altFullscreen);
engine.SetForceIntegerScaling(forceIntegerScaling);
engine.Begin(); engine.Begin();
engine.SetFastQuit(true); engine.SetFastQuit(true);

View File

@ -13,11 +13,8 @@ SDL_Window *sdl_window = NULL;
SDL_Renderer *sdl_renderer = NULL; SDL_Renderer *sdl_renderer = NULL;
SDL_Texture *sdl_texture = NULL; SDL_Texture *sdl_texture = NULL;
int scale = 1; int scale = 1;
bool fullscreen = false;
bool altFullscreen = false;
bool forceIntegerScaling = true;
bool vsyncHint = false; bool vsyncHint = false;
bool resizable = false; WindowFrameOps currentFrameOps = { false, false, false, false };
bool momentumScroll = true; bool momentumScroll = true;
bool showAvatars = true; bool showAvatars = true;
uint64_t lastTick = 0; uint64_t lastTick = 0;
@ -91,7 +88,7 @@ void blit(pixel *vid)
{ {
SDL_UpdateTexture(sdl_texture, NULL, vid, WINDOWW * sizeof (Uint32)); SDL_UpdateTexture(sdl_texture, NULL, vid, WINDOWW * sizeof (Uint32));
// need to clear the renderer if there are black edges (fullscreen, or resizable window) // need to clear the renderer if there are black edges (fullscreen, or resizable window)
if (fullscreen || resizable) if (currentFrameOps.fullscreen || currentFrameOps.resizable)
SDL_RenderClear(sdl_renderer); SDL_RenderClear(sdl_renderer);
SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL); SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL);
SDL_RenderPresent(sdl_renderer); SDL_RenderPresent(sdl_renderer);
@ -144,22 +141,36 @@ void SDLClose()
SDL_Quit(); SDL_Quit();
} }
void SDLSetScreen(int scale_, bool resizable_, bool fullscreen_, bool altFullscreen_, bool forceIntegerScaling_, bool vsyncHint_) void SDLSetScreen(int scale_, WindowFrameOps newFrameOps, bool vsyncHint_)
{ {
if (FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsEmbedded)
{
newFrameOps.resizable = false;
newFrameOps.fullscreen = false;
newFrameOps.changeResolution = false;
newFrameOps.forceIntegerScaling = false;
}
if (FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsHandheld)
{
newFrameOps.resizable = false;
newFrameOps.fullscreen = true;
newFrameOps.changeResolution = false;
newFrameOps.forceIntegerScaling = false;
}
// bool changingScale = scale != scale_; // bool changingScale = scale != scale_;
bool changingFullscreen = fullscreen_ != fullscreen || (altFullscreen_ != altFullscreen && fullscreen); bool changingFullscreen = newFrameOps.fullscreen != currentFrameOps.fullscreen || (newFrameOps.changeResolution != currentFrameOps.changeResolution && currentFrameOps.fullscreen);
bool changingResizable = resizable != resizable_; bool changingResizable = currentFrameOps.resizable != newFrameOps.resizable;
bool changingVsync = vsyncHint != vsyncHint_; bool changingVsync = vsyncHint != vsyncHint_;
scale = scale_; scale = scale_;
fullscreen = fullscreen_; currentFrameOps.fullscreen = newFrameOps.fullscreen;
altFullscreen = altFullscreen_; currentFrameOps.changeResolution = newFrameOps.changeResolution;
resizable = resizable_; currentFrameOps.resizable = newFrameOps.resizable;
forceIntegerScaling = forceIntegerScaling_; currentFrameOps.forceIntegerScaling = newFrameOps.forceIntegerScaling;
vsyncHint = vsyncHint_; vsyncHint = vsyncHint_;
// Recreate the window when toggling fullscreen, due to occasional issues // Recreate the window when toggling fullscreen, due to occasional issues
// Also recreate it when enabling resizable windows, to fix bugs on windows, // Also recreate it when enabling resizable windows, to fix bugs on windows,
// see https://github.com/jacob1/The-Powder-Toy/issues/24 // see https://github.com/jacob1/The-Powder-Toy/issues/24
if (changingFullscreen || altFullscreen || (changingResizable && resizable && !fullscreen) || changingVsync) if (changingFullscreen || currentFrameOps.changeResolution || (changingResizable && currentFrameOps.resizable && !currentFrameOps.fullscreen) || changingVsync)
{ {
RecreateWindow(); RecreateWindow();
return; return;
@ -168,23 +179,23 @@ void SDLSetScreen(int scale_, bool resizable_, bool fullscreen_, bool altFullscr
SDL_RestoreWindow(sdl_window); SDL_RestoreWindow(sdl_window);
SDL_SetWindowSize(sdl_window, WINDOWW * scale, WINDOWH * scale); SDL_SetWindowSize(sdl_window, WINDOWW * scale, WINDOWH * scale);
SDL_RenderSetIntegerScale(sdl_renderer, forceIntegerScaling && fullscreen ? SDL_TRUE : SDL_FALSE); SDL_RenderSetIntegerScale(sdl_renderer, currentFrameOps.forceIntegerScaling && currentFrameOps.fullscreen ? SDL_TRUE : SDL_FALSE);
unsigned int flags = 0; unsigned int flags = 0;
if (fullscreen) if (currentFrameOps.fullscreen)
flags = altFullscreen ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP; flags = currentFrameOps.changeResolution ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP;
SDL_SetWindowFullscreen(sdl_window, flags); SDL_SetWindowFullscreen(sdl_window, flags);
if (fullscreen) if (currentFrameOps.fullscreen)
SDL_RaiseWindow(sdl_window); SDL_RaiseWindow(sdl_window);
SDL_SetWindowResizable(sdl_window, resizable ? SDL_TRUE : SDL_FALSE); SDL_SetWindowResizable(sdl_window, currentFrameOps.resizable ? SDL_TRUE : SDL_FALSE);
} }
bool RecreateWindow() bool RecreateWindow()
{ {
unsigned int flags = 0; unsigned int flags = 0;
unsigned int rendererFlags = 0; unsigned int rendererFlags = 0;
if (fullscreen) if (currentFrameOps.fullscreen)
flags = altFullscreen ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP; flags = currentFrameOps.changeResolution ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP;
if (resizable && !fullscreen) if (currentFrameOps.resizable && !currentFrameOps.fullscreen)
flags |= SDL_WINDOW_RESIZABLE; flags |= SDL_WINDOW_RESIZABLE;
if (vsyncHint) if (vsyncHint)
rendererFlags |= SDL_RENDERER_PRESENTVSYNC; rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
@ -219,7 +230,7 @@ bool RecreateWindow()
return false; return false;
} }
SDL_RenderSetLogicalSize(sdl_renderer, WINDOWW, WINDOWH); SDL_RenderSetLogicalSize(sdl_renderer, WINDOWW, WINDOWH);
if (forceIntegerScaling && fullscreen) if (currentFrameOps.forceIntegerScaling && currentFrameOps.fullscreen)
SDL_RenderSetIntegerScale(sdl_renderer, SDL_TRUE); SDL_RenderSetIntegerScale(sdl_renderer, SDL_TRUE);
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, WINDOWW, WINDOWH); sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, WINDOWW, WINDOWH);
SDL_RaiseWindow(sdl_window); SDL_RaiseWindow(sdl_window);
@ -390,14 +401,9 @@ void EngineProcess()
drawingTimer = 0; drawingTimer = 0;
auto wantVsync = bool(std::get_if<FpsLimitVsync>(&fpsLimit)); auto wantVsync = bool(std::get_if<FpsLimitVsync>(&fpsLimit));
if (scale != engine.Scale || if (scale != engine.Scale || currentFrameOps != engine.GetWindowFrameOps() || vsyncHint != wantVsync)
fullscreen != engine.Fullscreen ||
altFullscreen != engine.GetAltFullscreen() ||
forceIntegerScaling != engine.GetForceIntegerScaling() ||
resizable != engine.GetResizable() ||
vsyncHint != wantVsync)
{ {
SDLSetScreen(engine.Scale, engine.GetResizable(), engine.Fullscreen, engine.GetAltFullscreen(), engine.GetForceIntegerScaling(), wantVsync); SDLSetScreen(engine.Scale, engine.GetWindowFrameOps(), wantVsync);
} }
blit(engine.g->Data()); blit(engine.g->Data());

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "common/String.h" #include "common/String.h"
#include "graphics/Pixel.h" #include "graphics/Pixel.h"
#include "gui/WindowFrameOps.h"
#include "FpsLimit.h" #include "FpsLimit.h"
#include <cstdint> #include <cstdint>
#include <SDL.h> #include <SDL.h>
@ -12,10 +13,8 @@ extern SDL_Window *sdl_window;
extern SDL_Renderer *sdl_renderer; extern SDL_Renderer *sdl_renderer;
extern SDL_Texture *sdl_texture; extern SDL_Texture *sdl_texture;
extern int scale; extern int scale;
extern bool fullscreen; extern bool vsyncHint;
extern bool altFullscreen; extern WindowFrameOps currentFrameOps;
extern bool forceIntegerScaling;
extern bool resizable;
extern bool momentumScroll; extern bool momentumScroll;
extern bool showAvatars; extern bool showAvatars;
extern uint64_t lastTick; extern uint64_t lastTick;
@ -41,7 +40,7 @@ void CalculateMousePosition(int *x, int *y);
void blit(pixel *vid); void blit(pixel *vid);
void SDLOpen(); void SDLOpen();
void SDLClose(); void SDLClose();
void SDLSetScreen(int scale_, bool resizable_, bool fullscreen_, bool altFullscreen_, bool forceIntegerScaling_); void SDLSetScreen(int scale_, WindowFrameOps newFrameOps, bool vsyncHint_);
void SetFpsLimit(FpsLimit newFpsLimit); void SetFpsLimit(FpsLimit newFpsLimit);
bool RecreateWindow(); bool RecreateWindow();
void LoadWindowPosition(); void LoadWindowPosition();

26
src/gui/WindowFrameOps.h Normal file
View File

@ -0,0 +1,26 @@
#pragma once
struct WindowFrameOps
{
bool resizable;
bool fullscreen;
bool changeResolution;
bool forceIntegerScaling;
bool operator ==(const WindowFrameOps &other) const
{
if (resizable != other.resizable ) return false;
if (fullscreen != other.fullscreen) return false;
if (fullscreen)
{
if (changeResolution != other.changeResolution ) return false;
if (forceIntegerScaling != other.forceIntegerScaling) return false;
}
return true;
}
bool operator !=(const WindowFrameOps &other) const
{
return !(*this == other);
}
};

View File

@ -15,8 +15,6 @@ Engine::Engine():
Scale(1), Scale(1),
Fullscreen(false), Fullscreen(false),
FrameIndex(0), FrameIndex(0),
altFullscreen(false),
resizable(false),
state_(NULL), state_(NULL),
windowTargetPosition(0, 0), windowTargetPosition(0, 0),
FastQuit(1), FastQuit(1),

View File

@ -5,6 +5,7 @@
#include "common/ExplicitSingleton.h" #include "common/ExplicitSingleton.h"
#include "graphics/Pixel.h" #include "graphics/Pixel.h"
#include "gui/interface/Point.h" #include "gui/interface/Point.h"
#include "gui/WindowFrameOps.h"
#include <climits> #include <climits>
#include "FpsLimit.h" #include "FpsLimit.h"
@ -47,16 +48,8 @@ namespace ui
void SetDrawingFrequencyLimit(int limit) {drawingFrequencyLimit = limit;} void SetDrawingFrequencyLimit(int limit) {drawingFrequencyLimit = limit;}
inline int GetDrawingFrequencyLimit() {return drawingFrequencyLimit;} inline int GetDrawingFrequencyLimit() {return drawingFrequencyLimit;}
void SetFullscreen(bool fullscreen) { Fullscreen = fullscreen; }
inline bool GetFullscreen() { return Fullscreen; }
void SetAltFullscreen(bool altFullscreen) { this->altFullscreen = altFullscreen; }
inline bool GetAltFullscreen() { return altFullscreen; }
void SetForceIntegerScaling(bool forceIntegerScaling) { this->forceIntegerScaling = forceIntegerScaling; }
inline bool GetForceIntegerScaling() { return forceIntegerScaling; }
void SetScale(int scale) { Scale = scale; } void SetScale(int scale) { Scale = scale; }
inline int GetScale() { return Scale; } inline int GetScale() { return Scale; }
void SetResizable(bool resizable) { this->resizable = resizable; }
inline bool GetResizable() { return resizable; }
void SetFastQuit(bool fastquit) { FastQuit = fastquit; } void SetFastQuit(bool fastquit) { FastQuit = fastquit; }
inline bool GetFastQuit() {return FastQuit; } inline bool GetFastQuit() {return FastQuit; }
@ -93,9 +86,6 @@ namespace ui
unsigned int FrameIndex; unsigned int FrameIndex;
private: private:
FpsLimit fpsLimit; FpsLimit fpsLimit;
bool altFullscreen;
bool forceIntegerScaling = true;
bool resizable;
bool textInput = false; bool textInput = false;
int lastTextEditingStart = INT_MAX; int lastTextEditingStart = INT_MAX;
@ -131,9 +121,31 @@ namespace ui
String textEditingBuf; String textEditingBuf;
WindowFrameOps windowFrameOps = { false, false, false, false };
public: public:
bool MomentumScroll = true; bool MomentumScroll = true;
bool ShowAvatars = true; bool ShowAvatars = true;
bool TouchUI = false;
inline WindowFrameOps GetWindowFrameOps() const
{
return windowFrameOps;
}
inline void SetWindowFrameOps(WindowFrameOps newWindowFrameOps)
{
windowFrameOps = newWindowFrameOps;
}
void SetFullscreen (bool newFullscreen ) { windowFrameOps.fullscreen = newFullscreen; }
void SetChangeResolution (bool setChangeResolution ) { windowFrameOps.changeResolution = setChangeResolution; }
void SetForceIntegerScaling(bool newForceIntegerScaling) { windowFrameOps.forceIntegerScaling = newForceIntegerScaling; }
void SetResizable (bool newResizable ) { windowFrameOps.resizable = newResizable; }
inline bool GetFullscreen () const { return windowFrameOps.fullscreen; }
inline bool GetChangeResolution () const { return windowFrameOps.changeResolution; }
inline bool GetForceIntegerScaling() const { return windowFrameOps.forceIntegerScaling; }
inline bool GetResizable () const { return windowFrameOps.resizable; }
}; };
} }

View File

@ -77,9 +77,9 @@ void OptionsController::SetFullscreen(bool fullscreen)
model->SetFullscreen(fullscreen); model->SetFullscreen(fullscreen);
} }
void OptionsController::SetAltFullscreen(bool altFullscreen) void OptionsController::SetChangeResolution(bool newChangeResolution)
{ {
model->SetAltFullscreen(altFullscreen); model->SetChangeResolution(newChangeResolution);
} }
void OptionsController::SetForceIntegerScaling(bool forceIntegerScaling) void OptionsController::SetForceIntegerScaling(bool forceIntegerScaling)

View File

@ -25,7 +25,7 @@ public:
void SetEdgeMode(int edgeMode); void SetEdgeMode(int edgeMode);
void SetTemperatureScale(int temperatureScale); void SetTemperatureScale(int temperatureScale);
void SetFullscreen(bool fullscreen); void SetFullscreen(bool fullscreen);
void SetAltFullscreen(bool altFullscreen); void SetChangeResolution(bool newChangeResolution);
void SetForceIntegerScaling(bool forceIntegerScaling); void SetForceIntegerScaling(bool forceIntegerScaling);
void SetScale(int scale); void SetScale(int scale);
void SetGraveExitsConsole(bool graveExitsConsole); void SetGraveExitsConsole(bool graveExitsConsole);

View File

@ -191,15 +191,15 @@ void OptionsModel::SetFullscreen(bool fullscreen)
notifySettingsChanged(); notifySettingsChanged();
} }
bool OptionsModel::GetAltFullscreen() bool OptionsModel::GetChangeResolution()
{ {
return ui::Engine::Ref().GetAltFullscreen(); return ui::Engine::Ref().GetChangeResolution();
} }
void OptionsModel::SetAltFullscreen(bool altFullscreen) void OptionsModel::SetChangeResolution(bool newChangeResolution)
{ {
ui::Engine::Ref().SetAltFullscreen(altFullscreen); ui::Engine::Ref().SetChangeResolution(newChangeResolution);
GlobalPrefs::Ref().Set("AltFullscreen", altFullscreen); GlobalPrefs::Ref().Set("AltFullscreen", newChangeResolution);
notifySettingsChanged(); notifySettingsChanged();
} }

View File

@ -45,8 +45,8 @@ public:
void SetResizable(bool resizable); void SetResizable(bool resizable);
bool GetFullscreen(); bool GetFullscreen();
void SetFullscreen(bool fullscreen); void SetFullscreen(bool fullscreen);
bool GetAltFullscreen(); bool GetChangeResolution();
void SetAltFullscreen(bool oldFullscreen); void SetChangeResolution(bool newChangeResolution);
bool GetForceIntegerScaling(); bool GetForceIntegerScaling();
void SetForceIntegerScaling(bool forceIntegerScaling); void SetForceIntegerScaling(bool forceIntegerScaling);
bool GetFastQuit(); bool GetFastQuit();

View File

@ -228,8 +228,9 @@ OptionsView::OptionsView() : ui::Window(ui::Point(-1, -1), ui::Point(320, 340))
}, [this] { }, [this] {
c->SetTemperatureScale(temperatureScale->GetOption().second); c->SetTemperatureScale(temperatureScale->GetOption().second);
}); });
addSeparator(); if (FORCE_WINDOW_FRAME_OPS != forceWindowFrameOpsHandheld)
{ {
addSeparator();
std::vector<std::pair<String, int>> options; std::vector<std::pair<String, int>> options;
int currentScale = ui::Engine::Ref().GetScale(); int currentScale = ui::Engine::Ref().GetScale();
int scaleIndex = 1; int scaleIndex = 1;
@ -252,7 +253,7 @@ OptionsView::OptionsView() : ui::Window(ui::Point(-1, -1), ui::Point(320, 340))
c->SetScale(scale->GetOption().second); c->SetScale(scale->GetOption().second);
}); });
} }
if (ALLOW_WINDOW_FRAME_OPS) if (FORCE_WINDOW_FRAME_OPS == forceWindowFrameOpsNone)
{ {
resizable = addCheckbox(0, "Resizable \bg- allow resizing and maximizing window", "", [this] { resizable = addCheckbox(0, "Resizable \bg- allow resizing and maximizing window", "", [this] {
c->SetResizable(resizable->GetChecked()); c->SetResizable(resizable->GetChecked());
@ -260,8 +261,8 @@ OptionsView::OptionsView() : ui::Window(ui::Point(-1, -1), ui::Point(320, 340))
fullscreen = addCheckbox(0, "Fullscreen \bg- fill the entire screen", "", [this] { fullscreen = addCheckbox(0, "Fullscreen \bg- fill the entire screen", "", [this] {
c->SetFullscreen(fullscreen->GetChecked()); c->SetFullscreen(fullscreen->GetChecked());
}); });
altFullscreen = addCheckbox(1, "Set optimal screen resolution", "", [this] { changeResolution = addCheckbox(1, "Set optimal screen resolution", "", [this] {
c->SetAltFullscreen(altFullscreen->GetChecked()); c->SetChangeResolution(changeResolution->GetChecked());
}); });
forceIntegerScaling = addCheckbox(1, "Force integer scaling \bg- less blurry", "", [this] { forceIntegerScaling = addCheckbox(1, "Force integer scaling \bg- less blurry", "", [this] {
c->SetForceIntegerScaling(forceIntegerScaling->GetChecked()); c->SetForceIntegerScaling(forceIntegerScaling->GetChecked());
@ -427,7 +428,10 @@ void OptionsView::NotifySettingsChanged(OptionsModel * sender)
customGravityY = sender->GetCustomGravityY(); customGravityY = sender->GetCustomGravityY();
decoSpace->SetOption(sender->GetDecoSpace()); decoSpace->SetOption(sender->GetDecoSpace());
edgeMode->SetOption(sender->GetEdgeMode()); edgeMode->SetOption(sender->GetEdgeMode());
scale->SetOption(sender->GetScale()); if (scale)
{
scale->SetOption(sender->GetScale());
}
if (resizable) if (resizable)
{ {
resizable->SetChecked(sender->GetResizable()); resizable->SetChecked(sender->GetResizable());
@ -436,9 +440,9 @@ void OptionsView::NotifySettingsChanged(OptionsModel * sender)
{ {
fullscreen->SetChecked(sender->GetFullscreen()); fullscreen->SetChecked(sender->GetFullscreen());
} }
if (altFullscreen) if (changeResolution)
{ {
altFullscreen->SetChecked(sender->GetAltFullscreen()); changeResolution->SetChecked(sender->GetChangeResolution());
} }
if (forceIntegerScaling) if (forceIntegerScaling)
{ {

View File

@ -29,7 +29,7 @@ class OptionsView: public ui::Window
ui::DropDown * scale; ui::DropDown * scale;
ui::Checkbox * resizable; ui::Checkbox * resizable;
ui::Checkbox * fullscreen; ui::Checkbox * fullscreen;
ui::Checkbox * altFullscreen; ui::Checkbox * changeResolution;
ui::Checkbox * forceIntegerScaling; ui::Checkbox * forceIntegerScaling;
ui::Checkbox * fastquit = nullptr; ui::Checkbox * fastquit = nullptr;
ui::DropDown * decoSpace; ui::DropDown * decoSpace;

View File

@ -22,19 +22,25 @@ conf_data.set('USE_UPDATESERVER', (update_server != '').to_string())
enforce_https = get_option('enforce_https') enforce_https = get_option('enforce_https')
allow_quit = true allow_quit = true
allow_window_frame_ops = true force_window_frame_ops = 'forceWindowFrameOpsNone'
allow_data_folder = true allow_data_folder = true
if host_platform == 'emscripten' if host_platform == 'emscripten'
allow_quit = false allow_quit = false
allow_window_frame_ops = false force_window_frame_ops = 'forceWindowFrameOpsEmbedded'
allow_data_folder = false allow_data_folder = false
endif endif
default_touch_ui = false
if host_platform == 'android'
default_touch_ui = true # TODO: some more sophisticated heuristic at runtime instead
force_window_frame_ops = 'forceWindowFrameOpsHandheld'
endif
secure_ciphers_only = get_option('secure_ciphers_only') secure_ciphers_only = get_option('secure_ciphers_only')
if not is_debug and not enforce_https if not is_debug and not enforce_https
error('refusing to build a release binary without enforcing HTTPS, configure with -Denforce_https=true to fix this error') error('refusing to build a release binary without enforcing HTTPS, configure with -Denforce_https=true to fix this error')
endif endif
conf_data.set('ALLOW_QUIT', allow_quit.to_string()) conf_data.set('ALLOW_QUIT', allow_quit.to_string())
conf_data.set('ALLOW_WINDOW_FRAME_OPS', allow_window_frame_ops.to_string()) conf_data.set('FORCE_WINDOW_FRAME_OPS', force_window_frame_ops)
conf_data.set('DEFAULT_TOUCH_UI', default_touch_ui.to_string())
conf_data.set('ALLOW_DATA_FOLDER', allow_data_folder.to_string()) conf_data.set('ALLOW_DATA_FOLDER', allow_data_folder.to_string())
conf_data.set('ENFORCE_HTTPS', enforce_https.to_string()) conf_data.set('ENFORCE_HTTPS', enforce_https.to_string())
conf_data.set('SECURE_CIPHERS_ONLY', secure_ciphers_only.to_string()) conf_data.set('SECURE_CIPHERS_ONLY', secure_ciphers_only.to_string())
@ -58,7 +64,12 @@ if host_platform == 'android'
'<uses-permission android:name="android.permission.INTERNET" />', '<uses-permission android:name="android.permission.INTERNET" />',
] ]
endif endif
android_properties = []
if is_debug
android_properties += [ 'android:debuggable="true"' ]
endif
conf_data.set('ANDROID_PERMISSIONS', '\n'.join(android_permissions)) conf_data.set('ANDROID_PERMISSIONS', '\n'.join(android_permissions))
conf_data.set('ANDROID_PROPERTIES', '\n'.join(android_properties))
endif endif
powder_files = files( powder_files = files(