summaryrefslogtreecommitdiff
path: root/plugingui/filebrowser.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-05-19 19:09:17 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-05-19 19:09:17 +0200
commitff83cfac10939ceba524c93d4e36f634f4bec805 (patch)
treed481913f2136bf04d2d1deb650e6bd084a531676 /plugingui/filebrowser.cc
parenta3dc9bd19f976cbc84ba3d1a16c72257b42b28ba (diff)
Make sure we don't resize to negative values.
Diffstat (limited to 'plugingui/filebrowser.cc')
-rw-r--r--plugingui/filebrowser.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc
index 8854f6e..75d717d 100644
--- a/plugingui/filebrowser.cc
+++ b/plugingui/filebrowser.cc
@@ -118,18 +118,19 @@ void FileBrowser::resize(std::size_t width, std::size_t height)
offset += btn_h;
lbl_path.resize(60, btn_h);
- lineedit.resize(width - 60 - brd, btn_h);
+ lineedit.resize(std::max((int)width - 60 - brd, 0), btn_h);
offset += brd;
listbox.move(brd, offset);
- listbox.resize(width - 1 - 2*brd, height - btn_h - 2*brd - offset);
+ listbox.resize(std::max((int)width - 1 - 2*brd, 0),
+ std::max((int)height - btn_h - 2*brd - offset, 0));
btn_esc.move(brd, height - btn_h - brd);
- btn_esc.resize((width - 1 - 2*brd) / 2 - brd / 2, btn_h);
+ btn_esc.resize(std::max(((int)width - 1 - 2*brd) / 2 - brd / 2, 0), btn_h);
btn_sel.move(brd + width / 2 - brd / 2, height - btn_h - brd);
- btn_sel.resize((width - 1 - 2*brd) / 2, btn_h);
+ btn_sel.resize(std::max((int)((int)width - 1 - 2*brd) / 2, 0), btn_h);
}
void FileBrowser::repaintEvent(RepaintEvent* repaintEvent)