PicoSDL fixes - not working!
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11607 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
03e87bb270
commit
130a0ef8da
@ -70,6 +70,7 @@ class FL_EXPORT Fl_Window : public Fl_Group {
|
|||||||
friend class Fl_X;
|
friend class Fl_X;
|
||||||
friend class Fl_Window_Driver;
|
friend class Fl_Window_Driver;
|
||||||
friend class Fl_PicoAndroid_Window_Driver;
|
friend class Fl_PicoAndroid_Window_Driver;
|
||||||
|
friend class Fl_PicoSDL_Window_Driver;
|
||||||
Fl_X *i; // points at the system-specific stuff, but exists only after the window is mapped
|
Fl_X *i; // points at the system-specific stuff, but exists only after the window is mapped
|
||||||
Fl_Window_Driver *pWindowDriver; // points at the system-specific stuff at window creation time
|
Fl_Window_Driver *pWindowDriver; // points at the system-specific stuff at window creation time
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ struct dirent {char d_name[1];};
|
|||||||
# pragma message "FL_PORTING: define struct stat and implement stat() for the platform"
|
# pragma message "FL_PORTING: define struct stat and implement stat() for the platform"
|
||||||
struct stat { /* the FLTK source code uses part of the stat() API */
|
struct stat { /* the FLTK source code uses part of the stat() API */
|
||||||
unsigned st_mode;
|
unsigned st_mode;
|
||||||
off_t st_size;
|
unsigned st_size;
|
||||||
};
|
};
|
||||||
#define S_IFMT 0170000 /* type of file */
|
#define S_IFMT 0170000 /* type of file */
|
||||||
#define S_IFDIR 0040000 /* directory */
|
#define S_IFDIR 0040000 /* directory */
|
||||||
|
@ -38,7 +38,6 @@ typedef void *Fl_Region;
|
|||||||
typedef void *Fl_Offscreen;
|
typedef void *Fl_Offscreen;
|
||||||
|
|
||||||
# include "Fl_Window.H"
|
# include "Fl_Window.H"
|
||||||
# include "../src/Fl_Font.H"
|
|
||||||
|
|
||||||
// Some random X equivalents
|
// Some random X equivalents
|
||||||
struct XPoint { int x, y; };
|
struct XPoint { int x, y; };
|
||||||
|
@ -356,6 +356,33 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "flstring.h"
|
#include "flstring.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform file browser
|
||||||
|
#elif defined(FL_PORTING)
|
||||||
|
# pragma message "FL_PORTING: implement the internals of your filechooser here"
|
||||||
|
// Ouch: this must be in the system driver!
|
||||||
|
int mkdir(const char *, unsigned int);
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(WIN32) && ! defined (__CYGWIN__)
|
||||||
|
# include <direct.h>
|
||||||
|
# include <io.h>
|
||||||
|
// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
|
||||||
|
// on Windows, which is supposed to be POSIX compliant...
|
||||||
|
# define access _access
|
||||||
|
# define mkdir _mkdir
|
||||||
|
// Apparently Borland C++ defines DIRECTORY in <direct.h>, which
|
||||||
|
// interfers with the Fl_File_Icon enumeration of the same name.
|
||||||
|
# ifdef DIRECTORY
|
||||||
|
# undef DIRECTORY
|
||||||
|
# endif // DIRECTORY
|
||||||
|
#else
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <pwd.h>
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// File chooser label strings and sort function...
|
// File chooser label strings and sort function...
|
||||||
@ -369,7 +396,11 @@ const char *Fl_File_Chooser::custom_filter_label = "Custom Filter";
|
|||||||
const char *Fl_File_Chooser::existing_file_label = "Please choose an existing file!";
|
const char *Fl_File_Chooser::existing_file_label = "Please choose an existing file!";
|
||||||
const char *Fl_File_Chooser::favorites_label = "Favorites";
|
const char *Fl_File_Chooser::favorites_label = "Favorites";
|
||||||
const char *Fl_File_Chooser::filename_label = "Filename:";
|
const char *Fl_File_Chooser::filename_label = "Filename:";
|
||||||
const char *Fl_File_Chooser::filesystems_label = Fl::system_driver()->filesystems_label();
|
#ifdef WIN32
|
||||||
|
const char *Fl_File_Chooser::filesystems_label = "My Computer";
|
||||||
|
#else
|
||||||
|
const char *Fl_File_Chooser::filesystems_label = "File Systems";
|
||||||
|
#endif // WIN32
|
||||||
const char *Fl_File_Chooser::manage_favorites_label = "Manage Favorites";
|
const char *Fl_File_Chooser::manage_favorites_label = "Manage Favorites";
|
||||||
const char *Fl_File_Chooser::new_directory_label = "New Directory?";
|
const char *Fl_File_Chooser::new_directory_label = "New Directory?";
|
||||||
const char *Fl_File_Chooser::new_directory_tooltip = "Create a new directory.";
|
const char *Fl_File_Chooser::new_directory_tooltip = "Create a new directory.";
|
||||||
@ -388,6 +419,9 @@ static int compare_dirnames(const char *a, const char *b);
|
|||||||
static void quote_pathname(char *, const char *, int);
|
static void quote_pathname(char *, const char *, int);
|
||||||
static void unquote_pathname(char *, const char *, int);
|
static void unquote_pathname(char *, const char *, int);
|
||||||
|
|
||||||
|
// use platform dependent getenv() to get the home directory (STR #3166)
|
||||||
|
static const char* get_homedir();
|
||||||
|
|
||||||
//
|
//
|
||||||
// 'Fl_File_Chooser::count()' - Return the number of selected files.
|
// 'Fl_File_Chooser::count()' - Return the number of selected files.
|
||||||
//
|
//
|
||||||
@ -441,25 +475,29 @@ Fl_File_Chooser::directory(const char *d)// I - Directory to change to
|
|||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
d = ".";
|
d = ".";
|
||||||
|
|
||||||
if (Fl::system_driver()->backslash_as_slash()) {
|
#ifdef WIN32
|
||||||
// See if the filename contains backslashes...
|
// See if the filename contains backslashes...
|
||||||
char *slash; // Pointer to slashes
|
char *slash; // Pointer to slashes
|
||||||
char fixpath[FL_PATH_MAX]; // Path with slashes converted
|
char fixpath[FL_PATH_MAX]; // Path with slashes converted
|
||||||
if (strchr(d, '\\')) {
|
if (strchr(d, '\\')) {
|
||||||
// Convert backslashes to slashes...
|
// Convert backslashes to slashes...
|
||||||
strlcpy(fixpath, d, sizeof(fixpath));
|
strlcpy(fixpath, d, sizeof(fixpath));
|
||||||
|
|
||||||
for (slash = strchr(fixpath, '\\'); slash; slash = strchr(slash + 1, '\\'))
|
for (slash = strchr(fixpath, '\\'); slash; slash = strchr(slash + 1, '\\'))
|
||||||
*slash = '/';
|
*slash = '/';
|
||||||
|
|
||||||
d = fixpath;
|
d = fixpath;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif // WIN32
|
||||||
|
|
||||||
if (d[0] != '\0')
|
if (d[0] != '\0')
|
||||||
{
|
{
|
||||||
// Make the directory absolute...
|
// Make the directory absolute...
|
||||||
if (d[0] != '/' && d[0] != '\\' && ( !Fl::system_driver()->colon_is_drive() || d[1] != ':' ) )
|
#if (defined(WIN32) && ! defined(__CYGWIN__))|| defined(__EMX__)
|
||||||
|
if (d[0] != '/' && d[0] != '\\' && d[1] != ':')
|
||||||
|
#else
|
||||||
|
if (d[0] != '/' && d[0] != '\\')
|
||||||
|
#endif /* WIN32 || __EMX__ */
|
||||||
fl_filename_absolute(directory_, d);
|
fl_filename_absolute(directory_, d);
|
||||||
else
|
else
|
||||||
strlcpy(directory_, d, sizeof(directory_));
|
strlcpy(directory_, d, sizeof(directory_));
|
||||||
@ -512,7 +550,7 @@ Fl_File_Chooser::favoritesButtonCB()
|
|||||||
|
|
||||||
if (!v) {
|
if (!v) {
|
||||||
// Add current directory to favorites...
|
// Add current directory to favorites...
|
||||||
if (Fl::system_driver()->home_directory_name()) v = favoritesButton->size() - 5;
|
if (get_homedir()) v = favoritesButton->size() - 5;
|
||||||
else v = favoritesButton->size() - 4;
|
else v = favoritesButton->size() - 4;
|
||||||
|
|
||||||
sprintf(menuname, "favorite%02d", v);
|
sprintf(menuname, "favorite%02d", v);
|
||||||
@ -687,11 +725,13 @@ Fl_File_Chooser::fileListCB()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Fl::event_clicks()) {
|
if (Fl::event_clicks()) {
|
||||||
int condition = 0;
|
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
|
||||||
if (Fl::system_driver()->colon_is_drive() && strlen(pathname) == 2 && pathname[1] == ':') condition = 1;
|
if ((strlen(pathname) == 2 && pathname[1] == ':') ||
|
||||||
if (!condition) condition = Fl::system_driver()->filename_isdir_quick(pathname);
|
Fl::system_driver()->filename_isdir_quick(pathname))
|
||||||
if (condition)
|
#else
|
||||||
{
|
if (Fl::system_driver()->filename_isdir_quick(pathname))
|
||||||
|
#endif /* WIN32 || __EMX__ */
|
||||||
|
{
|
||||||
// Change directories...
|
// Change directories...
|
||||||
directory(pathname);
|
directory(pathname);
|
||||||
|
|
||||||
@ -798,9 +838,13 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we have an absolute path...
|
// Make sure we have an absolute path...
|
||||||
int condition = directory_[0] != '\0' && filename[0] != '/';
|
#if (defined(WIN32) && !defined(__CYGWIN__)) || defined(__EMX__)
|
||||||
if (condition && Fl::system_driver()->colon_is_drive()) condition = !(isalpha(filename[0] & 255) && (!filename[1] || filename[1] == ':'));
|
if (directory_[0] != '\0' && filename[0] != '/' &&
|
||||||
if (condition) {
|
filename[0] != '\\' &&
|
||||||
|
!(isalpha(filename[0] & 255) && (!filename[1] || filename[1] == ':'))) {
|
||||||
|
#else
|
||||||
|
if (directory_[0] != '\0' && filename[0] != '/') {
|
||||||
|
#endif /* WIN32 || __EMX__ */
|
||||||
fl_filename_absolute(pathname, sizeof(pathname), filename);
|
fl_filename_absolute(pathname, sizeof(pathname), filename);
|
||||||
value(pathname);
|
value(pathname);
|
||||||
fileName->mark(fileName->position()); // no selection after expansion
|
fileName->mark(fileName->position()); // no selection after expansion
|
||||||
@ -814,12 +858,16 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
// Now process things according to the key pressed...
|
// Now process things according to the key pressed...
|
||||||
if (Fl::event_key() == FL_Enter || Fl::event_key() == FL_KP_Enter) {
|
if (Fl::event_key() == FL_Enter || Fl::event_key() == FL_KP_Enter) {
|
||||||
// Enter pressed - select or change directory...
|
// Enter pressed - select or change directory...
|
||||||
int condition = 0;
|
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
|
||||||
if (Fl::system_driver()->colon_is_drive()) condition = isalpha(pathname[0] & 255) && pathname[1] == ':' && !pathname[2];
|
if ((isalpha(pathname[0] & 255) && pathname[1] == ':' && !pathname[2]) ||
|
||||||
if (!condition) condition = ( Fl::system_driver()->filename_isdir_quick(pathname) && compare_dirnames(pathname, directory_) );
|
(Fl::system_driver()->filename_isdir_quick(pathname) &&
|
||||||
if (condition) {
|
compare_dirnames(pathname, directory_))) {
|
||||||
|
#else
|
||||||
|
if (Fl::system_driver()->filename_isdir_quick(pathname) &&
|
||||||
|
compare_dirnames(pathname, directory_)) {
|
||||||
|
#endif /* WIN32 || __EMX__ */
|
||||||
directory(pathname);
|
directory(pathname);
|
||||||
} else if ((type_ & CREATE) || fl_access(pathname, 0) == 0) {
|
} else if ((type_ & CREATE) || access(pathname, 0) == 0) {
|
||||||
if (!Fl::system_driver()->filename_isdir_quick(pathname) || (type_ & DIRECTORY)) {
|
if (!Fl::system_driver()->filename_isdir_quick(pathname) || (type_ & DIRECTORY)) {
|
||||||
// Update the preview box...
|
// Update the preview box...
|
||||||
update_preview();
|
update_preview();
|
||||||
@ -847,9 +895,13 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
*slash++ = '\0';
|
*slash++ = '\0';
|
||||||
filename = slash;
|
filename = slash;
|
||||||
|
|
||||||
int condition = Fl::system_driver()->case_insensitive_filenames() ?
|
#if defined(WIN32) || defined(__EMX__)
|
||||||
strcasecmp(pathname, directory_) : strcmp(pathname, directory_);
|
if (strcasecmp(pathname, directory_) &&
|
||||||
if (condition && (pathname[0] || strcmp("/", directory_))) {
|
(pathname[0] || strcasecmp("/", directory_))) {
|
||||||
|
#else
|
||||||
|
if (strcmp(pathname, directory_) &&
|
||||||
|
(pathname[0] || strcasecmp("/", directory_))) {
|
||||||
|
#endif // WIN32 || __EMX__
|
||||||
int p = fileName->position();
|
int p = fileName->position();
|
||||||
int m = fileName->mark();
|
int m = fileName->mark();
|
||||||
|
|
||||||
@ -875,8 +927,11 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
for (i = 1; i <= num_files && max_match > min_match; i ++) {
|
for (i = 1; i <= num_files && max_match > min_match; i ++) {
|
||||||
file = fileList->text(i);
|
file = fileList->text(i);
|
||||||
|
|
||||||
if ( (Fl::system_driver()->case_insensitive_filenames()?
|
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
|
||||||
strncasecmp(filename, file, min_match) : strncmp(filename, file, min_match)) == 0) {
|
if (strncasecmp(filename, file, min_match) == 0) {
|
||||||
|
#else
|
||||||
|
if (strncmp(filename, file, min_match) == 0) {
|
||||||
|
#endif // WIN32 || __EMX__
|
||||||
// OK, this one matches; check against the previous match
|
// OK, this one matches; check against the previous match
|
||||||
if (!first_line) {
|
if (!first_line) {
|
||||||
// First match; copy stuff over...
|
// First match; copy stuff over...
|
||||||
@ -895,8 +950,11 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
} else {
|
} else {
|
||||||
// Succeeding match; compare to find maximum string match...
|
// Succeeding match; compare to find maximum string match...
|
||||||
while (max_match > min_match)
|
while (max_match > min_match)
|
||||||
if ( (Fl::system_driver()->case_insensitive_filenames()?
|
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
|
||||||
strncasecmp(file, matchname, max_match) : strncmp(file, matchname, max_match)) == 0)
|
if (strncasecmp(file, matchname, max_match) == 0)
|
||||||
|
#else
|
||||||
|
if (strncmp(file, matchname, max_match) == 0)
|
||||||
|
#endif // WIN32 || __EMX__
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
max_match --;
|
max_match --;
|
||||||
@ -933,7 +991,7 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if we need to enable the OK button...
|
// See if we need to enable the OK button...
|
||||||
if (((type_ & CREATE) || !fl_access(fileName->value(), 0)) &&
|
if (((type_ & CREATE) || !access(fileName->value(), 0)) &&
|
||||||
(!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
|
(!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
|
||||||
okButton->activate();
|
okButton->activate();
|
||||||
} else {
|
} else {
|
||||||
@ -943,7 +1001,7 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
// FL_Delete or FL_BackSpace
|
// FL_Delete or FL_BackSpace
|
||||||
fileList->deselect(0);
|
fileList->deselect(0);
|
||||||
fileList->redraw();
|
fileList->redraw();
|
||||||
if (((type_ & CREATE) || !fl_access(fileName->value(), 0)) &&
|
if (((type_ & CREATE) || !access(fileName->value(), 0)) &&
|
||||||
(!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
|
(!fl_filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
|
||||||
okButton->activate();
|
okButton->activate();
|
||||||
} else {
|
} else {
|
||||||
@ -1017,13 +1075,21 @@ Fl_File_Chooser::newdir()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Make it relative to the current directory as needed...
|
// Make it relative to the current directory as needed...
|
||||||
if (dir[0] != '/' && dir[0] != '\\' && (!Fl::system_driver()->colon_is_drive() || dir[1] != ':') )
|
#if (defined(WIN32) && ! defined (__CYGWIN__)) || defined(__EMX__)
|
||||||
|
if (dir[0] != '/' && dir[0] != '\\' && dir[1] != ':')
|
||||||
|
#else
|
||||||
|
if (dir[0] != '/' && dir[0] != '\\')
|
||||||
|
#endif /* WIN32 || __EMX__ */
|
||||||
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, dir);
|
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, dir);
|
||||||
else
|
else
|
||||||
strlcpy(pathname, dir, sizeof(pathname));
|
strlcpy(pathname, dir, sizeof(pathname));
|
||||||
|
|
||||||
// Create the directory; ignore EEXIST errors...
|
// Create the directory; ignore EEXIST errors...
|
||||||
if (fl_mkdir(pathname, 0777))
|
#if defined(WIN32) && ! defined (__CYGWIN__)
|
||||||
|
if (mkdir(pathname))
|
||||||
|
#else
|
||||||
|
if (mkdir(pathname, 0777))
|
||||||
|
#endif /* WIN32 */
|
||||||
if (errno != EEXIST)
|
if (errno != EEXIST)
|
||||||
{
|
{
|
||||||
fl_alert("%s", strerror(errno));
|
fl_alert("%s", strerror(errno));
|
||||||
@ -1100,7 +1166,9 @@ Fl_File_Chooser::rescan()
|
|||||||
|
|
||||||
// Build the file list...
|
// Build the file list...
|
||||||
fileList->load(directory_, sort);
|
fileList->load(directory_, sort);
|
||||||
if (Fl::system_driver()->dot_file_hidden() && !showHiddenButton->value()) remove_hidden_files();
|
#ifndef WIN32
|
||||||
|
if (!showHiddenButton->value()) remove_hidden_files();
|
||||||
|
#endif
|
||||||
// Update the preview box...
|
// Update the preview box...
|
||||||
update_preview();
|
update_preview();
|
||||||
}
|
}
|
||||||
@ -1125,7 +1193,9 @@ void Fl_File_Chooser::rescan_keep_filename()
|
|||||||
|
|
||||||
// Build the file list...
|
// Build the file list...
|
||||||
fileList->load(directory_, sort);
|
fileList->load(directory_, sort);
|
||||||
if (Fl::system_driver()->dot_file_hidden() && !showHiddenButton->value()) remove_hidden_files();
|
#ifndef WIN32
|
||||||
|
if (!showHiddenButton->value()) remove_hidden_files();
|
||||||
|
#endif
|
||||||
// Update the preview box...
|
// Update the preview box...
|
||||||
update_preview();
|
update_preview();
|
||||||
|
|
||||||
@ -1137,7 +1207,11 @@ void Fl_File_Chooser::rescan_keep_filename()
|
|||||||
else
|
else
|
||||||
slash = pathname;
|
slash = pathname;
|
||||||
for (i = 1; i <= fileList->size(); i ++)
|
for (i = 1; i <= fileList->size(); i ++)
|
||||||
if ( (Fl::system_driver()->case_insensitive_filenames() ? strcasecmp(fileList->text(i), slash) : strcmp(fileList->text(i), slash)) == 0) {
|
#if defined(WIN32) || defined(__EMX__)
|
||||||
|
if (strcasecmp(fileList->text(i), slash) == 0) {
|
||||||
|
#else
|
||||||
|
if (strcmp(fileList->text(i), slash) == 0) {
|
||||||
|
#endif // WIN32 || __EMX__
|
||||||
fileList->topline(i);
|
fileList->topline(i);
|
||||||
fileList->select(i);
|
fileList->select(i);
|
||||||
found = 1;
|
found = 1;
|
||||||
@ -1211,7 +1285,7 @@ Fl_File_Chooser::update_favorites()
|
|||||||
favoritesButton->add(manage_favorites_label, FL_ALT + 'm', 0, 0, FL_MENU_DIVIDER);
|
favoritesButton->add(manage_favorites_label, FL_ALT + 'm', 0, 0, FL_MENU_DIVIDER);
|
||||||
favoritesButton->add(filesystems_label, FL_ALT + 'f', 0);
|
favoritesButton->add(filesystems_label, FL_ALT + 'f', 0);
|
||||||
|
|
||||||
if ((home = Fl::system_driver()->home_directory_name()) != NULL) {
|
if ((home = get_homedir()) != NULL) {
|
||||||
quote_pathname(menuname, home, sizeof(menuname));
|
quote_pathname(menuname, home, sizeof(menuname));
|
||||||
favoritesButton->add(menuname, FL_ALT + 'h', 0);
|
favoritesButton->add(menuname, FL_ALT + 'h', 0);
|
||||||
}
|
}
|
||||||
@ -1475,19 +1549,19 @@ Fl_File_Chooser::value(const char *filename)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Fl::system_driver()->backslash_as_slash()) {
|
#ifdef WIN32
|
||||||
// See if the filename contains backslashes...
|
// See if the filename contains backslashes...
|
||||||
char fixpath[FL_PATH_MAX]; // Path with slashes converted
|
char fixpath[FL_PATH_MAX]; // Path with slashes converted
|
||||||
if (strchr(filename, '\\')) {
|
if (strchr(filename, '\\')) {
|
||||||
// Convert backslashes to slashes...
|
// Convert backslashes to slashes...
|
||||||
strlcpy(fixpath, filename, sizeof(fixpath));
|
strlcpy(fixpath, filename, sizeof(fixpath));
|
||||||
|
|
||||||
for (slash = strchr(fixpath, '\\'); slash; slash = strchr(slash + 1, '\\'))
|
for (slash = strchr(fixpath, '\\'); slash; slash = strchr(slash + 1, '\\'))
|
||||||
*slash = '/';
|
*slash = '/';
|
||||||
|
|
||||||
filename = fixpath;
|
filename = fixpath;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif // WIN32
|
||||||
|
|
||||||
// See if there is a directory in there...
|
// See if there is a directory in there...
|
||||||
fl_filename_absolute(pathname, sizeof(pathname), filename);
|
fl_filename_absolute(pathname, sizeof(pathname), filename);
|
||||||
@ -1517,7 +1591,11 @@ Fl_File_Chooser::value(const char *filename)
|
|||||||
fileList->redraw();
|
fileList->redraw();
|
||||||
|
|
||||||
for (i = 1; i <= fcount; i ++)
|
for (i = 1; i <= fcount; i ++)
|
||||||
if ( ( Fl::system_driver()->case_insensitive_filenames() ? strcasecmp(fileList->text(i), slash) : strcmp(fileList->text(i), slash)) == 0) {
|
#if defined(WIN32) || defined(__EMX__)
|
||||||
|
if (strcasecmp(fileList->text(i), slash) == 0) {
|
||||||
|
#else
|
||||||
|
if (strcmp(fileList->text(i), slash) == 0) {
|
||||||
|
#endif // WIN32 || __EMX__
|
||||||
// printf("Selecting line %d...\n", i);
|
// printf("Selecting line %d...\n", i);
|
||||||
fileList->topline(i);
|
fileList->topline(i);
|
||||||
fileList->select(i);
|
fileList->select(i);
|
||||||
@ -1534,7 +1612,9 @@ void Fl_File_Chooser::show()
|
|||||||
rescan_keep_filename();
|
rescan_keep_filename();
|
||||||
fl_cursor(FL_CURSOR_DEFAULT);
|
fl_cursor(FL_CURSOR_DEFAULT);
|
||||||
fileName->take_focus();
|
fileName->take_focus();
|
||||||
if (!Fl::system_driver()->dot_file_hidden()) showHiddenButton->hide();
|
#ifdef WIN32
|
||||||
|
showHiddenButton->hide();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_File_Chooser::showHidden(int value)
|
void Fl_File_Chooser::showHidden(int value)
|
||||||
@ -1580,7 +1660,11 @@ compare_dirnames(const char *a, const char *b) {
|
|||||||
if (alen != blen) return alen - blen;
|
if (alen != blen) return alen - blen;
|
||||||
|
|
||||||
// Do a comparison of the first N chars (alen == blen at this point)...
|
// Do a comparison of the first N chars (alen == blen at this point)...
|
||||||
return Fl::system_driver()->case_insensitive_filenames() ? strncasecmp(a, b, alen) : strncmp(a, b, alen);
|
#ifdef WIN32
|
||||||
|
return strncasecmp(a, b, alen);
|
||||||
|
#else
|
||||||
|
return strncmp(a, b, alen);
|
||||||
|
#endif // WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1636,6 +1720,24 @@ unquote_pathname(char *dst, // O - Destination string
|
|||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 'get_homedir()' - Try to find the home directory (platform dependent).
|
||||||
|
|
||||||
|
static const char*
|
||||||
|
get_homedir() {
|
||||||
|
|
||||||
|
const char *home = fl_getenv("HOME");
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
|
if (!home) home = fl_getenv("UserProfile");
|
||||||
|
|
||||||
|
#endif // WIN32
|
||||||
|
|
||||||
|
return home;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id$".
|
// End of "$Id$".
|
||||||
//
|
//
|
||||||
|
@ -810,7 +810,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||||||
application_(0L) {
|
application_(0L) {
|
||||||
|
|
||||||
char *filename = Fl::system_driver()->preference_rootnode(prefs, root, vendor, application);
|
char *filename = Fl::system_driver()->preference_rootnode(prefs, root, vendor, application);
|
||||||
filename_ = strdup(filename);
|
filename_ = filename ? strdup(filename) : 0L;
|
||||||
vendor_ = strdup(vendor);
|
vendor_ = strdup(vendor);
|
||||||
application_ = strdup(application);
|
application_ = strdup(application);
|
||||||
read();
|
read();
|
||||||
|
@ -20,11 +20,24 @@
|
|||||||
#include "../../config_lib.h"
|
#include "../../config_lib.h"
|
||||||
#include "Fl_PicoSDL_Graphics_Driver.h"
|
#include "Fl_PicoSDL_Graphics_Driver.h"
|
||||||
|
|
||||||
|
#include "Fl_PicoSDL_Screen_Driver.H"
|
||||||
|
#include <FL/x.H>
|
||||||
|
#include <FL/Fl_Window_Driver.H>
|
||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#define __APPLE__
|
#define __APPLE__
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#undef __APPLE__
|
#undef __APPLE__
|
||||||
|
|
||||||
|
extern Window fl_window;
|
||||||
|
|
||||||
|
|
||||||
|
void Fl_Graphics_Driver::XDestroyRegion(void*) { }
|
||||||
|
//void Fl_Graphics_Driver::clip_region(void*) { }
|
||||||
|
Fl_Region Fl_Graphics_Driver::XRectangleRegion(int, int, int, int) { }
|
||||||
|
void Fl_Graphics_Driver::add_rectangle_to_region(void*, int, int, int, int) { }
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* By linking this module, the following static method will instantiate the
|
* By linking this module, the following static method will instantiate the
|
||||||
* PicoSDL Graphics driver as the main display driver.
|
* PicoSDL Graphics driver as the main display driver.
|
||||||
|
@ -155,7 +155,7 @@ void fl_clipboard_notify_change() { }
|
|||||||
//Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() { return 0; }
|
//Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() { return 0; }
|
||||||
//Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() { return 0; }
|
//Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() { return 0; }
|
||||||
void Fl_Graphics_Driver::global_gc() { }
|
void Fl_Graphics_Driver::global_gc() { }
|
||||||
int Fl::dnd() { return 0; }
|
//int Fl::dnd() { return 0; }
|
||||||
void Fl::copy(char const*, int, int, char const*) { }
|
void Fl::copy(char const*, int, int, char const*) { }
|
||||||
void Fl::paste(Fl_Widget&, int, char const*) { }
|
void Fl::paste(Fl_Widget&, int, char const*) { }
|
||||||
void Fl::get_mouse(int&, int&) { }
|
void Fl::get_mouse(int&, int&) { }
|
||||||
@ -165,16 +165,10 @@ int Fl_X::set_cursor(Fl_RGB_Image const*, int, int) { return 0; }
|
|||||||
void Fl_X::set_default_icons(Fl_RGB_Image const**, int) { }
|
void Fl_X::set_default_icons(Fl_RGB_Image const**, int) { }
|
||||||
|
|
||||||
void Fl_X::set_icons() { }
|
void Fl_X::set_icons() { }
|
||||||
void Fl_Window::size_range_() { }
|
//void Fl_Window::size_range_() { }
|
||||||
void Fl_Window::fullscreen_x() { }
|
//void Fl_Window::fullscreen_x() { }
|
||||||
|
|
||||||
void Fl_Window::make_current()
|
//void Fl_Window::fullscreen_off_x(int, int, int, int) { }
|
||||||
{
|
|
||||||
fl_window = i->xid;
|
|
||||||
current_ = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fl_Window::fullscreen_off_x(int, int, int, int) { }
|
|
||||||
|
|
||||||
Window fl_xid(const Fl_Window* w)
|
Window fl_xid(const Fl_Window* w)
|
||||||
{
|
{
|
||||||
@ -182,20 +176,14 @@ Window fl_xid(const Fl_Window* w)
|
|||||||
return temp ? temp->xid : 0;
|
return temp ? temp->xid : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Window::show() {
|
|
||||||
if (!shown()) {
|
|
||||||
Fl_X::make(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Fl_X* Fl_X::make(Fl_Window *w)
|
Fl_X* Fl_X::make(Fl_Window *w)
|
||||||
{
|
{
|
||||||
return w->driver()->makeWindow();
|
return w->driver()->makeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Window::label(char const*, char const*) { }
|
//void Fl_Window::label(char const*, char const*) { }
|
||||||
void Fl_Window::resize(int, int, int, int) { }
|
//void Fl_Window::resize(int, int, int, int) { }
|
||||||
Fl_Window *Fl_Window::current_;
|
//Fl_Window *Fl_Window::current_;
|
||||||
char fl_show_iconic;
|
char fl_show_iconic;
|
||||||
Window fl_window;
|
Window fl_window;
|
||||||
//void Fl_Image_Surface::translate(int x, int y) { }
|
//void Fl_Image_Surface::translate(int x, int y) { }
|
||||||
|
@ -1 +1,38 @@
|
|||||||
|
//
|
||||||
|
// "$Id: Fl_PicoSDL_System_Driver.cxx 11241 2016-02-27 13:52:27Z manolo $"
|
||||||
|
//
|
||||||
|
// System routines for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 2016 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please report all bugs and problems on the following page:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/str.php
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../config_lib.h"
|
||||||
|
#include "../../FL/Fl_System_Driver.H"
|
||||||
|
//#include "Fl_PicoSDL_System_Driver.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* By linking this module, the following static method will instantiate the
|
||||||
|
* PicoSDL Graphics driver as the main display driver.
|
||||||
|
*/
|
||||||
|
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
|
||||||
|
{
|
||||||
|
return new Fl_System_Driver();
|
||||||
|
// return new Fl_PicoSDL_System_Driver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// End of "$Id: Fl_PicoSDL_System_Driver.cxx 11241 2016-02-27 13:52:27Z manolo $".
|
||||||
|
//
|
||||||
|
@ -39,7 +39,9 @@ public:
|
|||||||
Fl_PicoSDL_Window_Driver(Fl_Window *win);
|
Fl_PicoSDL_Window_Driver(Fl_Window *win);
|
||||||
virtual ~Fl_PicoSDL_Window_Driver();
|
virtual ~Fl_PicoSDL_Window_Driver();
|
||||||
|
|
||||||
|
virtual void show();
|
||||||
virtual Fl_X *makeWindow();
|
virtual Fl_X *makeWindow();
|
||||||
|
virtual void make_current();
|
||||||
|
|
||||||
// --- window management
|
// --- window management
|
||||||
virtual void flush_single();
|
virtual void flush_single();
|
||||||
|
@ -24,6 +24,13 @@
|
|||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_WIndow.H>
|
#include <FL/Fl_WIndow.H>
|
||||||
|
|
||||||
|
void Fl_Window_Driver::default_icons(Fl_RGB_Image const**, int) { }
|
||||||
|
|
||||||
|
const char *fl_local_alt = "alt";
|
||||||
|
const char *fl_local_ctrl = "ctrl";
|
||||||
|
const char *fl_local_meta = "meta";
|
||||||
|
const char *fl_local_shift = "shift";
|
||||||
|
|
||||||
|
|
||||||
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *win)
|
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *win)
|
||||||
{
|
{
|
||||||
@ -50,7 +57,7 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
Window parent;
|
Window parent;
|
||||||
if (parent()) {
|
if (this->parent()) {
|
||||||
parent = fl_xid(pWindow->window());
|
parent = fl_xid(pWindow->window());
|
||||||
} else {
|
} else {
|
||||||
parent = 0;
|
parent = 0;
|
||||||
@ -62,7 +69,7 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
|
|||||||
if (!pWindow->force_position()) {
|
if (!pWindow->force_position()) {
|
||||||
pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w(), h(), 0);
|
pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w(), h(), 0);
|
||||||
} else {
|
} else {
|
||||||
pNativeWindow = SDL_CreateWindow(pWindow->label(), x(), y(), w(), h(), 0);
|
pNativeWindow = SDL_CreateWindow(pWindow->label(), pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h(), 0);
|
||||||
}
|
}
|
||||||
x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
|
x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
|
||||||
x->next = Fl_X::first;
|
x->next = Fl_X::first;
|
||||||
@ -94,6 +101,20 @@ void Fl_PicoSDL_Window_Driver::flush_single()
|
|||||||
SDL_RenderPresent((SDL_Renderer*)i->xid);
|
SDL_RenderPresent((SDL_Renderer*)i->xid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Fl_PicoSDL_Window_Driver::make_current()
|
||||||
|
{
|
||||||
|
fl_window = pWindow->i->xid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fl_PicoSDL_Window_Driver::show() {
|
||||||
|
if (!shown()) {
|
||||||
|
makeWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_PicoSDL_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $".
|
// End of "$Id: Fl_PicoSDL_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $".
|
||||||
//
|
//
|
@ -367,7 +367,7 @@ int Fl_Widget::test_shortcut() {
|
|||||||
return test_shortcut(label());
|
return test_shortcut(label());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FL_CFG_GFX_GDI)
|
#if defined(FL_CFG_GFX_GDI) || defined(FL_PORTING)
|
||||||
// This table must be in numeric order by fltk (X) keysym number:
|
// This table must be in numeric order by fltk (X) keysym number:
|
||||||
Fl_System_Driver::Keyname Fl_System_Driver::table[] = {
|
Fl_System_Driver::Keyname Fl_System_Driver::table[] = {
|
||||||
{' ', "Space"},
|
{' ', "Space"},
|
||||||
|
Loading…
Reference in New Issue
Block a user