Show a window from 32-bit NPAPI Plugin in 64-bit Safari - safari

I have an old NPAPI plugin for OS X that I'm trying to refit for use with Snow Leopard's version of Safari. My problem is that when I switch Safari to 64-bit mode, it changes the plugin environment to out of process mode (where plugins are hosted by a 32-bit WebKitPluginHost process). And now my toolbar palettes are not visible on screen, even though the NSPanels on which they are based think they are visible. The documentation says that bringing up windows is not recommended, but doesn't say its prohibited; is there something I can do to bring up my Windows?

The most reliable solution is to simply let another application, possibly connected to your plugin via some IPC mechanism, do thatApple:
Avoid creating windows. The intent is for plug-ins to operate within the browser window. Although some plug-ins have historically done so, creating windows in your plug-in is not recommended. If you need to maintain separate windows, you should consider starting a separate application.
Bringing up windows from a plugin might work in some circumstances and completely break in different ones. By recommending against doing so Apple is at liberty to break your previously working behaviour whenever it wishes to.

Unfortunately, probably not. If you're doing anything that is not possible using the normal graphics libraries (CoreAnimation, Cocoa, etc), you probably can't do it using the 32 bit plugin in 64 bit safari.
You might be able to do more if you compile your plugin in 64 bit mode, though. I don't know :-/

I know I am a little late. Safari doesn't allow plugin to display NSPanel. You should try using NSWindow instead. I know Apple doesn't agree.
For showing menu you could use "popupcontextmenu". It takes NPNSMenu which is NSMenu typecasted.

Related

NPRuntime plugin says Missing Plug-in in Safari(Windows)

I have developed an NPRuntime plugin, everything is ok, but it not initialized in Safari. I registered the plugin in MozillaPlugins registry key, it works fine for Chrome/FF/Opera, but Safari writes the the plugin is missing, although I found my plugin in the list of isntalled safari plugins. What am i doing wrong ?
That's real hard to say. Safari on windows isn't supported real well by Apple, so I don't bother supporting it much myself. If it's really important I'd recommend adding logging in all your NPP_ methods (and your NP_ functions too) and see what is getting called; find out if it even loads your plugin. Often if something doesn't go as the browser wants during startup it will act like it didn't find it at all.
You could also use Process Monitor to see if it is trying to load the file or not.

Open/Save dialog from Netscape plugin on Mac OS X?

I'm developing an NPAPI plugin for Mac OS X, and need an Open/Save dialog at various times. Accessing the window directly fails, since plugins are now run out-of-process... but Apple's documentation makes vague references to being able to launch dialogs and other things via provided APIs.
Can anyone shed light on how I might do something like launch an Open dialog, a modal sheet if possible? I was developing this as a WebKit Cocoa plugin for Safari but as of Mac OS X Lion they're now deprecated.
You can't open a modal sheet, because you have no reference to the browser window; it's impossible to get one across processes.
You can open an open/save dialog as a modal dialog using standard calls like -[NSSavePanel runModal], since you don't need any window references for that. The browser will take care of managing the process activation so that the dialog ends up in front of the browser.
Since when is a WebKit plugin deprecated? Do you mean NPAPI plugins, they are definitely deprecated under 64-bit webkit apps (as I am struggling with this myself).

a couple questions about the titanium platform

I have recently been browsing frameworks such as JavaScriptMVC, qooxdoo, Sproutcore and others alike which are using javascript to create desktop-like apps in the browser with minimal, or none css/html (depending on the framework).
What I know of titanium is that it uses html/css for the views, and language of choice (javascript, ruby,python,php) for everything else. Then it gets compiled(?) into a native app.
What are the quirks? if any?
Is it necessary for the user to install some sort of a runtime to execute the compiled app?
I suppose javascript is the prefered language, but how are the other ones handled?
For example, which Ruby interpreter would be included, would I be albe to use the ruby stdlib or external libraries? Would it affect the speed of the app? I.e JS > Ruby in terms of speed.
Since the views are CSS/HTML, would it still be necessary to style the elements, add them effects via JS librarier to achieve a widget-like feeling? Or does it come with some pre-made settings/classes for that?
I am not sure if it applies to the desktop package, but is there some syncing with the appcelerator's server required? What would it be necessary for?
I am sorry if the questions sound stupid, but I didn't even realise there are than many tools until recent. I am ultimately looking for something which is easy to use, has an option to work with a back-end server for data exchange, looks preferably good 'out of the box' or doesnt require that much work to get it themed nicely and works on mobile as well as desktop devices.
With Titanium you build your app out using javascript. Titanium ultimately generates its own XCode project for you that is compiled and deployed to a device.
The user does not require any runtime be installed prior to installing your app.
Unless your building custom modules to hook up your own controls you stick with javascript.
Your javascript calls end up as native controls, early versions required css like styling due to reliance on webkit but this is no longer the case.
There is no IDE but it does come with an app to create Titanium projects, test in emulator, deploy etc. It also talks back to HQ for updates.
In answer to (2), Titanium Mobile is Javascript only, but Desktop also supports Python, Perl and PHP.

