summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-22 09:35:51 +0000
committerManolo Gouy <Manolo>2016-03-22 09:35:51 +0000
commitb8e6c430e8bb1b4cec2f309f2835d7b81240749a (patch)
tree57f284a175cada2edb6037cfb0718b77f49d9bf7 /src/drivers
parent92d3e1e03a547850a61cddffa1eedbb626f0185e (diff)
Make sure can_xdbe() from Fl_X11_Window_Driver.cxx is called after fl_open_display().
This ensures fluid does not open the display when run with -c git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11398 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.H7
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx55
2 files changed, 32 insertions, 30 deletions
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H
index ac3d35269..8a51bbf2f 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.H
+++ b/src/drivers/X11/Fl_X11_Window_Driver.H
@@ -26,6 +26,7 @@
#define FL_X11_WINDOW_DRIVER_H
#include <FL/Fl_Window_Driver.H>
+#include <config.h> // for USE_XDBE
class Fl_Bitmap;
/*
@@ -66,7 +67,10 @@ private:
void combine_mask();
void shape_bitmap_(Fl_Image* b);
void shape_alpha_(Fl_Image* img, int offset);
- virtual void flush_double(int);
+ void flush_double(int erase_overlay);
+#ifdef USE_XDBE
+ void flush_double_dbe(int erase_overlay);
+#endif
public:
Fl_X11_Window_Driver(Fl_Window*);
@@ -83,6 +87,7 @@ public:
virtual void draw_begin();
virtual void make_current();
virtual void label(const char *name, const char *mininame);
+ virtual void destroy_double_buffer();
virtual void shape(const Fl_Image* img);
virtual void icons(const Fl_RGB_Image *icons[], int count);
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index 2fa295560..25cb50748 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -1,7 +1,7 @@
//
// "$Id$"
//
-// Definition of Apple Cocoa window driver.
+// Definition of X11 window driver.
//
// Copyright 1998-2016 by Bill Spitzak and others.
//
@@ -38,8 +38,8 @@ Window fl_window;
#if USE_XDBE
#include <X11/extensions/Xdbe.h>
-// whether the Xdbe extension is usable
-// DO NOT call this if the window is not mapped! [why not? I see it OK on Debian and Darwin (MG)]
+// whether the Xdbe extension is usable.
+// DO NOT call this if the window is not mapped, because we do not want fluid to open the display.
static int can_xdbe()
{
static int tried = 0;
@@ -47,7 +47,6 @@ static int can_xdbe()
if (!tried) {
tried = 1;
int event_base, error_base;
- fl_open_display();
if (!XdbeQueryExtension(fl_display, &event_base, &error_base)) return 0;
Drawable root = RootWindow(fl_display,fl_screen);
int numscreens = 1;
@@ -63,27 +62,11 @@ static int can_xdbe()
return use_xdbe;
}
-class Fl_Xdbe_Window_Driver : public Fl_X11_Window_Driver {
- virtual void flush_double(int erase_overlay);
-public:
- Fl_Xdbe_Window_Driver(Fl_Window *win) : Fl_X11_Window_Driver(win) {}
- virtual void destroy_double_buffer();
- virtual ~Fl_Xdbe_Window_Driver() {}
-};
-
-void Fl_Xdbe_Window_Driver::destroy_double_buffer() {
- Fl_X *i = Fl_X::i(pWindow);
- XdbeDeallocateBackBufferName(fl_display, i->other_xid);
- i->other_xid = 0;
-}
-
-void Fl_Xdbe_Window_Driver::flush_double(int erase_overlay)
+void Fl_X11_Window_Driver::flush_double_dbe(int erase_overlay)
{
- if (!pWindow->shown()) return;
pWindow->make_current(); // make sure fl_gc is non-zero
Fl_X *i = Fl_X::i(pWindow);
- if (!i) return; // window not yet created
if (!i->other_xid) {
i->other_xid = XdbeAllocateBackBufferName(fl_display, fl_xid(pWindow), XdbeCopied);
i->backbuffer_bad = 1;
@@ -112,13 +95,21 @@ void Fl_Xdbe_Window_Driver::flush_double(int erase_overlay)
#endif // USE_XDBE
+void Fl_X11_Window_Driver::destroy_double_buffer() {
+#if USE_XDBE
+ if (can_xdbe()) {
+ Fl_X *i = Fl_X::i(pWindow);
+ XdbeDeallocateBackBufferName(fl_display, i->other_xid);
+ i->other_xid = 0;
+ }
+ else
+#endif // USE_XDBE
+ Fl_Window_Driver::destroy_double_buffer();
+}
+
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
{
- return
-#if USE_XDBE
- can_xdbe() ? new Fl_Xdbe_Window_Driver(w) :
-#endif
- new Fl_X11_Window_Driver(w);
+ return new Fl_X11_Window_Driver(w);
}
@@ -203,15 +194,17 @@ void Fl_X11_Window_Driver::draw_begin()
void Fl_X11_Window_Driver::flush_double()
{
- flush_double(0);
+ if (!pWindow->shown()) return;
+#if USE_XDBE
+ if (can_xdbe()) flush_double_dbe(0); else
+#endif
+ flush_double(0);
}
void Fl_X11_Window_Driver::flush_double(int erase_overlay)
{
- if (!pWindow->shown()) return;
pWindow->make_current(); // make sure fl_gc is non-zero
Fl_X *i = Fl_X::i(pWindow);
- if (!i) return; // window not yet created
if (!i->other_xid) {
i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h());
pWindow->clear_damage(FL_DAMAGE_ALL);
@@ -230,8 +223,12 @@ void Fl_X11_Window_Driver::flush_double(int erase_overlay)
void Fl_X11_Window_Driver::flush_overlay()
{
+ if (!pWindow->shown()) return;
int erase_overlay = (pWindow->damage()&FL_DAMAGE_OVERLAY);
pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY));
+#if USE_XDBE
+ if (can_xdbe()) flush_double_dbe(erase_overlay); else
+#endif
flush_double(erase_overlay);
Fl_Overlay_Window *oWindow = pWindow->as_overlay_window();
if (oWindow->overlay_ == oWindow) oWindow->draw_overlay();