Build fix for non linux in FKeyboard::keyCorrection

This commit is contained in:
Markus Gans 2018-09-26 18:01:44 +02:00
parent 1eff94aead
commit 9671586be0
6 changed files with 34 additions and 26 deletions

View File

@ -6,8 +6,8 @@ First steps with the Final Cut widget toolkit
How to use the library How to use the library
---------------------- ----------------------
At the beginning of this introduction to the Final Cut usage, At the beginning of this introduction to the Final Cut
we start with a little example. we will start with a small example.
It creates an empty 30×10 character dialog. It creates an empty 30×10 character dialog.
@ -26,11 +26,11 @@ int main (int argc, char* argv[])
return app.exec(); return app.exec();
} }
``` ```
*(Note: Use mouse or <kbd>Shift</kbd>+<kbd>F10</kbd> or *(Note: Use mouse or <kbd>Shift</kbd>+<kbd>F10</kbd> or
<kbd>Ctrl</kbd>+<kbd>^</kbd> to close the dialog)* <kbd>Ctrl</kbd>+<kbd>^</kbd> 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: the above program with gcc:
```cpp ```cpp
g++ -O2 -lfinal dialog.cpp -o dialog g++ -O2 -lfinal dialog.cpp -o dialog
@ -44,24 +44,24 @@ How it works
```cpp ```cpp
#include <final/final.h> #include <final/final.h>
``` ```
All final cut programs must include the *final.h* header. All final cut programs must include the *final.h* header.
```cpp ```cpp
finalcut::FApplication app(argc, argv); finalcut::FApplication app(argc, argv);
``` ```
In this line creates the `finalcut::FApplication` object `app` with In this line creates the `finalcut::FApplication` object `app` with
the command line arguments `argc` and `argv`. This object manages the command line arguments `argc` and `argv`. This object manages
the application main event loop. It receives keyboard and mouse events the application main event loop. It receives keyboard and mouse events
and sends them to the target widgets. Before widgets can be created, and sends them to the target widgets. Before widgets can be created,
an application object must be created! Only one `finalcut::FApplication` an application object must be created! Only one `finalcut::FApplication`
object should be created. object should be created.
The next line The next line
```cpp ```cpp
finalcut::FDialog dialog(&app); finalcut::FDialog dialog(&app);
``` ```
creates the `finalcut::FDialog` object `dialog` with the object `app` creates the `finalcut::FDialog` object `dialog` with the object `app`
as parent object. The `finalcut::FDialog` class is the base class for as parent object. The `finalcut::FDialog` class is the base class for
creating dialog windows. creating dialog windows.
```cpp ```cpp
@ -73,28 +73,28 @@ The title bar of the dialog box gets the text "A dialog".
dialog.setGeometry (25, 5, 30, 10); dialog.setGeometry (25, 5, 30, 10);
``` ```
The dialog window geometry is set to a width of 30 characters and 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 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 at the positions x=25 and y=5 (note: x=1 and y=1 represents the upper
left corner ) left corner).
```cpp ```cpp
app.setMainWidget(&dialog); app.setMainWidget(&dialog);
``` ```
The `dialog` object is selected as the main widget for the application. The `dialog` object is selected as the main widget for the application.
When the user closes a main widget, the application exits. When the user closes a main widget, the application will be closed.
```cpp ```cpp
dialog.show(); dialog.show();
``` ```
A window or widget is not visible directly after its creation. 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. if available) visible.
```cpp ```cpp
return app.exec(); return app.exec();
``` ```
The last line calls `exec()` to start the application and return The last line calls `exec()` to start the application and return
the result to the operating system. When the application starts, the result to the operating system. When the application starts,
it enters the main event loop. This loop doesn't end until the it enters the main event loop. This loop doesn't end until the
window/application is closed. window/application is closed.

View File

@ -515,9 +515,9 @@ int FKeyboard::keyCorrection (const int& keycode)
if ( linux ) if ( linux )
key_correction = linux->modifierKeyCorrection(keycode); key_correction = linux->modifierKeyCorrection(keycode);
else else
key_correction = key; key_correction = keycode;
#else #else
key_correction = key; key_correction = keycode;
#endif #endif
return key_correction; return key_correction;

View File

@ -64,7 +64,7 @@ FToggleButton::FToggleButton (const FString& txt, FWidget* parent)
, focus_inside_group(true) , focus_inside_group(true)
, text() , text()
{ {
FToggleButton::setText(txt); // call own method FToggleButton::setText(txt); // call own method
init(); init();
if ( parent && parent->isInstanceOf("FButtonGroup") ) if ( parent && parent->isInstanceOf("FButtonGroup") )

View File

@ -195,8 +195,6 @@ inline bool FObject::isInstanceOf (const char classname[]) const
inline bool FObject::isTimerInUpdating() const inline bool FObject::isTimerInUpdating() const
{ return timer_modify_lock; } { return timer_modify_lock; }
} // namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Operator functions for timeval // 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); || (t1.tv_sec == t2.tv_sec && t1.tv_usec < t2.tv_usec);
} }
} // namespace finalcut
#endif // FOBJECT_H #endif // FOBJECT_H

View File

@ -199,6 +199,8 @@ void FMouseTest::noArgumentTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMouseTest::doubleClickTest() void FMouseTest::doubleClickTest()
{ {
using finalcut::operator -;
FMouse_protected mouse; FMouse_protected mouse;
CPPUNIT_ASSERT ( mouse.getDblclickInterval() == 500000 ); // 500 ms CPPUNIT_ASSERT ( mouse.getDblclickInterval() == 500000 ); // 500 ms
timeval tv = { 0, 0 }; timeval tv = { 0, 0 };

View File

@ -258,6 +258,7 @@ void FObjectTest::delTest()
*/ */
finalcut::FObject* obj = new finalcut::FObject(); finalcut::FObject* obj = new finalcut::FObject();
finalcut::FObject* child = new finalcut::FObject(obj); finalcut::FObject* child = new finalcut::FObject(obj);
CPPUNIT_ASSERT ( obj->hasChildren() ); CPPUNIT_ASSERT ( obj->hasChildren() );
CPPUNIT_ASSERT ( obj->numOfChildren() == 1 ); CPPUNIT_ASSERT ( obj->numOfChildren() == 1 );
CPPUNIT_ASSERT ( obj->isChild(child) ); CPPUNIT_ASSERT ( obj->isChild(child) );
@ -338,6 +339,11 @@ void FObjectTest::timeTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FObjectTest::timerTest() void FObjectTest::timerTest()
{ {
using finalcut::operator +;
using finalcut::operator -;
using finalcut::operator +=;
using finalcut::operator <;
FObject_protected t1; FObject_protected t1;
FObject_protected t2; FObject_protected t2;
int id1, id2; int id1, id2;