Bug 97936

Summary: Loss of focus associated with AirPlayUIAgent
Product: XQuartz Reporter: Richard Holmes <rs.holmes>
Component: New BugsAssignee: Jeremy Huddleston Sequoia <jeremyhu>
Status: RESOLVED NOTOURBUG QA Contact: Jeremy Huddleston Sequoia <jeremyhu>
Severity: normal    
Priority: medium    
Version: 2.7.9 (xserver-1.17.4)   
Hardware: IA64 (Itanium)   
OS: Mac OS X (All)   
i915 platform: i915 features:

Description Richard Holmes 2016-09-26 17:14:30 UTC
XQuartz windows sometimes lose focus while in use. Behavior is intermittent, but a Python script (see below) used to watch activations seems to show focus loss coincides with activity by AirPlayUIAgent:

2016-09-21 16:19:23.998 Python[809:36557] activated AirPlayUIAgent (com.apple.AirPlayUIAgent)

We apparently have several Apple TVs in our department, and when one is in use it leads to these activations. I do not connect with these Apple TVs myself, and do not seem to have them enabled in my displays prefs, but these AirPlayUIAgent activations happen anyway.

Steps to reproduce: Open Terminal, connect via SSH to our Linux computer, start up Emacs, begin editing. Keep working until AirPlayUIAgent activation occurs.

Actual results: Emacs window loses focus. No other window comes to foreground or gains focus.

Expected results: Emacs window continues to have focus.

OS version: Mac OS X 10.11.6

Below is the Python script used to discover the connection with AirPlayUIAgent:

import signal
import sys
def signal_handler(signal, frame):
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGQUIT, signal_handler)

from AppKit import *

class MyObserver(NSObject):
    def appActivated_(self, notification):
        app = notification.userInfo()["NSWorkspaceApplicationKey"]
        NSLog(u"activated %@ (%@)", app.localizedName(), app.bundleIdentifier())

ws = NSWorkspace.sharedWorkspace()
nc = ws.notificationCenter()
ob = MyObserver.new()
nc.addObserver_selector_name_object_(ob, "appActivated:", NSWorkspaceDidActivateApplicationNotification, ws)
Comment 1 Jeremy Huddleston Sequoia 2016-09-27 01:57:17 UTC
Please file a bug report at http://bugreport.apple.com about the loss of focus.  It will be duped to a radar that has existed for a while, but more noise and "me too"s are useful.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.