[Pkg-mozext-commits] [firetray] 06/38: First step toward xembed systray detection.
David Prévot
taffit at moszumanska.debian.org
Mon Apr 6 15:58:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firetray.
commit dc806f2447d72768ede9f25f82330cf6bfb07371
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Sun Jan 18 21:57:55 2015 +0100
First step toward xembed systray detection.
---
src/modules/ctypes/linux/gdk.jsm | 4 ++-
src/modules/ctypes/linux/x11.jsm | 4 +++
src/modules/linux/FiretrayStatusIcon.jsm | 54 ++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/src/modules/ctypes/linux/gdk.jsm b/src/modules/ctypes/linux/gdk.jsm
index ee11087..27cf198 100644
--- a/src/modules/ctypes/linux/gdk.jsm
+++ b/src/modules/ctypes/linux/gdk.jsm
@@ -265,12 +265,14 @@ function gdk_defines(lib) {
lib.lazy_bind("gdk_window_show_unraised", 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_screen_get_number", gobject.gint, this.GdkScreen.ptr);
+ lib.lazy_bind("gdk_screen_get_display", this.GdkDisplay.ptr, this.GdkScreen.ptr);
+ lib.lazy_bind("gdk_x11_get_xatom_by_name_for_display", x11.Atom, this.GdkDisplay.ptr, gobject.gchar.ptr);
lib.lazy_bind("gdk_pixbuf_new_from_file", this.GdkPixbuf.ptr, gobject.gchar.ptr, glib.GError.ptr.ptr);
lib.lazy_bind("gdk_pixbuf_copy", this.GdkPixbuf.ptr, this.GdkPixbuf.ptr);
lib.lazy_bind("gdk_pixbuf_composite", ctypes.void_t, this.GdkPixbuf.ptr, this.GdkPixbuf.ptr, ctypes.int, ctypes.int, ctypes.int, ctypes.int, ctypes.double, ctypes.double, ctypes.double, ctypes.double, ctypes.int, ctypes.int);
lib.lazy_bind("gdk_pixbuf_get_has_alpha", gobject.gboolean, this.GdkPixbuf.ptr);
lib.lazy_bind("gdk_pixbuf_add_alpha", this.GdkPixbuf.ptr, this.GdkPixbuf.ptr, gobject.gboolean, gobject.guchar, gobject.guchar, gobject.guchar);
-
lib.lazy_bind("gdk_pixbuf_get_colorspace", this.GdkColorspace, this.GdkPixbuf.ptr);
lib.lazy_bind("gdk_pixbuf_get_n_channels", ctypes.int, this.GdkPixbuf.ptr);
lib.lazy_bind("gdk_pixbuf_get_has_alpha", gobject.gboolean, this.GdkPixbuf.ptr);
diff --git a/src/modules/ctypes/linux/x11.jsm b/src/modules/ctypes/linux/x11.jsm
index ab25c99..2895f45 100644
--- a/src/modules/ctypes/linux/x11.jsm
+++ b/src/modules/ctypes/linux/x11.jsm
@@ -218,6 +218,10 @@ function x11_defines(lib) {
lib.lazy_bind("XRaiseWindow", ctypes.int, this.Display.ptr, this.Window);
lib.lazy_bind("XGetWindowAttributes", this.Status, this.Display.ptr, this.Window, this.XWindowAttributes.ptr);
lib.lazy_bind("XChangeWindowAttributes", ctypes.int, this.Display.ptr, this.Window, ctypes.unsigned_long, this.XSetWindowAttributes.ptr);
+ lib.lazy_bind("XGetSelectionOwner", this.Window, this.Display.ptr, this.Atom);
+ lib.lazy_bind("XGetAtomName", ctypes.char.ptr, this.Display.ptr, this.Atom);
+ lib.lazy_bind("XOpenDisplay", this.Display.ptr, ctypes.char.ptr);
+ lib.lazy_bind("XCloseDisplay", ctypes.int, this.Display.ptr);
}
new ctypes_library(X11_LIBNAME, X11_ABIS, x11_defines, this);
diff --git a/src/modules/linux/FiretrayStatusIcon.jsm b/src/modules/linux/FiretrayStatusIcon.jsm
index 4f1b09a..5c33db4 100644
--- a/src/modules/linux/FiretrayStatusIcon.jsm
+++ b/src/modules/linux/FiretrayStatusIcon.jsm
@@ -10,6 +10,7 @@ Cu.import("resource://firetray/ctypes/linux/gdk.jsm");
Cu.import("resource://firetray/ctypes/linux/gio.jsm");
Cu.import("resource://firetray/ctypes/linux/glib.jsm");
Cu.import("resource://firetray/ctypes/linux/gobject.jsm");
+Cu.import("resource://firetray/ctypes/linux/x11.jsm");
Cu.import("resource://firetray/commons.js");
firetray.Handler.subscribeLibsForClosing([gdk, gio, glib, gobject]);
@@ -38,6 +39,11 @@ firetray.StatusIcon = {
this.canAppIndicator =
(appind3.available() && this.dbusNotificationWatcherReady());
log.info("canAppIndicator="+this.canAppIndicator);
+ // Can we detect if EWMH icons handled ?
+ // For ex. if gtk_status_icon_new returns NULL ? NO
+ // XGetSelectionOwner(_NET_SYSTEM_TRAY_Sn) ?
+ let xtray = this.xSystemtrayReady();
+ log.warn("xtray="+xtray);
if (firetray.Utils.prefService.getBoolPref('with_appindicator') &&
this.canAppIndicator) {
/* FIXME: Ubuntu14.04/Unity: successfully closing appind3 crashes FF/TB
@@ -98,6 +104,54 @@ firetray.StatusIcon = {
loadImageCustom: function() { }, // done in setIconImageCustom
+ xSystemtrayReady: function() {
+ /*
+ GdkScreen * screen = gtk_widget_get_screen(GTK_WIDGET(p->panel->topgwin));
+ GdkDisplay * display = gdk_screen_get_display(screen);
+
+ char * selection_atom_name = g_strdup_printf("_NET_SYSTEM_TRAY_S%d", gdk_screen_get_number(screen));
+ Atom selection_atom = gdk_x11_get_xatom_by_name_for_display(display, selection_atom_name);
+ g_free(selection_atom_name);
+
+ if (XGetSelectionOwner(GDK_DISPLAY_XDISPLAY(display), selection_atom) != None)
+ {
+ ERR("tray: another systray already running\n");
+ return 1;
+ }
+ */
+
+ let dpy = x11.XOpenDisplay(null);
+ log.warn("dpy="+dpy);
+
+ // let screen = gdk.gdk_screen_get_default();
+ // let display = gdk.gdk_screen_get_display(screen);
+ // let selection_atom_name = "_NET_SYSTEM_TRAY_S"+gdk.gdk_screen_get_number(screen);
+ // log.warn("selection_atom_name="+selection_atom_name);
+ // let selection_atom = gdk.gdk_x11_get_xatom_by_name_for_display(display, selection_atom_name);
+ // log.warn("selection_atom="+selection_atom);
+
+ let intern_atom = x11.XInternAtom(dpy, "_NET_SYSTEM_TRAY_S0", 0);
+ log.warn("intern_atom="+intern_atom);
+
+ // let xdisplay = gdk.gdk_x11_display_get_xdisplay(display);
+ // log.warn("xdisplay="+xdisplay+" "+"Display="+x11.current.Display);
+ // let name = x11.XGetAtomName(xdisplay, selection_atom).readString();
+ // log.warn("name="+name);
+
+ // let rv = x11.XGetSelectionOwner(xdisplay, selection_atom);
+ // let rv = x11.XGetSelectionOwner(x11.current.Display, selection_atom);
+ let rv = x11.XGetSelectionOwner(dpy, intern_atom);
+ log.warn(rv);
+ log.warn(rv.value);
+ log.warn(rv.toSource());
+ log.warn(rv.toString());
+ log.warn(x11.None);
+
+ x11.XCloseDisplay(dpy);
+
+ return rv;
+ },
+
dbusNotificationWatcherReady: function() {
let watcherReady = false;
--
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