From 4cccc6527baae526779acbd95648a02caf61fe9b Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sat, 23 Jul 2016 20:56:20 +0200 Subject: [PATCH] Small code improvements --- src/fapp.cpp | 38 +++++++++++++++++++------------------- src/fdialog.cpp | 3 +-- src/fmenuitem.cpp | 2 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/fapp.cpp b/src/fapp.cpp index 76004c01..2a27fd5d 100644 --- a/src/fapp.cpp +++ b/src/fapp.cpp @@ -434,7 +434,7 @@ void FApplication::processKeyboardEvent() } //---------------------------------------------------------------------- -int FApplication::modifierKeyCorrection (int& key) +int FApplication::modifierKeyCorrection (int& key_id) { // get the current modifier key state getModifierKey(); @@ -442,11 +442,11 @@ int FApplication::modifierKeyCorrection (int& key) if ( ! m.shift && ! m.ctrl && ! m.alt ) { - return key; + return key_id; } else if ( m.shift && ! m.ctrl && ! m.alt ) { - switch ( key ) + switch ( key_id ) { case fc::Fkey_up: return fc::Fkey_sr; // Shift+Up @@ -479,12 +479,12 @@ int FApplication::modifierKeyCorrection (int& key) return fc::Fkey_snext; // Shift+PgDn default: - return key; + return key_id; } } else if ( ! m.shift && m.ctrl && ! m.alt ) { - switch ( key ) + switch ( key_id ) { case fc::Fkey_up: return fc::Fckey_up; // Ctrl+Up @@ -517,12 +517,12 @@ int FApplication::modifierKeyCorrection (int& key) return fc::Fckey_npage; // Ctrl+PgDn default: - return key; + return key_id; } } else if ( ! m.shift && ! m.ctrl && m.alt ) { - switch ( key ) + switch ( key_id ) { case fc::Fkey_up: return fc::Fmkey_up; // Meta+Up @@ -555,12 +555,12 @@ int FApplication::modifierKeyCorrection (int& key) return fc::Fmkey_npage; // Meta+PgDn default: - return key; + return key_id; } } else if ( m.shift && m.ctrl && ! m.alt ) { - switch ( key ) + switch ( key_id ) { case fc::Fkey_up: return fc::Fckey_sup; // Shift+Ctrl+Up @@ -593,12 +593,12 @@ int FApplication::modifierKeyCorrection (int& key) return fc::Fckey_snpage; // Shift+Ctrl+PgDn default: - return key; + return key_id; } } else if ( m.shift && ! m.ctrl && m.alt ) { - switch ( key ) + switch ( key_id ) { case fc::Fkey_up: return fc::Fmkey_sup; // Shift+Meta+Up @@ -631,12 +631,12 @@ int FApplication::modifierKeyCorrection (int& key) return fc::Fmkey_snpage; // Shift+Meta+PgDn default: - return key; + return key_id; } } else if ( ! m.shift && m.ctrl && m.alt ) { - switch ( key ) + switch ( key_id ) { case fc::Fkey_up: return fc::Fcmkey_up; // Ctrl+Meta+Up @@ -669,12 +669,12 @@ int FApplication::modifierKeyCorrection (int& key) return fc::Fcmkey_npage; // Ctrl+Meta+PgDn default: - return key; + return key_id; } } else if ( m.shift && m.ctrl && m.alt ) { - switch ( key ) + switch ( key_id ) { case fc::Fkey_up: return fc::Fcmkey_sup; // Shift+Ctrl+Meta+Up @@ -707,11 +707,11 @@ int FApplication::modifierKeyCorrection (int& key) return fc::Fcmkey_snpage; // Shift+Ctrl+Meta+PgDn default: - return key; + return key_id; } } - return key; + return key_id; } //---------------------------------------------------------------------- @@ -719,8 +719,8 @@ void FApplication::processDialogSwitchAccelerator() { if ( key >= fc::Fmkey_1 && key <= fc::Fmkey_9 ) { - int n = key - fc::Fmkey_0; - int s = dialog_list->size(); + uLong n = uLong(key - fc::Fmkey_0); + uLong s = dialog_list->size(); if ( s > 0 && s >= n ) { diff --git a/src/fdialog.cpp b/src/fdialog.cpp index c96407a8..945cb8d9 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -807,7 +807,6 @@ void FDialog::onAccel (FAccelEvent*) if ( ! this->isHiddenWindow() && ! this->isActiveWindow() ) { FWindow::setActiveWindow(this); - FWidget* focus_widget = this->getFocusWidget(); FWindow::raiseWindow (this); if ( focus_widget ) @@ -1101,7 +1100,7 @@ void FDialog::setGeometry (int x, int y, int w, int h, bool adjust) //---------------------------------------------------------------------- FWidget* FDialog::getFocusWidget() const { - return static_cast(focus_widget); + return focus_widget; } //---------------------------------------------------------------------- diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index ccda8132..b014cb88 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -267,7 +267,7 @@ void FMenuItem::createDialogList (FMenu* winmenu) if ( win ) { - int n = std::distance(begin, iter); + int n = int(std::distance(begin, iter)); FString win_title = win->getText(); FMenuItem* win_item = new FMenuItem (win_title, winmenu);