From 9671586be02ae5327d2eb94ed827c6c5419cf7ed Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Wed, 26 Sep 2018 18:01:44 +0200 Subject: [PATCH] Build fix for non linux in FKeyboard::keyCorrection --- doc/first-steps.md | 42 ++++++++++++++++++------------------- src/fkeyboard.cpp | 4 ++-- src/ftogglebutton.cpp | 2 +- src/include/final/fobject.h | 4 ++-- test/fmouse-test.cpp | 2 ++ test/fobject-test.cpp | 6 ++++++ 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/doc/first-steps.md b/doc/first-steps.md index 3ec0d26f..27f8b0a8 100644 --- a/doc/first-steps.md +++ b/doc/first-steps.md @@ -6,8 +6,8 @@ First steps with the Final Cut widget toolkit How to use the library ---------------------- -At the beginning of this introduction to the Final Cut usage, -we start with a little example. +At the beginning of this introduction to the Final Cut +we will start with a small example. It creates an empty 30×10 character dialog. @@ -26,11 +26,11 @@ int main (int argc, char* argv[]) return app.exec(); } ``` -*(Note: Use mouse or Shift+F10 or +*(Note: Use mouse or Shift+F10 or Ctrl+^ to close the dialog)* -After entering the source code in *dialog.cpp* you can compile +After entering the source code in *dialog.cpp* you can compile the above program with gcc: ```cpp g++ -O2 -lfinal dialog.cpp -o dialog @@ -44,24 +44,24 @@ How it works ```cpp #include ``` -All final cut programs must include the *final.h* header. +All final cut programs must include the *final.h* header. ```cpp finalcut::FApplication app(argc, argv); ``` -In this line creates the `finalcut::FApplication` object `app` with -the command line arguments `argc` and `argv`. This object manages -the application main event loop. It receives keyboard and mouse events -and sends them to the target widgets. Before widgets can be created, -an application object must be created! Only one `finalcut::FApplication` +In this line creates the `finalcut::FApplication` object `app` with +the command line arguments `argc` and `argv`. This object manages +the application main event loop. It receives keyboard and mouse events +and sends them to the target widgets. Before widgets can be created, +an application object must be created! Only one `finalcut::FApplication` object should be created. The next line ```cpp finalcut::FDialog dialog(&app); ``` -creates the `finalcut::FDialog` object `dialog` with the object `app` -as parent object. The `finalcut::FDialog` class is the base class for +creates the `finalcut::FDialog` object `dialog` with the object `app` +as parent object. The `finalcut::FDialog` class is the base class for creating dialog windows. ```cpp @@ -73,28 +73,28 @@ The title bar of the dialog box gets the text "A dialog". dialog.setGeometry (25, 5, 30, 10); ``` The dialog window geometry is set to a width of 30 characters and -a height of 10 characters. The window is positioned in the terminal -at the positions x=25 and y=5. (Note: x=1 and y=1 represents the upper -left corner ) +a height of 10 characters. The window in the terminal is positioned +at the positions x=25 and y=5 (note: x=1 and y=1 represents the upper +left corner). ```cpp app.setMainWidget(&dialog); ``` -The `dialog` object is selected as the main widget for the application. -When the user closes a main widget, the application exits. +The `dialog` object is selected as the main widget for the application. +When the user closes a main widget, the application will be closed. ```cpp dialog.show(); ``` A window or widget is not visible directly after its creation. -Only the call of `show()` makes it (and its child objects, +Only the call of `show()` makes it (and its child objects, if available) visible. ```cpp return app.exec(); ``` -The last line calls `exec()` to start the application and return -the result to the operating system. When the application starts, -it enters the main event loop. This loop doesn't end until the +The last line calls `exec()` to start the application and return +the result to the operating system. When the application starts, +it enters the main event loop. This loop doesn't end until the window/application is closed. diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index d78c7dd6..e34448ee 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -515,9 +515,9 @@ int FKeyboard::keyCorrection (const int& keycode) if ( linux ) key_correction = linux->modifierKeyCorrection(keycode); else - key_correction = key; + key_correction = keycode; #else - key_correction = key; + key_correction = keycode; #endif return key_correction; diff --git a/src/ftogglebutton.cpp b/src/ftogglebutton.cpp index 0b5ab6bf..8c9f5d0d 100644 --- a/src/ftogglebutton.cpp +++ b/src/ftogglebutton.cpp @@ -64,7 +64,7 @@ FToggleButton::FToggleButton (const FString& txt, FWidget* parent) , focus_inside_group(true) , text() { - FToggleButton::setText(txt); // call own method + FToggleButton::setText(txt); // call own method init(); if ( parent && parent->isInstanceOf("FButtonGroup") ) diff --git a/src/include/final/fobject.h b/src/include/final/fobject.h index 9d0d919b..4f42c39f 100644 --- a/src/include/final/fobject.h +++ b/src/include/final/fobject.h @@ -195,8 +195,6 @@ inline bool FObject::isInstanceOf (const char classname[]) const inline bool FObject::isTimerInUpdating() const { return timer_modify_lock; } -} // namespace finalcut - //---------------------------------------------------------------------- // Operator functions for timeval @@ -252,4 +250,6 @@ static inline bool operator < (const timeval& t1, const timeval& t2) || (t1.tv_sec == t2.tv_sec && t1.tv_usec < t2.tv_usec); } +} // namespace finalcut + #endif // FOBJECT_H diff --git a/test/fmouse-test.cpp b/test/fmouse-test.cpp index d2f86991..5bb2f3d0 100644 --- a/test/fmouse-test.cpp +++ b/test/fmouse-test.cpp @@ -199,6 +199,8 @@ void FMouseTest::noArgumentTest() //---------------------------------------------------------------------- void FMouseTest::doubleClickTest() { + using finalcut::operator -; + FMouse_protected mouse; CPPUNIT_ASSERT ( mouse.getDblclickInterval() == 500000 ); // 500 ms timeval tv = { 0, 0 }; diff --git a/test/fobject-test.cpp b/test/fobject-test.cpp index 151fc35d..24f20484 100644 --- a/test/fobject-test.cpp +++ b/test/fobject-test.cpp @@ -258,6 +258,7 @@ void FObjectTest::delTest() */ finalcut::FObject* obj = new finalcut::FObject(); finalcut::FObject* child = new finalcut::FObject(obj); + CPPUNIT_ASSERT ( obj->hasChildren() ); CPPUNIT_ASSERT ( obj->numOfChildren() == 1 ); CPPUNIT_ASSERT ( obj->isChild(child) ); @@ -338,6 +339,11 @@ void FObjectTest::timeTest() //---------------------------------------------------------------------- void FObjectTest::timerTest() { + using finalcut::operator +; + using finalcut::operator -; + using finalcut::operator +=; + using finalcut::operator <; + FObject_protected t1; FObject_protected t2; int id1, id2;