Re: Is CGImage... thread-safe?

2020-05-26 Thread Steve Mills via Cocoa-dev
On May 26, 2020, at 16:10:26, Gabriel Zachmann via Cocoa-dev 
 wrote:
> 
> I've just had a crash in
>   CGImageSourceCreateThumbnailAtIndex( new_image, 0, imageOpts );

We went through this quite a while ago in private emails. 
CGImageSourceCreateThumbnailAtIndex is fine to use from any thread. Are you 
sure the image source even has an image at index 0? Not all do. What's the 
crashed stack look like?

--
Steve Mills
Drummer, Mac geek

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Is CGImage... thread-safe?

2020-05-26 Thread Gabriel Zachmann via Cocoa-dev
I've just had a crash in
   CGImageSourceCreateThumbnailAtIndex( new_image, 0, imageOpts );
The new_image and imageOpts were created/assigned just a few lines earlier in 
the code.
(and in the debugger they appear to be non-null.)

So I was wondering if CGImageSourceCreateThumbnailAtIndex() is thread-safe.
Maybe, it would be more correct to ask whether the CGImage framework is 
re-entrant.

The only other CGImage functions I am using, as far as I can see,
are CGImageRelease() and layer.content = image.
(The latter is not directly a CGImage function, but it might use them.)
These two functions might get called in a different thread - 
but, of course, never on objects I pass into 
CGImageSourceCreateThumbnailAtIndex() !


Any ideas as to why I am experiencing the crash, will be appreciated.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Screensaver can capture mouse events under Catalina

2020-05-26 Thread Gabriel Zachmann via Cocoa-dev
> 
>> I can confirm: this is indeed critical.  Otherwise, the .saver does not 
>> receive mouse events.
>> 
>> Unfortunately, it seems that I still cannot get key events.
> 
> If you are trying to get events from arrow or modifier keys, you have to use 
> keyDown and not keyUp.  But you may not be able to get any key events in a 
> screensaver for security reasons.

Yes, I am defining 

  - (void) keyDown: (NSEvent *) theEvent

in my ScreenSaverView subclass, but it never gets called.


Gab.




smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Screensaver can capture mouse events under Catalina

2020-05-26 Thread James Crate via Cocoa-dev
On May 25, 2020, at 3:43 PM, Gabriel Zachmann via Cocoa-dev 
 wrote:

> I can confirm: this is indeed critical.  Otherwise, the .saver does not 
> receive mouse events.
> 
> Unfortunately, it seems that I still cannot get key events.

If you are trying to get events from arrow or modifier keys, you have to use 
keyDown and not keyUp.  But you may not be able to get any key events in a 
screensaver for security reasons.

Jim Crate

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Screensaver can capture mouse events under Catalina

2020-05-26 Thread Gabriel Zachmann via Cocoa-dev
>> Unfortunately, with -addGlobalMonitorForEventsMatchingMask: ,
>> the event is still passed on to the higher-up objects, so that makes the 
>> screensaver engine terminate the screensaver immediately.
> 
> Does this mean you’re unable to set up a global event tap/monitor?  If you 
> are able, how are you setting it up?

I didn't try, because, like I said, it would be of no use to me, even if it did 
work,
because the screensaver engine would still receive the event, and kill the 
screensaver immediately.


Best regards, Gabriel



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Screensaver can capture mouse events under Catalina

2020-05-26 Thread Sandor Szatmari via Cocoa-dev
Gabriel,

> On May 26, 2020, at 04:21, Gabriel Zachmann  wrote:
> 
> Thanks a lot for your response!
> 
> Unfortunately, with -addGlobalMonitorForEventsMatchingMask: ,
> the event is still passed on to the higher-up objects, so that makes the 
> screensaver engine terminate the screensaver immediately.

Does this mean you’re unable to set up a global event tap/monitor?  If you are 
able, how are you setting it up?

Sandor

> 
> Best regards, Gabriel
> 
> 
> 
>> On 26. May 2020, at 00:54, Sandor Szatmari  
>> wrote:
>> 
>> Gabriel,  (this is a dup reply, forgot to cc list)
>> 
>> How are you setting up you global event monitor? 
>> 
>> I use this to handle catching mouse moved event when my app is not in the 
>> foreground…. maybe you use something like this
>> Just watch out for a lot of events and making your app a CPU hog.
>> 
>>   [NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMovedMask
>>  handler:
>>^(NSEvent * _Nonnull event)
>>{
>>   // Do stuff to handle events that I care about
>>}];
>> 
>> Sandor
> 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Screensaver can capture mouse events under Catalina

2020-05-26 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your response!

Unfortunately, with -addGlobalMonitorForEventsMatchingMask: ,
 the event is still passed on to the higher-up objects, so that makes the 
screensaver engine terminate the screensaver immediately.

Best regards, Gabriel



> On 26. May 2020, at 00:54, Sandor Szatmari  
> wrote:
> 
> Gabriel,  (this is a dup reply, forgot to cc list)
> 
> How are you setting up you global event monitor? 
> 
> I use this to handle catching mouse moved event when my app is not in the 
> foreground…. maybe you use something like this
> Just watch out for a lot of events and making your app a CPU hog.
> 
>[NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMovedMask
>   handler:
> ^(NSEvent * _Nonnull event)
> {
>// Do stuff to handle events that I care about
> }];
> 
> Sandor



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com