Chrome Remote Desktop - Login window keyboard mouse simulation in macOS

166 views
Skip to first unread message

laughing_man

unread,
Dec 28, 2016, 1:25:22 AM12/28/16
to Chromium-dev
Hi,

I noticed that chrome remote desktop allows remote desktop connection in loginwindow of mac.
For a similar remote control application I was developing I was unable to simulate keyboarHM and mouse events
in login window service launchded via launchctl.

Can anyone explain how this is done in chrome desktop.  I am new to chrome source code, so will need some time
to figure it our by myself, so would be glad if someone who knows about this pitched in.

Thanks,

LH

PhistucK

unread,
Dec 28, 2016, 1:59:15 AM12/28/16
to sai.r.p...@gmail.com, Chromium-dev
​Until you get an answer, you can use cs.chromium.org for searching the entire code, including cross references. I bet the code in under the remoting/ directory.​
Use some keyword that might be related (macOS login, or osx login or OS X login) and you might get to comments that describe the process.


PhistucK

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

Sai Prasanna

unread,
Dec 28, 2016, 4:40:23 AM12/28/16
to PhistucK, Chromium-dev
@PhistucK - Thanks dude, this helped a lot.

I found that the mac code base for remoting uses deprecated API CGPostMouseEvent .

There was justification given in comments 

  // We use the deprecated CGPostMouseEvent API because we receive low-level
  // mouse events, whereas CGEventCreateMouseEvent is for injecting higher-level
  // events. For example, the deprecated APIs will detect double-clicks or drags
  // in a way that is consistent with how they would be generated using a local
  // mouse, whereas the new APIs expect us to inject these higher-level events
  // directly.
I also found that using CGPostMouseEvent is the only way to get mouse events simulatedon login window. The non deprecated API way of doing this using CGEventCreateMouseEvent + CGEventPost doesn't work in login window. Any idea on how this will be handled when the deprecated API is removed?

Sai Prasanna

unread,
Dec 28, 2016, 1:44:43 PM12/28/16
to PhistucK, Chromium-dev
And another thing is I tried using Keyboard simulation as given in inputinjector (CGEventCreateKeyBoardEvent), it doesn't seem to work in login window for my application.

Any special thing I have to do to enable this?

PhistucK

unread,
Dec 29, 2016, 7:14:45 AM12/29/16
to Sai Prasanna, Chromium-dev
I see that you tried to continue (or restart) a similar thread in chromium-discuss - please, keep the discussion here, as chromium-discuss is not as technical as this group and it will get more exposure to Chromium developers here.


PhistucK

Jamie Walch

unread,
Jan 9, 2017, 1:19:24 PM1/9/17
to Chromium-dev, phis...@gmail.com
You'll need to file a ticket with Apple support for instructions on how to get this working on the login window.

As for your question about the deprecated APIs, hopefully the comment explains why we use them in preference to the more modern ones. If the deprecated APIs are ever removed entirely, we'll have to switch to using CGEventPost instead, but until then the deprecated APIs are better for our purpose.

Hope this helps,
Jamie

Jamie Walch

unread,
Jan 9, 2017, 1:34:52 PM1/9/17
to Chromium-dev, PhistucK
Actually, it looks like Apple have published sample code for this now, so you can refer to it directly. Take a look at https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-421.18.3/IOHIDFamily.xcodeproj/project.pbxproj. Specifically, search for CGPreLoginApp for an example of how to do it via the -sectcreate option to ld.
Reply all
Reply to author
Forward
0 new messages