diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2011-08-05 09:28:29 -0400 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2011-08-05 09:28:29 -0400 |
commit | 4a021ae7d68a7b1701a6567ad14feea90b6a833f (patch) | |
tree | 13a2d9d8da8c3b95aeea62c34660d97d3b605079 | |
parent | 97fcaa47455240d4ae2c6b4a254e4d3cbccd110e (diff) |
Fix: Don't confuse FLTK when tabs overflow.
When tabs overflow width, FLTK starts resizing the last tab label. This
patch handles the case more gracefully.
-rw-r--r-- | src/ui.hh | 16 | ||||
-rw-r--r-- | src/uicmd.cc | 5 |
2 files changed, 19 insertions, 2 deletions
@@ -48,6 +48,7 @@ class CustTabs; * The resizable child get's the remaining space. */ class CustGroupHorizontal : public Fl_Group { + Fl_Widget *rsz; public: CustGroupHorizontal(int x,int y,int w ,int h,const char *l = 0) : Fl_Group(x,y,w,h,l) { }; @@ -57,13 +58,24 @@ public: int sum = 0, _x = x(); int children_ = children(); + if (resizable()) + rsz = resizable(); + for (int i=0; i < children_; i++) if (a[i] != resizable() && a[i]->visible()) sum += a[i]->w(); for (int i=0; i < children_; i++) { - if (a[i] == resizable()) { - a[i]->resize(_x, y(), w() - sum, h()); + if (a[i] == rsz) { + if (w() > sum) { + a[i]->resize(_x, y(), w()-sum, h()); + if (!resizable()) + resizable(rsz); + } else { + /* widgets overflow width */ + a[i]->resize(_x, y(), 0, h()); + resizable(NULL); + } } else { a[i]->resize(_x, y(), a[i]->w(), h()); } diff --git a/src/uicmd.cc b/src/uicmd.cc index c7bb5a8a..88dedd96 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -194,6 +194,11 @@ int CustTabs::handle(int e) a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL); ret = 1; } + } else if (e == FL_ENTER) { + /* WORKAROUND: when tabs overflow width, the resizable is set to NULL, + * and the close button loses its position. This call fixes it. */ + if (!resizable()) + rearrange(); } return (ret) ? ret : CustGroupHorizontal::handle(e); |