Skip to content

Commit 14aef59

Browse files
committed
FLTK: fix cross compile under linux
1 parent 9158ace commit 14aef59

File tree

9 files changed

+30
-25
lines changed

9 files changed

+30
-25
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
2015-07-18
22
Added IDE editor sdl/android
3+
Made a few minor performance improvements (SDL)
34

45
2015-06-07
56
Fixed PRINT 1/1000 and other floating point rounding issues

configure.ac

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,26 +140,28 @@ function buildFLTK() {
140140
esac
141141

142142
FLTK_CXXFLAGS="${PACKAGE_CFLAGS} `fltk2-config --cxxflags` -fno-exceptions"
143-
PACKAGE_LIBS="${PACKAGE_LIBS} `fltk2-config --ldflags --use-images`"
143+
PACKAGE_LIBS="${PACKAGE_LIBS} `fltk2-config --ldstaticflags --use-images`"
144144

145145
dnl do not depend on cygwin.dll under cygwin build
146146
case "${host_os}" in
147147
*mingw* | cygwin*)
148-
FLTK_CXXFLAGS="-I`cygpath -m /usr/local/include` ${FLTK_CXXFLAGS} -mms-bitfields"
149-
PACKAGE_LIBS="-L`cygpath -m /usr/local/lib` ${PACKAGE_LIBS} -lwsock32 -static-libgcc"
148+
FLTK_CXXFLAGS="${FLTK_CXXFLAGS} -mms-bitfields"
149+
PACKAGE_LIBS="-Wl,-Bstatic ${PACKAGE_LIBS} -lwsock32 -lws2_32 -static-libgcc -static-libstdc++"
150150
AC_DEFINE(_Win32, 1, [Windows build])
151+
;;
152+
153+
*)
154+
dnl check for sdl2-config for sound output
155+
AC_CHECK_PROG(have_sdl, sdl2-config, [yes], [no])
156+
if test "${have_sdl}" = "yes" ; then
157+
FLTK_CXXFLAGS="${FLTK_CXXFLAGS} `sdl2-config --cflags`"
158+
PACKAGE_LIBS="${PACKAGE_LIBS} `sdl2-config --libs`"
159+
AC_DEFINE(HAVE_SDL, 1, [Windows build])
160+
fi
151161
esac
152162

153163
defaultConditionals
154164

