summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2021-12-05 12:26:25 -0800
committerGreg Ercolano <erco@seriss.com>2021-12-05 12:26:25 -0800
commit74dd5164d3da59c99efc451438091c6a40327e0b (patch)
treea43a76016745482499e68f9e849d148a0a8472fd
parentcf58f7ae2b65cafd4185520e8a52af8fc259841e (diff)
Fixes STR #3352: "tiny window problem if child group larger than window"
-rw-r--r--src/Fl_cocoa.mm8
-rw-r--r--src/Fl_win32.cxx14
-rw-r--r--src/Fl_x.cxx8
3 files changed, 16 insertions, 14 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index e15115026..5cf74ea3e 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -2954,9 +2954,11 @@ Fl_X* Fl_Cocoa_Window_Driver::makeWindow()
} else {
if (w->resizable()) {
Fl_Widget *o = w->resizable();
- int minw = o->w(); if (minw > 100) minw = 100;
- int minh = o->h(); if (minh > 100) minh = 100;
- w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0);
+ int minw = w->w(); // minw is window's initial width
+ int minh = w->h(); // minh is window's initial height
+ int maxw = (o->w() == 0) ? minw : 0; // if resizable w()==0, disable resize w()
+ int maxh = (o->h() == 0) ? minh : 0; // if resizable h()==0, disable resize h()
+ w->size_range(minw, minh, maxw, maxh);
if (w->border()) winstyle |= NSResizableWindowMask;
} else {
w->size_range(w->w(), w->h(), w->w(), w->h());
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 9abbb5d58..ec8cca9ae 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -2069,14 +2069,12 @@ Fl_X *Fl_WinAPI_Window_Driver::makeWindow() {
} else {
if (!size_range_set()) {
if (w->resizable()) {
- Fl_Widget *o = w->resizable();
- int minw = o->w();
- if (minw > 100)
- minw = 100;
- int minh = o->h();
- if (minh > 100)
- minh = 100;
- w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0);
+ Fl_Widget *o = w->resizable();
+ int minw = w->w(); // minw is window's initial width
+ int minh = w->h(); // minh is window's initial height
+ int maxw = (o->w() == 0) ? minw : 0; // if resizable w()==0, disable resize w()
+ int maxh = (o->h() == 0) ? minh : 0; // if resizable h()==0, disable resize h()
+ w->size_range(minw, minh, maxw, maxh);
} else {
w->size_range(w->w(), w->h(), w->w(), w->h());
}
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index a57316207..55c249ecd 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -2791,9 +2791,11 @@ void Fl_X11_Window_Driver::sendxjunk() {
if (!size_range_set()) { // default size_range based on resizable():
if (w->resizable()) {
Fl_Widget *o = w->resizable();
- int minw = o->w(); if (minw > 100) minw = 100;
- int minh = o->h(); if (minh > 100) minh = 100;
- w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0);
+ int minw = w->w(); // minw is window's initial width
+ int minh = w->h(); // minh is window's initial height
+ int maxw = (o->w() == 0) ? minw : 0; // if resizable w()==0, disable resize w()
+ int maxh = (o->h() == 0) ? minh : 0; // if resizable h()==0, disable resize h()
+ w->size_range(minw, minh, maxw, maxh);
} else {
w->size_range(w->w(), w->h(), w->w(), w->h());
}