Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Under certain circumstances, resize() ignored on MacOSX (1.4.x) #52

Closed
erco77 opened this issue Feb 4, 2020 · 7 comments
Closed

Under certain circumstances, resize() ignored on MacOSX (1.4.x) #52

erco77 opened this issue Feb 4, 2020 · 7 comments

Comments

@erco77
Copy link
Contributor

erco77 commented Feb 4, 2020

It seems if one does these steps in a Mac application with 1.4.x, the resize() step has no effect:

  1. Create a window with an X,Y,W,H
  2. Create some child widgets (optional)
  3. Call window->resize();
  4. Call window->show();
  5. Fl::run();

Here, step 3's new width+height values are ignored.
(size()'s width/height values are also ignored)

This is specific on Mac OSX (tested on 10.10.5), didn't try others yet.

Apparently to replicate it's important an X,Y,W,H value are specified when creating the window,
and resize()/size() must be called BEFORE show(). Changing either of those things makes it work OK.

Attached program can be built with 'fltk-config --compile resize.cpp' on the Mac to demonstrate the problem; window shows as a tiny size (25,25) instead of (380,180).
resize.zip

@erco77
Copy link
Contributor Author

erco77 commented Feb 5, 2020

Some more info: this problem fit 'git bisect' really well, since checking the window's w() value could be done after the resize() to detect the failure condition, without ever needing to open the GUI.
It zeroed in on this commit:

c66caf5dce9331fd3e011873711a768adb28cf9d is the first bad commit
commit c66caf5dce9331fd3e011873711a768adb28cf9d
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
Date:   Sun Apr 7 09:09:33 2019 +0200

    Simpler implementation of Fl_Cocoa_Window_Driver::resize()

@erco77
Copy link
Contributor Author

erco77 commented Feb 5, 2020

Oh, and for what it's worth, here's the bisect operation that was done:

1. Modified the resize.cpp program, adding this one line above Fl::run() to detect the error:

    if ( window->w() == 25 ) exit(1); else exit(0); // exit(1)=FAIL, exit(0)=OK

2. Created a script called 'bisector' in the fltk directory with the contents:

      #!/bin/sh
      make clean && ( cd src ; make -j 4 ) && ( cd test ; ../fltk-config --compile resize.cpp )
      test/resize
      exit $?

3. Ran git bisect with the start/end commits from the fltk main directory using:
      git bisect good 6838814f9e6433fc93ff73f4415fe30bbd7ed326
      git bisect bad 23484c30a9126dcda3f589cd63e3fe2ec8b41c98
      git bisect run ./bisector

@ManoloFLTK
Copy link
Contributor

That should be fixed now.

@erco77
Copy link
Contributor Author

erco77 commented Feb 7, 2020

Great, the window size is fixed.
But there's still maybe a problem: if I scale the test program with e.g. Cloverleaf(+), the window contents disappears.
(I noticed this same issue when I tried applying my own fixes, so I knew to check for it)

@ManoloFLTK
Copy link
Contributor

That should be "really" fixed now.

@erco77
Copy link
Contributor Author

erco77 commented Feb 7, 2020

Confirmed!
The combination of commit d068fbf and commit 83bd04e solved the issue, thanks Manolo.

@Albrecht-S
Copy link
Member

FTR: the mention above in issue 427 is irrelevant (unintended).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants