mirror of
https://github.com/hyprwm/aquamarine.git
synced 2026-05-08 08:28:01 +02:00
libinput: method to get libinput_tablet_tool from ITabletTool (#278)
* libinput: method to get `libinput_tablet_tool` from ITabletTool Libinput has some configuration specific to the tablet tool that could be interesting to set for Tablet users. However there's currently no way of getting the required `libinput_tablet_tool` ptr from `ITabletTool`. Meaning it's not possible to build the configuration on Hyprland (or anything else using aquamarine). This change adds the virtual function `getLibinputTool()` to `ITabletTool` as well as an implementation for `CLibInputTabletTool` * Run clang-format
This commit is contained in:
parent
24f1db3c06
commit
981132ce0b
4 changed files with 16 additions and 5 deletions
|
|
@ -149,8 +149,9 @@ namespace Aquamarine {
|
|||
CLibinputTabletTool(Hyprutils::Memory::CSharedPointer<CLibinputDevice> dev, libinput_tablet_tool* tool);
|
||||
virtual ~CLibinputTabletTool();
|
||||
|
||||
virtual libinput_device* getLibinputHandle();
|
||||
virtual const std::string& getName();
|
||||
virtual libinput_device* getLibinputHandle();
|
||||
virtual libinput_tablet_tool* getLibinputTool();
|
||||
virtual const std::string& getName();
|
||||
|
||||
private:
|
||||
Hyprutils::Memory::CWeakPointer<CLibinputDevice> device;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <hyprutils/math/Vector2D.hpp>
|
||||
|
||||
struct libinput_device;
|
||||
struct libinput_tablet_tool;
|
||||
|
||||
namespace Aquamarine {
|
||||
class ITabletTool;
|
||||
|
|
@ -291,8 +292,9 @@ namespace Aquamarine {
|
|||
events.destroy.emit();
|
||||
}
|
||||
|
||||
virtual libinput_device* getLibinputHandle();
|
||||
virtual const std::string& getName() = 0;
|
||||
virtual libinput_device* getLibinputHandle();
|
||||
virtual libinput_tablet_tool* getLibinputTool();
|
||||
virtual const std::string& getName() = 0;
|
||||
|
||||
enum eTabletToolType : uint32_t {
|
||||
AQ_TABLET_TOOL_TYPE_INVALID = 0,
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ void Aquamarine::CSession::handleLibinputEvent(libinput_event* e) {
|
|||
case LIBINPUT_SWITCH_LID: hlDevice->switchy->type = ISwitch::AQ_SWITCH_TYPE_LID; break;
|
||||
case LIBINPUT_SWITCH_TABLET_MODE: hlDevice->switchy->type = ISwitch::AQ_SWITCH_TYPE_TABLET_MODE; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
hlDevice->switchy->events.fire.emit(ISwitch::SFireEvent{
|
||||
.timeMs = (uint32_t)(libinput_event_switch_get_time_usec(se) / 1000),
|
||||
|
|
@ -1066,6 +1066,10 @@ libinput_device* Aquamarine::CLibinputTabletTool::getLibinputHandle() {
|
|||
return device->device;
|
||||
}
|
||||
|
||||
libinput_tablet_tool* Aquamarine::CLibinputTabletTool::getLibinputTool() {
|
||||
return libinputTool;
|
||||
}
|
||||
|
||||
const std::string& Aquamarine::CLibinputTabletTool::getName() {
|
||||
if (!device)
|
||||
return AQ_UNKNOWN_DEVICE_NAME;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ libinput_device* Aquamarine::ITabletTool::getLibinputHandle() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
libinput_tablet_tool* Aquamarine::ITabletTool::getLibinputTool() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
libinput_device* Aquamarine::ITablet::getLibinputHandle() {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue