View Single Post
Old 04-03-2020, 12:02 AM   #1006
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
Default

Julian so here is the script with modifications because its not working on osx with the original (which works with windows)

In the class script:
Code:
230 :   if not Get_window_under_mouse() then return end
Code:
function Get_window_under_mouse()
   if mouse.l_down then
      local windowUnderMouse = reaper.JS_Window_FromPoint(mouse.x, mouse.y)
      if windowUnderMouse and windowUnderMouse ~= track_window then
         --local parentWindow = reaper.JS_Window_GetParent(windowUnderMouse)
         return false
      end
   end
   return true
end
WINDOWS:


OSX:


This additional check does not crash
Code:
function Get_window_under_mouse()
   if mouse.l_down then
      local windowUnderMouse = reaper.JS_Window_FromPoint(mouse.x, mouse.y)
      local old_windowUnderMouse = reaper.JS_Window_FromPoint(mouse.ox, mouse.oy)
      if windowUnderMouse then
         if windowUnderMouse ~= track_window then
            return true
         elseif old_windowUnderMouse then
            if old_windowUnderMouse ~= track_window then
               return true
            end
         end
      end
   end
   return false
end
Original code is commented out
Code:
40: --if reaper.JS_Window_GetForeground() ~= main_wnd then
41:  --  return
42--end
This works well on Windows, but cannot be used on OSX since if any window is opened it would trigger that API as TRUE. It sees any window that is opened as focused.

Anyway in the attachment is the old_version that is crashing on OSX, you can check the original behavior by commenting out line 230, and uncommenting lines 40-41-42 in the CLASS script.

The issue is only OSX

Last edited by Sexan; 02-13-2023 at 08:15 AM.
Sexan is offline   Reply With Quote