1
0
mirror of https://github.com/moparisthebest/FireTray synced 2024-12-22 05:48:49 -05:00

fix chat icon blink forever with gnome-shell 3.4.1 (#61)

This commit is contained in:
foudfou 2012-09-10 13:34:48 +02:00
parent a874d2852f
commit 5d9e0b4ef8
3 changed files with 16 additions and 15 deletions

View File

@ -87,12 +87,12 @@ firetray.Chat = {
}
},
stopIconBlinkingMaybe: function() {
stopIconBlinkingMaybe: function(xid) {
log.debug("acknowledgeOnFocus.must="+this.acknowledgeOnFocus.must);
if (!this.acknowledgeOnFocus.must) return;
let convIsActiveTabInActiveWin = this.isConvActiveTabInActiveWindow(
this.acknowledgeOnFocus.conv);
this.acknowledgeOnFocus.conv, xid);
log.debug("convIsActiveTabInActiveWin="+convIsActiveTabInActiveWin);
if (this.acknowledgeOnFocus.must && convIsActiveTabInActiveWin) {
@ -101,14 +101,17 @@ firetray.Chat = {
}
},
isConvActiveTabInActiveWindow: function(conv) {
let activeWin = firetray.Handler.findActiveWindow(),
activeChatTab = null;
isConvActiveTabInActiveWindow: function(conv, xid) {
let activeWin = xid || firetray.Handler.findActiveWindow();
if (!firetray.Handler.windows[activeWin]) return false;
let activeChatTab = null;
activeChatTab = this.findActiveChatTab(activeWin);
let convNameRegex = new RegExp(" - "+conv.name+"$");
return activeChatTab ? convNameRegex.test(activeChatTab.title) : false;
let title = activeChatTab && activeChatTab.title;
log.debug("conv.name='"+conv.name+"' title="+title);
return convNameRegex.test(title);
},
findActiveChatTab: function(xid) {

View File

@ -105,7 +105,9 @@ firetray.ChatStatusIcon = {
// (http://sourceforge.net/tracker/index.php?func=detail&aid=3190205&group_id=35398&atid=413960)
onFocusIn: function(widget, event, data) {
log.debug("onFocusIn");
firetray.Chat.stopIconBlinkingMaybe();
let xid = firetray.Window.getXIDFromGtkWidget(widget);
log.debug("xid="+xid);
firetray.Chat.stopIconBlinkingMaybe(xid);
}
// FIXME: TODO: onclick/activate -> chatHandler.showCurrentConversation()

View File

@ -147,13 +147,8 @@ firetray.Window = {
},
getXIDFromGtkWidget: function(gtkWid) {
try {
let gdkWin = gtk.gtk_widget_get_window(gtkWid);
return gdk.gdk_x11_drawable_get_xid(ctypes.cast(gdkWin, gdk.GdkDrawable.ptr));
} catch (x) {
log.error(x);
}
return null;
let gdkWin = gtk.gtk_widget_get_window(gtkWid);
return gdk.gdk_x11_drawable_get_xid(ctypes.cast(gdkWin, gdk.GdkDrawable.ptr));
},
addrPointedByInHex: function(ptr) {
@ -672,7 +667,8 @@ firetray.Handler.activateLastWindow = function(gtkStatusIcon, gdkEvent, userData
return stopPropagation;
};
/* gtk_window_is_active() not reliable */
/* NOTE: gtk_window_is_active() not reliable, and _NET_ACTIVE_WINDOW may not
always be set before 'focus-in-event' (gnome-shell 3.4.1) */
firetray.Handler.findActiveWindow = function() {
let rootWin = x11.XDefaultRootWindow(x11.current.Display);
let [propsFound, nitems] =