MacVisibilityChanged() Does not get triggered for Cocoa - macos

wxWindowMac::MacVisibilityChanged() is virtual method and it is meant to be overridden, but it does not get called in Cocoa, while when using Carbon it was. (There was a migration from Carbon to Cocao).
My guess is that triggering this method via events is not implemented for Cocoa port of wxWidgets. Anyone had the same problem, what was the solution?
I am using wxWidgets 3.0.2 and Mac OS 10.9.

Found the answer myself for this one.
Just add an event handler for wxShowEvent and forget about using wxWindowMac::MacVisibilityChanged.

Related

App rejected because of using global hotkeys

The last days I sent a new build of my app to Apple to fix some minor bugs with macOS Catalina. This evening Apple called me and explained that they are refusing the new version in the AppStore because the application monitors keystrokes. I use the Clipy/Magnet library (github.com/Clipy/Magnet) to manage the hotkeys. This library uses a Carbon API. Admittedly, I'm a little surprised - on the one hand that Apple is calling me directly via phone about this and on the other hand the use of this library has not caused any problems so far. The only thing I noticed about the new build was that Catalina asks for "Input-Monitoring" at the first start of the program. I've installed several other programs that also respond to global hotkeys and none of them require the permission for "input monitoring".
Does anyone have a similar phenomenon under Catalina or how do you solve the problem of query/monitoring global hotkeys?
I know of numerous applications using the MASShortcut framework, and I don't believe they've had issues with the store. It also uses a carbon API, but I think the issue in Magnet is the call to CGEvent.tapCreate which can globally monitor all keyboard input, and which MASShortcut doesn't use.

Using Carbon in Cocoa Apps?

I've asked a more specific question over here but it's rolling amongst tumbleweeds.
Maybe I can get an answer to a more general question:
Carbon being deprecated and 32-bit–only, how bad of an idea is it to call Carbon APIs in an otherwise fully 64-bit, modern Cocoa app?
Will it negate whatever improvements 64-bit execution brings?
Could it jeoprardize the MAS review process and contribute to an app getting rejected from the Mac App Store?
I understand that you should probably not choose to do it, I'm talking about a situation where import Carbon is the only way to achieve something. Is the feature still worth it at that point?
You simply can't call Carbon functions from a 64-bit app. The link will fail (if the compile didn't already fail). At best you could put the Carbon stuff in a helper tool that you talk to with a pipe or something. And yes, Apple has said that using deprecated APIs can result in your app being rejected by the Mac App Store.

Using JNA to Get NSWindow from JComponent on mac

Is it possible to get the pointer or the window number of the underlying NSWindow of a JComponent on Mac, using JNA. I found methods getWindowID and getWindowPointer in com.sun.jna.Native. The documentation mentions getWindowID is for X11 and getWindowPointer is for win32. Is there a similar function for Mac OSX ?? I know how to get the cocoa window of a component using a JNI function but I am interested in using something in Java without writing a JNI function.
-Thanks,
Abhinay.
If you know how to do it in jni, then you most probably can do it with JNA. But, you would have to create your own mapping to cocoa libraries or see if rococoa already has what you need.
getWindowPointer() does the same thing for Mac OSX (it returns a pointer corresponding to the cocoa view ref). You may have to do additional manipulations to get a reference to the exact reference you need; as Denis suggests, rococoa likely has some utilities that would provide useful.

Sparkle Framework, Delegate methods are not getting called under Lion

I am trying to add Sparkle framework to my Application for automatic updates.
I did everything as prescribed in the documentation. But the update was not happening. I tried to find out more by putting some NSLog statements. What I found this was is quite scary. Most of the delegates does not work.
My application does not have much interface. So I called checkForUpdates directly in the code.
Did anyone faced the same problem? Can anyone help me to get out of this issue?
I'm using Xcode 4.1 under Mac OS X 10.7 Lion.

how to detect network event in cocoa osx

Is it possible to make sure my thread reacts on whenever there is network available ? Basically my thread should automatically get event that network is available and perform certain task.
Any help will be appreciated.
Yes you can, use Reachability APIs in SystemConfiguration.framework. See here. A sample code (for iphone) is available here. The parts concerning the reachability APIs should be usable for OS X, too.
To use the APIs, you need to understand an OS X specific concept of "run loops." See here.
I found a way of getting network change event using growl framework.
Added code on top of it to receive network change event.
Growl framework can be found at http://growl.info/documentation/developer/

Resources