On Tue, Oct 18, 2011 at 4:49 AM, Manolo Gouy <[email protected]> wrote:
>> On Mon, Oct 17, 2011 at 4:58 AM, Manolo Gouy wrote:
>> > Could you, please, try to "restore" a window after having added
>> > this patch but without overriding show() ?
>>
>> Excellent, seems to work!
>>
>
> Thanks. The new code has been committed in r.9134.

Sorry, but I think there's something wrong with this patch.  Given the
following file:

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>


void
make(int x, int y, int w, int h, const char *label)
{
    printf("%s: wanted: %d %d\n", label, x, y);
    Fl_Window *win = new Fl_Window(x, y, w, h, label);
    win->show();
    printf("got: %d %d\n", win->x(), win->y());
}

int
main()
{
    make(2318, 22, 120, 1092, "1");
    make(2920, 22, 86, 310, "2"); // 1800, 854
    make(2440, 22, 71, 195, "3"); // 2440, 854
    make(2543, 23, 374, 767, "4");
    make(2200, 22, 118, 1006, "5");
    Fl::run();
    return 0;
}


The windows marked with comments appear at the (x, y) coordinates in
the comment, not the requested ones.  This might be tricky to
reproduce because I have a 1680x1050 monitor (macbook built in) with a
1600x1200 to the right such that the tops line up.  If you don't have
that setup maybe you can get a repro with different monitors?  Or at
least let me know what I should check out.

I've fiddled with it a bit, but it's still a mystery to me.  It's
definitely dependent on which windows are displayed, if I omit one of
the correctly placed windows, one of the incorrect ones will show up
in the requested spot.  So there's presumably some persistent state
messing things up.  Also it depends on the geometry of the monitors,
if I do the same on a vertically rotated external monitor, the
misplaced windows are misplaced in different place (along the X axis
instead of the Y axis, if I remember correctly).  And if I go set
position() on those windows they are in the right place.

I've tracked it down to these lines in Fl_cocoa.mm:make():

    crect = [[cw contentView] frame];
    w->w(int(crect.size.width));
    w->h(int(crect.size.height));
    crect = [cw frame];
    w->x(int(crect.origin.x));
    w->y(int(main_screen_height - (crect.origin.y + w->h())));

The thing is, I don't understand what crect is supposed to be so I
don't understand what this is doing.  I'll look at the docs for the
'frame' message, but maybe you'd understand this more quickly.

Thanks!

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to