XtDisplayToApplicationContext fails with "Error: Couldn't find per display information"

Glynn Clements glynn at gclements.plus.com
Tue Feb 3 19:40:00 PST 2009


Tristan Schmelcher wrote:

> Hello all. Sorry if this is not the right place to send this, but I'm
> developing a plugin for Firefox on Linux and I've run up against a
> roadblock. In my plugin I'm being passed a pointer to an X "Display" struct
> (in NPP_SetWindow, for those of you that know NPAPI) and I'm calling
> XtDisplayToApplicationContext on it to get an app context to use in various
> Xt calls. Now on most systems this works fine--e.g., Ubuntu Dapper 32-bit
> with FF2 and Intrepid 32-bit with FF3 both work flawlessly. However, when I
> build a 64-bit version and try it on Ubuntu Hardy 64-bit with FF3, it
> doesn't work. When it enters XtDisplayToApplicationContext, I get "Error:
> Couldn't find per display information" on the console and the program exits.
> 
> Does anyone know what could be causing this function to fail? I searched the
> web but without luck.

AFAIK, the display must have been "registered" with Xt via
XtDisplayInitialize(). With a conventional Xt-based application, this
is done by e.g. XtAppInitialize().

Firefox isn't an Xt application, so I'm a bit surprised that it works
at all. However, digging deeper I see that libxul.so uses Xt:

	$ nm -D /opt/firefox/libxul.so | fgrep ' U Xt'
	         U XtAddEventHandler
	         U XtAppCreateShell
	         U XtAppPending
	         U XtAppProcessEvent
	         U XtAppSetFallbackResources
	         U XtCreateApplicationContext
	         U XtDestroyWidget
	         U XtDisplay
	         U XtDisplayToApplicationContext
	         U XtManageChild
	         U XtOpenDisplay
	         U XtRealizeWidget
	         U XtRegisterDrawable
	         U XtRemoveEventHandler
	         U XtSetValues
	         U XtShellStrings
	         U XtStrings
	         U XtToolkitInitialize
	         U XtUnrealizeWidget
	         U XtUnregisterDrawable
	         U XtVaCreateWidget
	         U XtWindow
	         U XtWindowToWidget

XtOpenDisplay() calls XtDisplayInitialize(), so if it's getting the
Display* from there, it should work. If the Display* comes from
elsewhere (e.g. Gtk/Gdk), it probably won't.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list