summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>2002-03-09 21:33:54 +0000
committerBill Spitzak <spitzak@gmail.com>2002-03-09 21:33:54 +0000
commit1a8da69ca397bf17f5ca099910acac29e6462692 (patch)
tree8cd219e98578b3929c3c4550b505254b75b5fa9b /src
parent2addf953f0bbc24a5c106211b4a89d7df366f3fb (diff)
Same change as for fltk2.0 to fix warning messages from Xft.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1996 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx11
-rw-r--r--src/fl_font_xft.cxx52
2 files changed, 44 insertions, 19 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 7c34badea..d0eae5094 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl.cxx,v 1.24.2.41.2.22 2002/03/07 19:22:56 spitzak Exp $"
+// "$Id: Fl.cxx,v 1.24.2.41.2.23 2002/03/09 21:33:54 spitzak Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
@@ -669,6 +669,10 @@ int Fl::handle(int event, Fl_Window* window)
////////////////////////////////////////////////////////////////
// hide() destroys the X window, it does not do unmap!
+#if !defined(_WIN32) && USE_XFT
+extern void fl_destroy_xft_draw(Window);
+#endif
+
void Fl_Window::hide() {
clear_visible();
@@ -734,6 +738,9 @@ void Fl_Window::hide() {
XDestroyWindow(fl_display, x->xid);
}
#else
+# if USE_XFT
+ fl_destroy_xft_draw(x->xid);
+# endif
XDestroyWindow(fl_display, x->xid);
#endif
@@ -882,5 +889,5 @@ void Fl_Window::flush() {
}
//
-// End of "$Id: Fl.cxx,v 1.24.2.41.2.22 2002/03/07 19:22:56 spitzak Exp $".
+// End of "$Id: Fl.cxx,v 1.24.2.41.2.23 2002/03/09 21:33:54 spitzak Exp $".
//
diff --git a/src/fl_font_xft.cxx b/src/fl_font_xft.cxx
index 27a1c817b..6490a5271 100644
--- a/src/fl_font_xft.cxx
+++ b/src/fl_font_xft.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_font_xft.cxx,v 1.4.2.1 2002/03/06 18:11:01 easysw Exp $"
+// "$Id: fl_font_xft.cxx,v 1.4.2.2 2002/03/09 21:33:54 spitzak Exp $"
//
// Xft font code for the Fast Light Tool Kit (FLTK).
//
@@ -168,7 +168,6 @@ double fl_width(uchar c) {
return fl_width((const char *)(&c), 1);
}
-
#if USE_OVERLAY
// Currently Xft does not work with colormapped visuals, so this probably
// does not work unless you have a true-color overlay.
@@ -177,23 +176,42 @@ extern Colormap fl_overlay_colormap;
extern XVisualInfo* fl_overlay_visual;
#endif
+// For some reason Xft produces errors if you destroy a window whose id
+// still exists in an XftDraw structure. It would be nice if this is not
+// true, a lot of junk is needed to try to stop this:
+
+static XftDraw* draw;
+static Window draw_window;
+#if USE_OVERLAY
+static XftDraw* draw_overlay;
+static Window draw_overlay_window;
+#endif
+
+void fl_destroy_xft_draw(Window id) {
+ if (id == draw_window)
+ XftDrawChange(draw, draw_window = fl_message_window);
+#if USE_OVERLAY
+ if (id == draw_overlay_window)
+ XftDrawChange(draw_overlay, draw_overlay_window = fl_message_window);
+#endif
+}
+
void fl_draw(const char *str, int n, int x, int y) {
#if USE_OVERLAY
- static XftDraw* draw_main, * draw_overlay;
- XftDraw*& draw = fl_overlay ? draw_overlay : draw_main;
- if (!draw)
- draw = XftDrawCreate(fl_display, fl_window,
- (fl_overlay?fl_overlay_visual:fl_visual)->visual,
- fl_overlay ? fl_overlay_colormap : fl_colormap);
- else
- XftDrawChange(draw, fl_window);
-#else
- static XftDraw *draw = 0;
- if (!draw)
- draw = XftDrawCreate(fl_display, fl_window, fl_visual->visual, fl_colormap);
- else
- XftDrawChange(draw, fl_window);
+ XftDraw*& draw = fl_overlay ? draw_overlay : ::draw;
+ if (fl_overlay) {
+ if (!draw)
+ draw = XftDrawCreate(fl_display, draw_overlay_window = fl_window,
+ fl_overlay_visual->visual, fl_overlay_colormap);
+ else //if (draw_overlay_window != fl_window)
+ XftDrawChange(draw, draw_overlay_window = fl_window);
+ } else
#endif
+ if (!draw)
+ draw = XftDrawCreate(fl_display, draw_window = fl_window,
+ fl_visual->visual, fl_colormap);
+ else //if (draw_window != fl_window)
+ XftDrawChange(draw, draw_window = fl_window);
Region region = fl_clip_region();
if (region) {
@@ -215,5 +233,5 @@ void fl_draw(const char *str, int n, int x, int y) {
}
//
-// End of "$Id: fl_font_xft.cxx,v 1.4.2.1 2002/03/06 18:11:01 easysw Exp $"
+// End of "$Id: fl_font_xft.cxx,v 1.4.2.2 2002/03/09 21:33:54 spitzak Exp $"
//