Browse Source

Resolved a Windows/Android touchID incompatibility

tags/2021-05-28
Tom Poole 6 years ago
parent
commit
061ea2e072
1 changed files with 19 additions and 6 deletions
  1. +19
    -6
      modules/juce_gui_basics/native/juce_MultiTouchMapper.h

+ 19
- 6
modules/juce_gui_basics/native/juce_MultiTouchMapper.h View File

@@ -24,6 +24,13 @@
============================================================================== ==============================================================================
*/ */
#if JUCE_CLANG
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#endif
namespace juce namespace juce
{ {
@@ -35,7 +42,7 @@ public:
int getIndexOfTouch (ComponentPeer* peer, IDType touchID) int getIndexOfTouch (ComponentPeer* peer, IDType touchID)
{ {
jassert (touchID != nullptr); // need to rethink this if IDs can be 0!
jassert (touchID != 0); // need to rethink this if IDs can be 0!
TouchInfo info {touchID, peer}; TouchInfo info {touchID, peer};
int touchIndex = currentTouches.indexOf (info); int touchIndex = currentTouches.indexOf (info);
@@ -64,7 +71,7 @@ public:
bool areAnyTouchesActive() const noexcept bool areAnyTouchesActive() const noexcept
{ {
for (auto& t : currentTouches) for (auto& t : currentTouches)
if (t.touchId != nullptr)
if (t.touchId != 0)
return true; return true;
return false; return false;
@@ -72,16 +79,16 @@ public:
void deleteAllTouchesForPeer (ComponentPeer* peer) void deleteAllTouchesForPeer (ComponentPeer* peer)
{ {
for (auto& t : currentTouches)
if (t.owner == peer)
t.touchId = nullptr;
for (auto& t : currentTouches)
if (t.owner == peer)
t.touchId = 0;
} }
private: private:
//============================================================================== //==============================================================================
struct TouchInfo struct TouchInfo
{ {
TouchInfo() noexcept : touchId (nullptr), owner (nullptr) {}
TouchInfo() noexcept : touchId (0), owner (nullptr) {}
TouchInfo (IDType idToUse, ComponentPeer* peer) noexcept : touchId (idToUse), owner (peer) {} TouchInfo (IDType idToUse, ComponentPeer* peer) noexcept : touchId (idToUse), owner (peer) {}
TouchInfo (const TouchInfo&) = default; TouchInfo (const TouchInfo&) = default;
@@ -112,3 +119,9 @@ private:
}; };
} // namespace juce } // namespace juce
#if JUCE_CLANG
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic pop
#endif
#endif

Loading…
Cancel
Save