From 23ddf5d6f2fbc47197b3ea61c4b7b5f158bfe6d2 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Mon, 23 Dec 2019 14:20:31 +0100 Subject: [PATCH] Correction for height and width alignment in adjustSize() --- ChangeLog | 1 + examples/background-color.cpp | 44 +++++++++++++---------------------- src/fcombobox.cpp | 19 +++++++-------- src/fwidget.cpp | 3 ++- 4 files changed, 27 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8bc288b..03c61026 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 2019-12-23 Markus Gans + * Correction for height and width alignment in adjustSize() * Better setSize() implementation in some widgets 2019-12-20 Markus Gans diff --git a/examples/background-color.cpp b/examples/background-color.cpp index 6561d3b8..79c7570a 100644 --- a/examples/background-color.cpp +++ b/examples/background-color.cpp @@ -142,35 +142,23 @@ Background::Background (finalcut::FWidget* parent) F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp) ); - red.addCallback - ( - "changed", - F_METHOD_CALLBACK (this, &Background::cb_changed) - ); + for (const auto spinbox : {&red, &green, &blue}) + { + spinbox->addCallback + ( + "changed", + F_METHOD_CALLBACK (this, &Background::cb_changed) + ); + } - green.addCallback - ( - "changed", - F_METHOD_CALLBACK (this, &Background::cb_changed) - ); - - blue.addCallback - ( - "changed", - F_METHOD_CALLBACK (this, &Background::cb_changed) - ); - - color_choice.addCallback - ( - "clicked", - F_METHOD_CALLBACK (this, &Background::cb_choice) - ); - - color_choice.addCallback - ( - "row-changed", - F_METHOD_CALLBACK (this, &Background::cb_choice) - ); + for (const auto& signal : {"row-changed", "clicked"}) + { + color_choice.addCallback + ( + signal, + F_METHOD_CALLBACK (this, &Background::cb_choice) + ); + } } //---------------------------------------------------------------------- diff --git a/src/fcombobox.cpp b/src/fcombobox.cpp index 428de30c..219440f0 100644 --- a/src/fcombobox.cpp +++ b/src/fcombobox.cpp @@ -512,17 +512,14 @@ void FComboBox::initCallbacks() F_METHOD_CALLBACK (this, &FComboBox::cb_setInputField) ); - list_window.list.addCallback - ( - "row-selected", - F_METHOD_CALLBACK (this, &FComboBox::cb_closeComboBox) - ); - - list_window.list.addCallback - ( - "clicked", - F_METHOD_CALLBACK (this, &FComboBox::cb_closeComboBox) - ); + for (const auto& signal : {"row-selected", "clicked"}) + { + list_window.list.addCallback + ( + signal, + F_METHOD_CALLBACK (this, &FComboBox::cb_closeComboBox) + ); + } } //---------------------------------------------------------------------- diff --git a/src/fwidget.cpp b/src/fwidget.cpp index b3762185..45fd34fb 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -1646,6 +1646,7 @@ void FWidget::onAccel (FAccelEvent*) //---------------------------------------------------------------------- void FWidget::onResize (FResizeEvent* ev) { + // The terminal was resized rootObject->resize(); rootObject->redraw(); ev->accept(); @@ -1779,7 +1780,7 @@ inline void FWidget::insufficientSpaceAdjust() adjust_wsize.y2_ref()--; if ( getHeight() < size_hints.min_height ) - adjust_wsize.setWidth(size_hints.min_height); + adjust_wsize.setHeight(size_hints.min_height); if ( getHeight() == 0 ) adjust_wsize.setHeight(1);