Skip to content

Commit

Permalink
Set SDL3 window creation properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugh Sanderson committed Oct 2, 2024
1 parent 3742558 commit c6fdc07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 5 additions & 4 deletions project/src/common/ExternalInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5894,6 +5894,7 @@ EMSCRIPTEN_KEEPALIVE int nme_file_upload_info( const char *event, double progres
}
#endif

inline const char *safeStr( const char *inPtr ) { return inPtr ? inPtr : ""; }
bool nme_file_dialog_open(HxString inTitle, HxString inText, HxString inDefaultPath, HxString inTypes, value inCallback, int inFlags )
{
if (gCurrentFileDialog)
Expand All @@ -5902,10 +5903,10 @@ bool nme_file_dialog_open(HxString inTitle, HxString inText, HxString inDefaultP
// TODO - mac
#if (defined(HX_WINDOWS) && !defined(HX_WINRT)) || defined(HX_MACOS)
gCurrentFileDialog = new FileDialogSpec();
gCurrentFileDialog->title = inTitle.c_str();
gCurrentFileDialog->text = inText.c_str();
gCurrentFileDialog->defaultPath = inDefaultPath.c_str();
gCurrentFileDialog->fileTypes = inTypes.c_str();
gCurrentFileDialog->title = safeStr(inTitle.c_str());
gCurrentFileDialog->text = safeStr(inText.c_str());
gCurrentFileDialog->defaultPath = safeStr(inDefaultPath.c_str());
gCurrentFileDialog->fileTypes = safeStr(inTypes.c_str());
gCurrentFileDialog->callback = new AutoGCRoot(inCallback);
gCurrentFileDialog->flags = inFlags;

Expand Down
8 changes: 7 additions & 1 deletion project/src/sdl2/SDL2Stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2482,7 +2482,13 @@ void CreateMainFrame(FrameCreationCallback inOnFrame, int inWidth, int inHeight,
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, targetY);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, setWidth);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, setHeight);
SDL_SetNumberProperty(props, "flags", requestWindowFlags);

SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN, resizable);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN, borderless);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN, fullscreen);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN, tryHighDpi);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN, inFlags & wfAlwaysOnTop);

window = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props);
#else
Expand Down

0 comments on commit c6fdc07

Please sign in to comment.