Instantiate the right Fl_Window_Driver.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11195 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2016-02-19 22:21:02 +00:00
parent a072a412a1
commit 052401a34e
18 changed files with 66 additions and 17 deletions

View File

@ -34,6 +34,7 @@
#define FL_DOUBLE_WINDOW 0xF1 ///< double window type id #define FL_DOUBLE_WINDOW 0xF1 ///< double window type id
class Fl_X; class Fl_X;
class Fl_Window_Driver;
class Fl_RGB_Image; class Fl_RGB_Image;
class Fl_Shared_Image; class Fl_Shared_Image;
@ -69,8 +70,9 @@ class FL_EXPORT Fl_Window : public Fl_Group {
int fullscreen_screen_right; int fullscreen_screen_right;
friend class Fl_X; friend class Fl_X;
friend class Fl_Window_Driver;
friend class Fl_Paged_Device; friend class Fl_Paged_Device;
Fl_X *i; // points at the system-specific stuff Fl_Window_Driver *i; // points at the system-specific stuff
struct icon_data { struct icon_data {
const void *legacy_icon; const void *legacy_icon;

View File

@ -27,13 +27,17 @@
#include <FL/x.H> #include <FL/x.H>
class Fl_Window;
/** /**
\brief A base class for platform specific window handling code. \brief A base class for platform specific window handling code.
*/ */
class FL_EXPORT Fl_Window_Driver : public Fl_X { class FL_EXPORT Fl_Window_Driver : public Fl_X {
public: public:
Fl_Window_Driver(); Fl_Window_Driver(Fl_Window *);
virtual ~Fl_Window_Driver(); virtual ~Fl_Window_Driver();
static Fl_Window_Driver *newWindowDriver(Fl_Window *);
}; };

View File

@ -149,7 +149,7 @@ public:
int wait_for_expose; int wait_for_expose;
NSCursor *cursor; NSCursor *cursor;
static Fl_X* first; static Fl_X* first;
static Fl_X* i(const Fl_Window* w) {return w->i;} static Fl_X* i(const Fl_Window* w) {return (Fl_X*)w->i;}
static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&); static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
static void make(Fl_Window*); static void make(Fl_Window*);
void flush(); void flush();

View File

@ -79,6 +79,7 @@ set(CPPFILES
Fl_Value_Slider.cxx Fl_Value_Slider.cxx
Fl_Widget.cxx Fl_Widget.cxx
Fl_Window.cxx Fl_Window.cxx
Fl_Window_Driver.cxx
Fl_Window_fullscreen.cxx Fl_Window_fullscreen.cxx
Fl_Window_hotspot.cxx Fl_Window_hotspot.cxx
Fl_Window_iconize.cxx Fl_Window_iconize.cxx

View File

@ -47,6 +47,7 @@
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Screen_Driver.H> #include <FL/Fl_Screen_Driver.H>
#include <FL/Fl_Window_Driver.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/Fl_Tooltip.H> #include <FL/Fl_Tooltip.H>
#include <FL/x.H> #include <FL/x.H>

View File

@ -22,7 +22,7 @@
// equivalent (but totally different) crap for MSWindows is in Fl_win32.cxx // equivalent (but totally different) crap for MSWindows is in Fl_win32.cxx
#include <config.h> #include <config.h>
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/x.H> #include <FL/Fl_Window_Driver.H>
#include <FL/Fl_RGB_Image.H> #include <FL/Fl_RGB_Image.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <stdlib.h> #include <stdlib.h>

View File

@ -24,7 +24,7 @@
#include <FL/Fl.H> #include <FL/Fl.H>
Fl_Window_Driver::Fl_Window_Driver() Fl_Window_Driver::Fl_Window_Driver(Fl_Window *win)
{ {
} }

View File

@ -16,7 +16,7 @@
// http://www.fltk.org/str.php // http://www.fltk.org/str.php
// //
#include <FL/x.H> #include <FL/Fl_Window_Driver.H>
extern char fl_show_iconic; // in Fl_x.cxx extern char fl_show_iconic; // in Fl_x.cxx

View File

@ -36,7 +36,7 @@ extern "C" {
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/x.H> #include <FL/Fl_Window_Driver.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/Fl_Tooltip.H> #include <FL/Fl_Tooltip.H>
#include <FL/Fl_Printer.H> #include <FL/Fl_Printer.H>
@ -2946,7 +2946,7 @@ void Fl_X::make(Fl_Window* w)
yp -= by+bt; yp -= by+bt;
} }
Fl_X* x = new Fl_X; Fl_Window_Driver *x = Fl_Window_Driver::newWindowDriver(w);
x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows
x->region = 0; x->region = 0;
x->subRect(0); x->subRect(0);

View File

@ -24,6 +24,7 @@
#ifndef FL_DOXYGEN #ifndef FL_DOXYGEN
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Window_Driver.H>
#include <FL/fl_utf8.h> #include <FL/fl_utf8.h>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
@ -1900,7 +1901,7 @@ Fl_X* Fl_X::make(Fl_Window* w) {
} else if (Fl::grab()) parent = fl_xid(Fl::grab()); } else if (Fl::grab()) parent = fl_xid(Fl::grab());
} }
Fl_X* x = new Fl_X; Fl_Window_Driver *x = Fl_Window_Driver::newWindowDriver(w);
x->other_xid = 0; x->other_xid = 0;
x->setwindow(w); x->setwindow(w);
x->region = 0; x->region = 0;

