Browse Source

putil: rename MouseData to PointerData to be more inclusive

rdb 7 years ago
parent
commit
9b85a28861

+ 1 - 3
panda/src/device/inputDevice.h

@@ -20,7 +20,7 @@
 #include "buttonEventList.h"
 #include "buttonEventList.h"
 #include "pointerEvent.h"
 #include "pointerEvent.h"
 #include "pointerEventList.h"
 #include "pointerEventList.h"
-#include "mouseData.h"
+#include "pointerData.h"
 #include "trackerData.h"
 #include "trackerData.h"
 #include "clockObject.h"
 #include "clockObject.h"
 
 
@@ -29,8 +29,6 @@
 #include "lightMutex.h"
 #include "lightMutex.h"
 #include "lightMutexHolder.h"
 #include "lightMutexHolder.h"
 
 
-typedef MouseData PointerData;
-
 /**
 /**
  * This is a structure representing a single input device.  Input devices may
  * This is a structure representing a single input device.  Input devices may
  * have zero or more buttons, pointers, or axes associated with them, and
  * have zero or more buttons, pointers, or axes associated with them, and

+ 1 - 1
panda/src/display/mouseAndKeyboard.cxx

@@ -99,7 +99,7 @@ do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &,
     output.set_data(_pixel_size_output, EventParameter(_pixel_size));
     output.set_data(_pixel_size_output, EventParameter(_pixel_size));
 
 
     if (device->has_pointer()) {
     if (device->has_pointer()) {
-      const MouseData &mdata = device->get_pointer();
+      PointerData mdata = device->get_pointer();
 
 
       if (mdata._in_window) {
       if (mdata._in_window) {
         // Get mouse motion in pixels.
         // Get mouse motion in pixels.

+ 7 - 31
panda/src/putil/mouseData.h

@@ -7,45 +7,21 @@
  * with this source code in a file named "LICENSE."
  * with this source code in a file named "LICENSE."
  *
  *
  * @file mouseData.h
  * @file mouseData.h
- * @author drose
- * @date 1999-02-08
+ * @author rdb
+ * @date 2018-09-24
  */
  */
 
 
 #ifndef MOUSEDATA_H
 #ifndef MOUSEDATA_H
 #define 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 &copy);
-  INLINE void operator = (const MouseData &copy);
-
-  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);
+typedef PointerData MouseData;
 
 
-#include "mouseData.I"
+END_PUBLISH
 
 
 #endif
 #endif

+ 1 - 1
panda/src/putil/p3putil_composite2.cxx

@@ -9,11 +9,11 @@
 #include "loaderOptions.cxx"
 #include "loaderOptions.cxx"
 #include "modifierButtons.cxx"
 #include "modifierButtons.cxx"
 #include "mouseButton.cxx"
 #include "mouseButton.cxx"
-#include "mouseData.cxx"
 #include "nameUniquifier.cxx"
 #include "nameUniquifier.cxx"
 #include "nodeCachedReferenceCount.cxx"
 #include "nodeCachedReferenceCount.cxx"
 #include "paramValue.cxx"
 #include "paramValue.cxx"
 #include "pbitops.cxx"
 #include "pbitops.cxx"
+#include "pointerData.cxx"
 #include "pta_ushort.cxx"
 #include "pta_ushort.cxx"
 #include "simpleHashMap.cxx"
 #include "simpleHashMap.cxx"
 #include "sparseArray.cxx"
 #include "sparseArray.cxx"

+ 11 - 11
panda/src/putil/mouseData.I → panda/src/putil/pointerData.I

@@ -6,7 +6,7 @@
  * license.  You should have received a copy of this license along
  * license.  You should have received a copy of this license along
  * with this source code in a file named "LICENSE."
  * with this source code in a file named "LICENSE."
  *
  *
- * @file mouseData.I
+ * @file pointerData.I
  * @author drose
  * @author drose
  * @date 2002-07-15
  * @date 2002-07-15
  */
  */
@@ -14,8 +14,8 @@
 /**
 /**
  *
  *
  */
  */
