DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Active]

Link: http://www.fltk.org/str.php?L2304
Version: 1.3-current
Fix Version: 1.3.0 (r7884)


I committed more clipping fixes in r 7884, so that it's now all in
r7882-7884.

I also uploaded an extended test program (scroll_1b.cxx). This commit
should fix all problems for standard box drawing functions, but it is
not a complete fix for all drawing functions that could have clipping
problems with coordinates > 32767.

Further info for those interested why this is needed: X11 uses only
coordinates in 16-bit coordinate space. Although all windows are within
this space, we can have problems if we have large objects (like Fl_Group
in the example program) that extend beyond the visible area (inside an
Fl_Scroll widget). FLTK then relies an clipping by the graphic subsystem,
but X11 can't handle this. Thus, we must do our own clipping (at least
to 16-bit coordinates) before calling X11 functions.

To devs: please take a look at the changes, maybe I've overlooked
something. Thanks.

If there are no more comments in the next days, this STR will be closed
with resolution.


Link: http://www.fltk.org/str.php?L2304
Version: 1.3-current
Fix Version: 1.3.0 (r7884)
/*
  This demo program shows the drawing bug (STR #2304) on Linux, but works
  well on Windows (Mac currently untested).

  Compile and run with:

  fltk-config --compile scroll_1a.cxx && ./scroll_1

  The bug can only be seen if the Fl_Scroll widget has a Fl_Group child,
  and this Fl_Group becomes more than 32767 pixels high by adding more than
  about 1310 child widgets and resizing the Fl_Group accordingly.

  It works okay, if the Fl_Group is omitted and the Fl_Box child widgets
  are added directly to the Fl_Scroll widget.

  Please define USE_GROUP to 1 to see the bug
  and define USE_GROUP to 0 to see that it works okay

*/

#define USE_GROUP 1     // 0 works okay, 1 shows the bug

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Scroll.H>

#include <stdio.h>

#define SIZE_V (3200)
#define SIZE_H (100)
#define WIDTH (330)
#define HEIGHT (25)

int main(int argc, char **argv)
{
  char text[40];
  Fl_Double_Window *win = new Fl_Double_Window (250,320,"Scrolling test");
    win->begin();
    Fl_Scroll *scroll = new Fl_Scroll (20, 15, 200, 250);
    // scroll->type(FL_VERTICAL);
    scroll->box(FL_BORDER_BOX);
    scroll->color(fl_lighter(FL_BLUE));
    scroll->begin();
    Fl_Box *b1 = new Fl_Box(21,16,3,3); // top left in Fl_Scroll
    b1->box(FL_FLAT_BOX);
    b1->color(FL_RED);
#if USE_GROUP
    Fl_Group *g = new Fl_Group(24,15,SIZE_H*WIDTH+10,SIZE_V*HEIGHT+10);
    g->box(FL_DOWN_BOX);
    g->color(FL_YELLOW);
    g->begin();
#endif
    int x;
    int y = 20;
    for (int i=0; i<SIZE_V; i++, y += HEIGHT) {
      x = 30;
      for (int j=0; j<SIZE_H; j++, x += WIDTH) {
        sprintf (text,"%d,%d (%d,%d)",i,j,x,y);
        Fl_Box *b = new Fl_Box(x,y,WIDTH,HEIGHT);
        b->copy_label(text);
        b->box(FL_BORDER_BOX);
      }
    }
#if USE_GROUP
    g->end();
    printf("g=%p, g->resizable() = %p\n",g,g->resizable());
#endif
    Fl_Box *b2 = new Fl_Box(20,y+5,3,3);        // bottom left in Fl_Scroll
    b2->box(FL_FLAT_BOX);
    b2->color(FL_GREEN);

    scroll->end();
    printf ("max. y = %d\n",y);
  win->end();
  win->resizable(scroll);
  win->show(argc,argv);
  return Fl::run();
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to