Separating platform-dependent from platform-independent code: make src/Fl.cxx cross-platform.

File src/Fl_win32.cxx is now compiled instead of included in Fl.cxx.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11420 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2016-03-25 13:08:48 +00:00
parent 2530120d7d
commit a69133d317
12 changed files with 87 additions and 107 deletions
-7
View File
@@ -65,13 +65,6 @@ class Fl_Screen_Driver;
# define FL_SOCKET int
#endif
// Pointers you can use to change FLTK to a foreign language.
// Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
extern FL_EXPORT const char* fl_local_ctrl;
extern FL_EXPORT const char* fl_local_meta;
extern FL_EXPORT const char* fl_local_alt;
extern FL_EXPORT const char* fl_local_shift;
/** \defgroup callback_functions Callback function typedefs
\brief Typedefs defined in <FL/Fl.H> for callback or handler functions passed as function parameters.
+7
View File
@@ -25,7 +25,14 @@
#define FL_SYSTEM_DRIVER_H
#include <FL/Fl_Device.H>
#include <FL/Fl_Export.H>
// Pointers you can use to change FLTK to a foreign language.
// Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
extern FL_EXPORT const char* fl_local_alt;
extern FL_EXPORT const char* fl_local_ctrl;
extern FL_EXPORT const char* fl_local_meta;
extern FL_EXPORT const char* fl_local_shift;
/**
\brief A base class for platform specific window handling code.
+2 -1
View File
@@ -98,7 +98,6 @@ set(CPPFILES
Fl_lock.cxx
Fl_own_colormap.cxx
Fl_visual.cxx
Fl_x.cxx
filename_absolute.cxx
filename_expand.cxx
filename_ext.cxx
@@ -182,6 +181,7 @@ if (USE_X11)
drivers/Xlib/Fl_Translated_Xlib_Graphics_Driver.cxx
drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx
drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx
Fl_x.cxx
)
if (USE_XFT)
set(DRIVER_FILES ${DRIVER_FILES}
@@ -275,6 +275,7 @@ else ()
drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx
Fl_win32.cxx
)
set(DRIVER_HEADER_FILES
drivers/WinAPI/Fl_WinAPI_System_Driver.H
+13 -64
View File
@@ -16,29 +16,17 @@
// http://www.fltk.org/str.php
//
#include <config.h>
#include "config_lib.h"
/* We require Windows 2000 features (e.g. VK definitions) */
#if defined(WIN32)
# if !defined(WINVER) || (WINVER < 0x0500)
# ifdef WINVER
# undef WINVER
# endif
# define WINVER 0x0500
# endif
# if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT 0x0500
# endif
#endif
// recent versions of MinGW warn: "Please include winsock2.h before windows.h",
// hence we must include winsock2.h before FL/Fl.H (A.S. Dec. 2010, IMM May 2011)
#if defined(WIN32) && !defined(__CYGWIN__)
# include <winsock2.h>
#ifdef WIN32
#elif defined(__APPLE__)
#elif defined(USE_SDL)
# pragma message "FL_SDL: implement the FLTK core in its own file"
#elif defined(ANDROID)
# pragma message "ANDROID: implement the FLTK core in its own file"
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the FLTK core in its own file"
# include "Fl_porting.cxx"
#endif
#include <FL/Fl.H>
@@ -47,6 +35,7 @@
#include <FL/Fl_Window.H>
#include <FL/Fl_Tooltip.H>
#include <FL/x.H>
#include <FL/fl_draw.H>
#include <ctype.h>
#include <stdlib.h>
@@ -56,27 +45,8 @@
# include <stdio.h>
#endif // DEBUG || DEBUG_WATCH
#ifdef WIN32
#include <FL/Fl_Graphics_Driver.H> // for fl_graphics_driver
#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - window driver and main loop
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement global variables for your platform here"
#else // X11
#endif
#ifdef WIN32
# include <ole2.h>
void fl_free_fonts(void);
HBRUSH fl_brush_action(int action);
void fl_cleanup_pens(void);
void fl_release_dc(HWND,HDC);
void fl_cleanup_dc_list(void);
#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform functions
#endif // WIN32
//
// Runtime configuartion flags
// Runtime configuration flags
//
#ifdef FL_CFG_GFX_XLIB
bool Fl::cfg_gfx_xlib = 1;
@@ -152,24 +122,11 @@ bool Fl::cfg_sys_win32 = 1;
bool Fl::cfg_sys_win32 = 0;
#endif
//
// Globals...
//
// Pointers you can use to change FLTK to a foreign language.
// Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
#if !defined(__APPLE__) || defined(FL_DOXYGEN)
const char* fl_local_alt = "Alt"; ///< string pointer used in shortcuts, you can change it to another language
const char* fl_local_ctrl = "Ctrl"; ///< string pointer used in shortcuts, you can change it to another language
const char* fl_local_meta = "Meta"; ///< string pointer used in shortcuts, you can change it to another language
const char* fl_local_shift = "Shift"; ///< string pointer used in shortcuts, you can change it to another language
#else
const char* fl_local_alt = "\xe2\x8c\xa5\\"; // U+2325 (option key)
const char* fl_local_ctrl = "\xe2\x8c\x83\\"; // U+2303 (up arrowhead)
const char* fl_local_meta = "\xe2\x8c\x98\\"; // U+2318 (place of interest sign)
const char* fl_local_shift = "\xe2\x87\xa7\\"; // U+21E7 (upwards white arrow)
#endif
Fl_Widget *fl_selection_requestor;
#ifndef FL_DOXYGEN
Fl_Widget *Fl::belowmouse_,
@@ -1039,7 +996,6 @@ void fl_fix_focus() {
}
}
extern Fl_Widget *fl_selection_requestor; // from Fl_x.cxx
// This function is called by ~Fl_Widget() and by Fl_Widget::deactivate()
// and by Fl_Widget::hide(). It indicates that the widget does not want
@@ -1459,8 +1415,6 @@ void Fl::paste(Fl_Widget &receiver) {
}
////////////////////////////////////////////////////////////////
#include <FL/fl_draw.H>
void Fl_Widget::redraw() {
damage(FL_DAMAGE_ALL);
}
@@ -1577,11 +1531,6 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
}
#ifdef WIN32
# include "Fl_win32.cxx"
#endif
//
// The following methods allow callbacks to schedule the deletion of
// widgets at "safe" times.
-3
View File
@@ -84,9 +84,6 @@ static void clipboard_check(void);
static unsigned make_current_counts = 0; // if > 0, then Fl_Window::make_current() can be called only once
static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y, int w, int h);
// make this available on all platforms to make code maintainability easier
/*extern*/ class Fl_Widget *fl_selection_requestor;
int fl_mac_os_version = Fl_X::calc_mac_os_version(); // the version number of the running Mac OS X (e.g., 100604 for 10.6.4)
// public variables
+35 -7
View File
@@ -20,12 +20,37 @@
// in. Search other files for "WIN32" or filenames ending in _win32.cxx
// for other system-specific code.
// This file must be #include'd in Fl.cxx and not compiled separately.
#if defined(WIN32) and !defined(FL_DOXYGEN)
/* We require Windows 2000 features (e.g. VK definitions) */
# if !defined(WINVER) || (WINVER < 0x0500)
# ifdef WINVER
# undef WINVER
# endif
# define WINVER 0x0500
# endif
# if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT 0x0500
# endif
// recent versions of MinGW warn: "Please include winsock2.h before windows.h",
#if !defined(__CYGWIN__)
# include <winsock2.h>
#endif
#include <windows.h>
#include <ole2.h>
void fl_free_fonts(void);
void fl_release_dc(HWND,HDC);
void fl_cleanup_dc_list(void);
#ifndef FL_DOXYGEN
#include <FL/Fl.H>
#include <FL/Fl_Window_Driver.H>
#include <src/Drivers/WinAPI//Fl_WinAPI_Window_Driver.H>
#include <FL/Fl_Graphics_Driver.H> // for fl_graphics_driver
#include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H"
#include <FL/fl_utf8.h>
#include <FL/Fl_Window.H>
#include <FL/fl_draw.H>
@@ -63,6 +88,12 @@
#include <ole2.h>
#include <shellapi.h>
extern bool fl_clipboard_notify_empty(void);
extern void fl_trigger_clipboard_notify(int source);
extern HBRUSH fl_brush_action(int action);
extern void fl_cleanup_pens(void);
//
// USE_ASYNC_SELECT - define it if you have WSAAsyncSelect()...
// USE_ASYNC_SELECT is OBSOLETED in 1.3 for the following reasons:
@@ -85,9 +116,6 @@
for async mode proper operation, not mentioning the side effects...
*/
// make this available on all platforms to make code maintainability easier
class Fl_Widget *fl_selection_requestor;
// Internal functions
static void fl_clipboard_notify_target(HWND wnd);
static void fl_clipboard_notify_untarget(HWND wnd);
@@ -2467,7 +2495,7 @@ void preparePrintFront(void)
}
#endif // USE_PRINT_BUTTON
#endif // FL_DOXYGEN
#endif // defined(WIN32) and !defined(FL_DOXYGEN)
//
// End of "$Id$".
+4 -20
View File
@@ -16,25 +16,7 @@
// http://www.fltk.org/str.php
//
#include <config.h>
// make this available on all platforms to make code maintainability easier
class Fl_Widget *fl_selection_requestor;
#ifdef WIN32
//# include "Fl_win32.cxx"
#elif defined(__APPLE__) // PORTME: Fl_System_Driver - platform window driver
// PORTME: Fl_Screen_Driver
// PORTME: Fl_Window_Driver
//# include "Fl_mac.cxx" // now Fl_cocoa.mm
#elif defined(USE_SDL)
# pragma message "FL_SDL: implement the FLTK core in its own file"
#elif defined(ANDROID)
# pragma message "ANDROID: implement the FLTK core in its own file"
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the FLTK core in its own file"
# include "Fl_porting.cxx"
#elif !defined(FL_DOXYGEN)
#if !defined(FL_DOXYGEN)
# define CONSOLIDATE_MOTION 1
/**** Define this if your keyboard lacks a backspace key... ****/
@@ -89,6 +71,8 @@ static bool have_xfixes = false;
# include <X11/extensions/Xrender.h>
# endif
extern Fl_Widget *fl_selection_requestor;
////////////////////////////////////////////////////////////////
// interface to poll/select call:
@@ -2986,7 +2970,7 @@ static int unused = prepare_print_button();
#endif // USE_PRINT_BUTTON
#endif
#endif // !defined(FL_DOXYGEN)
//
// End of "$Id$".
+5 -5
View File
@@ -117,7 +117,6 @@ CPPFILES = \
Fl_lock.cxx \
Fl_own_colormap.cxx \
Fl_visual.cxx \
Fl_x.cxx \
filename_absolute.cxx \
filename_expand.cxx \
filename_ext.cxx \
@@ -252,7 +251,8 @@ XLIBCPPFILES = \
drivers/X11/Fl_X11_Window_Driver.cxx \
drivers/X11/Fl_X11_Screen_Driver.cxx \
drivers/Posix/Fl_Posix_System_Driver.cxx \
drivers/Posix/Fl_Posix_Printer_Driver.cxx
drivers/Posix/Fl_Posix_Printer_Driver.cxx \
Fl_x.cxx
XLIBFONTFILES = \
drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx
@@ -274,7 +274,8 @@ GDICPPFILES = \
drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx \
drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx \
drivers/WinAPI/Fl_WinAPI_System_Driver.cxx \
drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx
drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx \
Fl_win32.cxx
PSCPPFILES = \
drivers/PostScript/Fl_PostScript.cxx \
@@ -576,7 +577,7 @@ include makedepend
Fl_get_key.o: Fl_get_key_mac.cxx Fl_get_key_win32.cxx
Fl_Native_File_Chooser.o : Fl_Native_File_Chooser_WIN32.cxx
Fl_Native_File_Chooser_MAC.o: Fl_Native_File_Chooser_MAC.mm
Fl.o: Fl_win32.cxx
Fl_win32.o: Fl_win32.cxx
Fl_cocoa.o: Fl_cocoa.mm
fl_color.o:
fl_dnd.o: fl_dnd_win32.cxx fl_dnd_x.cxx
@@ -625,7 +626,6 @@ fl_vertex.o: ../FL/mac.H ../FL/win32.H
Fl_visual.o: ../FL/mac.H ../FL/win32.H
Fl_Window_fullscreen.o: ../FL/mac.H ../FL/win32.H
Fl_Window_iconize.o: ../FL/mac.H ../FL/win32.H
Fl_x.o: ../FL/mac.H ../FL/win32.H
gl_draw.o: ../FL/mac.H ../FL/win32.H
gl_start.o: ../FL/mac.H ../FL/win32.H
@@ -20,6 +20,14 @@
#include "../../config_lib.h"
#include "Fl_Darwin_System_Driver.H"
//const char* fl_local_alt = "\xe2\x8c\xa5\\"; // U+2325 (option key)
const char* fl_local_alt = "\\"; // U+2325 (option key)
//const char* fl_local_ctrl = "\xe2\x8c\x83\\"; // U+2303 (up arrowhead)
const char* fl_local_ctrl = "\\"; // U+2303 (up arrowhead)
//const char* fl_local_meta = "\xe2\x8c\x98\\"; // U+2318 (place of interest sign)
const char* fl_local_meta = "\\"; // U+2318 (place of interest sign)
//const char* fl_local_shift = "\xe2\x87\xa7\\"; // U+21E7 (upwards white arrow)
const char* fl_local_shift = "\\"; // U+21E7 (upwards white arrow)
//
// End of "$Id$".
@@ -20,6 +20,12 @@
#include "../../config_lib.h"
#include "Fl_Posix_System_Driver.H"
// Pointers you can use to change FLTK to a foreign language.
// Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
const char* fl_local_alt = "Alt"; ///< string pointer used in shortcuts, you can change it to another language
const char* fl_local_ctrl = "Ctrl"; ///< string pointer used in shortcuts, you can change it to another language
const char* fl_local_meta = "Meta"; ///< string pointer used in shortcuts, you can change it to another language
const char* fl_local_shift = "Shift"; ///< string pointer used in shortcuts, you can change it to another language
//
// End of "$Id$".
@@ -20,6 +20,12 @@
#include "../../config_lib.h"
#include "Fl_WinAPI_System_Driver.H"
#if !defined(FL_DOXYGEN)
const char* fl_local_alt = "Alt";
const char* fl_local_ctrl = "Ctrl";
const char* fl_local_meta = "Meta";
const char* fl_local_shift = "Shift";
#endif
//
// End of "$Id$".
+1
View File
@@ -36,6 +36,7 @@
#include <FL/Fl_Widget.H>
#include <FL/Fl_Button.H>
#include <FL/fl_draw.H>
#include <FL/Fl_System_Driver.H>
#include <stdlib.h>
#include <ctype.h>
#include "flstring.h"