-INLINE MouseData::
-MouseData() {
+INLINE PointerData::
+PointerData() {
   _in_window = false;
   _in_window = false;
   _xpos = 0;
   _xpos = 0;
   _ypos = 0;
   _ypos = 0;
@@ -24,8 +24,8 @@ MouseData() {
 /**
 /**
  *
  *
  */
  */
-INLINE MouseData::
-MouseData(const MouseData &copy) :
+INLINE PointerData::
+PointerData(const PointerData &copy) :
   _in_window(copy._in_window),
   _in_window(copy._in_window),
   _xpos(copy._xpos),
   _xpos(copy._xpos),
   _ypos(copy._ypos)
   _ypos(copy._ypos)
@@ -35,8 +35,8 @@ MouseData(const MouseData &copy) :
 /**
 /**
  *
  *
  */
  */
-INLINE void MouseData::
-operator = (const MouseData &copy) {
+INLINE void PointerData::
+operator = (const PointerData &copy) {
   _in_window = copy._in_window;
   _in_window = copy._in_window;
   _xpos = copy._xpos;
   _xpos = copy._xpos;
   _ypos = copy._ypos;
   _ypos = copy._ypos;
@@ -45,7 +45,7 @@ operator = (const MouseData &copy) {
 /**
 /**
  *
  *
  */
  */
-INLINE double MouseData::
+INLINE double PointerData::
 get_x() const {
 get_x() const {
   return _xpos;
   return _xpos;
 }
 }
@@ -53,7 +53,7 @@ get_x() const {
 /**
 /**
  *
  *
  */
  */
-INLINE double MouseData::
+INLINE double PointerData::
 get_y() const {
 get_y() const {
   return _ypos;
   return _ypos;
 }
 }
@@ -61,13 +61,13 @@ get_y() const {
 /**
 /**
  *
  *
  */
  */
-INLINE bool MouseData::
+INLINE bool PointerData::
 get_in_window() const {
 get_in_window() const {
   return _in_window;
   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);
   md.output(out);
   return out;
   return out;
 }
 }

+ 5 - 5
panda/src/putil/mouseData.cxx → panda/src/putil/pointerData.cxx

@@ -6,21 +6,21 @@
  * license.  You should have received a copy of this license along
  * license.  You should have received a copy of this license along
  * with this source code in a file named "LICENSE."
  * with this source code in a file named "LICENSE."
  *
  *
- * @file mouseData.cxx
+ * @file pointerData.cxx
  * @author drose
  * @author drose
  * @date 1999-02-08
  * @date 1999-02-08
  */
  */
 
 
-#include "mouseData.h"
+#include "pointerData.h"
 
 
 /**
 /**
  *
  *
  */
  */
-void MouseData::
+void PointerData::
 output(std::ostream &out) const {
 output(std::ostream &out) const {
   if (!_in_window) {
   if (!_in_window) {
-    out << "MouseData: Not in window";
+    out << "PointerData: Not in window";
   } else {
   } else {
-    out << "MouseData: (" << _xpos << ", " << _ypos << ")";
+    out << "PointerData: (" << _xpos << ", " << _ypos << ")";
   }
   }
 }
 }

+ 51 - 0
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 &copy);
+  INLINE void operator = (const PointerData &copy);
+
+  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

+ 2 - 2
panda/src/x11display/x11GraphicsWindow.cxx

@@ -354,7 +354,7 @@ process_events() {
 
 
     case MotionNotify:
     case MotionNotify:
       if (_dga_mouse_enabled) {
       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);
         _input->set_pointer_in_window(md.get_x() + event.xmotion.x_root, md.get_y() + event.xmotion.y_root);
       } else {
       } else {
         _input->set_pointer_in_window(event.xmotion.x, event.xmotion.y);
         _input->set_pointer_in_window(event.xmotion.x, event.xmotion.y);
@@ -376,7 +376,7 @@ process_events() {
 
 
     case EnterNotify:
     case EnterNotify:
       if (_dga_mouse_enabled) {
       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());
         _input->set_pointer_in_window(md.get_x(), md.get_y());
       } else {
       } else {
         _input->set_pointer_in_window(event.xcrossing.x, event.xcrossing.y);
         _input->set_pointer_in_window(event.xcrossing.x, event.xcrossing.y);