Unable to load DLL 'coredll.dll': The specified module could not be found. (On Windows XP)

Thanks to the gurus at StackOverflow. You guys are awesome. I posted on question on detecting idle time on a Compact framework application and got answers very quickly. When I tried the suggested solution on my Windows XP development box, I get this error
Unable to load DLL 'coredll.dll': The
specified module could not be found.
(On Windows XP)
After googling for sometime I understood that OpenNETCF libraries are trying to launch coredll.dll to detect the idle time but this dll is shiped with only Windows Mobile OS. As we are developing the application on a Windows XP PC and dont have access to Windows CE device now, we are struck with the problem.
Is there any way to get coredll.dll on Windows XP? Any other solution to this problem?
Updated: we are targeting the application for device running on Windows Mobile 6 Professional
I'm confused. The question was specifically about Compact Framework, which is for Windows CE. If you don't have your target hardware yet, then use an emulator.
In this specific case, the SDF is not P/Invoking to do this, it's using an IMessageFilter implementation. You could easily do the same for the desktop.
But that said, you simply can't develop a CF application targeting XP. What that means is that if you create your app using the full framework, targeting the desktop, and expect it to just run when you get your CE device, you're in for a big surprise. If targeting both OSes is a design goal, then there's a lot of work to be done, and most UI stuff is not transferrable (I'd actually recommend using different UI assemblies for the two targets and common business logic).
EDIT1
I guess to more fully answer the question of "can I get coredll.dll for my desktop?" the answer is a resounding "no". There are a multitude of reasons this wouldn't work (it's in ROM, it's hardware dependent, it's not actually a file, but fixed up to execute in place, it's compiled for a different OS, it may be compiled for a totally different processor, etc).
You have a couple options. You could try to create a desktop version of coredll.dll that exported all of the functions you want and proxies them to the kernel32, user32, etc DLLs. That's a boatload of work (been there, tried that).
You could try to write code that will work for both platforms. Doable, but also quite challenging.
The short of it is, unless you absolutely must target both, you don't want to try to. Get an emulator, virtual PC or some sort of eval system, and target that.
You can't run OpenNetCF in a Windows PC. You need to use a Windows CE emulator. This comes with the Windows CE SDK.
Write code that works for both platforms.
In our solution anything that is going to touch the platform is abstracted out to different objects. Therefore we have a IPlatformServices object (that returns stuff like IPowerManagement, IPrinter etc) we have two different implementations a PCPlatformServices and a CEPlatformServices and the one returned is based on the Environment.PlatformID value. In your scenario you want 2 different IdleDetector objects one for CE and one for Desktop. Aye its a bit of a pain to identify and abstract all this but you will need to do this is you want compatability between the two different platforms.
Our "PCPlatformServices" is mainly mocks in our case as we only want desktop compatibility to test things more quickly that don't interact with the hardware (like app code / business logic)

How to write a cross-platform program?

