Skip to content

Commit

Permalink
UPDDMultitouch: Implement multi-touch in macOS using the UPDD API
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-kendall-tb committed May 7, 2024
1 parent eac95d5 commit cf2057c
Show file tree
Hide file tree
Showing 4 changed files with 1,480 additions and 2 deletions.
1 change: 1 addition & 0 deletions modules/juce_gui_basics/juce_gui_basics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
#else
#include "native/accessibility/juce_Accessibility_mac.mm"
#include "native/juce_PerScreenDisplayLinks_mac.h"
#include "native/juce_UPDDMultitouch_mac.mm"
#include "native/juce_NSViewComponentPeer_mac.mm"
#include "native/juce_WindowUtils_mac.mm"
#include "native/juce_Windowing_mac.mm"
Expand Down
13 changes: 11 additions & 2 deletions modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ static void setOwner (id self, Callback* newOwner)
isSharedWindow (viewToAttachTo != nil),
lastRepaintTime (Time::getMillisecondCounter())
{
UPDDManager::getInstance()->ensureConnected();

appFocusChangeCallback = appFocusChanged;
isEventBlockedByModalComps = checkEventBlockedByModalComps;

Expand Down Expand Up @@ -2945,9 +2947,16 @@ static NSDragOperation draggingUpdated (id self, SEL, id<NSDraggingInfo> sender)
//==============================================================================
bool detail::MouseInputSourceList::addSource()
{
if (sources.size() == 0)
auto numSources = sources.size();

if (numSources == 0)
{
addSource (0, MouseInputSource::InputSourceType::mouse);

if (UPDDManager::getInstance()->isUPDDAvailable()) {
addSource (1, MouseInputSource::InputSourceType::touch);
}

return true;
}

Expand All @@ -2956,7 +2965,7 @@ static NSDragOperation draggingUpdated (id self, SEL, id<NSDraggingInfo> sender)

bool detail::MouseInputSourceList::canUseTouch() const
{
return false;
return UPDDManager::getInstance()->isUPDDAvailable();
}

//==============================================================================
Expand Down
Loading

0 comments on commit cf2057c

Please sign in to comment.