Skip to content

Commit

Permalink
InputCommon: Constify Device::Input::IsDetectable function.
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-woyak committed Feb 22, 2020
1 parent 2b6a1ee commit da12f3e
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class KeyboardMouse : public Core::Device
{
}
std::string GetName() const override;
bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
ControlState GetState() const override;

private:
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/InputCommon/ControllerInterface/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Device
public:
// Things like absolute axes/ absolute mouse position should override this to prevent
// undesirable behavior in our mapping logic.
virtual bool IsDetectable() { return true; }
virtual bool IsDetectable() const { return true; }

// Implementations should return a value from 0.0 to 1.0 across their normal range.
// One input should be provided for each "direction". (e.g. 2 for each axis)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ class Device final : public Core::Device
{
public:
using AnalogInput::AnalogInput;
bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
};

class MotionInput final : public AnalogInput<float>
{
public:
using AnalogInput::AnalogInput;
bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
};

using AccelerometerInput = MotionInput;
Expand All @@ -121,7 +121,7 @@ class Device final : public Core::Device
}
}

bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }

private:
const BatteryState& m_battery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class KeyboardAndMouse : public Core::Device
{
}
std::string GetName() const override;
bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
ControlState GetState() const override;

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Touchscreen : public Core::Device
{
public:
std::string GetName() const;
bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
Axis(int pad_id, ButtonManager::ButtonType index, float neg = 1.0f)
: m_pad_id(pad_id), m_index(index), m_neg(neg)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class GenericInput : public Core::Device::Input
{
}

bool IsDetectable() override { return Detectable; }
bool IsDetectable() const override { return Detectable; }

std::string GetName() const override { return m_name; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Battery final : public Core::Device::Input
Battery(const ControlState* level) : m_level(*level) {}
std::string GetName() const override { return "Battery"; }
ControlState GetState() const override { return m_level; }
bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }

private:
const ControlState& m_level;
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class KeyboardMouse : public Core::Device
{
public:
std::string GetName() const override { return name; }
bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
Cursor(u8 index, bool positive, const float* cursor);
ControlState GetState() const override;

Expand All @@ -78,7 +78,7 @@ class KeyboardMouse : public Core::Device
{
public:
std::string GetName() const override { return name; }
bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
Axis(u8 index, bool positive, const float* axis);
ControlState GetState() const override;

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class MotionDataInput final : public AnalogInput
return std::string(motion_data_names[m_code]) + (m_range < 0 ? '-' : '+');
}

bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
};

class CursorInput final : public Axis
Expand All @@ -192,7 +192,7 @@ class CursorInput final : public Axis
return std::string("Cursor ") + char('X' + m_code) + (m_range < 0 ? '-' : '+');
}

bool IsDetectable() override { return false; }
bool IsDetectable() const override { return false; }
};

static std::thread s_hotplug_thread;
Expand Down

0 comments on commit da12f3e

Please sign in to comment.