small fixes

This commit is contained in:
Markus Gans 2019-07-29 02:34:58 +02:00
parent 8026f64754
commit 0ba913a23e
15 changed files with 75 additions and 14 deletions

Binary file not shown.

View File

@ -41,6 +41,14 @@ FPoint& FPoint::operator = (const FPoint& p)
return *this; return *this;
} }
//----------------------------------------------------------------------
FPoint& FPoint::operator = (FPoint&& p)
{
xpos = std::move(p.xpos);
ypos = std::move(p.ypos);
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FPoint& FPoint::operator += (const FPoint& p) FPoint& FPoint::operator += (const FPoint& p)
{ {

View File

@ -306,6 +306,16 @@ FRect& FRect::operator = (const FRect& r)
return *this; return *this;
} }
//----------------------------------------------------------------------
FRect& FRect::operator = (FRect&& r)
{
X1 = std::move(r.getX1());
Y1 = std::move(r.getY1());
X2 = std::move(r.getX2());
Y2 = std::move(r.getY2());
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRect operator + (const FRect& r, const FSize& s) FRect operator + (const FRect& r, const FSize& s)
{ {

View File

@ -41,6 +41,14 @@ FSize& FSize::operator = (const FSize& s)
return *this; return *this;
} }
//----------------------------------------------------------------------
FSize& FSize::operator = (FSize&& s)
{
width = std::move(s.width);
height = std::move(s.height);
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSize& FSize::operator += (const FSize& s) FSize& FSize::operator += (const FSize& s)
{ {

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2012-2018 Markus Gans * * Copyright 2012-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -69,6 +69,13 @@ FString::FString (const FString& s) // copy constructor
_assign (s.string); _assign (s.string);
} }
//----------------------------------------------------------------------
FString::FString (FString&& s) // move constructor
{
if ( ! s.isNull() )
_assign (std::move(s.string));
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString::FString (const std::wstring& s) FString::FString (const std::wstring& s)
{ {
@ -160,6 +167,13 @@ FString& FString::operator = (const FString& s)
return *this; return *this;
} }
//----------------------------------------------------------------------
FString& FString::operator = (FString&& s)
{
_assign (std::move(s.string));
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FString& FString::operator += (const FString& s) const FString& FString::operator += (const FString& s)
{ {

View File

@ -52,19 +52,22 @@ FTermFreeBSD::CursorStyle FTermFreeBSD::getCursorStyle()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermFreeBSD::setCursorStyle (CursorStyle style, bool hidden) bool FTermFreeBSD::setCursorStyle (CursorStyle style, bool hidden)
{ {
// Set cursor style in a BSD console // Set cursor style in a BSD console
if ( ! fsystem || ! isFreeBSDConsole() || ! change_cursorstyle ) if ( ! fsystem || ! isFreeBSDConsole() || ! change_cursorstyle )
return; return false;
cursor_style = style; cursor_style = style;
if ( hidden ) if ( hidden )
return; return false;
fsystem->ioctl (0, CONS_CURSORTYPE, &style); if ( fsystem->ioctl(0, CONS_CURSORTYPE, &style) == 0 )
return true;
else
return false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -64,10 +64,10 @@ FVTerm::term_area* FVTerm::vterm = nullptr;
FVTerm::term_area* FVTerm::vdesktop = nullptr; FVTerm::term_area* FVTerm::vdesktop = nullptr;
FVTerm::term_area* FVTerm::active_area = nullptr; FVTerm::term_area* FVTerm::active_area = nullptr;
FKeyboard* FVTerm::keyboard = nullptr; FKeyboard* FVTerm::keyboard = nullptr;
charData FVTerm::term_attribute; charData FVTerm::term_attribute{};
charData FVTerm::next_attribute; charData FVTerm::next_attribute{};
charData FVTerm::s_ch; charData FVTerm::s_ch{};
charData FVTerm::i_ch; charData FVTerm::i_ch{};
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1676,7 +1676,9 @@ charData FVTerm::generateCharacter (const FPoint& pos)
if ( tmp->attr.bit.trans_shadow ) // Transparent shadow if ( tmp->attr.bit.trans_shadow ) // Transparent shadow
{ {
// Keep the current vterm character // Keep the current vterm character
std::memcpy (&s_ch, sc, sizeof(s_ch)); if ( sc != &s_ch )
std::memcpy (&s_ch, sc, sizeof(s_ch));
s_ch.fg_color = tmp->fg_color; s_ch.fg_color = tmp->fg_color;
s_ch.bg_color = tmp->bg_color; s_ch.bg_color = tmp->bg_color;
s_ch.attr.bit.reverse = false; s_ch.attr.bit.reverse = false;

View File

@ -60,6 +60,7 @@ class FPoint
// Overloaded operators // Overloaded operators
FPoint& operator = (const FPoint&); FPoint& operator = (const FPoint&);
FPoint& operator = (FPoint&&);
FPoint& operator += (const FPoint&); FPoint& operator += (const FPoint&);
FPoint& operator -= (const FPoint&); FPoint& operator -= (const FPoint&);

View File

@ -70,6 +70,7 @@ class FRect
// Overloaded operators // Overloaded operators
FRect& operator = (const FRect&); FRect& operator = (const FRect&);
FRect& operator = (FRect&&);
friend FRect operator + (const FRect&, const FSize&); friend FRect operator + (const FRect&, const FSize&);
friend FRect operator - (const FRect&, const FSize&); friend FRect operator - (const FRect&, const FSize&);

View File

@ -62,6 +62,7 @@ class FSize
// Overloaded operators // Overloaded operators
FSize& operator = (const FSize&); FSize& operator = (const FSize&);
FSize& operator = (FSize&&);
FSize& operator += (const FSize&); FSize& operator += (const FSize&);
FSize& operator -= (const FSize&); FSize& operator -= (const FSize&);

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2012-2018 Markus Gans * * Copyright 2012-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -89,6 +89,7 @@ class FString
explicit FString (std::size_t); explicit FString (std::size_t);
FString (std::size_t, wchar_t); FString (std::size_t, wchar_t);
FString (const FString&); // implicit conversion copy constructor FString (const FString&); // implicit conversion copy constructor
FString (FString&&); // implicit conversion move constructor
FString (const std::wstring&); // implicit conversion constructor FString (const std::wstring&); // implicit conversion constructor
FString (const wchar_t[]); // implicit conversion constructor FString (const wchar_t[]); // implicit conversion constructor
FString (const std::string&); // implicit conversion constructor FString (const std::string&); // implicit conversion constructor
@ -102,6 +103,7 @@ class FString
// Overloaded operators // Overloaded operators
FString& operator = (const FString&); FString& operator = (const FString&);
FString& operator = (FString&&);
const FString& operator += (const FString&); const FString& operator += (const FString&);

View File

@ -104,7 +104,7 @@ class FTermFreeBSD final
static bool isFreeBSDConsole(); static bool isFreeBSDConsole();
// Mutators // Mutators
static void setCursorStyle (CursorStyle, bool); static bool setCursorStyle (CursorStyle, bool);
static void enableChangeCursorStyle(); static void enableChangeCursorStyle();
static void disableChangeCursorStyle(); static void disableChangeCursorStyle();
static void enableMetaSendsEscape(); static void enableMetaSendsEscape();

View File

@ -716,6 +716,8 @@ void ftermfreebsdTest::freebsdConsoleTest()
if ( waitpid(pid, 0, WUNTRACED) != pid ) if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl; std::cerr << "waitpid error" << std::endl;
} }
delete fsys;
} }

View File

@ -1108,7 +1108,7 @@ int FSystemTest::ioctl (int fd, uLong request, ...)
fn->height = terminal_font.height; fn->height = terminal_font.height;
fn->charcount = terminal_font.charcount; fn->charcount = terminal_font.charcount;
if ( fn->data ) if ( fn->data && terminal_font.data )
std::memcpy (fn->data, terminal_font.data, font_data_size); std::memcpy (fn->data, terminal_font.data, font_data_size);
terminal_font.op = KD_FONT_OP_GET; terminal_font.op = KD_FONT_OP_GET;
@ -1121,7 +1121,7 @@ int FSystemTest::ioctl (int fd, uLong request, ...)
terminal_font.height = fn->height; terminal_font.height = fn->height;
terminal_font.charcount = fn->charcount; terminal_font.charcount = fn->charcount;
if ( fn->data ) if ( fn->data && terminal_font.data )
std::memcpy (terminal_font.data, fn->data, font_data_size); std::memcpy (terminal_font.data, fn->data, font_data_size);
terminal_font.op = KD_FONT_OP_SET; terminal_font.op = KD_FONT_OP_SET;
@ -1620,6 +1620,7 @@ void FTermLinuxTest::linuxConsoleTest()
} }
linux.finish(); linux.finish();
delete fsys;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1761,6 +1762,7 @@ void FTermLinuxTest::linuxCursorStyleTest()
} }
linux.finish(); linux.finish();
delete fsys;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2037,6 +2039,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
} }
linux.finish(); linux.finish();
delete fsys;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2180,6 +2183,7 @@ void FTermLinuxTest::linuxFontTest()
} }
linux.finish(); linux.finish();
delete fsys;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2651,6 +2655,7 @@ void FTermLinuxTest::modifierKeyTest()
mod_key.shift = 1; mod_key.shift = 1;
mod_keycode = linux.modifierKeyCorrection(keycode); mod_keycode = linux.modifierKeyCorrection(keycode);
CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_space ); CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_space );
delete fsys;
} }
// Put the test suite in the registry // Put the test suite in the registry

View File

@ -380,6 +380,8 @@ void ftermopenbsdTest::netbsdConsoleTest()
if ( waitpid(pid, 0, WUNTRACED) != pid ) if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl; std::cerr << "waitpid error" << std::endl;
} }
delete fsys;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -486,6 +488,8 @@ void ftermopenbsdTest::openbsdConsoleTest()
if ( waitpid(pid, 0, WUNTRACED) != pid ) if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl; std::cerr << "waitpid error" << std::endl;
} }
delete fsys;
} }