define GtkWidget struct with a 'parent' pointer pointer to itself - thx Benjamin Smedberg

This commit is contained in:
foudfou 2011-07-18 22:29:41 +02:00
parent f2245d1ca0
commit 7a614a38a3
3 changed files with 36 additions and 20 deletions

View File

@ -48,6 +48,14 @@ var mozt_getAllWindows = function() {
baseWindows[baseWindows.length] = mozt_getBaseWindow(w);
}
// e = wm.getEnumerator(null);
// // e = wm.getXULWindowEnumerator(null);
// while(e.hasMoreElements()) {
// let win = e.getNext().QueryInterface(Components.interfaces.nsIDOMChromeWindow);
// // let win = e.getNext().QueryInterface(Components.interfaces.nsIXULWindow);
// mozt.Debug.debug("WINDOW TITLE = " + win.document.documentElement.getAttribute("title") );
// }
return baseWindows;
};
@ -107,20 +115,18 @@ var mozt_trayCbJS = function() {
};
var mozt_func;
var mozt_funcGdkJS = function(a1, a2, a3) {
var mozt_funcGdkJS = function(data, userData) {
try {
mozt.Debug.debug("GDK Window");
mozt.Debug.debug(a1);
// mozt.Debug.debug(a2);
// mozt.Debug.debug(a3);
mozt.Debug.debug(data + "\t" + userData);
} catch(e) {mozt.Debug.debug(ex);}
};
var mozt_funcGtkJS = function(win) {
var mozt_funcGtkJS = function(data, userData) {
try {
ctypes.cast(win, LibGtkStatusIcon.GtkWidget.ptr);
mozt.Debug.debug("GTK Window " + win);
LibGtkStatusIcon.gtk_widget_hide(win);
ctypes.cast(data, LibGtkStatusIcon.GtkWidget.ptr);
mozt.Debug.debug("GTK Window " + data);
LibGtkStatusIcon.gtk_widget_hide(data);
} catch(e) {mozt.Debug.debug(ex);}
};

View File

@ -150,7 +150,7 @@ XPCOMUtils.defineLazyGetter(this, "GFunc", function() {
XPCOMUtils.defineLazyGetter(this, "GFunc_t", function() {
var GFunc_t = ctypes.FunctionType(
ctypes.default_abi, ctypes.void_t,
[gpointer]
[gpointer, gpointer]
).ptr;
if (!GFunc_t)
throw "GFunc_t is unavailable";

View File

@ -56,18 +56,28 @@ var LibGtkStatusIcon = {
]);
this.GtkStyle = ctypes.StructType("GtkStyle");
this.GtkRequisition = ctypes.StructType("GtkRequisition");
this.GtkAllocation = ctypes.StructType("GtkAllocation");
this.GtkRequisition = ctypes.StructType(
"GtkRequisition", [
{ width: LibGObject.gint },
{ height: LibGObject.gint }
]);
this.GtkAllocation = ctypes.StructType(
"GtkAllocation", [
{ x: LibGObject.gint },
{ y: LibGObject.gint },
{ width: LibGObject.gint },
{ height: LibGObject.gint }
]);
/* NOTE: recursive struct needs define() and included structs MUST be
* defined ! */
this.GtkWidget = ctypes.StructType("GtkWidget");
/* FIXME: unable to fix "struct field types must have defined and nonzero
* size" */
// this.GtkWidget.define([
// { "style": this.GtkStyle.ptr },
// { "requisition": this.GtkRequisition },
// { "allocation": this.GtkAllocation },
// { "window": LibGdkWindow.GdkWindow.ptr },
// { "parent": ctypes.PointerType(ctypes.void_t) } // this.GtkWidget.ptr
// ]);
this.GtkWidget.define([
{ "style": this.GtkStyle.ptr },
{ "requisition": this.GtkRequisition },
{ "allocation": this.GtkAllocation },
{ "window": LibGdkWindow.GdkWindow.ptr },
{ "parent": this.GtkWidget.ptr }
]);
// Consts
// this.INDICATOR_MESSAGES_SERVER_TYPE = "message";