155-
dnl check for sdl-config for sound output
156-
AC_CHECK_PROG(have_sdl, sdl-config, [yes], [no])
157-
if test "${have_sdl}" = "yes" ; then
158-
FLTK_CXXFLAGS="${FLTK_CXXFLAGS} `sdl-config --cflags`"
159-
PACKAGE_LIBS="${PACKAGE_LIBS} `sdl-config --libs`"
160-
AC_DEFINE(HAVE_SDL, 1, [Windows build])
161-
fi
162-
163165
dnl preconfigured values for FLTK build
164166
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
165167
AC_DEFINE(_FLTK, 1, [Defined for FLTK build.])
@@ -200,8 +202,8 @@ function buildSDL() {
200202
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -D__USE_MINGW_ANSI_STDIO"
201203

202204
dnl do not depend on cygwin.dll under cygwin build
203-
PACKAGE_CFLAGS="-I`cygpath -m /usr/local/include` ${PACKAGE_CFLAGS} -mms-bitfields"
204-
PACKAGE_LIBS="-L`cygpath -m /usr/local/lib` ${PACKAGE_LIBS} -lwsock32 -lws2_32 -static-libgcc -static-libstdc++"
205+
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -mms-bitfields"
206+
PACKAGE_LIBS="${PACKAGE_LIBS} -lwsock32 -lws2_32 -static-libgcc -static-libstdc++"
205207
AC_DEFINE(_Win32, 1, [Windows build])
206208
;;
207209

src/platform/fltk/HelpWidget.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2942,7 +2942,7 @@ Image *loadImage(const char *imgSrc) {
29422942

29432943
#if defined(WIN32)
29442944
#include <windows.h>
2945-
#include <fltk/window.h>
2945+
#include <fltk/Window.h>
29462946
#include <fltk/win32.h>
29472947
#endif
29482948

src/platform/fltk/Profile.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void Profile::restore(MainWindow *wnd) {
7474
restoreValue(&profile, lineNumbersKey, &_lineNumbers);
7575
restoreStyles(&profile);
7676

77-
Rectangle rc;
77+
fltk::Rectangle rc;
7878
rc = restoreRect(&profile, appPositionKey);
7979
if (!rc.empty()) {
8080
_appPosition = rc;
@@ -93,7 +93,7 @@ void Profile::restore(MainWindow *wnd) {
9393
//
9494
// restore the standalone window position
9595
//
96-
void Profile::restoreAppPosition(Rectangle *wnd) {
96+
void Profile::restoreAppPosition(fltk::Rectangle *wnd) {
9797
if (!_appPosition.empty()) {
9898
wnd->w(_appPosition.w());
9999
wnd->h(_appPosition.h());
@@ -142,8 +142,8 @@ int Profile::nextInteger(const char *s, int len, int &index) {
142142
//
143143
// restore a rectangle value with the given key
144144
//
145-
Rectangle Profile::restoreRect(Properties *profile, const char *key) {
146-
Rectangle result(0, 0, 0, 0);
145+
fltk::Rectangle Profile::restoreRect(Properties *profile, const char *key) {
146+
fltk::Rectangle result(0, 0, 0, 0);
147147
String *value = profile->get(key);
148148
if (value != NULL) {
149149
const char *buffer = value->c_str();
@@ -253,7 +253,7 @@ void Profile::restoreValue(Properties *p, const char *key, int *value) {
253253
//
254254
// restore the main window position
255255
//
256-
void Profile::restoreWindowPos(MainWindow *wnd, Rectangle &rc) {
256+
void Profile::restoreWindowPos(MainWindow *wnd, fltk::Rectangle &rc) {
257257
int x = rc.x();
258258
int y = rc.y();
259259
int w = rc.w();
@@ -270,7 +270,7 @@ void Profile::restoreWindowPos(MainWindow *wnd, Rectangle &rc) {
270270
//
271271
// save the window position
272272
//
273-
void Profile::saveRect(FILE *fp, const char *key, Rectangle *rc) {
273+
void Profile::saveRect(FILE *fp, const char *key, fltk::Rectangle *rc) {
274274
fprintf(fp, "%s=%d;%d;%d;%d\n", key, rc->x(), rc->y(), rc->w(), rc->h());
275275
}
276276

src/platform/fltk/audio.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include "common/osd.h"
1414

1515
#if defined(HAVE_SDL)
16-
#include <SDL/SDL.h>
17-
#include <SDL/SDL_audio.h>
16+
#include <SDL2/SDL.h>
17+
#include <SDL2/SDL_audio.h>
1818
#include <queue>
1919
#include <cmath>
2020

src/platform/fltk/dev_fltk.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ int System::ask(const char *title, const char *prompt, bool cancel) {
468468
if (cancel) {
469469
return fltk::choice(prompt, "Yes", "No", "Cancel");
470470
} else {
471-
return fltk::choice(prompt, "Yes", "No");
471+
return fltk::choice(prompt, "Yes", "No", "");
472472
}
473473
}
474474

src/platform/fltk/display.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ int Canvas::getPixel(int x, int y) {
218218
int delta = _img->buffer_linedelta();
219219
U32 *row = (U32 *)(_img->buffer() + (y * delta));
220220
result = row[x];
221+
} else {
222+
result = 0;
221223
}
222224
#else
223225
GSave gsave;

src/ui/image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ ImageBuffer *load_image(dev_file_t *filep) {
110110
ImageBuffer *result = NULL;
111111
List_each(ImageBuffer *, it, cache) {
112112
ImageBuffer *next = (*it);
113-
if (strcmp(next->_filename, filep->name) == 0) {
113+
if (next->_filename != NULL && strcmp(next->_filename, filep->name) == 0) {
114114
result = next;
115115
break;
116116
}

src/ui/textedit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ struct TextEditHelpWidget : public TextEditInput {
157157
void createSearch(bool replace);
158158
bool edit(int key, int screenWidth, int charWidth);
159159
char *copy(bool cut) { return NULL; }
160-
void paste(char *text) {}
160+
void paste(const char *text) {}
161161
bool isDrawTop() { return true; }
162162
void resize(int w, int h) { _x = w - _width; _height = h; }
163163
void reset(HelpMode mode);

0 commit comments

Comments
 (0)