Author: AlbrechtS
Date: 2011-01-17 15:52:32 -0800 (Mon, 17 Jan 2011)
New Revision: 8289
Log:
Hiding the Fl_X class under WIN32 (STR #2522).
Applied Manolo's patch, modified to use FL_INTERNALS for
explicit request in user code to expose class Fl_X.
Also changed X11 and Mac OS to use FL_INTERNALS.


Modified:
   branches/branch-1.3/FL/mac.H
   branches/branch-1.3/FL/win32.H
   branches/branch-1.3/FL/x.H
   branches/branch-1.3/documentation/src/osissues.dox
   branches/branch-1.3/src/Fl_win32.cxx

Modified: branches/branch-1.3/FL/mac.H
===================================================================
--- branches/branch-1.3/FL/mac.H        2011-01-17 22:42:34 UTC (rev 8288)
+++ branches/branch-1.3/FL/mac.H        2011-01-17 23:52:32 UTC (rev 8289)
@@ -3,7 +3,7 @@
 //
 // Mac header file for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2011 by Bill Spitzak and others.
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -53,7 +53,7 @@
 #define MAC_OS_X_VERSION_10_6 1060
 #endif
 
-#ifndef FL_LIBRARY // this part is used when compiling an application program
+#if !(defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part is used when 
compiling an application program
 
 typedef void* Fl_Region;
 typedef void* Fl_CGContextRef;
@@ -163,7 +163,7 @@
 } *fl_current_xmap;
 extern FL_EXPORT Window fl_window;
 
-#endif // FL_LIBRARY
+#endif // FL_LIBRARY || FL_INTERNALS
 
 extern FL_EXPORT Fl_CGContextRef fl_gc;
 extern FL_EXPORT class Fl_Sys_Menu_Bar *fl_sys_menu_bar;

Modified: branches/branch-1.3/FL/win32.H
===================================================================
--- branches/branch-1.3/FL/win32.H      2011-01-17 22:42:34 UTC (rev 8288)
+++ branches/branch-1.3/FL/win32.H      2011-01-17 23:52:32 UTC (rev 8289)
@@ -3,7 +3,7 @@
 //
 // WIN32 header file for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2011 by Bill Spitzak and others.
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -35,6 +35,12 @@
 #endif // !Fl_X_H
 
 #include <windows.h>
+typedef HRGN Fl_Region;
+typedef HWND Window;
+
+// this part is included only when compiling the FLTK library or if requested 
explicitly
+#if defined(FL_LIBRARY) || defined(FL_INTERNALS) 
+
 // In some of the distributions, the gcc header files are missing some stuff:
 #ifndef LPMINMAXINFO
 #define LPMINMAXINFO MINMAXINFO*
@@ -45,14 +51,9 @@
 #define VK_APPS 0x5D
 #endif
 
-#include <FL/Fl_Device.H>
-
 // some random X equivalents
-typedef HWND Window;
 typedef POINT XPoint;
 struct XRectangle {int x, y, width, height;};
-typedef HRGN Fl_Region;
-FL_EXPORT void fl_clip_region(Fl_Region);
 extern Fl_Region XRectangleRegion(int x, int y, int w, int h);
 inline void XDestroyRegion(Fl_Region r) {DeleteObject(r);}
 inline void XClipBox(Fl_Region r,XRectangle* rect) {
@@ -66,7 +67,7 @@
 #define XMapWindow(a,b) ShowWindow(b, SW_RESTORE)
 #define XUnmapWindow(a,b) ShowWindow(b, SW_HIDE)
 
-#include "Fl_Window.H"
+#include <FL/Fl_Window.H>
 // this object contains all win32-specific stuff about a window:
 // Warning: this object is highly subject to change!
 class FL_EXPORT Fl_X {
@@ -94,11 +95,18 @@
 };
 extern FL_EXPORT HCURSOR fl_default_cursor;
 extern FL_EXPORT UINT fl_wake_msg;
-inline Window fl_xid(const Fl_Window*w) {Fl_X *temp = Fl_X::i(w); return temp 
? temp->xid : 0;}
-FL_EXPORT Fl_Window* fl_find(Window xid);
 extern FL_EXPORT char fl_override_redirect; // hack into Fl_Window::make_xid()
 extern FL_EXPORT int fl_background_pixel;  // hack into Fl_Window::make_xid()
+extern FL_EXPORT HPALETTE fl_palette; // non-zero only on 8-bit displays!
+extern FL_EXPORT void fl_release_dc(HWND w, HDC dc);
+extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
 
+#endif // FL_LIBRARY || FL_INTERNALS
+
+extern FL_EXPORT Window fl_xid(const Fl_Window*w);
+FL_EXPORT Fl_Window* fl_find(Window xid);
+FL_EXPORT void fl_clip_region(Fl_Region);
+
 // most recent fl_color() or fl_rgbcolor() points at one of these:
 extern FL_EXPORT struct Fl_XMap {
   COLORREF rgb;        // this should be the type the RGB() macro returns
@@ -113,19 +121,15 @@
 extern FL_EXPORT HINSTANCE fl_display;
 extern FL_EXPORT Window fl_window;
 extern FL_EXPORT HDC fl_gc;
-extern FL_EXPORT HPALETTE fl_palette; // non-zero only on 8-bit displays!
+extern FL_EXPORT MSG fl_msg;
 extern FL_EXPORT HDC fl_GetDC(Window);
-extern FL_EXPORT MSG fl_msg;
-extern FL_EXPORT void fl_release_dc(HWND w, HDC dc);
-extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
+extern FL_EXPORT HDC fl_makeDC(HBITMAP);
 
 // off-screen pixmaps: create, destroy, draw into, copy to window
 typedef HBITMAP Fl_Offscreen;
 #define fl_create_offscreen(w, h) \
   CreateCompatibleBitmap( (fl_gc ? fl_gc : fl_GetDC(0) ) , w, h)
 
-extern FL_EXPORT HDC fl_makeDC(HBITMAP);
-
 # define fl_begin_offscreen(b) \
    HDC _sgc=fl_gc; Window _sw=fl_window; \
    Fl_Surface_Device *_ss = fl_surface; fl_display_device->set_current(); \
@@ -133,11 +137,11 @@
 
 # define fl_end_offscreen() \
    fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); 
_ss->set_current(); fl_window=_sw; fl_gc = _sgc
-   
 
+
 FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int 
srcx,int srcy);
 FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP 
