Old 12-24-2019, 05:20 AM   #841
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by TabbyCat View Post
It's not clear to me what the purpose of that PassThrough function is, since it has exactly the same number of args as reaper.JS_WindowMessage_Intercept and they both return an integer. I'm not sure if there's any performance/readability difference between trying to set the flag on an existing intercept, vs creating/destroying one outright...so I've just been using the latter function.
Intercept is for setting up new intercepts, and will return an error if the message type is already being intercepted -- perhaps by another script that expects a certain input.
Passthrough forces an existing intercept to change, and returns an error if the message type is not already being intercepted.

I often think about how the WindowMessage functions can be improved so that multiple scripts can more easily intercept the same message type at the same time, but I haven't yet figured out an optimal way.


Quote:
Originally Posted by Sexan View Post
Are there any changes to WindowMessage_PassThrough API?

Code:
if track_part == "LOWER" then
   reaper.JS_WindowMessage_PassThrough(track_window, "WM_LBUTTONDOWN", false)
elseif track_part == "UPPER" then
   reaper.JS_WindowMessage_PassThrough(track_window, "WM_LBUTTONDOWN", true)
end
This does not do anything ? Should be blocking mouse click. Its looped while the mouse is down so not sure why its not working.
There have been no changes to this functions, IIRC. If there is already an intercept for WM_LBUTTONDOWN on track_window, this code should block clicks when track_part == "LOWER". What value does the function return? If success, it should return 1. If there is no existing intercept, it should return 0.
juliansader is offline   Reply With Quote
Old 12-24-2019, 05:31 AM   #842
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Sexan View Post
This code worked as is in my script,not sure if something updated broke it

EDIT:
Really not sure what I'm doing wrong... I cannot do any intercept of any kind (mouse).

Any example how to block LMB ?
This seems to work fine on my system, blocking LBUTTON for 10 seconds:

Code:
w = reaper.JS_Window_FromPoint(reaper.GetMousePosition())
iOK = reaper.JS_WindowMessage_Intercept(w, "WM_LBUTTONDOWN", false)
t = reaper.time_precise()

function loop()
    pOK, pass, time = reaper.JS_WindowMessage_Peek(w, "WM_LBUTTONDOWN")
    if pOK and time > t+10 then 
        reaper.JS_WindowMessage_Release(w, "WM_LBUTTONDOWN") 
        return 
    end
    reaper.defer(loop)
end

loop()
juliansader is offline   Reply With Quote
Old 12-24-2019, 05:41 AM   #843
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

I'm little confused because the code worked before I even have a gif few pages back where I block mouse click when drawing over envelopes (when you introduced mouse cursors), its pretty much the exact same code whats only added is envelope cursors (if cursor == xyz_envelope) ...

Maybe I'm going insane....


What function does is:
Tracks where the mouse is in track (upper or lower half) but it waits for mouse click to return the value. If its in upper half and there is defined cursor to avoid then disable mouse click and after mouse is released enable the mouse button.

Mouse click needs to be blocked BEFORE its clicked?
Mouse click is disabled only in certain conditions and it should be enabled when its released.

EDIT: So if I got it right, mouse needs to be intercepted from the beginning all the time and released when told ?

Last edited by Sexan; 12-24-2019 at 06:10 AM.
Sexan is online now   Reply With Quote
Old 12-24-2019, 10:59 AM   #844
TabbyCat
Human being with feelings
 
TabbyCat's Avatar
 
Join Date: May 2019
Location: Los Angeles, CA
Posts: 161
Default

Quote:
Originally Posted by juliansader View Post
Intercept is for setting up new intercepts, and will return an error if the message type is already being intercepted -- perhaps by another script that expects a certain input.
Passthrough forces an existing intercept to change, and returns an error if the message type is not already being intercepted.
Ah I see. PassThrough doesn't have an error code list in the auto-generated docs for some reason - assumed it was the same as Intercept and InterceptList (which are both identical).

Helpful, thank you.
TabbyCat is offline   Reply With Quote
Old 12-26-2019, 11:40 AM   #845
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Me again, again, again... again?

Any chance you'd consider adding something like this to your ext?

Code:
reaper.BR_GetMediaTrackByGUID( proj, guidStringIn )
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 12-26-2019, 11:55 AM   #846
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

I'm not sure I understand -- isn't the SWS function working correctly?

