2018-01-14 21:21:08 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* fmouse.h - Read mouse events *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
|
|
|
* Copyright 2018 Markus Gans *
|
|
|
|
* *
|
|
|
|
* The Final Cut is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* The Final Cut is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
/* Inheritance diagram
|
|
|
|
* ═══════════════════
|
|
|
|
*
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FMouse ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲
|
|
|
|
* │
|
|
|
|
* ┌─────────────┬──────┴───────┬─────────────┐
|
|
|
|
* │ │ │ │
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FMouseGPM ▏ ▕ FMouseX11 ▏ ▕ FMouseSGR ▏ ▕ FMouseUrxvt ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏1 1▕▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FMouseControl ▏- -┬- - -▕ FMouseGPM ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏ : ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* :
|
|
|
|
* : 1▕▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* :- - -▕ FMouseX11 ▏
|
|
|
|
* : ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* :
|
|
|
|
* : 1▕▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* └- - -▕ FMouseSGR ▏
|
|
|
|
* : ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* :
|
|
|
|
* : 1▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* └- - -▕ FMouseUrxvt ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FMOUSE_H
|
|
|
|
#define FMOUSE_H
|
|
|
|
|
|
|
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
|
|
#error "Only <final/final.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "final/fconfig.h"
|
2018-10-11 03:46:37 +02:00
|
|
|
#include "final/fkeyboard.h"
|
2018-01-14 21:21:08 +01:00
|
|
|
#include "final/fpoint.h"
|
|
|
|
#include "final/ftypes.h"
|
|
|
|
|
|
|
|
#if defined(__linux__)
|
|
|
|
#include <linux/keyboard.h> // need for gpm keyboard modifiers
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef F_HAVE_LIBGPM
|
|
|
|
#include <gpm.h>
|
|
|
|
#endif
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
namespace finalcut
|
|
|
|
{
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMouse
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FMouse
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Enumeration
|
|
|
|
enum mouse_type
|
|
|
|
{
|
|
|
|
none = 0,
|
|
|
|
gpm = 1,
|
|
|
|
x11 = 2,
|
|
|
|
sgr = 3,
|
|
|
|
urxvt = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
FMouse();
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
virtual ~FMouse()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
// Accessors
|
|
|
|
virtual const char* getClassName() const;
|
|
|
|
FPoint& getPos();
|
|
|
|
void clearEvent();
|
|
|
|
|
|
|
|
// Mutators
|
2018-12-28 22:57:43 +01:00
|
|
|
void setMaxWidth (uInt16);
|
|
|
|
void setMaxHeight (uInt16);
|
|
|
|
void setDblclickInterval (const uInt64);
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Inquiries
|
|
|
|
virtual bool hasData() = 0;
|
|
|
|
bool hasEvent();
|
|
|
|
bool isLeftButtonPressed();
|
|
|
|
bool isLeftButtonReleased();
|
|
|
|
bool isLeftButtonDoubleClick();
|
|
|
|
bool isRightButtonPressed();
|
|
|
|
bool isRightButtonReleased();
|
|
|
|
bool isMiddleButtonPressed();
|
|
|
|
bool isMiddleButtonReleased();
|
|
|
|
bool isShiftKeyPressed();
|
|
|
|
bool isControlKeyPressed();
|
|
|
|
bool isMetaKeyPressed();
|
|
|
|
bool isWheelUp();
|
|
|
|
bool isWheelDown();
|
|
|
|
bool isMoved();
|
|
|
|
bool isInputDataPending();
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
static FMouse* createMouseObject (mouse_type);
|
2018-10-11 03:46:37 +02:00
|
|
|
virtual void setRawData (FKeyboard::keybuffer&) = 0;
|
2018-01-14 21:21:08 +01:00
|
|
|
virtual void processEvent (struct timeval*) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Typedef and Enumerations
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uChar left_button : 2; // 0..3
|
|
|
|
uChar right_button : 2; // 0..3
|
|
|
|
uChar middle_button : 2; // 0..3
|
|
|
|
uChar shift_button : 1; // 0..1
|
|
|
|
uChar control_button : 1; // 0..1
|
|
|
|
uChar meta_button : 1; // 0..1
|
|
|
|
uChar wheel_up : 1; // 0..1
|
|
|
|
uChar wheel_down : 1; // 0..1
|
|
|
|
uChar mouse_moved : 1; // 0..1
|
|
|
|
uChar : 4; // padding bits
|
|
|
|
} button; // bit field
|
|
|
|
|
|
|
|
enum states
|
|
|
|
{
|
|
|
|
Undefined = 0,
|
|
|
|
Pressed = 1,
|
|
|
|
Released = 2,
|
|
|
|
DoubleClick = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
// Mutator
|
|
|
|
void setPos (const FPoint&);
|
|
|
|
|
|
|
|
// Method
|
|
|
|
bool isDblclickTimeout (timeval*);
|
|
|
|
|
|
|
|
// Data Members
|
2018-12-03 03:22:36 +01:00
|
|
|
button b_state{};
|
|
|
|
bool mouse_event_occurred{false};
|
|
|
|
bool input_data_pending{false};
|
2018-12-28 22:57:43 +01:00
|
|
|
uInt64 dblclick_interval{500000}; // 500 ms
|
|
|
|
uInt16 max_width{80};
|
|
|
|
uInt16 max_height{25};
|
2018-12-03 03:22:36 +01:00
|
|
|
struct timeval time_mousepressed{};
|
|
|
|
FPoint zero_point{0, 0}; // zero point (x=0, y=0)
|
|
|
|
FPoint mouse{0, 0}; // mouse click position
|
|
|
|
FPoint new_mouse_position{};
|
2018-01-14 21:21:08 +01:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef F_HAVE_LIBGPM
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMouseGPM
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FMouseGPM : public FMouse
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Constructor
|
|
|
|
FMouseGPM();
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
virtual ~FMouseGPM();
|
|
|
|
|
|
|
|
// Accessors
|
2018-01-14 21:53:45 +01:00
|
|
|
virtual const char* getClassName() const;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Mutators
|
|
|
|
void setStdinNo(int);
|
|
|
|
|
|
|
|
// Inquiry
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual bool hasData() override;
|
2018-01-14 21:21:08 +01:00
|
|
|
bool isGpmMouseEnabled();
|
|
|
|
|
|
|
|
// Methods
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual void setRawData (FKeyboard::keybuffer&) override;
|
|
|
|
virtual void processEvent (struct timeval*) override;
|
2018-01-14 21:21:08 +01:00
|
|
|
bool gpmMouse (bool);
|
|
|
|
bool enableGpmMouse();
|
|
|
|
bool disableGpmMouse();
|
2018-12-01 21:28:25 +01:00
|
|
|
bool hasSignificantEvents();
|
|
|
|
void interpretKeyDown();
|
|
|
|
void interpretKeyUp();
|
2018-01-14 21:21:08 +01:00
|
|
|
bool getGpmKeyPressed(bool);
|
|
|
|
void drawGpmPointer();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Enumeration
|
|
|
|
enum gpmEventType
|
|
|
|
{
|
|
|
|
no_event = 0,
|
|
|
|
keyboard_event = 1,
|
|
|
|
mouse_event = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
// Method
|
|
|
|
int gpmEvent (bool = true);
|
|
|
|
|
|
|
|
// Data Member
|
2018-12-03 03:22:36 +01:00
|
|
|
Gpm_Event gpm_ev{};
|
|
|
|
bool has_gpm_mouse_data{false};
|
|
|
|
bool gpm_mouse_enabled{false};
|
|
|
|
int stdin_no{0};
|
2018-01-14 21:21:08 +01:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
2018-01-14 22:24:15 +01:00
|
|
|
|
2018-01-14 21:21:08 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FMouseGPM::enableGpmMouse()
|
|
|
|
{ return gpmMouse(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FMouseGPM::disableGpmMouse()
|
|
|
|
{ return gpmMouse(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FMouseGPM::isGpmMouseEnabled()
|
|
|
|
{ return gpm_mouse_enabled; }
|
2018-09-20 23:59:01 +02:00
|
|
|
#endif // F_HAVE_LIBGPM
|
2018-01-14 21:21:08 +01:00
|
|
|
|
2018-01-28 19:54:52 +01:00
|
|
|
|
2018-01-14 21:21:08 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMouseX11
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FMouseX11 : public FMouse
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Constructor
|
2018-12-09 18:24:31 +01:00
|
|
|
FMouseX11() = default;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Destructor
|
2018-12-09 18:24:31 +01:00
|
|
|
virtual ~FMouseX11() = default;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Accessors
|
2018-01-14 21:53:45 +01:00
|
|
|
virtual const char* getClassName() const;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Inquiry
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual bool hasData() override;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Methods
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual void setRawData (FKeyboard::keybuffer&) override;
|
|
|
|
virtual void processEvent (struct timeval*) override;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Enumeration
|
|
|
|
enum btn_states
|
|
|
|
{
|
|
|
|
key_shift = 0x04,
|
|
|
|
key_meta = 0x08,
|
|
|
|
key_ctrl = 0x10,
|
|
|
|
key_button_mask = 0x1c,
|
|
|
|
button1_pressed = 0x20,
|
|
|
|
button2_pressed = 0x21,
|
|
|
|
button3_pressed = 0x22,
|
|
|
|
all_buttons_released = 0x23,
|
|
|
|
button1_pressed_move = 0x40,
|
|
|
|
button2_pressed_move = 0x41,
|
|
|
|
button3_pressed_move = 0x42,
|
|
|
|
button_mask = 0x63,
|
|
|
|
button_up = 0x60,
|
|
|
|
button_down = 0x61,
|
|
|
|
button_up_move = 0x60,
|
|
|
|
button_down_move = 0x61
|
|
|
|
};
|
|
|
|
|
|
|
|
// Constant
|
2018-12-26 23:41:49 +01:00
|
|
|
static constexpr std::size_t MOUSE_BUF_SIZE = 4;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Method
|
|
|
|
void setKeyState (int);
|
|
|
|
void setMoveState (const FPoint&, int);
|
|
|
|
void setButtonState (int, struct timeval*);
|
|
|
|
|
|
|
|
// Data Member
|
2018-12-09 18:24:31 +01:00
|
|
|
char x11_mouse[MOUSE_BUF_SIZE]{'\0'};
|
2018-12-03 03:22:36 +01:00
|
|
|
uChar x11_button_state{all_buttons_released};
|
2018-01-14 21:21:08 +01:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMouseSGR
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FMouseSGR : public FMouse
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Constructor
|
2018-12-09 18:24:31 +01:00
|
|
|
FMouseSGR() = default;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Destructor
|
2018-12-09 18:24:31 +01:00
|
|
|
virtual ~FMouseSGR() = default;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Accessors
|
2018-12-03 03:22:36 +01:00
|
|
|
virtual const char* getClassName() const;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Inquiry
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual bool hasData() override;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Methods
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual void setRawData (FKeyboard::keybuffer&) override;
|
|
|
|
virtual void processEvent (struct timeval*) override;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Enumeration
|
|
|
|
enum x11_ext_btn_states
|
|
|
|
{
|
|
|
|
key_shift = 0x04,
|
|
|
|
key_meta = 0x08,
|
|
|
|
key_ctrl = 0x10,
|
|
|
|
key_button_mask = 0x1c,
|
|
|
|
button1 = 0x00,
|
|
|
|
button2 = 0x01,
|
|
|
|
button3 = 0x02,
|
|
|
|
button1_move = 0x20,
|
|
|
|
button2_move = 0x21,
|
|
|
|
button3_move = 0x22,
|
|
|
|
button_mask = 0x63,
|
|
|
|
button_up = 0x40,
|
|
|
|
button_down = 0x41,
|
|
|
|
pressed = 'M',
|
|
|
|
released = 'm'
|
|
|
|
};
|
|
|
|
|
|
|
|
// Constant
|
2018-12-26 23:41:49 +01:00
|
|
|
static constexpr std::size_t MOUSE_BUF_SIZE = 13;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Methods
|
|
|
|
void setKeyState (int);
|
|
|
|
void setMoveState (const FPoint&, int);
|
|
|
|
void setPressedButtonState (int, struct timeval*);
|
|
|
|
void setReleasedButtonState (int);
|
|
|
|
|
|
|
|
// Data Members
|
2018-12-09 18:24:31 +01:00
|
|
|
char sgr_mouse[MOUSE_BUF_SIZE]{'\0'};
|
2018-12-03 03:22:36 +01:00
|
|
|
uChar sgr_button_state{0x23};
|
2018-01-14 21:21:08 +01:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMouseUrxvt
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FMouseUrxvt : public FMouse
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Constructor
|
2018-12-09 18:24:31 +01:00
|
|
|
FMouseUrxvt() = default;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Destructor
|
2018-12-09 18:24:31 +01:00
|
|
|
virtual ~FMouseUrxvt() = default;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Accessors
|
2018-12-03 03:22:36 +01:00
|
|
|
virtual const char* getClassName() const;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Inquiry
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual bool hasData() override;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Methods
|
2018-12-31 06:18:39 +01:00
|
|
|
virtual void setRawData (FKeyboard::keybuffer&) override;
|
|
|
|
virtual void processEvent (struct timeval*) override;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Enumeration
|
|
|
|
enum urxvt_btn_states
|
|
|
|
{
|
|
|
|
key_shift = 0x04,
|
|
|
|
key_meta = 0x08,
|
|
|
|
key_ctrl = 0x10,
|
|
|
|
key_button_mask = 0x1c,
|
|
|
|
button1_pressed = 0x20,
|
|
|
|
button2_pressed = 0x21,
|
|
|
|
button3_pressed = 0x22,
|
|
|
|
all_buttons_released = 0x23,
|
|
|
|
button1_pressed_move = 0x40,
|
|
|
|
button2_pressed_move = 0x41,
|
|
|
|
button3_pressed_move = 0x42,
|
|
|
|
button_mask = 0x63,
|
|
|
|
button_up = 0x60,
|
|
|
|
button_down = 0x61,
|
|
|
|
button_up_move = 0x60,
|
|
|
|
button_down_move = 0x61
|
|
|
|
};
|
|
|
|
|
|
|
|
// Constant
|
2018-12-26 23:41:49 +01:00
|
|
|
static constexpr std::size_t MOUSE_BUF_SIZE = 13;
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Methods
|
|
|
|
void setKeyState (int);
|
|
|
|
void setMoveState (const FPoint&, int);
|
|
|
|
void setButtonState (int, struct timeval*);
|
|
|
|
|
|
|
|
// Data Members
|
2018-12-09 18:24:31 +01:00
|
|
|
char urxvt_mouse[MOUSE_BUF_SIZE]{'\0'};
|
2018-12-03 03:22:36 +01:00
|
|
|
uChar urxvt_button_state{all_buttons_released};
|
2018-01-14 21:21:08 +01:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMouseControl
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
class FMouseControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Constructor
|
|
|
|
FMouseControl();
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
virtual ~FMouseControl();
|
|
|
|
|
|
|
|
// Accessors
|
2018-01-14 21:53:45 +01:00
|
|
|
virtual const char* getClassName() const;
|
|
|
|
FPoint& getPos();
|
|
|
|
void clearEvent();
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Mutators
|
2018-01-14 21:53:45 +01:00
|
|
|
void setStdinNo (int);
|
2018-12-28 22:57:43 +01:00
|
|
|
void setMaxWidth (uInt16);
|
|
|
|
void setMaxHeight (uInt16);
|
|
|
|
void setDblclickInterval (const uInt64);
|
2018-01-14 21:53:45 +01:00
|
|
|
void useGpmMouse (bool = true);
|
|
|
|
void useXtermMouse (bool = true);
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Inquiries
|
2018-01-14 21:53:45 +01:00
|
|
|
bool hasData();
|
|
|
|
bool hasEvent();
|
|
|
|
bool isLeftButtonPressed();
|
|
|
|
bool isLeftButtonReleased();
|
|
|
|
bool isLeftButtonDoubleClick();
|
|
|
|
bool isRightButtonPressed();
|
|
|
|
bool isRightButtonReleased();
|
|
|
|
bool isMiddleButtonPressed();
|
|
|
|
bool isMiddleButtonReleased();
|
|
|
|
bool isShiftKeyPressed();
|
|
|
|
bool isControlKeyPressed();
|
|
|
|
bool isMetaKeyPressed();
|
|
|
|
bool isWheelUp();
|
|
|
|
bool isWheelDown();
|
|
|
|
bool isMoved();
|
|
|
|
bool isInputDataPending();
|
|
|
|
bool isGpmMouseEnabled();
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Methods
|
2018-01-14 21:53:45 +01:00
|
|
|
void enable();
|
|
|
|
void disable();
|
2018-10-11 03:46:37 +02:00
|
|
|
virtual void setRawData ( FMouse::mouse_type
|
|
|
|
, FKeyboard::keybuffer& );
|
2018-01-14 21:53:45 +01:00
|
|
|
virtual void processEvent (struct timeval* time);
|
|
|
|
bool getGpmKeyPressed (bool);
|
|
|
|
void drawGpmPointer();
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Accessor
|
2018-01-16 16:16:29 +01:00
|
|
|
FMouse* getMouseWithData();
|
|
|
|
FMouse* getMouseWithEvent();
|
2018-01-22 19:47:20 +01:00
|
|
|
void xtermMouse (bool);
|
|
|
|
void enableXTermMouse();
|
|
|
|
void disableXTermMouse();
|
2018-01-14 21:21:08 +01:00
|
|
|
|
|
|
|
// Data Member
|
2018-12-03 03:22:36 +01:00
|
|
|
std::map<FMouse::mouse_type, FMouse*> mouse_protocol{};
|
|
|
|
std::map<FMouse::mouse_type, FMouse*>::iterator iter{};
|
|
|
|
FPoint zero_point{0, 0};
|
|
|
|
bool use_gpm_mouse{false};
|
|
|
|
bool use_xterm_mouse{false};
|
2018-01-14 21:21:08 +01:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
2018-07-22 23:07:49 +02:00
|
|
|
// FMouseControl inline functions
|
|
|
|
//----------------------------------------------------------------------
|
2018-01-14 21:21:08 +01:00
|
|
|
inline const char* FMouseControl::getClassName() const
|
|
|
|
{ return "FMouseControl"; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FMouseControl::enableXTermMouse()
|
|
|
|
{ xtermMouse(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FMouseControl::disableXTermMouse()
|
|
|
|
{ xtermMouse(false); }
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
} // namespace finalcut
|
|
|
|
|
2018-01-14 21:21:08 +01:00
|
|
|
#endif // FMOUSE_H
|