Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 09-02-2017, 12:00 PM   #1
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default API function: my_getViewport buggy?

I've tried a lot around with that function, as I hoped, it would give me control over the boundaries and position of the Reaper-Window itself.

But instead, it does nothing I can figure out of. No matter what I'm putting into the parameters, if I use them as "pointer variable" to get something(as sometimes reaperarrays work) or as a parameter so set something, it doesn't do anything I can make us of.

I'm not sure, whether this function is broken or useless, but I don't know for sure.

So, how to make it do anything? Or is it for something, no one knows? Is it working or is it buggy?
Meo-Ada Mespotine is online now   Reply With Quote
Old 09-02-2017, 04:36 PM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

There's absolutely no documentation for it, that's the problem. If you google the function name you can actually find it used in a .cpp on (IIRC) Landoleet, Justin's dev server.

I've been able to do this much with it in Lua:
Code:
local _, _, w, h = reaper.my_getViewport(0, 0, 0, 0, 0, 0, 0, 0, 1)

reaper.ShowConsoleMsg("Screen width = "..tostring(w).."\nScreen height = "..tostring(h))
- The 30px missing from Height are my taskbar, I think.

- It has issues with multiple monitors.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 09-08-2017, 09:29 AM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

It's a pity that it's not documented. Having the boundaries of the main Reaper-window would allow tons of cool features immediately.
Especially, as a lot of information on position of GUI-elements are stored in the reaper.ini.

I just figured out, how to do Client2Screen2Client-pixelconversion for the x-ccordinate for the main-Reaper window, yet.
The y-coordinate is still missing in my toolbox... :/
Meo-Ada Mespotine is online now   Reply With Quote
Old 09-08-2017, 07:41 PM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

Quote:
Originally Posted by Lokasenna View Post
There's absolutely no documentation for it, that's the problem. If you google the function name you can actually find it used in a .cpp on (IIRC) Landoleet, Justin's dev server.

I've been able to do this much with it in Lua:
Code:
local _, _, w, h = reaper.my_getViewport(0, 0, 0, 0, 0, 0, 0, 0, 1)

reaper.ShowConsoleMsg("Screen width = "..tostring(w).."\nScreen height = "..tostring(h))
- The 30px missing from Height are my taskbar, I think.

- It has issues with multiple monitors.
Heh I don't think this was ever actually intended to be used from Lua...

Explanation:
Code:
local l, t, r, b = reaper.my_getViewport(0, 0, 0, 0, pl, pt, pr, pb, want_workspace)
returns left/top/right/bottom of viewport. If want_workspace is 0, then returns the full monitor coordinates, otherwise returns the workspace.

pl/pt/pr/pb define a rectangle which will be used for multimonitors -- it will return the viewport that that rectangle is on/closest to.
Justin is online now   Reply With Quote
Old 09-10-2017, 08:25 AM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

@justin

thanx for the description
Meo-Ada Mespotine is online now   Reply With Quote
Old 01-23-2021, 02:49 PM   #6
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,134
Default

Would be great if it tracked and returned the relative size of the work area rather than the absolute one for when the main window is shrunk
Buy One is offline   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 06:00 AM.


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