(The purpose of this extension is to give scripts access to C++ functions and capabilities that aren't natively included in the ReaScript API.)
juliansader is offline   Reply With Quote
Old 12-26-2019, 05:15 PM   #847
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

It does.

And actually now that I think it should it, it's very easy to just run a loop through all project media tracks in a project to check whether their GUID's match without the use of Breeder's function.

Once again, I am stupid.

I get into a sort of 'zone' when I'm coding where dumb ideas pop into my head and I think they are brilliant. It's weird
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 12-27-2019, 04:14 AM   #848
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Hi !


Just curious, we have reaper.JS_Window_AttachTopmostPin( windowHWND ) but do we have a function to Get Pin State of a window ?


Thx !
X-Raym is offline   Reply With Quote
Old 12-27-2019, 05:22 AM   #849
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

Julian whats your approach with intercepting in multitool?

You change the cursor and then block the mouse?

I'm kind on the dead end with ideas how to block mouse click when I'm on item edge (i need to block on specific part of the track when on item for example block only when on edge of the item and in upper half of the track so the bottom is free for reaper native actions). But for now I cannot make any good implementation (it wont block if the mouse is already clicked)
Sexan is online now   Reply With Quote
Old 12-27-2019, 05:55 AM   #850
nappies
Human being with feelings
 
nappies's Avatar
 
Join Date: Dec 2017
Posts: 302
Default

Quote:
Originally Posted by Sexan View Post
Julian whats your approach with intercepting in multitool?

You change the cursor and then block the mouse?

I'm kind on the dead end with ideas how to block mouse click when I'm on item edge (i need to block on specific part of the track when on item for example block only when on edge of the item and in upper half of the track so the bottom is free for reaper native actions). But for now I cannot make any good implementation (it wont block if the mouse is already clicked)
Hey Sexan! Unfortunately I can`t to find solution too. How to intercept messages with custom cursors.I have one idea how but we need some new api from devs.
nappies is offline   Reply With Quote
Old 12-27-2019, 06:32 AM   #851
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

I would really appreciate some help here IF someone has some idea:

Bypass mouse click when certain condition is met.

Not sure if it can be done WHEN mouse is already clicked.... (I've tried everything but it bypasses it on next click)

If something like this would be possible we are good:
1. Click
2. Condition
3. Bypass
4. Release
5. Remove bypass

I'm open to any ideas here
Sexan is online now   Reply With Quote
Old 12-27-2019, 09:34 AM   #852
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

I'm not quite sure I understand what you are trying to do, but I suggest:
* Intercept and block WM_LBUTTONDOWN (and perhaps WM_LBUTTONDBLCLK too).
* If you detect a click, and if the click should be passed through, pass it on with JS_WindowMessage_Post or _Send (I'm not sure which of the two would work best).
juliansader is offline   Reply With Quote
Old 12-27-2019, 09:43 AM   #853
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by nappies View Post
Hey Sexan! Unfortunately I can`t to find solution too. How to intercept messages with custom cursors.I have one idea how but we need some new api from devs.
Could you explain a bit more what you are trying to do?
juliansader is offline   Reply With Quote
Old 12-27-2019, 09:51 AM   #854
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Sexan View Post
Julian whats your approach with intercepting in multitool?

You change the cursor and then block the mouse?
Changing the cursor and blocking mouse clicks are separate messages that don't affect each other, AFAIK, so I don't think the order in which you do them makes a difference. In the Multi tool, I change the cursor a lot, after the mouse clicks have already been blocked.
juliansader is offline   Reply With Quote
Old 12-27-2019, 10:57 AM   #855
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

I want to be able to draw area over items and item edges etc. Code is:
1.Track mouse cursors
2.Track mouse position in track
3. CONDITION - Upper half and edge cursor and mouse click?
4.Disable mouse button so we can draw over the item (do not select item,extend the edge, do not do anything to item)

When mouse button is released intercept also needs to be released.

But I'm unable to make this behavoir:
1. It does not block immediatly
2. It blocks on second click
3. It does not releasing the intercept on button release

The script needs to be able to interact with native modifiers

Last edited by Sexan; 12-27-2019 at 11:04 AM.
Sexan is online now   Reply With Quote
Old 12-27-2019, 11:05 AM   #856
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Try this:
0.Intercept and block clicks
1.Track mouse cursors
2.Track mouse position in track
3.CONDITION - mouse click and NOT (upper half and edge cursor)?
4.Post click to window so that native modifier action is triggered
juliansader is offline   Reply With Quote
Old 12-27-2019, 11:07 AM   #857
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

In that case how should I trigger release? Since mouse needs to be in normal state 90% of the time to use reaper?

Edit: sorry did not read it right. So this will keep mouse unblocked until we are in codition zone?
Sexan is online now   Reply With Quote
Old 12-27-2019, 11:23 AM   #858
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Sexan View Post
In that case how should I trigger release? Since mouse needs to be in normal state 90% of the time to use reaper?
Are you referring to lifting the mouse button, and the LBUTTONUP message? I don't think that you need to block this message, since extra LBUTTONUP messages don't trigger anything in REAPER, AFAIK. Just intercept with passthrough=true (i.e. just listen to the messages, don't block), and stop the script when it detects an LBUTTONUP.


Quote:
Originally Posted by Sexan View Post
Edit: sorry did not read it right. So this will keep mouse unblocked until we are in codition zone?
Yes. It manually passes through mouse clicks unless the mouse is in the condition zone.
juliansader is offline   Reply With Quote
Old 12-27-2019, 11:26 AM   #859
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

It might be easier to initialize Area Select drawing with a keyboard shortcut, though, instead of mouse position.

Similar to how native mouse modifiers are triggered by pressing a mouse modifier and then a mouse click/drag, Area drawing can be triggered by a keyboard shortcut followed by mouse click/drag.
juliansader is offline   Reply With Quote
Old 12-27-2019, 12:25 PM   #860
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

Edit......

Last edited by Sexan; 12-28-2019 at 03:16 AM.
Sexan is online now   Reply With Quote
Old 12-28-2019, 03:15 AM   #861
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

Got it working!
Not sure why Post works but Send does not...

Anyway you are right it will be much easier if we trigger drawing with shortcut, then I do not need to track cursors etc...
Sexan is online now   Reply With Quote
Old 12-29-2019, 08:39 AM   #862
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Please pardon my ignorance (and my lack of desire to skim through these 22 pages of thread):

Is there any condensed up-to-date documentation for your extension, JS, possibly even including release/update logs? I know that X-Raym's awesome tool is usually pretty promptly updated, I just didn't know if there was any other location or source that is more current & comprehensive...
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 12-29-2019, 08:44 AM   #863
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default

Help > ReaScript documentation is generated on the fly with the extensions you have currently loaded so it is always up-to-date.

You can find every release notes in ReaPack > Browse packages > "js_ReaScript API" > About this package > History.
cfillion is offline   Reply With Quote
Old 12-29-2019, 08:59 AM   #864
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by cfillion View Post
Help > ReaScript documentation is generated on the fly with the extensions you have currently loaded so it is always up-to-date.

You can find every release notes in ReaPack > Browse packages > "js_ReaScript API" > About this package > History.
Awesome! It never occurred to me to look there!

Thanks again, my friend!
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 12-30-2019, 01:11 PM   #865
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Function 'JS_ReaScriptAPI_Version' is returning '0.996' for the v0.997 x64 dll.
Edgemeal is offline   Reply With Quote
Old 01-03-2020, 11:46 AM   #866
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default Set arrange view vertical scroll position (scroll to track by track ID)

I thought that this was nice, so I post it here
Code:
local floor = math.floor

function scroll_to_track(track_id, relative_y_pos, include_envelopes)
  relative_y_pos = relative_y_pos or 0 -- default position is "top"
  local p = "I_WNDH" -- Exclude envelope lane heights
  if not include_envelopes then -- Include envelope lane heights
    p = "I_TCPH"
  end
  -- Ignore hidden tracks
  if not reaper.IsTrackVisible(track_id, true) then
    return false
  end
  local tcp_y = reaper.GetMediaTrackInfo_Value(track_id, "I_TCPY")
  local tcp_h = reaper.GetMediaTrackInfo_Value(track_id, p)
  local arrange_id = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(), 0x3E8)
  local ok, ar_vsb_position, ar_vsb_page, ar_vsb_min, ar_vsb_max, ar_vsb_trackPos = reaper.JS_Window_GetScrollInfo(arrange_id, "v")
  if ok then
    ok = reaper.JS_Window_SetScrollPos(arrange_id, "v", tcp_y + ar_vsb_position - floor(relative_y_pos*(ar_vsb_page-tcp_h)))
  end
  return ok
end

-- Example: scroll to track #10
local tr = reaper.GetTrack(0, 9) -- Get track 10
if tr then
 -- Desc: scroll_to_track(track_id, relative_y_pos, include_envelopes)
  scroll_to_track(tr)
  --scroll_to_track(tr, 0.5, false)
  --scroll_to_track(tr, 1, false)
  --scroll_to_track(tr, 1, true)
end
spk77 is offline   Reply With Quote
Old 01-06-2020, 01:57 AM   #867
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

One more question regarding intercept and msg post, it is called defered (30hz)? Because items and movement start laging while LMB is intercepted? On slow movement its kinda ok but on any fast movement items get "stuck" not following mouse cursor as it should.
Sexan is online now   Reply With Quote
Old 01-06-2020, 06:19 AM   #868
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

There is no way to actually block mouse on demand (rather than block it all the time and pass it to reaper)?

After spending a lot of time with various approaches to mouse intercept its not working as it should (better to say as I've thought it will).

When LMB is intercepted and passthru like:

Code:
local WML_intercept = reaper.JS_WindowMessage_Intercept(track_window, "WM_LBUTTONDOWN", false)

function pass_thru()
   local xc, yc = reaper.JS_Window_ScreenToClient(track_window, mouse.x, mouse.y)
   reaper.JS_WindowMessage_Post(track_window, "WM_LBUTTONDOWN", 1, 0, xc, yc)
end

--IN MAIN LOOP
if not AREA and mouse.l_down then
 pass_thru()
end
Script ON (Intercepting LMB)


Script OFF


Which is the right way too do this stuff (as I've understand). Mouse becomes little unresponsive:
1. Movement is not tracked well (I guess because of 30hz defered speed)
2. If you grab the item to move it and your mouse gets over FADE or ITEM EDGE because of issue above, it starts to trigger moving fades and item edges and click stuff around.

Or I'm doing something wrong again?

Last edited by Sexan; 01-06-2020 at 06:26 AM.
Sexan is online now   Reply With Quote
Old 01-06-2020, 06:44 AM   #869
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default

The Linux build fails to load here:
Code:
swell: dlopen() failed: reaper_js_ReaScriptAPI64.so: undefined symbol: gdk_window_get_effective_toplevel
reaper_js_ReaScriptAPI64.so is not linked against GDK:
Code:
$ ldd ~/.config/REAPER/UserPlugins/reaper_js_ReaScriptAPI64.so 
	linux-vdso.so.1 (0x00007ffdcfb54000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f6c5cafc000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f6c5c9b6000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f6c5c99c000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f6c5c97a000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f6c5c7b3000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f6c5d081000)

Last edited by cfillion; 01-06-2020 at 07:04 AM.
cfillion is offline   Reply With Quote
Old 01-06-2020, 08:28 AM   #870
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Sexan View Post
There is no way to actually block mouse on demand (rather than block it all the time and pass it to reaper)?

After spending a lot of time with various approaches to mouse intercept its not working as it should (better to say as I've thought it will).

When LMB is intercepted and passthru like:

Code:
local WML_intercept = reaper.JS_WindowMessage_Intercept(track_window, "WM_LBUTTONDOWN", false)

function pass_thru()
   local xc, yc = reaper.JS_Window_ScreenToClient(track_window, mouse.x, mouse.y)
   reaper.JS_WindowMessage_Post(track_window, "WM_LBUTTONDOWN", 1, 0, xc, yc)
end

--IN MAIN LOOP
if not AREA and mouse.l_down then
 pass_thru()
end
Code:
local WML_intercept = reaper.JS_WindowMessage_Intercept(track_window, "WM_LBUTTONDOWN", false)

function pass_thru()
   local xc, yc = reaper.JS_Window_ScreenToClient(track_window, mouse.x, mouse.y)
   reaper.JS_WindowMessage_Post(track_window, "WM_LBUTTONDOWN", 1, 0, xc, yc)
end

--IN MAIN LOOP
if not AREA and not block and mouse.l_down then
 pass_thru()
end
Maybe you need another flag (block in this example):
  1. Set block true when mouse is clicked on AREA.
  2. Set block false when LMB is released.
spk77 is offline   Reply With Quote
Old 01-06-2020, 08:34 AM   #871
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

Quote:
Originally Posted by spk77 View Post

Maybe you need another flag (block in this example):
  1. Set block true when mouse is clicked on AREA.
  2. Set block false when LMB is released.
I'm doing that with AREA (use it as a flag).

What would be the use of that additional flag in your case ? What would it solve (ff I did not understands something)?

This passes thru the LMB while area is not drawing and its working (to some degree,explained above whats the problem)
Sexan is online now   Reply With Quote
Old 01-06-2020, 08:37 AM   #872
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Sexan View Post
I'm doing that with AREA (use it as a flag)
Oh, I thought AREA is some rectangle...then it's weird that it doesn't work properly.
spk77 is offline   Reply With Quote
Old 01-06-2020, 08:40 AM   #873
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

well it works but it SPAMS LMB down I guess (don't know how to explain it better...), you can see in the GIF above:
I hold LMB and it clicks pretty much everything the mouse is over from item,fade,item buttons,edges etc. And the mouse movement is "lagging" sometimes.
Its just single mouse down,it should be like second gif (which I've expected to be but maybe I'm wrong)
Sexan is online now   Reply With Quote
Old 01-06-2020, 09:04 AM   #874
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Sexan View Post
What would be the use of that additional flag in your case ? What would it solve (ff I did not understands something)?)

If AREA would have been a rectangle and lmb click positions would have been stored when clicking on that rectangle, the block flag would have prevented calling pass_thru() until the lmb would have been released.
Then it wouldn't had matter how fast the mouse is moved or which reaper UI-element it's on etc.
spk77 is offline   Reply With Quote
Old 01-06-2020, 12:47 PM   #875
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by cfillion View Post
The Linux build fails to load here:
Code:
swell: dlopen() failed: reaper_js_ReaScriptAPI64.so: undefined symbol: gdk_window_get_effective_toplevel
reaper_js_ReaScriptAPI64.so is not linked against GDK:
Code:
$ ldd ~/.config/REAPER/UserPlugins/reaper_js_ReaScriptAPI64.so 
	linux-vdso.so.1 (0x00007ffdcfb54000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f6c5cafc000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f6c5c9b6000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f6c5c99c000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f6c5c97a000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f6c5c7b3000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f6c5d081000)
Strangely, the x32 build works fine on my system, even though ldd returns a similarly short list.

Could you please try this new build? I made a small change in the linking command (listing the source cpp before the gdk library) and now the list of dependencies is much longer.
juliansader is offline   Reply With Quote
Old 01-06-2020, 01:27 PM   #876
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default

That one works, thanks!
cfillion is offline   Reply With Quote
Old 01-06-2020, 01:52 PM   #877
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Sexan View Post
Which is the right way too do this stuff (as I've understand). Mouse becomes little unresponsive:
1. Movement is not tracked well (I guess because of 30hz defered speed)
2. If you grab the item to move it and your mouse gets over FADE or ITEM EDGE because of issue above, it starts to trigger moving fades and item edges and click stuff around.
It might work better -- and feel more accurate for the user -- if you pass the original data of each message through unaltered, instead of updating the mouse position:
Code:
reaper.JS_WindowMessage_Intercept(w, "WM_LBUTTONDOWN", false)
...
pOK, pass, time, wLow, wHigh, lLow, lHigh = reaper.JS_WindowMessage_Peek(w, "WM_LBUTTONDOWN")
...
reaper.JS_WindowMessage_Post(w, "WM_LBUTTONDOWN", wLow, wHigh, lLow, lHigh)
juliansader is offline   Reply With Quote
Old 01-06-2020, 02:09 PM   #878
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

like this?

Code:
local WML_intercept = reaper.JS_WindowMessage_Intercept(track_window, "WM_LBUTTONDOWN", false)

function pass_thru()
   pOK, pass, time, wLow, wHigh, lLow, lHigh = reaper.JS_WindowMessage_Peek(track_window, "WM_LBUTTONDOWN")
   reaper.JS_WindowMessage_Post(track_window, "WM_LBUTTONDOWN", wLow, wHigh, lLow, lHigh)
end

function Main()
if not mouse.Ctrl() and not mouse.Shift() and mouse.l_down then
            pass_thru()
         end
end
Not working exactly (maybe my bad?)
Sexan is online now   Reply With Quote
Old 01-06-2020, 02:25 PM   #879
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

It is also crucial to check the timestamp of the message, which will tell you if the message is new, so that you pass each message through only once:
Code:
local WML_intercept = reaper.JS_WindowMessage_Intercept(track_window, "WM_LBUTTONDOWN", false)
prevTime = 0 -- or script start time

function pass_thru()
    pOK, pass, time, wLow, wHigh, lLow, lHigh = reaper.JS_WindowMessage_Peek(track_window, "WM_LBUTTONDOWN")
    if pOK and time > prevTime then
        prevTime = time       
        reaper.JS_WindowMessage_Post(track_window, "WM_LBUTTONDOWN", wLow, wHigh, lLow, lHigh)
    end
end

function Main()
if not mouse.Ctrl() and not mouse.Shift() and mouse.l_down then
            pass_thru()
         end
end
juliansader is offline   Reply With Quote
Old 01-06-2020, 02:54 PM   #880
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,687
Default

You are a very magical person!
Sexan is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.