[Pkg-mozext-commits] [firetray] 113/399: MAJOR RE-DESIGN: drop X11 and Gecko window-cooking, and solely rely on GTK.
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:24 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 a13437891c52ac4806900081f660a2d22b08f993
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Thu Dec 15 17:14:56 2011 +0100
MAJOR RE-DESIGN: drop X11 and Gecko window-cooking, and solely rely on GTK.
WORK IN PROGRESS
---
src/chrome/content/overlay.js | 13 +--
src/modules/FiretrayHandler.jsm | 172 ++++++++++++++++-----------------
src/modules/FiretrayIconLinux.jsm | 189 +++++++++++++------------------------
src/modules/gdk.jsm | 1 +
src/modules/glib.jsm | 3 +
src/modules/gobject.jsm | 43 ++++++++-
src/modules/gtk.jsm | 13 +++
7 files changed, 213 insertions(+), 221 deletions(-)
diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index a095d56..929e8e1 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -37,11 +37,13 @@ firetray.Main = {
if (firetray.Handler.inMailApp && firetray.Messaging.initialized)
firetray.Messaging.updateUnreadMsgCount();
+/* GTK TEST
// prevent window closing.
let that = this;
window.addEventListener('close', that.onClose, true);
// NOTE: each new window gets a new firetray.Main, and hence listens to pref
// changes
+*/
LOG('Firetray LOADED: ' + init);
return true;
@@ -57,6 +59,7 @@ firetray.Main = {
tray icon) */
},
+/* GTK TEST
// TODO: prevent preceding warning about closing multiple tabs
// (browser.tabs.warnOnClose)
onClose: function(event) {
@@ -68,6 +71,7 @@ firetray.Main = {
event && event.preventDefault(); // no event when called directly (xul)
}
},
+*/
observe: function(subject, topic, data) {
// Observer for pref changes
@@ -92,12 +96,3 @@ window.addEventListener(
removeEventListener('unload', arguments.callee, true);
firetray.Main.onQuit(); },
false);
-
-// // TEST - can we catch minimize event ?
-// window.addEventListener(
-// 'command', function (e) {
-// removeEventListener('command', arguments.callee, true);
-// WARN("Got deactivated: "+e.originalTarget.windowState); // Ci.nsIDOMChromeWindow.STATE_MINIMIZED|STATE_NORMAL
-// WARN("attrName: "+e.attrName);
-// },
-// false);
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 7968fa2..24fabd8 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -160,92 +160,92 @@ firetray.Handler = {
}
},
- // FIXME: parameters may not be needed !! see gobject.GCallback_t
- showHideToTray: function(a1, a2, a3) {
- LOG("showHideToTray");
-
- /*
- * we update _handledDOMWindows only when hiding, because remembered{X,Y}
- * properties are attached to them, and we suppose there won't be
- * created/delete windows when all are hidden.
- *
- * NOTE: this may not be a good design if we want to show/hide one window
- * at a time... might need win.QueryInterface(Ci.nsIInterfaceRequestor)
- * .getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
- */
- if (!this._windowsHidden) // hide
- this._updateHandledDOMWindows();
- LOG("nb Windows: " + this._handledDOMWindows.length);
-
- for(let i=0; i<this._handledDOMWindows.length; i++) {
- let bw = this._getBaseOrXULWindowFromDOMWindow(
- this._handledDOMWindows[i], "BaseWindow");
-
- LOG('isHidden: ' + this._windowsHidden);
- LOG("bw.visibility: " + bw.visibility);
- try {
- if (this._windowsHidden) { // show
-
- // correct position, size and state
- let x = this._handledDOMWindows[i].rememberedX;
- let y = this._handledDOMWindows[i].rememberedY;
- let cx = this._handledDOMWindows[i].rememberedWidth;
- let cy = this._handledDOMWindows[i].rememberedHeight;
- LOG("set bw.position: " + x + ", " + y + ", " + cx + ", " + cy);
- let windowState = this._handledDOMWindows[i].rememberedState;
- LOG("set windowState: " + windowState);
-
- switch (windowState) {
- case Ci.nsIDOMChromeWindow.STATE_MAXIMIZED: // 1
- this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).maximize();
- break;
- case Ci.nsIDOMChromeWindow.STATE_MINIMIZED: // 2
- let prefHidesOnMinimize = firetray.Utils.prefService.getBoolPref("hides_on_minimize");
- if (!prefHidesOnMinimize)
- this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).minimize();
- break;
- case Ci.nsIDOMChromeWindow.STATE_NORMAL: // 3
- bw.setPositionAndSize(x, y, cx, cy, false); // repaint
- break;
- case Ci.nsIDOMChromeWindow.STATE_FULLSCREEN: // 4
- // FIXME: NOT IMPLEMENTED YET
- default:
- }
- LOG("maximize after: " + this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).windowState);
-
- bw.visibility = true;
-
- } else { // hide
-
- // remember position and size
- let x = {}, y = {}, cx = {}, cy = {};
- bw.getPositionAndSize(x, y, cx, cy);
- LOG("remember bw.position: " + x.value + ", " + y.value + ", " + cx.value + ", " + cy.value);
- this._handledDOMWindows[i].rememberedX = x.value;
- this._handledDOMWindows[i].rememberedY = y.value;
- this._handledDOMWindows[i].rememberedWidth = cx.value;
- this._handledDOMWindows[i].rememberedHeight = cy.value;
- this._handledDOMWindows[i].rememberedState = this._handledDOMWindows[i]
- .QueryInterface(Ci.nsIDOMChromeWindow).windowState;
- LOG("maximized: " + this._handledDOMWindows[i].rememberedState);
-
- bw.visibility = false;
- }
-
- } catch (x) {
- LOG(x);
- }
- LOG("bw.visibility: " + bw.visibility);
- LOG("bw.title: " + bw.title);
- }
-
- if (this._windowsHidden) {
- this._windowsHidden = false;
- } else {
- this._windowsHidden = true;
- }
-
- }, // showHideToTray
+/* GTK TEST */
+ // showHideToTray: function(a1) { // unused param
+ // LOG("showHideToTray");
+
+ // /*
+ // * we update _handledDOMWindows only when hiding, because remembered{X,Y}
+ // * properties are attached to them, and we suppose there won't be
+ // * created/delete windows when all are hidden.
+ // *
+ // * NOTE: this may not be a good design if we want to show/hide one window
+ // * at a time... might need win.QueryInterface(Ci.nsIInterfaceRequestor)
+ // * .getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
+ // */
+ // if (!this._windowsHidden) // hide
+ // this._updateHandledDOMWindows();
+ // LOG("nb Windows: " + this._handledDOMWindows.length);
+
+ // for(let i=0; i<this._handledDOMWindows.length; i++) {
+ // let bw = this._getBaseOrXULWindowFromDOMWindow(
+ // this._handledDOMWindows[i], "BaseWindow");
+
+ // LOG('isHidden: ' + this._windowsHidden);
+ // LOG("bw.visibility: " + bw.visibility);
+ // try {
+ // if (this._windowsHidden) { // show
+
+ // // correct position, size and state
+ // let x = this._handledDOMWindows[i].rememberedX;
+ // let y = this._handledDOMWindows[i].rememberedY;
+ // let cx = this._handledDOMWindows[i].rememberedWidth;
+ // let cy = this._handledDOMWindows[i].rememberedHeight;
+ // LOG("set bw.position: " + x + ", " + y + ", " + cx + ", " + cy);
+ // let windowState = this._handledDOMWindows[i].rememberedState;
+ // LOG("set windowState: " + windowState);
+
+ // switch (windowState) {
+ // case Ci.nsIDOMChromeWindow.STATE_MAXIMIZED: // 1
+ // this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).maximize();
+ // break;
+ // case Ci.nsIDOMChromeWindow.STATE_MINIMIZED: // 2
+ // let prefHidesOnMinimize = firetray.Utils.prefService.getBoolPref("hides_on_minimize");
+ // if (!prefHidesOnMinimize)
+ // this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).minimize();
+ // break;
+ // case Ci.nsIDOMChromeWindow.STATE_NORMAL: // 3
+ // bw.setPositionAndSize(x, y, cx, cy, false); // repaint
+ // break;
+ // case Ci.nsIDOMChromeWindow.STATE_FULLSCREEN: // 4
+ // // FIXME: NOT IMPLEMENTED YET
+ // default:
+ // }
+ // LOG("maximize after: " + this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).windowState);
+
+ // bw.visibility = true;
+
+ // } else { // hide
+
+ // // remember position and size
+ // let x = {}, y = {}, cx = {}, cy = {};
+ // bw.getPositionAndSize(x, y, cx, cy);
+ // LOG("remember bw.position: " + x.value + ", " + y.value + ", " + cx.value + ", " + cy.value);
+ // this._handledDOMWindows[i].rememberedX = x.value;
+ // this._handledDOMWindows[i].rememberedY = y.value;
+ // this._handledDOMWindows[i].rememberedWidth = cx.value;
+ // this._handledDOMWindows[i].rememberedHeight = cy.value;
+ // this._handledDOMWindows[i].rememberedState = this._handledDOMWindows[i]
+ // .QueryInterface(Ci.nsIDOMChromeWindow).windowState;
+ // LOG("maximized: " + this._handledDOMWindows[i].rememberedState);
+
+ // bw.visibility = false;
+ // }
+
+ // } catch (x) {
+ // LOG(x);
+ // }
+ // LOG("bw.visibility: " + bw.visibility);
+ // LOG("bw.title: " + bw.title);
+ // }
+
+ // if (this._windowsHidden) {
+ // this._windowsHidden = false;
+ // } else {
+ // this._windowsHidden = true;
+ // }
+
+ // }, // showHideToTray
quitApplication: function() {
try {
diff --git a/src/modules/FiretrayIconLinux.jsm b/src/modules/FiretrayIconLinux.jsm
index 2c0bebc..7940cb1 100644
--- a/src/modules/FiretrayIconLinux.jsm
+++ b/src/modules/FiretrayIconLinux.jsm
@@ -15,7 +15,6 @@ Cu.import("resource://firetray/gdk.jsm");
Cu.import("resource://firetray/gtk.jsm");
Cu.import("resource://firetray/libc.jsm");
Cu.import("resource://firetray/pango.jsm");
-Cu.import("resource://firetray/x11.jsm");
Cu.import("resource://firetray/commons.js");
const Services2 = {};
@@ -35,7 +34,8 @@ var firetray_iconActivateCb;
var firetray_popupMenuCb;
var firetray_menuItemQuitActivateCb;
var firetray_findGtkWindowByTitleCb;
-var firetray_filterWindowCb;
+var firetray_windowDeleteCb;
+var firetray_windowStateCb;
/**
* custum type used to pass data in to and out of firetray_findGtkWindowByTitleCb
@@ -68,32 +68,48 @@ firetray.IconLinux = {
// attach popupMenu to trayIcon
try {
- // watch out for binding problems ! here we prefer to keep 'this' in
- // showHideToTray() and abandon the args.
- firetray_iconActivateCb = gobject.GCallback_t(
- function(){firetray.Handler.showHideToTray();});
- gobject.g_signal_connect(this.trayIcon, "activate",
- firetray_iconActivateCb, null);
+
+ /* GTK TEST. initWindow should be done somewhere else
+ (Firetray.WindowLinux ?) */
+ let win = Services.wm.getMostRecentWindow(null);
+ /* NOTE: it should not be necessary to cast gtkWin to a GtkWidget, nor
+ gtk_widget_add_events(gtkWin, gdk.GDK_ALL_EVENTS_MASK); */
+ let gtkWin = this.getGtkWindowHandle(win);
+ LOG("gtkWin="+gtkWin);
+ let gdkWin = gtk.gtk_widget_get_window(
+ ctypes.cast(gtkWin, gtk.GtkWidget.ptr));
+ LOG("gdkWin="+gdkWin);
+
+ firetray_iconActivateCb = gtk.GCallbackStatusIconActivate_t(firetray.IconLinux.showHideToTray);
+ // gobject.g_signal_connect(this.trayIcon, "activate", firetray_iconActivateCb, null);
+ gobject.g_signal_connect(this.trayIcon, "activate", firetray_iconActivateCb, gdkWin); // TEST
+
+ /* delete_event_cb (in gtk2/nsWindow.cpp) prevents us from catching
+ "delete-event" */
+
+ let deleteEventId = gobject.g_signal_lookup("delete-event", gtk.gtk_window_get_type());
+ LOG("deleteEventId="+deleteEventId);
+ let deleteEventHandler = gobject.g_signal_handler_find(gtkWin, gobject.G_SIGNAL_MATCH_ID, deleteEventId, 0, null, null, null);
+ LOG("deleteEventHandler="+deleteEventHandler);
+ gobject.g_signal_handler_block(gtkWin, deleteEventHandler); // not _disconnect
+
+ firetray_windowDeleteCb = gtk.GCallbackGenericEvent_t(firetray.IconLinux.windowDelete);
+ // let res = gobject.g_signal_connect(gtkWin, "delete_event", firetray_windowDeleteCb, null);
+ let res = gobject.g_signal_connect(gtkWin, "delete_event", firetray_windowDeleteCb, null);
+ LOG("g_connect delete-event="+res);
+
+
+ /* we'll catch minimize events with Gtk:
+ http://stackoverflow.com/questions/8018328/what-is-the-gtk-event-called-when-a-window-minimizes */
+ firetray_windowStateCb = gtk.GCallbackGenericEvent_t(firetray.IconLinux.windowState);
+ res = gobject.g_signal_connect(gtkWin, "window-state-event", firetray_windowStateCb, null);
+ LOG("g_connect window-state-event="+res);
+
} catch (x) {
ERROR(x);
return false;
}
- // TEST - should probably be done in Main.onLoad()
- let win = Services.wm.getMostRecentWindow(null);
- let gdkWin = this.getGdkWindowHandle(win);
- // TODO: register window here ? (and unregister in shutdown)
- try {
- let that = this;
- let filterData = gdkWin;
- /* NOTE: We may have to do this with Gdk:
- http://stackoverflow.com/questions/8018328/what-is-the-gtk-event-called-when-a-window-minimizes */
- firetray_filterWindowCb = gdk.GdkFilterFunc_t(that.filterWindow);
- gdk.gdk_window_add_filter(gdkWin, firetray_filterWindowCb, filterData);
- } catch(x) {
- ERROR(x);
- }
-
return true;
},
@@ -223,6 +239,7 @@ firetray.IconLinux = {
}
},
+ // FIXME: it may not be worth wrapping gtk_widget_get_window...
getGdkWindowFromGtkWindow: function(gtkWin) {
try {
let gtkWid = ctypes.cast(gtkWin, gtk.GtkWidget.ptr);
@@ -248,89 +265,35 @@ firetray.IconLinux = {
return null;
},
- checkXWindowEWMState: function(xwin, prop) {
- LOG("prop="+prop);
-
- // infos returned by XGetWindowProperty()
- let actual_type = new x11.Atom;
- let actual_format = new ctypes.int;
- let nitems = new ctypes.unsigned_long;
- let bytes_after = new ctypes.unsigned_long;
- let prop_value = new ctypes.unsigned_char.ptr;
-
- let bufSize = XATOMS_EWMH_WM_STATES.length*ctypes.unsigned_long.size;
- let offset = 0;
- let res = x11.XGetWindowProperty(
- x11.current.Display, xwin, x11.current.Atoms._NET_WM_STATE, offset, bufSize, 0, x11.AnyPropertyType,
- actual_type.address(), actual_format.address(), nitems.address(), bytes_after.address(), prop_value.address());
- LOG("XGetWindowProperty res="+res+", actual_type="+actual_type.value+", actual_format="+actual_format.value+", bytes_after="+bytes_after.value+", nitems="+nitems.value);
-
- if (!strEquals(res, x11.Success)) {
- ERROR("XGetWindowProperty failed");
- return false;
- }
- if (strEquals(actual_type.value, x11.None)) {
- WARN("property does not exist");
- return false;
- }
-
- LOG("prop_value="+prop_value+", size="+prop_value.constructor.size);
- /* If the returned format is 32, the property data will be stored as an
- array of longs (which in a 64-bit application will be 64-bit values
- that are padded in the upper 4 bytes). [man XGetWindowProperty] */
- if (actual_format.value === 32) {
- LOG("format OK");
- var props = ctypes.cast(prop_value, ctypes.unsigned_long.array(nitems.value).ptr);
- } else
- ERROR("unsupported format: "+actual_format.value);
- LOG("props="+props+", size="+props.constructor.size);
-
- for (let i=0; i<nitems.value; ++i) {
- LOG(props.contents[i]);
- if (strEquals(props.contents[i], prop))
- return true;
+ showHideToTray: function(gtkStatusIcon, userData){
+ LOG("showHideToTray: "+userData);
+ try {
+ let gdkWin = ctypes.cast(userData, gdk.GdkWindow.ptr);
+ gdk.gdk_window_show(gdkWin);
+ } catch (x) {
+ ERROR(x);
}
- x11.XFree(prop_value);
-
- return false;
+ let stopPropagation = true;
+ return stopPropagation;
},
- filterWindow: function(xev, gdkEv, data) {
- if (!xev)
- return gdk.GDK_FILTER_CONTINUE;
-
- try {
- let xany = ctypes.cast(xev, x11.XAnyEvent.ptr);
- let xwin = xany.contents.window;
-
- switch (xany.contents.type) {
-
- case x11.UnmapNotify:
- LOG("UnmapNotify");
- LOG("isHidden="+firetray.IconLinux.checkXWindowEWMState(xwin, x11.current.Atoms._NET_WM_STATE_HIDDEN));
- break;
-
- case x11.ClientMessage:
- LOG("ClientMessage");
- let xclient = ctypes.cast(xev, x11.XClientMessageEvent.ptr);
- LOG("xclient.data="+xclient.contents.data);
- LOG("message_type="+xclient.contents.message_type+", format="+xclient.contents.format);
- if (strEquals(xclient.contents.data[0], x11.current.Atoms.WM_DELETE_WINDOW)) {
- LOG("Delete Window prevented");
- return gdk.GDK_FILTER_REMOVE;
- }
- break;
-
- default:
- // LOG("xany.type="+xany.contents.type);
- break;
- }
- } catch(x) {
+ windowDelete: function(gtkWidget, gdkEv, userData){
+ LOG("gtk_widget_hide: "+gtkWidget+", "+gdkEv+", "+userData);
+ try{
+ let gdkWin = firetray.IconLinux.getGdkWindowFromGtkWindow(gtkWidget);
+ gdk.gdk_window_hide(gdkWin);
+ } catch (x) {
ERROR(x);
}
+ let stopPropagation = true;
+ return stopPropagation;
+ },
- return gdk.GDK_FILTER_CONTINUE;
+ windowState: function(gtkWidget, gdkEv, userData){
+ LOG("window-state-event");
+ let stopPropagation = true;
+ return stopPropagation;
}
}; // firetray.IconLinux
@@ -483,30 +446,6 @@ firetray.Handler.setText = function(text, color) { // TODO: split into smaller f
return true;
};
-
-/**
- * init X11 Display and handled XAtoms.
- * Needs to be defined and called outside x11.jsm because: gdk already import
- * x11, and there is no means to get the default Display solely with Xlib
- * without opening one... :-(
- */
-x11.init = function() {
- if (!isEmpty(this.current))
- return true; // init only once
-
- this.current = {};
- try {
- let gdkDisplay = gdk.gdk_display_get_default();
- this.current.Display = gdk.gdk_x11_display_get_xdisplay(gdkDisplay);
- this.current.Atoms = {};
- XATOMS.forEach(function(atomName, index, array) {
- this.current.Atoms[atomName] = x11.XInternAtom(this.current.Display, atomName, 0);
- LOG("x11.current.Atoms."+atomName+"="+this.current.Atoms[atomName]);
- }, this);
- return true;
- } catch (x) {
- ERROR(x);
- return false;
- }
+firetray.Handler.showHideToTray = function() {
+ // How to do that ?? is called in overlay.xul
};
-x11.init();
diff --git a/src/modules/gdk.jsm b/src/modules/gdk.jsm
index 5b4da2f..2298bc1 100644
--- a/src/modules/gdk.jsm
+++ b/src/modules/gdk.jsm
@@ -133,6 +133,7 @@ function gdk_defines(lib) {
lib.lazy_bind("gdk_window_destroy", ctypes.void_t, this.GdkWindow.ptr);
lib.lazy_bind("gdk_x11_window_set_user_time", ctypes.void_t, this.GdkWindow.ptr, gobject.guint32);
lib.lazy_bind("gdk_window_hide", ctypes.void_t, this.GdkWindow.ptr);
+ lib.lazy_bind("gdk_window_show", ctypes.void_t, this.GdkWindow.ptr);
lib.lazy_bind("gdk_screen_get_default", this.GdkScreen.ptr);
lib.lazy_bind("gdk_screen_get_toplevel_windows", gobject.GList.ptr, this.GdkScreen.ptr);
lib.lazy_bind("gdk_pixbuf_new_from_file", this.GdkPixbuf.ptr, gobject.gchar.ptr, glib.GError.ptr.ptr);
diff --git a/src/modules/glib.jsm b/src/modules/glib.jsm
index eebbbad..019e1db 100644
--- a/src/modules/glib.jsm
+++ b/src/modules/glib.jsm
@@ -13,6 +13,9 @@ Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
function glib_defines(lib) {
+ /* mutual inclusion not possible */
+ this.GQuark = ctypes.uint32_t; // this.GQuark = gobject.guint32;
+
this.GError = ctypes.StructType("GError");
};
diff --git a/src/modules/gobject.jsm b/src/modules/gobject.jsm
index 53fe463..5df1dbb 100644
--- a/src/modules/gobject.jsm
+++ b/src/modules/gobject.jsm
@@ -48,9 +48,41 @@ const Ci = Components.interfaces;
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
+Cu.import("resource://firetray/glib.jsm");
function gobject_defines(lib) {
+ this.GdkEventMask = ctypes.int; // enum
+ this.GDK_EXPOSURE_MASK = 1 << 1,
+ this.GDK_POINTER_MOTION_MASK = 1 << 2,
+ this.GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
+ this.GDK_BUTTON_MOTION_MASK = 1 << 4,
+ this.GDK_BUTTON1_MOTION_MASK = 1 << 5,
+ this.GDK_BUTTON2_MOTION_MASK = 1 << 6,
+ this.GDK_BUTTON3_MOTION_MASK = 1 << 7,
+ this.GDK_BUTTON_PRESS_MASK = 1 << 8,
+ this.GDK_BUTTON_RELEASE_MASK = 1 << 9,
+ this.GDK_KEY_PRESS_MASK = 1 << 10,
+ this.GDK_KEY_RELEASE_MASK = 1 << 11,
+ this.GDK_ENTER_NOTIFY_MASK = 1 << 12,
+ this.GDK_LEAVE_NOTIFY_MASK = 1 << 13,
+ this.GDK_FOCUS_CHANGE_MASK = 1 << 14,
+ this.GDK_STRUCTURE_MASK = 1 << 15,
+ this.GDK_PROPERTY_CHANGE_MASK = 1 << 16,
+ this.GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
+ this.GDK_PROXIMITY_IN_MASK = 1 << 18,
+ this.GDK_PROXIMITY_OUT_MASK = 1 << 19,
+ this.GDK_SUBSTRUCTURE_MASK = 1 << 20,
+ this.GDK_SCROLL_MASK = 1 << 21,
+ this.GDK_ALL_EVENTS_MASK = 0x3FFFFE
+ this.GSignalMatchType = ctypes.int; // enum
+ this.G_SIGNAL_MATCH_ID = 1 << 0,
+ this.G_SIGNAL_MATCH_DETAIL = 1 << 1,
+ this.G_SIGNAL_MATCH_CLOSURE = 1 << 2,
+ this.G_SIGNAL_MATCH_FUNC = 1 << 3,
+ this.G_SIGNAL_MATCH_DATA = 1 << 4,
+ this.G_SIGNAL_MATCH_UNBLOCKED = 1 << 5
+
this.gpointer = ctypes.voidptr_t;
this.gulong = ctypes.unsigned_long;
this.guint = ctypes.unsigned_int;
@@ -82,11 +114,15 @@ function gobject_defines(lib) {
{ ref_count: this.guint },
{ qdata: this.GData.ptr },
]);
+ this.GClosure = ctypes.StructType("GClosure", [
+ { in_marshal: this.guint },
+ { is_invalid: this.guint },
+ ]);
/* NOTE: if we needed more/different args, we'd need to implement another
FunctionType */
this.GCallback_t = ctypes.FunctionType(
- ctypes.default_abi, ctypes.void_t, [this.gpointer, this.guint, this.gpointer]).ptr;
+ ctypes.default_abi, ctypes.void_t, [this.gpointer]).ptr;
// intended for g_list_foreach.
this.GFunc_t = ctypes.FunctionType(
ctypes.default_abi, ctypes.void_t, [this.gpointer, this.gpointer]).ptr;
@@ -102,6 +138,11 @@ function gobject_defines(lib) {
lib.lazy_bind("g_list_free", ctypes.void_t, this.GList.ptr);
lib.lazy_bind("g_list_length", this.guint, this.GList.ptr);
lib.lazy_bind("g_list_foreach", ctypes.void_t, this.GList.ptr, this.GFunc, this.gpointer);
+ lib.lazy_bind("g_signal_lookup", this.guint, this.gchar.ptr, this.GType);
+ lib.lazy_bind("g_signal_handler_find", this.gulong, this.gpointer, this.GSignalMatchType, this.guint, glib.GQuark, this.GClosure.ptr, this.gpointer, this.gpointer);
+ lib.lazy_bind("g_signal_handler_disconnect", ctypes.void_t, this.gpointer, this.gulong);
+ lib.lazy_bind("g_signal_handler_block", ctypes.void_t, this.gpointer, this.gulong);
+ lib.lazy_bind("g_signal_handler_unblock", ctypes.void_t, this.gpointer, this.gulong);
}
diff --git a/src/modules/gtk.jsm b/src/modules/gtk.jsm
index cee6b7d..7a36814 100644
--- a/src/modules/gtk.jsm
+++ b/src/modules/gtk.jsm
@@ -53,10 +53,16 @@ function gtk_defines(lib) {
ctypes.default_abi, ctypes.void_t,
[this.GtkMenu.ptr, gobject.gint.ptr, gobject.gint.ptr,
gobject.gboolean.ptr, gobject.gpointer]).ptr;
+ this.GCallbackStatusIconActivate_t = ctypes.FunctionType(
+ ctypes.default_abi, gobject.gboolean,
+ [this.GtkStatusIcon.ptr, gobject.gpointer]).ptr;
this.GCallbackMenuPopup_t = ctypes.FunctionType(
ctypes.default_abi, ctypes.void_t,
[this.GtkStatusIcon.ptr, gobject.guint, gobject.guint,
gobject.gpointer]).ptr;
+ this.GCallbackGenericEvent_t = ctypes.FunctionType(
+ ctypes.default_abi, gobject.gboolean,
+ [this.GtkWidget.ptr, gdk.GdkEvent.ptr, gobject.gpointer]).ptr;
lib.lazy_bind("gtk_status_icon_new", this.GtkStatusIcon.ptr);
lib.lazy_bind("gtk_status_icon_set_from_file", ctypes.void_t,
@@ -97,6 +103,13 @@ function gtk_defines(lib) {
lib.lazy_bind("gtk_window_set_decorated", ctypes.void_t, this.GtkWindow.ptr,
gobject.gboolean);
+ lib.lazy_bind("gtk_widget_hide_on_delete", gobject.gboolean, this.GtkWidget.ptr);
+ // lib.lazy_bind("gtk_widget_hide", ctypes.void_t, this.GtkWidget.ptr);
+ // lib.lazy_bind("gtk_widget_show", ctypes.void_t, this.GtkWidget.ptr);
+ lib.lazy_bind("gtk_widget_get_events", gobject.gint, this.GtkWidget.ptr);
+ lib.lazy_bind("gtk_widget_get_events", gobject.gint, this.GtkWidget.ptr);
+ lib.lazy_bind("gtk_widget_add_events", ctypes.void_t, this.GtkWidget.ptr, gobject.gint);
+ lib.lazy_bind("gtk_window_get_type", gobject.GType);
}
if (!gtk) {
--
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