diff --git a/panda/src/device/inputDevice.h b/panda/src/device/inputDevice.h index 7e4d4f623b..10ad2c8177 100644 --- a/panda/src/device/inputDevice.h +++ b/panda/src/device/inputDevice.h @@ -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 diff --git a/panda/src/display/mouseAndKeyboard.cxx b/panda/src/display/mouseAndKeyboard.cxx index 8243ef4759..97c6447bdb 100644 --- a/panda/src/display/mouseAndKeyboard.cxx +++ b/panda/src/display/mouseAndKeyboard.cxx @@ -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. diff --git a/panda/src/putil/mouseData.h b/panda/src/putil/mouseData.h index 0d2a294568..2747c26061 100644 --- a/panda/src/putil/mouseData.h +++ b/panda/src/putil/mouseData.h @@ -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 diff --git a/panda/src/putil/p3putil_composite2.cxx b/panda/src/putil/p3putil_composite2.cxx index 9b0f01d851..80ae7450bb 100644 --- a/panda/src/putil/p3putil_composite2.cxx +++ b/panda/src/putil/p3putil_composite2.cxx @@ -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" diff --git a/panda/src/putil/mouseData.I b/panda/src/putil/pointerData.I similarity index 68% rename from panda/src/putil/mouseData.I rename to panda/src/putil/pointerData.I index c0ab6997ef..6697c31d1a 100644 --- a/panda/src/putil/mouseData.I +++ b/panda/src/putil/pointerData.I @@ -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; } diff --git a/panda/src/putil/mouseData.cxx b/panda/src/putil/pointerData.cxx similarity index 70% rename from panda/src/putil/mouseData.cxx rename to panda/src/putil/pointerData.cxx index de83bd1505..ccf8e9d9f9 100644 --- a/panda/src/putil/mouseData.cxx +++ b/panda/src/putil/pointerData.cxx @@ -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 << ")"; } } diff --git a/panda/src/putil/pointerData.h b/panda/src/putil/pointerData.h new file mode 100644 index 0000000000..aa3f3aeb62 --- /dev/null +++ b/panda/src/putil/pointerData.h @@ -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 diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index b9fa562c64..6297e38758 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -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);