• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CGPostMouseEvent clicking Cocoa UI element causes system UI locku p
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CGPostMouseEvent clicking Cocoa UI element causes system UI locku p


  • Subject: CGPostMouseEvent clicking Cocoa UI element causes system UI locku p
  • From: "Crichlow, Eric" <email@hidden>
  • Date: Mon, 30 Dec 2002 15:31:38 -0500

I'm using USB and Bluetooth devices to simulate a mouse. I set up a
callback for data from the device, convert the device coordinates to screen
coordinates, and make a call to CGPostMouseEvent. The result is that my
Bluetooth or USB device acts as an exceptional mouse.

But, alas, there's a problem, a big one.

I have a Cocoa app that sets up the device and registers the callback.
This app also has its own windows for performing certain management
functionality.

Utilizing Cocoa to its fullest, I have action methods attached to many
of the user interface items on my windows.

Problem: if I generate a mouse click on a Cocoa user interface element
belonging to my app, that has an action method associated with it, I lock up
the entire OS X user interface. By this, I mean that I can still move the
mouse, and windows on the screen belonging to other applications continue to
update, iTunes continues to play music, and I can log into the computer
remotely, but I can no longer get the OS to accept mouse clicks or keyboard
input. I cannot Alt-Apple-ESC to kill the offending app. The only thing I
can do is reboot. Setting breakpoints to see what happens, I generate the
mouse event, the user interface element highlights, but my action method
never gets invoked... the system locks up first.

My first thought was that I was doing too much from within a callback,
that it wasn't wise to generate a system mouse event from within a USB or
Bluetooth callback. So, I changed my application so that within the callback
it creates a mouse event structure and adds it to an event queue that I
maintain. I set up a timer that fires periodically (I'm experimenting with
the rate) and checks the queue and issues the mouse events.

The only time this eliminates the problem is if I set the timer to fire
at some ridiculously slow rate, like once every couple of seconds.
Obviously, this is WAY too slow to simulate a mouse.

However, the fact that this works suggests to me that the problem is in
having data come in from USB/Bluetooth through a callback at the same time
as generating mouse events which cause my application's action methods to
get invoked.

Is this a problem/bug with Cocoa? Or is this an expected and reasonable
issue in dealing with callbacks and Cocoa action methods?

...Thanx...
...Eric Crichlow...
...GTCO CalComp...
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: CGPostMouseEvent clicking Cocoa UI element causes system UI locku p
      • From: Philip George <email@hidden>
  • Prev by Date: Re: NSKeyBinding suppressCapitalizedKeyWarning?
  • Next by Date: window loading sequence
  • Previous by thread: Re: NSTableView bug: No scroll bar
  • Next by thread: Re: CGPostMouseEvent clicking Cocoa UI element causes system UI locku p
  • Index(es):
    • Date
    • Thread