diff options
author | FeralChild64 <unknown> | 2022-10-14 13:22:04 +0300 |
---|---|---|
committer | kcgen <1557255+kcgen@users.noreply.github.com> | 2022-10-22 21:15:34 +0300 |
commit | ffc06cae7a0665c08f363c4cb2c6a364fdccd640 (patch) | |
tree | 457b21b0adda1b36abe761521f9f04c42dbfcdd0 /include | |
parent | 8dbfbf9e7a6c9ef4ad476967a2d705731457ecc6 (diff) |
Fix mouse code formatting
Diffstat (limited to 'include')
-rw-r--r-- | include/mouse.h | 169 |
1 files changed, 81 insertions, 88 deletions
diff --git a/include/mouse.h b/include/mouse.h index ad93aa28c..12b3b5e51 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -30,7 +30,7 @@ // Initialization, configuration // *************************************************************************** -void MOUSE_Init(Section * ); +void MOUSE_Init(Section *); void MOUSE_AddConfigSection(const config_ptr_t &); // *************************************************************************** @@ -38,35 +38,35 @@ void MOUSE_AddConfigSection(const config_ptr_t &); // *************************************************************************** enum class MouseInterfaceId : uint8_t { - DOS, // emulated DOS mouse driver - PS2, // PS/2 mouse (this includes VMware mouse protocol) - COM1, // serial mouse - COM2, - COM3, - COM4, - - First = DOS, - Last = COM4, - None = UINT8_MAX + DOS, // emulated DOS mouse driver + PS2, // PS/2 mouse (this includes VMware mouse protocol) + COM1, // serial mouse + COM2, + COM3, + COM4, + + First = DOS, + Last = COM4, + None = UINT8_MAX }; -constexpr uint8_t num_mouse_interfaces = static_cast<uint8_t>(MouseInterfaceId::Last) + 1; - +constexpr uint8_t num_mouse_interfaces = static_cast<uint8_t>(MouseInterfaceId::Last) + + 1; enum class MouseMapStatus : uint8_t { - HostPointer, - Mapped, // single physical mouse mapped to emulated port - Disconnected, // physical mouse used to be mapped, but got unplugged - Disabled + HostPointer, + Mapped, // single physical mouse mapped to emulated port + Disconnected, // physical mouse used to be mapped, but got unplugged + Disabled }; // *************************************************************************** // Notifications from external subsystems - all should go via these methods // *************************************************************************** -void MOUSE_EventMoved(const float x_rel, const float y_rel, +void MOUSE_EventMoved(const float x_rel, const float y_rel, const uint16_t x_abs, const uint16_t y_abs); -void MOUSE_EventMoved(const float x_rel, const float y_rel, +void MOUSE_EventMoved(const float x_rel, const float y_rel, const MouseInterfaceId device_id); void MOUSE_EventButton(const uint8_t idx, const bool pressed); @@ -74,8 +74,7 @@ void MOUSE_EventButton(const uint8_t idx, const bool pressed, const MouseInterfaceId device_id); void MOUSE_EventWheel(const int16_t w_rel); -void MOUSE_EventWheel(const int16_t w_rel, - const MouseInterfaceId device_id); +void MOUSE_EventWheel(const int16_t w_rel, const MouseInterfaceId device_id); void MOUSE_NotifyBooting(); @@ -91,7 +90,8 @@ void MOUSE_NewScreenParams(const uint16_t clip_x, const uint16_t clip_y, // Information for the GFX subsystem // *************************************************************************** -bool MOUSE_IsUsingSeamlessDriver(); // if driver with seamless pointer support is running +bool MOUSE_IsUsingSeamlessDriver(); // if driver with seamless pointer support + // is running bool MOUSE_IsUsingSeamlessSetting(); // if user selected seamless mode is in effect // *************************************************************************** @@ -126,98 +126,91 @@ class MousePhysical; class MouseInterfaceInfoEntry final { public: - - bool IsEmulated() const; - bool IsMapped() const; - bool IsMapped(const uint8_t device_idx) const; - bool IsMappedDeviceDisconnected() const; - - MouseInterfaceId GetInterfaceId() const; - MouseMapStatus GetMapStatus() const; - const std::string &GetMappedDeviceName() const; - int8_t GetSensitivityX() const; // -99 to +99 - int8_t GetSensitivityY() const; // -99 to +99 - uint16_t GetMinRate() const; // 10-500, 0 for none - uint16_t GetRate() const; // current rate, 10-500, 0 for N/A + bool IsEmulated() const; + bool IsMapped() const; + bool IsMapped(const uint8_t device_idx) const; + bool IsMappedDeviceDisconnected() const; + + MouseInterfaceId GetInterfaceId() const; + MouseMapStatus GetMapStatus() const; + const std::string &GetMappedDeviceName() const; + int8_t GetSensitivityX() const; // -99 to +99 + int8_t GetSensitivityY() const; // -99 to +99 + uint16_t GetMinRate() const; // 10-500, 0 for none + uint16_t GetRate() const; // current rate, 10-500, 0 for N/A private: + friend class MouseInterface; + MouseInterfaceInfoEntry(const MouseInterfaceId interface_id); - friend class MouseInterface; - MouseInterfaceInfoEntry(const MouseInterfaceId interface_id); - - const uint8_t idx; - const MouseInterface &Interface() const; - const MousePhysical &MappedPhysical() const; + const uint8_t idx; + const MouseInterface &Interface() const; + const MousePhysical &MappedPhysical() const; }; class MousePhysicalInfoEntry final { public: - - bool IsMapped() const; - bool IsDeviceDisconnected() const; - const std::string &GetDeviceName() const; + bool IsMapped() const; + bool IsDeviceDisconnected() const; + const std::string &GetDeviceName() const; private: + friend class ManyMouseGlue; + MousePhysicalInfoEntry(const uint8_t idx); - friend class ManyMouseGlue; - MousePhysicalInfoEntry(const uint8_t idx); - - const uint8_t idx; - const MousePhysical &Physical() const; + const uint8_t idx; + const MousePhysical &Physical() const; }; class MouseControlAPI final { public: + // Always destroy the object once it is not needed anymore + // (configuration tool finishes it's job) and we are returning + // to normal code execution! - // Always destroy the object once it is not needed anymore - // (configuration tool finishes it's job) and we are returning - // to normal code execution! - - MouseControlAPI(); - ~MouseControlAPI(); + MouseControlAPI(); + ~MouseControlAPI(); - // Empty list = performs operation on all emulated interfaces - typedef std::vector<MouseInterfaceId> ListIDs; + // Empty list = performs operation on all emulated interfaces + typedef std::vector<MouseInterfaceId> ListIDs; - // Do not use the references after object gets destroyed - const std::vector<MouseInterfaceInfoEntry> &GetInfoInterfaces() const; - const std::vector<MousePhysicalInfoEntry> &GetInfoPhysical(); + // Do not use the references after object gets destroyed + const std::vector<MouseInterfaceInfoEntry> &GetInfoInterfaces() const; + const std::vector<MousePhysicalInfoEntry> &GetInfoPhysical(); - static bool IsNoMouseMode(); - static bool CheckInterfaces(const ListIDs &list_ids); - static bool PatternToRegex(const std::string &pattern, std::regex ®ex); + static bool IsNoMouseMode(); + static bool CheckInterfaces(const ListIDs &list_ids); + static bool PatternToRegex(const std::string &pattern, std::regex ®ex); - bool ProbeForMapping(uint8_t &device_id); // For interactive mapping in MOUSECTL.COM only! + bool ProbeForMapping(uint8_t &device_id); // For interactive mapping in + // MOUSECTL.COM only! - bool Map(const MouseInterfaceId interface_id, const uint8_t device_idx); - bool Map(const MouseInterfaceId interface_id, const std::regex ®ex); - bool UnMap(const ListIDs &list_ids); + bool Map(const MouseInterfaceId interface_id, const uint8_t device_idx); + bool Map(const MouseInterfaceId interface_id, const std::regex ®ex); + bool UnMap(const ListIDs &list_ids); - bool OnOff(const ListIDs &list_ids, const bool enable); - bool Reset(const ListIDs &list_ids); + bool OnOff(const ListIDs &list_ids, const bool enable); + bool Reset(const ListIDs &list_ids); - // Valid sensitivity values are from -99 to +99 - bool SetSensitivity(const ListIDs &list_ids, - const int8_t sensitivity_x, - const int8_t sensitivity_y); - bool SetSensitivityX(const ListIDs &list_ids, - const int8_t sensitivity_x); - bool SetSensitivityY(const ListIDs &list_ids, - const int8_t sensitivity_y); + // Valid sensitivity values are from -99 to +99 + bool SetSensitivity(const ListIDs &list_ids, const int8_t sensitivity_x, + const int8_t sensitivity_y); + bool SetSensitivityX(const ListIDs &list_ids, const int8_t sensitivity_x); + bool SetSensitivityY(const ListIDs &list_ids, const int8_t sensitivity_y); - bool ResetSensitivity(const ListIDs &list_ids); - bool ResetSensitivityX(const ListIDs &list_ids); - bool ResetSensitivityY(const ListIDs &list_ids); + bool ResetSensitivity(const ListIDs &list_ids); + bool ResetSensitivityX(const ListIDs &list_ids); + bool ResetSensitivityY(const ListIDs &list_ids); - static const std::vector<uint16_t> &GetValidMinRateList(); - static const std::string &GetValidMinRateStr(); - bool SetMinRate(const MouseControlAPI::ListIDs &list_ids, - const uint16_t value_hz); - bool ResetMinRate(const MouseControlAPI::ListIDs &list_ids); + static const std::vector<uint16_t> &GetValidMinRateList(); + static const std::string &GetValidMinRateStr(); + bool SetMinRate(const MouseControlAPI::ListIDs &list_ids, + const uint16_t value_hz); + bool ResetMinRate(const MouseControlAPI::ListIDs &list_ids); private: - MouseControlAPI(const MouseControlAPI &) = delete; - MouseControlAPI &operator=(const MouseControlAPI &) = delete; + MouseControlAPI(const MouseControlAPI &) = delete; + MouseControlAPI &operator=(const MouseControlAPI &) = delete; }; #endif // DOSBOX_MOUSE_H |