Skip to content

Commit

Permalink
Add initial dummy scancode implementation on Linux (DRM)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimci86 committed Jun 29, 2022
1 parent 04b16eb commit c666c83
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 6 deletions.
36 changes: 36 additions & 0 deletions src/SFML/Window/DRM/InputImplUDev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ namespace
//
event.type = inputEvent.value ? sf::Event::KeyPressed : sf::Event::KeyReleased;
event.key.code = kb;
event.key.scancode = sf::Keyboard::Scan::Unknown; // TODO: not implemented
event.key.alt = altDown();
event.key.control = controlDown();
event.key.shift = shiftDown();
Expand Down Expand Up @@ -567,6 +568,41 @@ bool InputImpl::isKeyPressed(Keyboard::Key key)
return keyMap[key];
}

////////////////////////////////////////////////////////////
bool InputImpl::isKeyPressed(Keyboard::Scancode /* code */)
{
// TODO: not implemented
err() << "sf::Keyboard::isKeyPressed(Keyboard::Scancode) is not implemented for DRM." << std::endl;
return false;
}


////////////////////////////////////////////////////////////
Keyboard::Key InputImpl::localize(Keyboard::Scancode /* code */)
{
// TODO: not implemented
err() << "sf::Keyboard::localize is not implemented for DRM." << std::endl;
return Keyboard::Unknown;
}


////////////////////////////////////////////////////////////
Keyboard::Scancode InputImpl::delocalize(Keyboard::Key /* key */)
{
// TODO: not implemented
err() << "sf::Keyboard::delocalize is not implemented for DRM." << std::endl;
return Keyboard::Scan::Unknown;
}


////////////////////////////////////////////////////////////
String InputImpl::getDescription(Keyboard::Scancode /* code */)
{
// TODO: not implemented
err() << "sf::Keyboard::getDescription is not implemented for DRM." << std::endl;
return "";
}


////////////////////////////////////////////////////////////
void InputImpl::setVirtualKeyboardVisible(bool /*visible*/)
Expand Down
30 changes: 24 additions & 6 deletions src/SFML/Window/DRM/InputImplUDev.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,37 @@ class InputImpl
public:

////////////////////////////////////////////////////////////
/// \brief Check if a key is pressed
/// \copydoc sf::Keyboard::isKeyPressed(Key)
///
/// \param key Key to check
////////////////////////////////////////////////////////////
static bool isKeyPressed(Keyboard::Key key);

////////////////////////////////////////////////////////////
/// \copydoc sf::Keyboard::isKeyPressed(Scancode)
///
/// \return True if the key is pressed, false otherwise
////////////////////////////////////////////////////////////
static bool isKeyPressed(Keyboard::Scancode code);

////////////////////////////////////////////////////////////
/// \copydoc sf::Keyboard::localize
///
////////////////////////////////////////////////////////////
static bool isKeyPressed(Keyboard::Key key);
static Keyboard::Key localize(Keyboard::Scancode code);

////////////////////////////////////////////////////////////
/// \brief Show or hide the virtual keyboard
/// \copydoc sf::Keyboard::delocalize
///
/// \param visible True to show, false to hide
////////////////////////////////////////////////////////////
static Keyboard::Scancode delocalize(Keyboard::Key key);

////////////////////////////////////////////////////////////
/// \copydoc sf::Keyboard::getDescription
///
////////////////////////////////////////////////////////////
static String getDescription(Keyboard::Scancode code);

////////////////////////////////////////////////////////////
/// \copydoc sf::Keyboard::setVirtualKeyboardVisible
///
////////////////////////////////////////////////////////////
static void setVirtualKeyboardVisible(bool visible);
Expand Down

0 comments on commit c666c83

Please sign in to comment.