Fixed: build with gcc < 5.5 - std::hash<FKey>
This commit is contained in:
parent
eb61e6fec0
commit
fc7be67f2a
|
@ -813,7 +813,7 @@ void MyDialog::cb_about()
|
|||
finalcut::FMessageBox info ( "About"
|
||||
, line + L" FINAL CUT " + line + L"\n\n"
|
||||
L"Version " + libver + L"\n\n"
|
||||
L"(c) 2020 by Markus Gans"
|
||||
L"(c) 2021 by Markus Gans"
|
||||
, finalcut::FMessageBox::ButtonType::Ok
|
||||
, finalcut::FMessageBox::ButtonType::Reject
|
||||
, finalcut::FMessageBox::ButtonType::Reject
|
||||
|
@ -1046,7 +1046,7 @@ int main (int argc, char* argv[])
|
|||
{
|
||||
const finalcut::FString ver{F_VERSION}; // Library version
|
||||
const finalcut::FString title { "FINAL CUT " + ver
|
||||
+ " (C) 2020 by Markus Gans" };
|
||||
+ " (C) 2021 by Markus Gans" };
|
||||
|
||||
// Create the application object app
|
||||
finalcut::FApplication app{argc, argv};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# spec file for package finalcut
|
||||
#
|
||||
# Copyright (c) 2020 by Markus Gans
|
||||
# Copyright (c) 2021 by Markus Gans
|
||||
#
|
||||
|
||||
%define sover 0
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2020 Markus Gans *
|
||||
* Copyright 2015-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -799,6 +799,14 @@ enum class FKey : uInt32
|
|||
Incomplete = UINT32_MAX
|
||||
};
|
||||
|
||||
struct FKeyHash
|
||||
{
|
||||
std::size_t operator () (const FKey& p) const
|
||||
{
|
||||
return std::hash<uInt32>()(uInt32(p));
|
||||
}
|
||||
};
|
||||
|
||||
constexpr FKey operator >> (const FKey& k, const uInt32 n) noexcept
|
||||
{
|
||||
return FKey(uInt32(k) >> n);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2012-2020 Markus Gans *
|
||||
* Copyright 2012-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -167,7 +167,7 @@ class FDialog : public FWindow
|
|||
};
|
||||
|
||||
// Using-declaration
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>>;
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>, FKeyHash>;
|
||||
|
||||
// Constant
|
||||
static constexpr std::size_t MENU_BTN = 3;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2012-2020 Markus Gans *
|
||||
* Copyright 2012-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -166,7 +166,7 @@ class FLineEdit : public FWidget
|
|||
private:
|
||||
// Using-declaration
|
||||
using offsetPair = std::pair<std::size_t, std::size_t>;
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>>;
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>, FKeyHash>;
|
||||
|
||||
// Constants
|
||||
static constexpr auto NOT_SET = static_cast<std::size_t>(-1);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2020 Markus Gans *
|
||||
* Copyright 2014-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -275,8 +275,8 @@ class FListBox : public FWidget
|
|||
|
||||
private:
|
||||
// Using-declaration
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>>;
|
||||
using KeyMapResult = std::unordered_map<FKey, std::function<bool()>>;
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>, FKeyHash>;
|
||||
using KeyMapResult = std::unordered_map<FKey, std::function<bool()>, FKeyHash>;
|
||||
using LazyInsert = std::function<void(FListBoxItem&, FDataAccess*, std::size_t)>;
|
||||
|
||||
// Enumeration
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2020 Markus Gans *
|
||||
* Copyright 2017-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -406,8 +406,8 @@ class FListView : public FWidget
|
|||
struct Header; // forward declaration
|
||||
|
||||
// Using-declaration
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>>;
|
||||
using KeyMapResult = std::unordered_map<FKey, std::function<bool()>>;
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>, FKeyHash>;
|
||||
using KeyMapResult = std::unordered_map<FKey, std::function<bool()>, FKeyHash>;
|
||||
using HeaderItems = std::vector<Header>;
|
||||
using SortTypes = std::vector<SortType>;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2020 Markus Gans *
|
||||
* Copyright 2017-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -150,7 +150,7 @@ class FScrollView : public FWidget
|
|||
|
||||
private:
|
||||
// Using-declaration
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>>;
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>, FKeyHash>;
|
||||
|
||||
// Constants
|
||||
static constexpr std::size_t vertical_border_spacing = 2;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2018-2020 Markus Gans *
|
||||
* Copyright 2018-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -130,6 +130,16 @@ class FTermLinux final
|
|||
uChar : 4; // padding bits
|
||||
};
|
||||
|
||||
struct ModifierKeyHash
|
||||
{
|
||||
std::size_t operator () (const ModifierKey& m_key) const
|
||||
{
|
||||
uChar m{};
|
||||
std::memcpy(&m, &m_key, sizeof(uChar));
|
||||
return std::hash<uChar>()(m);
|
||||
}
|
||||
};
|
||||
|
||||
struct RGB
|
||||
{
|
||||
uChar red;
|
||||
|
@ -152,13 +162,11 @@ class FTermLinux final
|
|||
{
|
||||
std::size_t operator () (const Pair& pair) const
|
||||
{
|
||||
uChar m{};
|
||||
std::memcpy(&m, &pair.modifier, sizeof(uChar));
|
||||
size_t seed = 0;
|
||||
const auto h1 = std::hash<uChar>()(m);
|
||||
const auto h2 = std::hash<FKey>()(pair.key);
|
||||
seed ^= h1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= h2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
const auto hash1 = ModifierKeyHash()(pair.modifier);
|
||||
const auto hash2 = FKeyHash()(pair.key);
|
||||
seed ^= hash1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= hash2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2020 Markus Gans *
|
||||
* Copyright 2014-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -138,7 +138,7 @@ class FTextView : public FWidget
|
|||
|
||||
private:
|
||||
// Using-declaration
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>>;
|
||||
using KeyMap = std::unordered_map<FKey, std::function<void()>, FKeyHash>;
|
||||
|
||||
// Accessors
|
||||
std::size_t getTextHeight() const;
|
||||
|
|
Loading…
Reference in New Issue