diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-08 22:10:40 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-08 22:10:40 +0300 |
commit | 172d111d1cdb8414da9a3a81b2626db2b14c9e5e (patch) | |
tree | 1d8785c1f31a732bbe30abe287765709a0983099 | |
parent | Fix variable shadowing that caused the key response to be null (diff) | |
download | nheko-172d111d1cdb8414da9a3a81b2626db2b14c9e5e.tar.xz |
Add -Wshadow
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Splitter.cc | 14 |
2 files changed, 8 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 495f80ba..30e2cd18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,7 @@ if(NOT MSVC) -Wall \ -Wextra \ -Werror \ + -Wshadow \ -pipe \ -pedantic \ -fsized-deallocation \ diff --git a/src/Splitter.cc b/src/Splitter.cc index 8a625227..7b6c9573 100644 --- a/src/Splitter.cc +++ b/src/Splitter.cc @@ -88,12 +88,12 @@ Splitter::onSplitterMoved(int pos, int index) rightMoveCount_ += 1; if (rightMoveCount_ > moveEventLimit_) { - auto left = widget(0); - auto pos = left->mapFromGlobal(QCursor::pos()); + auto left = widget(0); + auto cursorPosition = left->mapFromGlobal(QCursor::pos()); // if we are coming from the right, the cursor should // end up on the first widget. - if (left->rect().contains(pos)) { + if (left->rect().contains(cursorPosition)) { left->setMinimumWidth(ui::sidebar::SmallSize); left->setMaximumWidth(ui::sidebar::SmallSize); @@ -104,9 +104,9 @@ Splitter::onSplitterMoved(int pos, int index) leftMoveCount_ += 1; if (leftMoveCount_ > moveEventLimit_) { - auto left = widget(0); - auto right = widget(1); - auto pos = right->mapFromGlobal(QCursor::pos()); + auto left = widget(0); + auto right = widget(1); + auto cursorPosition = right->mapFromGlobal(QCursor::pos()); // We move the start a little further so the transition isn't so abrupt. auto extended = right->rect(); @@ -114,7 +114,7 @@ Splitter::onSplitterMoved(int pos, int index) // if we are coming from the left, the cursor should // end up on the second widget. - if (extended.contains(pos) && + if (extended.contains(cursorPosition) && right->size().width() >= conf::sideBarCollapsePoint + ui::sidebar::NormalSize) { left->setMinimumWidth(ui::sidebar::NormalSize); |