Skip to content

Commit 0887697

Browse files
committed
SDL: fix windows build
1 parent 427d250 commit 0887697

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/platform/sdl/editor.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
#include "config.h"
1010

1111
#include "common/sbapp.h"
12-
#include "ui/system.h"
1312
#include "ui/textedit.h"
14-
#include "platform/sdl/syswm.h"
13+
#include "platform/sdl/runtime.h"
1514

16-
void onlineHelp(TextEditInput *widget) {
15+
void onlineHelp(Runtime *runtime, TextEditInput *widget) {
1716
char path[100];
1817
const char *nodeId = widget->getNodeId();
1918
if (nodeId != NULL && nodeId[0] != '0') {
@@ -27,7 +26,7 @@ void onlineHelp(TextEditInput *widget) {
2726
sprintf(path, "http://smallbasic.sf.net");
2827
}
2928
}
30-
browseFile(path);
29+
runtime->browseFile(path);
3130
}
3231

3332
void System::editSource(strlib::String &loadPath) {
@@ -150,7 +149,7 @@ void System::editSource(strlib::String &loadPath) {
150149
break;
151150
case SB_KEY_F(2):
152151
redraw = false;
153-
onlineHelp(editWidget);
152+
onlineHelp((Runtime *)this, editWidget);
154153
break;
155154
case SB_KEY_F(5):
156155
saveFile(editWidget, loadPath);

src/platform/sdl/runtime.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ int Runtime::ask(const char *title, const char *prompt, bool cancel) {
130130
return buttonId;
131131
}
132132

133+
void Runtime::browseFile(const char *url) {
134+
::browseFile(_window, url);
135+
}
136+
133137
void Runtime::construct(const char *font, const char *boldFont) {
134138
logEntered();
135139
_state = kClosingState;

src/platform/sdl/runtime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct Runtime : public System {
2323

2424
void alert(const char *title, const char *message);
2525
int ask(const char *title, const char *prompt, bool cancel);
26+
void browseFile(const char *url);
2627
void construct(const char *font, const char *boldFont);
2728
void debugStart(TextEditInput *edit, const char *file);
2829
void debugStep(TextEditInput *edit, TextEditHelpWidget *help, bool cont);

src/platform/sdl/syswm.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void appLog(const char *format, ...);
1919

2020
#if defined(_Win32)
2121
#include <SDL_syswm.h>
22+
#include <shellapi.h>
2223

2324
void loadIcon(SDL_Window *window) {
2425
HINSTANCE handle = ::GetModuleHandle(NULL);
@@ -57,18 +58,12 @@ void launchDebug(const char *file) {
5758
}
5859
}
5960

60-
#if defined(WIN32)
61-
#include <windows.h>
62-
#include <fltk/Window.h>
63-
#include <fltk/win32.h>
64-
#endif
65-
66-
void browseFile(const char *url) {
61+
void browseFile(SDL_Window *window, const char *url) {
6762
SDL_SysWMinfo wminfo;
6863
SDL_VERSION(&wminfo.version);
6964
if (SDL_GetWindowWMInfo(window, &wminfo) == 1) {
7065
HWND hwnd = wminfo.info.win.window;
71-
ShellExecute(hwnd, "open", url, 0, 0, SW_SHOWNORMAL);
66+
::ShellExecute(hwnd, "open", url, 0, 0, SW_SHOWNORMAL);
7267
}
7368
}
7469

@@ -77,6 +72,7 @@ void browseFile(const char *url) {
7772
#include <errno.h>
7873

7974
void loadIcon(SDL_Window *window) {
75+
// handled via smallbasic.desktop
8076
}
8177

8278
int getStartupFontSize(SDL_Window *window) {
@@ -105,7 +101,7 @@ void launchDebug(const char *file) {
105101
}
106102
}
107103

108-
void browseFile(const char *url) {
104+
void browseFile(SDL_Window *window, const char *url) {
109105
if (fork() == 0) {
110106
const char *browser[] = {
111107
"sensible-browser",

src/platform/sdl/syswm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
void loadIcon(SDL_Window *window);
1515
int getStartupFontSize(SDL_Window *window);
1616
void launchDebug(const char *file);
17-
void browseFile(const char *url);
17+
void browseFile(SDL_Window *window, const char *url);
1818

1919
#endif

0 commit comments

Comments
 (0)