Greetings,
I want to write a small cross-platform utility program with GUI in it. What language/GUI-library should I stick to? Is it possible whatsoever?
This is gonna be a small program, so I don't want to make people download JVM or .NET Framework. Is it possible to develop it natively?
Update 1.
By "natively" I mean that the end result will be native code without intermediate layers like Java Virtual Machine or .NET Common Language Runtime
Update 2.
A FREE solution is preferable ;)
If you know C or C++ the first cross platform GUI framework I can think of are:
QT (C++, proprietary but free with the LGPL licensing)
wxWidgets (C++, the most complete and stable but also huge)
FLTK (C++)
FOX (C++)
IUP (C, simpler and cleaner than the ones above)
If you know Pascal, you can try freepascal+Lazarus. I've never used it, though.
The problem is: If you do not want to have a GUI but you do not want to ask the user to download an eternal API, Framework or virtual machine to run it in, be it TCL/TK, Java or QT etc. then you get lost pretty fast.
The reason is: You would have to rebuild all the (GUI) functionality those APIs, frameworks and virtual machines provide you with to be platform independent. And that's a whole lot of work to do... .
On the other side: The Java virtual machine is installed on nearly any operating system from scratch, why not give this one a shot?
You want to develop a cross-platform program natively? Uh...I don't think that'll work, mainly because that phrase is a paradox. If you write native code, it by its very nature will only run on the platform you programmed it for. ;-) That's what the Frameworks are all about.
So what you should do instead is use a very slim framework if your program is going to be so small. itsmatt's idea of Qt is a possibility.
WxWindows? Oh, it's called WxWidgets now: http://www.wxwidgets.org/
wxWidgets has bindings to all sorts of languages - python for instance, if your app is small enough.
Lazarus is great. GTK2 on Linux, win32/64 on Windows, WINCE on euh, Wince. It even uses Carbon on Mac (working on COCOA). Also easy to sell to your boss (the code is Delphi compatible)
How about Python using Qt or Wx and then using PythonToExe to make a 'distributable'
Thought will have to giving to the development to ensure that no native functionality is used (i.e. registry etc.) Also things like line breaks in text files will have different escape characters so will need to be handled
Which OS's do you have in mind when you say cross-platform?
As Epaga correctly points out, native and cross-platform are mutually exclusive. You can either write multiple versions that run natively on multiple platforms, or you need to use some cross-platform framework.
In the case of the cross-platform framework approach, there will always be extra installs required. For example, many here suggest using Python and one of its frameworks. This would necessitate instructing people to install python - and potentially the framework - first.
If you are aiming at Windows and OS X (and are prepared to experiment with alpha-release code for Linux if support for that OS is required), I'd highly recommend you take a look at using Adobe AIR for cross-platform GUI applications.
I agree with Georgi, Java is the way to go. With a bit of work, you can make your desktop application work as a Java applet too (so that users do not need to actively download anything at all). See http://www.geogebra.org as an example of an application with runs smoothly as a cross-platform Java application AND has a simple port to a web applet.
Two other advantages to using Java are:
They have extensive libraries for building the UI, including UI component builders.
The Java runtime framework is generally updated automatically for the user.
One disadvantage:
The version of Java installed on your end users computer may not be totally compatible with your application, requiring you to code to the lowest likely denominator.
Try RealBasic. Visual Basic-like syntax, targets Win32, OS X and Linux. I don't know any details about targetting Linux, but for any cross-platform development I've done between Win32 and OS X its been a dream.
http://www.realbasic.com
Edit: Generates native executables. There is a small cost - $100.
Have you looked at Qt?
Flash? It's installed pretty much everywhere.
If it "HAS" to be Desktop use Qt. Nothing beats it right now.
However personally I gave up on desktop and any UI based project I do is normally Browser/Server based. You can easily write a little custom server that listens to some port so the program can run locally with no need for your users to install Apache or have access to the net. I have a small Lua, Python and C++ framework I made for that purpose (Want to add Javascript for the backend with V8 :)
If you're going to look at Qt and WxWidgets, don't forget to also check out GTK+ !
I agree with David Wees and Georgi,
Java is cross-platformness par excellence. You literally write once and run everywhere. With no need of compiling your code for each target OS or bitness, no worries about linking against anything, etc.
Only thing is, as you pointed out, that a JRE must be installed, but it's quick and straightforward to do even for novice end-users (it's a matter of clicking "Next>" a few times in the installer).
And with Java Web Start deployment gets even easier: the user just clicks the launch button on a webpage and the application runs (if the proper JVM is installed according to what specified in the JNLP descriptor) or the user gets redirected to the Java download page (if no suitable JVM is found).