DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2522
Version: 1.3.0


The attached patch hides the Fl_X class under WIN32,
to complete the operation already committed for Mac OS and X11.
With the patch, FLTK must be compiled with FL_LIBRARY defined.
All libraries and test programs compile and run well with this patch
(using configure/make).

All VisualC projects should be modified also to define FL_LIBRARY
when compiling libfltk, libfltk_gl and libfltk_images,
but not for any other target (not even fluid).
I can't do that because I don't have access to MSWin IDEs.

Could someone commit these changes and modify MSWin IDE projects 
accordingly ?

Did I understand well that, with VisualC, application programs
compiled with -DFL_LIBRARY to get access to the Fl_X class
would fail at link time or run time ?
Clearly, such problem does not arise with gcc.

The Fl_X class is mentionned in the doc only for the X11 platform,
where an application program can be compiled with -DFL_LIBRARY
without problem. Thus I believe there no urgent need to add a new
compile time variable to give access to FLTK internals.


Link: http://www.fltk.org/str.php?L2522
Version: 1.3.0
Index: src/Fl_win32.cxx
===================================================================
--- src/Fl_win32.cxx    (revision 8265)
+++ src/Fl_win32.cxx    (working copy)
@@ -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
Index: FL/win32.H
===================================================================
--- FL/win32.H  (revision 8241)
+++ FL/win32.H  (working copy)
@@ -35,6 +35,11 @@
 #endif // !Fl_X_H
 
 #include <windows.h>
+typedef HRGN Fl_Region;
+typedef HWND Window;
+
+#ifdef FL_LIBRARY // this part is included only when compiling the FLTK library
+
 // In some of the distributions, the gcc header files are missing some stuff:
 #ifndef LPMINMAXINFO
 #define LPMINMAXINFO MINMAXINFO*
@@ -45,14 +50,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 +66,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 +94,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
+
+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 +120,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 +136,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;
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to