Simplification of FMouse::createMouseObject()
This commit is contained in:
parent
3d2a0c6dd2
commit
c1b2699e53
|
@ -1,6 +1,7 @@
|
|||
2020-06-06 Markus Gans <guru.mail@muenster.de>
|
||||
* Now, the terminal is not initialized before the method show()
|
||||
is called. Or you force it explicitly via the FApplication object.
|
||||
* Simplification of FMouse::createMouseObject()
|
||||
|
||||
2020-05-30 Markus Gans <guru.mail@muenster.de>
|
||||
* With the two new methods FApplication::setDarkTheme() and
|
||||
|
|
|
@ -216,7 +216,7 @@ int main (int argc, char* argv[])
|
|||
// Pointer to the global virtual terminal object
|
||||
app = &term_app;
|
||||
|
||||
if ( app->isQuit() )
|
||||
if ( finalcut::FApplication::isQuit() )
|
||||
return 0;
|
||||
|
||||
// Get screen dimension
|
||||
|
@ -267,14 +267,12 @@ int main (int argc, char* argv[])
|
|||
std::cout << "\r" << line << std::flush;
|
||||
// Generation of a logger in a shared_ptr via a pointer
|
||||
finalcut::FApplication::setLog(std::make_shared<DirectLogger>());
|
||||
// Get the shared_ptr with the base class
|
||||
std::shared_ptr<finalcut::FLog> log = finalcut::FApplication::getLog();
|
||||
const finalcut::FOptiMove& opti_move = *finalcut::FTerm::getFOptiMove();
|
||||
finalcut::printDurations(opti_move);
|
||||
delete &log;
|
||||
|
||||
// Waiting for keypress
|
||||
keyPressed();
|
||||
app = nullptr; // End of term_app object scope
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -177,40 +177,6 @@ inline bool FMouse::isInputDataPending()
|
|||
return input_data_pending;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FMouse* FMouse::createMouseObject (const mouse_type mt)
|
||||
{
|
||||
assert ( mt == FMouse::none
|
||||
|| mt == FMouse::gpm
|
||||
|| mt == FMouse::x11
|
||||
|| mt == FMouse::sgr
|
||||
|| mt == FMouse::urxvt );
|
||||
|
||||
switch ( mt )
|
||||
{
|
||||
case none:
|
||||
return nullptr;
|
||||
|
||||
case gpm:
|
||||
#ifdef F_HAVE_LIBGPM
|
||||
return new FMouseGPM;
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
|
||||
case x11:
|
||||
return new FMouseX11;
|
||||
|
||||
case sgr:
|
||||
return new FMouseSGR;
|
||||
|
||||
case urxvt:
|
||||
return new FMouseUrxvt;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMouse::clearButtonState()
|
||||
{
|
||||
|
@ -1216,12 +1182,12 @@ void FMouseUrxvt::setButtonState (const int btn, const struct timeval* time)
|
|||
FMouseControl::FMouseControl()
|
||||
{
|
||||
#ifdef F_HAVE_LIBGPM
|
||||
mouse_protocol[FMouse::gpm] = FMouse::createMouseObject(FMouse::gpm);
|
||||
mouse_protocol[FMouse::gpm] = FMouse::createMouseObject<FMouseGPM>();
|
||||
#endif
|
||||
|
||||
mouse_protocol[FMouse::x11] = FMouse::createMouseObject(FMouse::x11);
|
||||
mouse_protocol[FMouse::sgr] = FMouse::createMouseObject(FMouse::sgr);
|
||||
mouse_protocol[FMouse::urxvt] = FMouse::createMouseObject(FMouse::urxvt);
|
||||
mouse_protocol[FMouse::x11] = FMouse::createMouseObject<FMouseX11>();
|
||||
mouse_protocol[FMouse::sgr] = FMouse::createMouseObject<FMouseSGR>();
|
||||
mouse_protocol[FMouse::urxvt] = FMouse::createMouseObject<FMouseUrxvt>();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -2549,7 +2549,9 @@ void FTerm::terminalSizeChange()
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::processTermination (int signum)
|
||||
{
|
||||
init_term_object->finish();
|
||||
if ( init_term_object )
|
||||
init_term_object->finish();
|
||||
|
||||
std::fflush (stderr);
|
||||
std::fflush (stdout);
|
||||
|
||||
|
@ -2562,6 +2564,9 @@ void FTerm::processTermination (int signum)
|
|||
printExitMessage();
|
||||
}
|
||||
|
||||
if ( init_term_object )
|
||||
init_term_object->deallocationValues();
|
||||
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ class FApplication : public FWidget
|
|||
void sendQueuedEvents();
|
||||
bool eventInQueue();
|
||||
bool removeQueuedEvent (const FObject*);
|
||||
void initTerminal();
|
||||
void initTerminal() override;
|
||||
static void setDefaultTheme();
|
||||
static void setDarkTheme();
|
||||
static void closeConfirmationDialog (FWidget*, FCloseEvent*);
|
||||
|
|
|
@ -130,7 +130,8 @@ class FMouse
|
|||
bool isInputDataPending();
|
||||
|
||||
// Methods
|
||||
static FMouse* createMouseObject (const mouse_type);
|
||||
template<typename ClassT>
|
||||
static FMouse* createMouseObject ();
|
||||
void clearButtonState();
|
||||
virtual void setRawData (FKeyboard::keybuffer&) = 0;
|
||||
virtual void processEvent (struct timeval*) = 0;
|
||||
|
@ -191,6 +192,13 @@ class FMouse
|
|||
FPoint new_mouse_position{};
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
template<typename ClassT>
|
||||
inline FMouse* FMouse::createMouseObject()
|
||||
{
|
||||
return new ClassT;
|
||||
}
|
||||
|
||||
|
||||
#ifdef F_HAVE_LIBGPM
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -317,7 +317,7 @@ class FVTerm
|
|||
void processTerminalUpdate();
|
||||
static void startTerminalUpdate();
|
||||
static void finishTerminalUpdate();
|
||||
void initTerminal();
|
||||
virtual void initTerminal();
|
||||
|
||||
private:
|
||||
// Enumerations
|
||||
|
|
|
@ -374,7 +374,7 @@ class FWidget : public FVTerm, public FObject
|
|||
void setTermOffsetWithPadding();
|
||||
|
||||
// Methods
|
||||
void initTerminal();
|
||||
void initTerminal() override;
|
||||
void initDesktop();
|
||||
virtual void adjustSize();
|
||||
void adjustSizeGlobal();
|
||||
|
|
Loading…
Reference in New Issue