Skip to content

Commit

Permalink
Continue implementation of class Fl_Window_Driver according to Albrec…
Browse files Browse the repository at this point in the history
…ht's plan.

This removes a bunch of
   friend class Fl_XXX_Window_Driver;
declarations from Fl_Window.H, and therefore allows
to add a new window driver without modifying the platform-independent code.

The Fl_PicoXXX_Window_Driver classes  have been modified but not tested ==> test needed.

File Fl_X11_Window_Driver.cxx contained this:

// DO NOT call this if the window is not mapped!
static int can_xdbe()
 { ... }

The new code does call can_xdbe() before any window is mapped,
and does work. Since can_xdbe() asks the X server whether it supports
the Xdbe extension, I don't see why this should not work without a
mapped window. This point should be clarified by the author of
"DO NOT call this if the window is not mapped!".


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11388 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Mar 20, 2016
1 parent 5103053 commit 4baca53
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 171 deletions.
6 changes: 0 additions & 6 deletions FL/Fl_Window.H
Expand Up @@ -72,12 +72,6 @@ class FL_EXPORT Fl_Window : public Fl_Group {

friend class Fl_X;
friend class Fl_Window_Driver;
friend class Fl_X11_Window_Driver;
friend class Fl_Pico_Window_Driver;
friend class Fl_Cocoa_Window_Driver;
friend class Fl_WinAPI_Window_Driver;
friend class Fl_PicoSDL_Window_Driver;
friend class Fl_PicoAndroid_Window_Driver;
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 creatino time

Expand Down
9 changes: 9 additions & 0 deletions FL/Fl_Window_Driver.H
Expand Up @@ -54,6 +54,13 @@ public:
virtual ~Fl_Window_Driver();
static Fl_Window_Driver *newWindowDriver(Fl_Window *);

// --- accessors to private window data
int minw();
int minh();
int maxw();
int maxh();
unsigned char size_range_set();

// --- window data
virtual int decorated_w() = 0;
virtual int decorated_h() = 0;
Expand All @@ -62,8 +69,10 @@ public:
virtual void take_focus();
virtual void flush_double();
virtual void flush_overlay();
virtual void flush_single();
virtual void draw_begin();
virtual void draw_end();
void draw();

virtual Fl_X *makeWindow() { /* FIXME: move Fl_X::make(Fl_Window*) here for OSX, MSWin, and X11 */ return 0; }
virtual void wait_for_expose() {} // TODO: check
Expand Down
11 changes: 11 additions & 0 deletions src/Fl_Window_Driver.cxx
Expand Up @@ -34,6 +34,15 @@ Fl_Window_Driver::~Fl_Window_Driver()
{
}

int Fl_Window_Driver::minw() {return pWindow->minw;}
int Fl_Window_Driver::minh() {return pWindow->minh;}
int Fl_Window_Driver::maxw() {return pWindow->maxw;}
int Fl_Window_Driver::maxh() {return pWindow->maxh;}
unsigned char Fl_Window_Driver::size_range_set() {return pWindow->size_range_set;}

void Fl_Window_Driver::flush_single() { pWindow->Fl_Window::flush(); }
void Fl_Window_Driver::draw() { pWindow->draw(); }


void Fl_Window_Driver::take_focus()
{
Expand All @@ -43,11 +52,13 @@ void Fl_Window_Driver::take_focus()

void Fl_Window_Driver::flush_double()
{
flush_single();
}


void Fl_Window_Driver::flush_overlay()
{
flush_single();
}


Expand Down
4 changes: 2 additions & 2 deletions src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
Expand Up @@ -56,7 +56,7 @@ void Fl_Cocoa_Window_Driver::take_focus()


void Fl_Cocoa_Window_Driver::flush_double() {
pWindow->Fl_Window::flush();
flush_single();
}


Expand Down Expand Up @@ -115,7 +115,7 @@ void Fl_Cocoa_Window_Driver::draw_end()
// corner. This code draws a little ribbed triangle for dragging.
CGContextRef gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc();
if (fl_mac_os_version < 100700 && gc && !pWindow->parent() && pWindow->resizable() &&
(!pWindow->size_range_set || pWindow->minh!=pWindow->maxh || pWindow->minw!=pWindow->maxw)) {
(!size_range_set() || minh() != maxh() || minw() != maxw())) {
int dx = Fl::box_dw(pWindow->box())-Fl::box_dx(pWindow->box());
int dy = Fl::box_dh(pWindow->box())-Fl::box_dy(pWindow->box());
if (dx<=0) dx = 1;
Expand Down
7 changes: 0 additions & 7 deletions src/drivers/Pico/Fl_Pico_Window_Driver.H
Expand Up @@ -37,13 +37,6 @@ public:
// --- window data
virtual int decorated_w();
virtual int decorated_h();

// --- window management
virtual void flush_single();
virtual void flush_double();
virtual void flush_overlay();
virtual void draw_begin();
virtual void draw_end();
};


Expand Down
39 changes: 0 additions & 39 deletions src/drivers/Pico/Fl_Pico_Window_Driver.cxx
Expand Up @@ -25,7 +25,6 @@
#include <FL/fl_draw.h>



Fl_Pico_Window_Driver::Fl_Pico_Window_Driver(Fl_Window *win)
: Fl_Window_Driver(win)
{
Expand All @@ -50,44 +49,6 @@ int Fl_Pico_Window_Driver::decorated_h()
return pWindow->h();
}


// --- window management
void Fl_Pico_Window_Driver::flush_single()
{
Fl_X *i = Fl_X::i(pWindow);
if (!i) return;
fl_clip_region(i->region);
i->region = 0;
pWindow->draw();
}


void Fl_Pico_Window_Driver::flush_double()
{
flush_single();
}


void Fl_Pico_Window_Driver::flush_overlay()
{
flush_single();
}




void Fl_Pico_Window_Driver::draw_begin()
{
// nothing to do
}


void Fl_Pico_Window_Driver::draw_end()
{
// nothing to do
}


//
// End of "$Id: Fl_Pico_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $".
//
13 changes: 0 additions & 13 deletions src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx
Expand Up @@ -95,7 +95,6 @@ Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow()
}



void Fl_PicoAndroid_Window_Driver::flush_single()
{
glClearColor(0, 0, 0, 1);
Expand All @@ -110,18 +109,6 @@ void Fl_PicoAndroid_Window_Driver::flush_single()
}


void Fl_PicoAndroid_Window_Driver::flush_double()
{
flush_single();
}


void Fl_PicoAndroid_Window_Driver::flush_overlay()
{
flush_single();
}


void Fl_X::flush()
{
w->flush();
Expand Down
2 changes: 0 additions & 2 deletions src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.H
Expand Up @@ -43,8 +43,6 @@ public:

// --- window management
virtual void flush_single();
virtual void flush_double();
virtual void flush_overlay();
};


Expand Down
15 changes: 0 additions & 15 deletions src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx
Expand Up @@ -94,21 +94,6 @@ void Fl_PicoSDL_Window_Driver::flush_single()
SDL_RenderPresent((SDL_Renderer*)i->xid);
}


void Fl_PicoSDL_Window_Driver::flush_double()
{
flush_single();
}


void Fl_PicoSDL_Window_Driver::flush_overlay()
{
flush_single();
// draw_overlay();
}



//
// End of "$Id: Fl_PicoSDL_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $".
//
4 changes: 2 additions & 2 deletions src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
Expand Up @@ -270,7 +270,7 @@ void Fl_WinAPI_Window_Driver::flush_double()
fl_clip_region(i->region); i->region = 0;
fl_begin_offscreen(i->other_xid);
fl_graphics_driver->clip_region( 0 );
pWindow->draw();
draw();
fl_end_offscreen();
}

Expand Down Expand Up @@ -299,7 +299,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay()
fl_clip_region(i->region); i->region = 0;
fl_begin_offscreen(i->other_xid);
fl_graphics_driver->clip_region(0);
pWindow->draw();
draw();
fl_end_offscreen();
}

Expand Down
1 change: 0 additions & 1 deletion src/drivers/X11/Fl_X11_Window_Driver.H
Expand Up @@ -88,7 +88,6 @@ public:
virtual void free_icons();
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right);
virtual void wait_for_expose();
virtual void destroy_double_buffer();
};


Expand Down

0 comments on commit 4baca53

Please sign in to comment.