FLTK logo

[Library] r6669 - in branches/branch-1.3: . src

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[Library] r6669 - in branches/branch-1.3: . src fltk-dev Feb 25, 2009  
 
Author: AlbrechtS
Date: 2009-02-25 00:44:54 -0800 (Wed, 25 Feb 2009)
New Revision: 6669
Log:
 Fl_Window::draw() now doesn't reset its x/y-coordinates to 0 anymore
 before drawing itself and its children.
 
 The problem was that subwindows "lost" their x/y-coordinates during draw(),
 and child widgets couldn't get their parent window's coordinates.
 
 Currently this is needed (maybe only) in fl_set_spot() for Windows, but it
 had been solved there with a Windows-specific coordinate transformation
 (MapWindowPoints). Todo: rewrite Fl_win32.cxx/fl_set_spot().


Modified:
   branches/branch-1.3/CHANGES
   branches/branch-1.3/src/Fl_Window.cxx

Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES	2009-02-21 10:18:47 UTC (rev 6668)
+++ branches/branch-1.3/CHANGES	2009-02-25 08:44:54 UTC (rev 6669)
@@ -1,5 +1,7 @@
 CHANGES IN FLTK 1.3.0
 
+	- Fl_Window::draw() now doesn't reset its x/y-coordinates to 0
+	  anymore before drawing itself and its children.
 	- All draw() methods of widgets are now protected (STR #2142).
 	- The new configure option --enable-x11 (lowercase 'x') enables
 	  cygwin builds under Windows (with --enable-cygwin) to use X11

Modified: branches/branch-1.3/src/Fl_Window.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Window.cxx	2009-02-21 10:18:47 UTC (rev 6668)
+++ branches/branch-1.3/src/Fl_Window.cxx	2009-02-25 08:44:54 UTC (rev 6669)
@@ -99,14 +99,16 @@
 }
 
 void Fl_Window::draw() {
-  const char *savelabel = label();
-  int saveflags = flags();
-  int savex = x(); x(0);
-  int savey = y(); y(0);
-  // Make sure we don't draw the window title in the window background...
-  clear_flag(COPIED_LABEL); // do not free copied labels!
-  Fl_Widget::label(0);
-  Fl_Group::draw();
+
+  // The following is similar to Fl_Group::draw(), but ...
+  //  - we draw the box with x=0 and y=0 instead of x() and y()
+  //  - we don't draw a label
+
+  if (damage() & ~FL_DAMAGE_CHILD) {	 // draw the entire thing
+    draw_box(box(),0,0,w(),h(),color()); // draw box with x/y = 0
+  }
+  draw_children();
+
 #ifdef __APPLE_QUARTZ__
   if (!parent() && resizable() && (!size_range_set || minh!=maxh || minw!=maxw)) {
     int dx = Fl::box_dw(box())-Fl::box_dx(box());
@@ -127,11 +129,6 @@
     }
   }
 #endif
-  // Restore the label...
-  Fl_Widget::label(savelabel);
-  set_flag(saveflags);
-  y(savey);
-  x(savex);
 
 # if defined(USE_CAIRO)
   Fl::cairo_make_current(this); // checkout if an update is necessary

Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.