Adobe-CEP / CEP-Resources

Tools and documentation for building Creative Cloud app extensions with CEP
https://www.adobe.io/apis/creativecloud/cep.html
1.62k stars 824 forks source link

Determine Screen Location of Adobe Application? #119

Open AndrewMore1 opened 7 years ago

AndrewMore1 commented 7 years ago

Is there a way I determine what portion of the screen is occupied by the Adobe application? I've looked through the ExtendScript Toolkit's Data Browser, and I'm not seeing anything that would enable me to make this determination.

To be clear, I'm looking for this information for the actual desktop/screen, rather than some sort of relative positioning within the app's window.

I need this information for Illustrator, Photoshop, and InDesign.

Thanks in advance.

bbb999 commented 7 years ago

What would you do, with that information?

Though it may be possible, I can't imagine why those apps would expose their own full bounds to a panel, which is presumed to only take up part of that area...

AndrewMore1 commented 7 years ago

Handle custom drag and drop.

Right now I've got a custom application in an extension panel. I need to be able to drag/drop custom information from the panel into the Adobe application. However, the Drag/Drop information isn't in a format that Adobe understands, further there doesn't seem to be a way to get notification of drag/drop events from the Adobe applications.

I'm tracking the drag/drop information from the events in the extension panel. When the drop happens I need to be able to determine if the drop occurred over the Adobe application (at which point I use the custom information to create images/text/etc in the Adobe application), or over the desktop (at which point I do nothing)

I would also be fine with just the part that includes the document being worked on, but it can't be relative, since I still wouldn't know where the app is in the screen, and the drag and drop information is all absolute from the top of the screen.

bbb999 commented 7 years ago

I understand why you might want to vary that behavior, depending on drag destination.

CEP panels provide drag FROM info, when the drag begins; it's not up to any drag source, to determine anything about where the drag ends.

See the Drag-n-Drop pane, in the CEP HTML Test Extension, for further implementation examples.

https://github.com/Adobe-CEP/Samples/tree/master/CEP_HTML_Test_Extension

AndrewMore1 commented 7 years ago

Usually you'd be correct, it doesn't matter. You load up the dragTransfer with information, and either the destination accepts it, or it does not. You can clearly see that in the sample you linked, which covers most cases. So if I just wanted to transfer an Image, or some text, no problem.

However, this case is special, which is why I mentioned "custom drag and drop" instead of just normal drag and drop.

I can't load the datatransfer with this information because Adobe doesn't understand it, and I can't get access to the OS drag and drop mechanisms to handle it myself. Which leaves waiting for the dragend event, checking to see where it stopped, and then doing all the functionality.

I've got that part working, but without knowing where the Adobe app is on the screen I can't tell the difference between a drop on the Adobe app, and something else. Nor is that information found in the regular drag/drop event info.

bbb999 commented 7 years ago

Makes sense. I have no idea how our applications would go about exposing that info.

AndrewMore1 commented 7 years ago

Honestly, just a rectangle on the App object with the absolute position on the screen would be enough. I don't think that would expose any sensitive information, wouldn't be that difficult to do. Not sure how many people would have a use for it.

bbb999 commented 7 years ago

I would agree that the implementation does not sound like rocket surgery.

However, such behavior would break the bounds of the extension model. Why should one panel in a multi – paneled UI get " privileged information" about the entire app's screen boundaries?

(I see why; it's just not an easy problem to solve, given the current extension model.)

AndrewMore1 commented 7 years ago

However, such behavior would break the bounds of the extension model. Why should one panel in a multi – paneled UI get " privileged information" about the entire app's screen boundaries?

Why stop at one panel? Wouldn't all panels get access to this information? Also what makes it privileged? Seems far less problematic than the level of access already granted by the File IO APIs which would enable an attacker to rummage around in the OS opening documents, reading their contents, and then doing whatever.

Anyway, I think you've answered my original question, which is that the information is not available. Thanks!

bbb999 commented 7 years ago

Privileged = I meant that, given the extension model used across Adobe apps, a panel Should™ not need to know anything about its peers, or its host's UI plans.

AndrewMore1 commented 7 years ago

Privileged = I meant that, given the extension model used across Adobe apps, a panel Should™ not need to know anything about its peers, or its host's UI plans.

Okay, yes, I see your point. However, I'm not seeing a way to do this otherwise.