pixmap,int srcx,int srcy);
-#define fl_delete_offscreen(bitmap) DeleteObject(bitmap);
+#define fl_delete_offscreen(bitmap) DeleteObject(bitmap)
 
 // Bitmap masks
 typedef HBITMAP Fl_Bitmask;

Modified: branches/branch-1.3/FL/x.H
===================================================================
--- branches/branch-1.3/FL/x.H  2011-01-17 22:42:34 UTC (rev 8288)
+++ branches/branch-1.3/FL/x.H  2011-01-17 23:52:32 UTC (rev 8289)
@@ -3,7 +3,7 @@
 //
 // X11 header file for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2011 by Bill Spitzak and others.
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -105,7 +105,7 @@
 extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, 
const uchar *data);
 extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
 
-#ifdef FL_LIBRARY
+#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
 extern FL_EXPORT Window fl_message_window;
 extern FL_EXPORT void *fl_xftfont;
 FL_EXPORT Fl_Region XRectangleRegion(int x, int y, int w, int h); // in 
fl_rect.cxx
@@ -138,7 +138,7 @@
 
 // this object contains all X-specific stuff about a window:
 // Warning: this object is highly subject to change!  
-// FL_LIBRARY must be defined to access this class.
+// FL_LIBRARY or FL_INTERNALS must be defined to access this class.
 class FL_EXPORT Fl_X {
 public:
   Window xid;
@@ -163,7 +163,7 @@
 extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid()
 extern FL_EXPORT int fl_background_pixel;  // hack into Fl_X::make_xid()
 
-#endif // FL_LIBRARY
+#endif // FL_LIBRARY || FL_INTERNALS
 
 // convert xid <-> Fl_Window:
 Window fl_xid(const Fl_Window*w);

Modified: branches/branch-1.3/documentation/src/osissues.dox
===================================================================
--- branches/branch-1.3/documentation/src/osissues.dox  2011-01-17 22:42:34 UTC 
(rev 8288)
+++ branches/branch-1.3/documentation/src/osissues.dox  2011-01-17 23:52:32 UTC 
(rev 8289)
@@ -368,7 +368,7 @@
 }
 \endcode
 
-\note Access to the Fl_X hidden class requires to \#define FL_LIBRARY
+\note Access to the Fl_X hidden class requires to \#define FL_INTERNALS
 before compilation.
 
 \subsection osissues_x_icon Setting the Icon of a Window

Modified: branches/branch-1.3/src/Fl_win32.cxx
===================================================================
--- branches/branch-1.3/src/Fl_win32.cxx        2011-01-17 22:42:34 UTC (rev 
8288)
+++ branches/branch-1.3/src/Fl_win32.cxx        2011-01-17 23:52:32 UTC (rev 
8289)
@@ -1933,6 +1933,11 @@
   return CreatePolygonRgn(pt, 4, ALTERNATE);
 }
 
+Window fl_xid(const Fl_Window *w) {
+  Fl_X *temp = Fl_X::i(w); 
+  return temp ? temp->xid : 0;
+}
+
 #ifdef USE_PRINT_BUTTON
 // to test the Fl_Printer class creating a "Print front window" button in a 
separate window
 // contains also preparePrintFront call above

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to