[Pkg-mozext-commits] [firetray] 16/399: define GtkWidget struct with a 'parent' pointer pointer to itself - thx Benjamin Smedberg

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:06 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit 7a614a38a37815d68a10a2d11789862c5efd80a3
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Mon Jul 18 22:29:41 2011 +0200

    define GtkWidget struct with a 'parent' pointer pointer to itself - thx Benjamin Smedberg
---
 src/chrome/content/overlay.js   |   22 ++++++++++++++--------
 src/modules/LibGObject.js       |    2 +-
 src/modules/LibGtkStatusIcon.js |   32 +++++++++++++++++++++-----------
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index 6d622e5..1ab5cbd 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -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);}
 };
 
diff --git a/src/modules/LibGObject.js b/src/modules/LibGObject.js
index 787ccf2..106d90f 100644
--- a/src/modules/LibGObject.js
+++ b/src/modules/LibGObject.js
@@ -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";
diff --git a/src/modules/LibGtkStatusIcon.js b/src/modules/LibGtkStatusIcon.js
index 0d05ae9..5645d70 100644
--- a/src/modules/LibGtkStatusIcon.js
+++ b/src/modules/LibGtkStatusIcon.js
@@ -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";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git



More information about the Pkg-mozext-commits mailing list