View File

@ -2285,7 +2285,7 @@ void Fl_Window::fullscreen_off_x(int X, int Y, int W, int H) {
void fl_fix_focus(); // in Fl.cxx void fl_fix_focus(); // in Fl.cxx
Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) { Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) {
Fl_X* xp = new Fl_X; Fl_Window_Driver *x = Fl_Window_Driver::newWindowDriver(win);
xp->xid = winxid; xp->xid = winxid;
xp->other_xid = 0; xp->other_xid = 0;
xp->setwindow(win); xp->setwindow(win);

View File

@ -21,6 +21,19 @@
#include "Fl_Cocoa_Window_Driver.h" #include "Fl_Cocoa_Window_Driver.h"
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
{
return new Fl_Cocoa_Window_Driver(w);
}
Fl_Cocoa_Window_Driver::Fl_Cocoa_Window_Driver(Fl_Window *win)
: Fl_Window_Driver(win)
{
}
// //
// End of "$Id$". // End of "$Id$".
// //

View File

@ -25,7 +25,7 @@
#ifndef FL_COCOA_WINDOW_DRIVER_H #ifndef FL_COCOA_WINDOW_DRIVER_H
#define FL_COCOA_WINDOW_DRIVER_H #define FL_COCOA_WINDOW_DRIVER_H
#include <FL/x.H> #include <FL/Fl_Window_Driver.H>
/* /*
Move everything here that manages the native window interface. Move everything here that manages the native window interface.
@ -42,9 +42,10 @@
? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx? ? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx?
*/ */
class FL_EXPORT Fl_Cocoa_Window_Driver : public Fl_X class FL_EXPORT Fl_Cocoa_Window_Driver : public Fl_Window_Driver
{ {
public: public:
Fl_Cocoa_Window_Driver(Fl_Window*);
}; };

View File

@ -21,6 +21,18 @@
#include "Fl_WinAPI_Window_Driver.h" #include "Fl_WinAPI_Window_Driver.h"
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
{
return new Fl_WinAPI_Window_Driver(w);
}
Fl_WinAPI_Window_Driver::Fl_WinAPI_Window_Driver(Fl_Window *win)
: Fl_Window_Driver(win)
{
}
// //
// End of "$Id$". // End of "$Id$".
// //

View File

@ -25,7 +25,7 @@
#ifndef FL_WINAPI_WINDOW_DRIVER_H #ifndef FL_WINAPI_WINDOW_DRIVER_H
#define FL_WINAPI_WINDOW_DRIVER_H #define FL_WINAPI_WINDOW_DRIVER_H
#include <FL/x.H> #include <FL/Fl_Window_Driver.H>
/* /*
Move everything here that manages the native window interface. Move everything here that manages the native window interface.
@ -42,9 +42,10 @@
? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx? ? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx?
*/ */
class FL_EXPORT Fl_WinAPI_Window_Driver : public Fl_X class FL_EXPORT Fl_WinAPI_Window_Driver : public Fl_Window_Driver
{ {
public: public:
Fl_WinAPI_Window_Driver(Fl_Window*);
}; };

View File

@ -21,6 +21,18 @@
#include "Fl_X11_Window_Driver.h" #include "Fl_X11_Window_Driver.h"
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
{
return new Fl_X11_Window_Driver(w);
}
Fl_X11_Window_Driver::Fl_X11_Window_Driver(Fl_Window *win)
: Fl_Window_Driver(win)
{
}
// //
// End of "$Id$". // End of "$Id$".
// //

View File

@ -25,7 +25,7 @@
#ifndef FL_X11_WINDOW_DRIVER_H #ifndef FL_X11_WINDOW_DRIVER_H
#define FL_X11_WINDOW_DRIVER_H #define FL_X11_WINDOW_DRIVER_H
#include <FL/x.H> #include <FL/Fl_Window_Driver.H>
/* /*
Move everything here that manages the native window interface. Move everything here that manages the native window interface.
@ -42,9 +42,10 @@
? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx? ? where do we handle the interface between OpenGL/DirectX and Cocoa/WIN32/Glx?
*/ */
class FL_EXPORT Fl_X11_Window_Driver : public Fl_X class FL_EXPORT Fl_X11_Window_Driver : public Fl_Window_Driver
{ {
public: public:
Fl_X11_Window_Driver(Fl_Window*);
}; };

View File

@ -26,7 +26,7 @@
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/Fl_Pixmap.H> #include <FL/Fl_Pixmap.H>
#include <FL/Fl_RGB_Image.H> #include <FL/Fl_RGB_Image.H>
#include <FL/x.H> #include <FL/Fl_Window_Driver.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include "fl_cursor_wait.xpm" #include "fl_cursor_wait.xpm"