input mouse mm: Fix tracing, trace all methods and add destructor
- Fix tracing when TRACE_MOVEMENT_MAKER is defined. This seems to be a leftover from the migration of movement_maker.cpp from kernel to user space at hrev56293. - Improve tracing by adding a call per method When tracing is enabled, the class name and the function method is provided to trace every method call by using new CALLER helper macro. - Add destructor as well to improve tracing. Change-Id: I60b49b1d83a8abeb3ba6835d0e303f1b28dde90a Reviewed-on: https://review.haiku-os.org/c/haiku/+/9909 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
172caabf4d
commit
b7a226b66e
@@ -22,14 +22,14 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <KernelExport.h>
|
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_MOVEMENT_MAKER
|
//#define TRACE_MOVEMENT_MAKER
|
||||||
#ifdef TRACE_MOVEMENT_MAKER
|
#ifdef TRACE_MOVEMENT_MAKER
|
||||||
# define TRACE(x...) dprintf(x)
|
#define TRACE(x...) debug_printf(x)
|
||||||
|
#define CALLED(x...) TRACE("CALLED %s", __PRETTY_FUNCTION__)
|
||||||
#else
|
#else
|
||||||
#define TRACE(x...)
|
#define TRACE(x...)
|
||||||
|
#define CALLED(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -48,6 +48,8 @@ make_small(float value)
|
|||||||
void
|
void
|
||||||
MovementMaker::SetSettings(const touchpad_settings& settings)
|
MovementMaker::SetSettings(const touchpad_settings& settings)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +57,8 @@ MovementMaker::SetSettings(const touchpad_settings& settings)
|
|||||||
void
|
void
|
||||||
MovementMaker::SetSpecs(const touchpad_specs& specs)
|
MovementMaker::SetSpecs(const touchpad_specs& specs)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
fSpecs = specs;
|
fSpecs = specs;
|
||||||
|
|
||||||
fAreaWidth = fSpecs.areaEndX - fSpecs.areaStartX;
|
fAreaWidth = fSpecs.areaEndX - fSpecs.areaStartX;
|
||||||
@@ -69,6 +73,8 @@ MovementMaker::SetSpecs(const touchpad_specs& specs)
|
|||||||
void
|
void
|
||||||
MovementMaker::StartNewMovment()
|
MovementMaker::StartNewMovment()
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
if (fSettings.scroll_xstepsize <= 0)
|
if (fSettings.scroll_xstepsize <= 0)
|
||||||
fSettings.scroll_xstepsize = 1;
|
fSettings.scroll_xstepsize = 1;
|
||||||
if (fSettings.scroll_ystepsize <= 0)
|
if (fSettings.scroll_ystepsize <= 0)
|
||||||
@@ -83,6 +89,8 @@ MovementMaker::StartNewMovment()
|
|||||||
void
|
void
|
||||||
MovementMaker::GetMovement(uint32 posX, uint32 posY)
|
MovementMaker::GetMovement(uint32 posX, uint32 posY)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
_GetRawMovement(posX, posY);
|
_GetRawMovement(posX, posY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,6 +98,8 @@ MovementMaker::GetMovement(uint32 posX, uint32 posY)
|
|||||||
void
|
void
|
||||||
MovementMaker::GetScrolling(uint32 posX, uint32 posY)
|
MovementMaker::GetScrolling(uint32 posX, uint32 posY)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
int32 stepsX = 0, stepsY = 0;
|
int32 stepsX = 0, stepsY = 0;
|
||||||
int32 directionMultiplier = fSettings.scroll_reverse ? -1 : 1;
|
int32 directionMultiplier = fSettings.scroll_reverse ? -1 : 1;
|
||||||
|
|
||||||
@@ -125,6 +135,8 @@ MovementMaker::GetScrolling(uint32 posX, uint32 posY)
|
|||||||
void
|
void
|
||||||
MovementMaker::_GetRawMovement(uint32 posX, uint32 posY)
|
MovementMaker::_GetRawMovement(uint32 posX, uint32 posY)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
// calibrated on the synaptics touchpad
|
// calibrated on the synaptics touchpad
|
||||||
posX = posX * SYN_WIDTH / fAreaWidth;
|
posX = posX * SYN_WIDTH / fAreaWidth;
|
||||||
posY = posY * SYN_HEIGHT / fAreaHeight;
|
posY = posY * SYN_HEIGHT / fAreaHeight;
|
||||||
@@ -196,6 +208,8 @@ MovementMaker::_GetRawMovement(uint32 posX, uint32 posY)
|
|||||||
void
|
void
|
||||||
MovementMaker::_ComputeAcceleration(int8 accel_factor)
|
MovementMaker::_ComputeAcceleration(int8 accel_factor)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
// acceleration
|
// acceleration
|
||||||
float acceleration = 1;
|
float acceleration = 1;
|
||||||
if (accel_factor != 0) {
|
if (accel_factor != 0) {
|
||||||
@@ -216,6 +230,8 @@ MovementMaker::_ComputeAcceleration(int8 accel_factor)
|
|||||||
|
|
||||||
TouchpadMovement::TouchpadMovement()
|
TouchpadMovement::TouchpadMovement()
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
fMovementStarted = false;
|
fMovementStarted = false;
|
||||||
fScrollingStarted = false;
|
fScrollingStarted = false;
|
||||||
fTapStarted = false;
|
fTapStarted = false;
|
||||||
@@ -223,11 +239,17 @@ TouchpadMovement::TouchpadMovement()
|
|||||||
fDoubleClick = false;
|
fDoubleClick = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TouchpadMovement::~TouchpadMovement() {
|
||||||
|
CALLED();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TouchpadMovement::EventToMovement(const touchpad_movement* event, mouse_movement* movement,
|
TouchpadMovement::EventToMovement(const touchpad_movement* event, mouse_movement* movement,
|
||||||
bigtime_t& repeatTimeout)
|
bigtime_t& repeatTimeout)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
if (!movement)
|
if (!movement)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
@@ -288,6 +310,8 @@ bool
|
|||||||
TouchpadMovement::_EdgeMotion(const touchpad_movement *event, mouse_movement *movement,
|
TouchpadMovement::_EdgeMotion(const touchpad_movement *event, mouse_movement *movement,
|
||||||
bool validStart)
|
bool validStart)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
float xdelta = 0;
|
float xdelta = 0;
|
||||||
float ydelta = 0;
|
float ydelta = 0;
|
||||||
|
|
||||||
@@ -347,6 +371,8 @@ TouchpadMovement::_EdgeMotion(const touchpad_movement *event, mouse_movement *mo
|
|||||||
void
|
void
|
||||||
TouchpadMovement::_UpdateButtons(mouse_movement *movement)
|
TouchpadMovement::_UpdateButtons(mouse_movement *movement)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
// set click count correctly according to double click timeout
|
// set click count correctly according to double click timeout
|
||||||
if (movement->buttons != 0 && fButtonsState == 0) {
|
if (movement->buttons != 0 && fButtonsState == 0) {
|
||||||
if (fClickLastTime + click_speed > movement->timestamp)
|
if (fClickLastTime + click_speed > movement->timestamp)
|
||||||
@@ -368,6 +394,8 @@ void
|
|||||||
TouchpadMovement::_NoTouchToMovement(const touchpad_movement *event,
|
TouchpadMovement::_NoTouchToMovement(const touchpad_movement *event,
|
||||||
mouse_movement *movement)
|
mouse_movement *movement)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
uint32 buttons = event->buttons;
|
uint32 buttons = event->buttons;
|
||||||
|
|
||||||
if (fMovementStarted)
|
if (fMovementStarted)
|
||||||
@@ -420,6 +448,8 @@ TouchpadMovement::_NoTouchToMovement(const touchpad_movement *event,
|
|||||||
void
|
void
|
||||||
TouchpadMovement::_MoveToMovement(const touchpad_movement *event, mouse_movement *movement)
|
TouchpadMovement::_MoveToMovement(const touchpad_movement *event, mouse_movement *movement)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
bool isStartOfMovement = false;
|
bool isStartOfMovement = false;
|
||||||
float pressure = 0;
|
float pressure = 0;
|
||||||
|
|
||||||
@@ -478,6 +508,8 @@ bool
|
|||||||
TouchpadMovement::_CheckScrollingToMovement(const touchpad_movement *event,
|
TouchpadMovement::_CheckScrollingToMovement(const touchpad_movement *event,
|
||||||
mouse_movement *movement)
|
mouse_movement *movement)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
bool isSideScrollingV = false;
|
bool isSideScrollingV = false;
|
||||||
bool isSideScrollingH = false;
|
bool isSideScrollingH = false;
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ enum button_ids
|
|||||||
class TouchpadMovement : public MovementMaker {
|
class TouchpadMovement : public MovementMaker {
|
||||||
public:
|
public:
|
||||||
TouchpadMovement();
|
TouchpadMovement();
|
||||||
|
virtual ~TouchpadMovement();
|
||||||
|
|
||||||
status_t EventToMovement(const touchpad_movement *event,
|
status_t EventToMovement(const touchpad_movement *event,
|
||||||
mouse_movement *movement, bigtime_t &repeatTimeout);
|
mouse_movement *movement, bigtime_t &repeatTimeout);
|
||||||
|
|||||||
Reference in New Issue
Block a user