aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2011-08-05 09:28:26 -0400
committerJorge Arellano Cid <jcid@dillo.org>2011-08-05 09:28:26 -0400
commit97fcaa47455240d4ae2c6b4a254e4d3cbccd110e (patch)
tree2c3e7f9f503e2c505bd34236d4135a4d45dda8fe /src
parentd27ee4a09a9c0dd8a994eb3ac49cbacc7017e556 (diff)
Fix resize for the corner case of starting dillo in a tiny window
FLTK has no problem in resizing from a "fitting" size into a "compressed" one, but if it starts compressed, things go wild.
Diffstat (limited to 'src')
-rw-r--r--src/ui.hh5
-rw-r--r--src/uicmd.cc7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/ui.hh b/src/ui.hh
index 68b7a972..57611f86 100644
--- a/src/ui.hh
+++ b/src/ui.hh
@@ -31,6 +31,11 @@ typedef enum {
UI_HIDDEN = 1
} UIPanelmode;
+
+// Min size to fit the full UI
+#define UI_MIN_W 600
+#define UI_MIN_H 200
+
// Private classes
class CustProgressBox;
class CustTabs;
diff --git a/src/uicmd.cc b/src/uicmd.cc
index 864113d6..c7bb5a8a 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -210,12 +210,16 @@ UI *CustTabs::add_new_tab(UI *old_ui, int focus)
Wizard->resize(0,ctab_h,Wizard->w(),window()->h()-ctab_h);
resize(0,0,window()->w(),ctab_h); // tabbar
CloseBtn->show();
+ child(0)->size(tab_w,ctab_h);
child(0)->show(); // first tab button
window()->init_sizes();
}
+ /* The UI is constructed in a comfortable fitting size, and then resized
+ * so FLTK doesn't get confused later with even smaller dimensions! */
current(0);
- UI *new_ui = new UI(0,ctab_h,Wizard->w(),Wizard->h(),0,old_ui);
+ UI *new_ui = new UI(0,0,UI_MIN_W,UI_MIN_H,0,old_ui);
+ new_ui->resize(0,ctab_h,Wizard->w(),Wizard->h());
new_ui->tabs(this);
Wizard->add(new_ui);
new_ui->show();
@@ -276,6 +280,7 @@ void CustTabs::remove_tab(UI *ui)
// hide tabbar
ctab_h = 1;
CloseBtn->hide();
+ child(0)->size(0,0);
child(0)->hide(); // first tab button
resize(0,0,window()->w(),ctab_h); // tabbar
Wizard->resize(0,ctab_h,Wizard->w(),window()->h()-ctab_h);