mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
putil: rename MouseData to PointerData to be more inclusive
This commit is contained in:
parent
3ffe11485d
commit
9b85a28861
@ -20,7 +20,7 @@
|
||||
#include "buttonEventList.h"
|
||||
#include "pointerEvent.h"
|
||||
#include "pointerEventList.h"
|
||||
#include "mouseData.h"
|
||||
#include "pointerData.h"
|
||||
#include "trackerData.h"
|
||||
#include "clockObject.h"
|
||||
|
||||
@ -29,8 +29,6 @@
|
||||
#include "lightMutex.h"
|
||||
#include "lightMutexHolder.h"
|
||||
|
||||
typedef MouseData PointerData;
|
||||
|
||||
/**
|
||||
* This is a structure representing a single input device. Input devices may
|
||||
* have zero or more buttons, pointers, or axes associated with them, and
|
||||
|
@ -99,7 +99,7 @@ do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &,
|
||||
output.set_data(_pixel_size_output, EventParameter(_pixel_size));
|
||||
|
||||
if (device->has_pointer()) {
|
||||
const MouseData &mdata = device->get_pointer();
|
||||
PointerData mdata = device->get_pointer();
|
||||
|
||||
if (mdata._in_window) {
|
||||
// Get mouse motion in pixels.
|
||||
|
@ -7,45 +7,21 @@
|
||||
* with this source code in a file named "LICENSE."
|
||||
*
|
||||
* @file mouseData.h
|
||||
* @author drose
|
||||
* @date 1999-02-08
|
||||
* @author rdb
|
||||
* @date 2018-09-24
|
||||
*/
|
||||
|
||||
#ifndef MOUSEDATA_H
|
||||
#define MOUSEDATA_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "modifierButtons.h"
|
||||
#include "pointerData.h"
|
||||
|
||||
BEGIN_PUBLISH
|
||||
/**
|
||||
* Holds the data that might be generated by a 2-d pointer input device, such
|
||||
* as the mouse in the GraphicsWindow.
|
||||
* Deprecated alias for PointerData.
|
||||
*/
|
||||
class EXPCL_PANDA_PUTIL MouseData {
|
||||
PUBLISHED:
|
||||
INLINE MouseData();
|
||||
INLINE MouseData(const MouseData ©);
|
||||
INLINE void operator = (const MouseData ©);
|
||||
typedef PointerData MouseData;
|
||||
|
||||
INLINE double get_x() const;
|
||||
INLINE double get_y() const;
|
||||
INLINE bool get_in_window() const;
|
||||
|
||||
void output(std::ostream &out) const;
|
||||
|
||||
MAKE_PROPERTY(x, get_x);
|
||||
MAKE_PROPERTY(y, get_y);
|
||||
MAKE_PROPERTY(in_window, get_in_window);
|
||||
|
||||
public:
|
||||
bool _in_window;
|
||||
double _xpos;
|
||||
double _ypos;
|
||||
};
|
||||
|
||||
INLINE std::ostream &operator << (std::ostream &out, const MouseData &md);
|
||||
|
||||
#include "mouseData.I"
|
||||
END_PUBLISH
|
||||
|
||||
#endif
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include "loaderOptions.cxx"
|
||||
#include "modifierButtons.cxx"
|
||||
#include "mouseButton.cxx"
|
||||
#include "mouseData.cxx"
|
||||
#include "nameUniquifier.cxx"
|
||||
#include "nodeCachedReferenceCount.cxx"
|
||||
#include "paramValue.cxx"
|
||||
#include "pbitops.cxx"
|
||||
#include "pointerData.cxx"
|
||||
#include "pta_ushort.cxx"
|
||||
#include "simpleHashMap.cxx"
|
||||
#include "sparseArray.cxx"
|
||||
|
@ -6,7 +6,7 @@
|
||||
* license. You should have received a copy of this license along
|
||||
* with this source code in a file named "LICENSE."
|
||||
*
|
||||
* @file mouseData.I
|
||||
* @file pointerData.I
|
||||
* @author drose
|
||||
* @date 2002-07-15
|
||||
*/
|
||||
@ -14,8 +14,8 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE MouseData::
|
||||
MouseData() {
|
||||
INLINE PointerData::
|
||||
PointerData() {
|
||||
_in_window = false;
|
||||
_xpos = 0;
|
||||
_ypos = 0;
|
||||
@ -24,8 +24,8 @@ MouseData() {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE MouseData::
|
||||
MouseData(const MouseData ©) :
|
||||
INLINE PointerData::
|
||||
PointerData(const PointerData ©) :
|
||||
_in_window(copy._in_window),
|
||||
_xpos(copy._xpos),
|
||||
_ypos(copy._ypos)
|
||||
@ -35,8 +35,8 @@ MouseData(const MouseData ©) :
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE void MouseData::
|
||||
operator = (const MouseData ©) {
|
||||
INLINE void PointerData::
|
||||
operator = (const PointerData ©) {
|
||||
_in_window = copy._in_window;
|
||||
_xpos = copy._xpos;
|
||||
_ypos = copy._ypos;
|
||||
@ -45,7 +45,7 @@ operator = (const MouseData ©) {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE double MouseData::
|
||||
INLINE double PointerData::
|
||||
get_x() const {
|
||||
return _xpos;
|
||||
}
|
||||
@ -53,7 +53,7 @@ get_x() const {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE double MouseData::
|
||||
INLINE double PointerData::
|
||||
get_y() const {
|
||||
return _ypos;
|
||||
}
|
||||
@ -61,13 +61,13 @@ get_y() const {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE bool MouseData::
|
||||
INLINE bool PointerData::
|
||||
get_in_window() const {
|
||||
return _in_window;
|
||||
}
|
||||
|
||||
|
||||
INLINE std::ostream &operator << (std::ostream &out, const MouseData &md) {
|
||||
INLINE std::ostream &operator << (std::ostream &out, const PointerData &md) {
|
||||
md.output(out);
|
||||
return out;
|
||||
}
|
@ -6,21 +6,21 @@
|
||||
* license. You should have received a copy of this license along
|
||||
* with this source code in a file named "LICENSE."
|
||||
*
|
||||
* @file mouseData.cxx
|
||||
* @file pointerData.cxx
|
||||
* @author drose
|
||||
* @date 1999-02-08
|
||||
*/
|
||||
|
||||
#include "mouseData.h"
|
||||
#include "pointerData.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void MouseData::
|
||||
void PointerData::
|
||||
output(std::ostream &out) const {
|
||||
if (!_in_window) {
|
||||
out << "MouseData: Not in window";
|
||||
out << "PointerData: Not in window";
|
||||
} else {
|
||||
out << "MouseData: (" << _xpos << ", " << _ypos << ")";
|
||||
out << "PointerData: (" << _xpos << ", " << _ypos << ")";
|
||||
}
|
||||
}
|
51
panda/src/putil/pointerData.h
Normal file
51
panda/src/putil/pointerData.h
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* PANDA 3D SOFTWARE
|
||||
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
*
|
||||
* All use of this software is subject to the terms of the revised BSD
|
||||
* license. You should have received a copy of this license along
|
||||
* with this source code in a file named "LICENSE."
|
||||
*
|
||||
* @file pointerData.h
|
||||
* @author drose
|
||||
* @date 1999-02-08
|
||||
*/
|
||||
|
||||
#ifndef POINTERDATA_H
|
||||
#define POINTERDATA_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "modifierButtons.h"
|
||||
|
||||
/**
|
||||
* Holds the data that might be generated by a 2-d pointer input device, such
|
||||
* as the mouse in the GraphicsWindow.
|
||||
*/
|
||||
class EXPCL_PANDA_PUTIL PointerData {
|
||||
PUBLISHED:
|
||||
INLINE PointerData();
|
||||
INLINE PointerData(const PointerData ©);
|
||||
INLINE void operator = (const PointerData ©);
|
||||
|
||||
INLINE double get_x() const;
|
||||
INLINE double get_y() const;
|
||||
INLINE bool get_in_window() const;
|
||||
|
||||
void output(std::ostream &out) const;
|
||||
|
||||
MAKE_PROPERTY(x, get_x);
|
||||
MAKE_PROPERTY(y, get_y);
|
||||
MAKE_PROPERTY(in_window, get_in_window);
|
||||
|
||||
public:
|
||||
bool _in_window;
|
||||
double _xpos;
|
||||
double _ypos;
|
||||
};
|
||||
|
||||
INLINE std::ostream &operator << (std::ostream &out, const PointerData &md);
|
||||
|
||||
#include "pointerData.I"
|
||||
|
||||
#endif
|
@ -354,7 +354,7 @@ process_events() {
|
||||
|
||||
case MotionNotify:
|
||||
if (_dga_mouse_enabled) {
|
||||
const MouseData &md = _input->get_pointer();
|
||||
PointerData md = _input->get_pointer();
|
||||
_input->set_pointer_in_window(md.get_x() + event.xmotion.x_root, md.get_y() + event.xmotion.y_root);
|
||||
} else {
|
||||
_input->set_pointer_in_window(event.xmotion.x, event.xmotion.y);
|
||||
@ -376,7 +376,7 @@ process_events() {
|
||||
|
||||
case EnterNotify:
|
||||
if (_dga_mouse_enabled) {
|
||||
const MouseData &md = _input->get_pointer();
|
||||
PointerData md = _input->get_pointer();
|
||||
_input->set_pointer_in_window(md.get_x(), md.get_y());
|
||||
} else {
|
||||
_input->set_pointer_in_window(event.xcrossing.x, event.xcrossing.y);
|
||||
|
Loading…
x
Reference in New Issue
Block a user