diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index f98200f..8bc5989 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -63,13 +63,20 @@ var firetrayUIOptions = {
},
initWindowAndIconControls: function() {
- this.disableHidesOptions(!firetray.Utils.prefService.getBoolPref('hides_on_close'));
+ let doDisable = !(firetray.Utils.prefService.getBoolPref('hides_on_close') ||
+ firetray.Utils.prefService.getBoolPref('hides_on_minimize'));
+ this.updateHidesOptions(doDisable);
},
- disableHidesOptions: function(doDisable) {
- LOG("doDisable="+doDisable);
+ updateHidesOptions: function(doDisable) {
+ if ("undefined" === typeof(doDisable)) {
+ let hides_on_close = document.getElementById("ui_hides_on_close").checked;
+ let hides_on_minimize = document.getElementById("ui_hides_on_minimize").checked;
+ LOG("hides_on_close="+hides_on_close+", hides_on_minimize="+hides_on_minimize);
+ doDisable = !hides_on_close && !hides_on_minimize;
+ }
+
document.getElementById('ui_hides_single_window').disabled = doDisable;
- // TODO: NOT IMPLEMENTED YET: document.getElementById('ui_hides_on_minimize').disabled = doDisable;
},
initMailControls: function() {
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index 0562fd4..629ffb2 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -43,15 +43,15 @@
+ oncommand="firetrayUIOptions.updateHidesOptions();"/>
+
-
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index 89aca0e..df2ec9e 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -12,11 +12,11 @@
+
+
+
-
-
-
diff --git a/src/modules/gtk2/FiretrayWindow.jsm b/src/modules/gtk2/FiretrayWindow.jsm
index 0dde823..a94fc36 100644
--- a/src/modules/gtk2/FiretrayWindow.jsm
+++ b/src/modules/gtk2/FiretrayWindow.jsm
@@ -21,6 +21,7 @@ Cu.import("resource://firetray/gobject.jsm");
Cu.import("resource://firetray/gdk.jsm");
Cu.import("resource://firetray/gtk.jsm");
Cu.import("resource://firetray/libc.jsm");
+Cu.import("resource://firetray/x11.jsm");
Cu.import("resource://firetray/commons.js");
const Services2 = {};
@@ -203,26 +204,118 @@ firetray.Window = {
LOG("restored WindowState: " + firetray.Handler.windows[xid].chromeWin.windowState);
},
- // http://www.gtkforums.com/viewtopic.php?t=1624
- onWindowState: function(gtkWidget, gdkEventState, userData){
+/* KEPT FOR LATER USE
+ onWindowState: function(gtkWidget, gdkEventState, userData) {
LOG("window-state-event: "+gdkEventState.contents.new_window_state);
if (gdkEventState.contents.new_window_state & gdk.GDK_WINDOW_STATE_ICONIFIED) {
let xid = firetray.Window.getXIDFromGtkWidget(gtkWidget);
LOG(xid+" iconified: "+gdkEventState.contents.changed_mask+" "+gdkEventState.contents.new_window_state);
-
- // let hides_on_minimize = firetray.Utils.prefService.getBoolPref('hides_on_minimize');
- // let hides_single_window = firetray.Utils.prefService.getBoolPref('hides_single_window');
- // if (hides_on_minimize) {
- // if (hides_single_window) {
- // firetray.Handler.hideSingleWindow(xid);
- // } else
- // firetray.Handler.hideAllWindows();
- // }
}
let stopPropagation = true; // not usefull
return stopPropagation;
+ },
+*/
+
+ checkXWindowEWMState: function(xwin, prop) {
+ LOG("xwin="+xwin+" 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 not found");
+ 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) {
+ ERROR("unsupported format: "+actual_format.value);
+ x11.XFree(prop_value);
+ return false;
+ }
+ LOG("format OK");
+ var props = ctypes.cast(prop_value, ctypes.unsigned_long.array(nitems.value).ptr);
+ LOG("props="+props+", size="+props.constructor.size);
+
+ for (let i=0; i