Merge branch 'raised'
This commit is contained in:
commit
c2203c063f
|
@ -23,6 +23,7 @@
|
|||
<preference id="pref_bool_hides_on_minimize" name="extensions.firetray.hides_on_minimize" type="bool"/>
|
||||
<preference id="pref_bool_hides_single_window" name="extensions.firetray.hides_single_window" type="bool"/>
|
||||
<preference id="pref_bool_start_hidden" name="extensions.firetray.start_hidden" type="bool"/>
|
||||
<preference id="pref_bool_show_activates" name="extensions.firetray.show_activates" type="bool"/>
|
||||
<preference id="pref_bool_show_icon_on_hide" name="extensions.firetray.show_icon_on_hide" type="bool"/>
|
||||
<preference id="pref_bool_scroll_hides" name="extensions.firetray.scroll_hides" type="bool" />
|
||||
<preference id="pref_string_scroll_mode" name="extensions.firetray.scroll_mode" type="string" />
|
||||
|
@ -58,6 +59,10 @@
|
|||
<checkbox id="ui_start_hidden" preference="pref_bool_start_hidden"
|
||||
label="&bool_start_hidden.label;"
|
||||
accesskey="&bool_start_hidden.accesskey;"/>
|
||||
<checkbox id="ui_show_activates" preference="pref_bool_show_activates"
|
||||
label="&bool_show_activates.label;"
|
||||
accesskey="&bool_show_activates.accesskey;"
|
||||
tooltiptext="&bool_show_activates.tooltip;"/>
|
||||
</groupbox>
|
||||
|
||||
<groupbox>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!ENTITY prefwindow.title "FireTray preferences">
|
||||
<!ENTITY prefwindow.title "y preferences">
|
||||
<!ENTITY pane1.title "FireTray preferences">
|
||||
|
||||
<!ENTITY NOT_IMPLEMENTED_YET "NOT IMPLEMENTED YET">
|
||||
|
@ -16,6 +16,9 @@
|
|||
<!ENTITY bool_hides_single_window.accesskey "H">
|
||||
<!ENTITY bool_start_hidden.label "Start application hidden to tray">
|
||||
<!ENTITY bool_start_hidden.accesskey "S">
|
||||
<!ENTITY bool_show_activates.label "Activate restored windows">
|
||||
<!ENTITY bool_show_activates.accesskey "e">
|
||||
<!ENTITY bool_show_activates.tooltip "restored windows raise on top and get focus">
|
||||
|
||||
<!ENTITY icon_settings "Icon settings">
|
||||
<!ENTITY bool_show_icon_on_hide.label "Show tray icon only if a window is hidden">
|
||||
|
|
|
@ -11,6 +11,8 @@ pref("extensions.firetray.hides_on_close", true);
|
|||
pref("extensions.firetray.hides_on_minimize", true);
|
||||
pref("extensions.firetray.hides_single_window", false);
|
||||
pref("extensions.firetray.start_hidden", false);
|
||||
pref("extensions.firetray.show_activates", false);
|
||||
|
||||
pref("extensions.firetray.show_icon_on_hide", false);
|
||||
pref("extensions.firetray.scroll_hides", true);
|
||||
pref("extensions.firetray.scroll_mode", "down_hides");
|
||||
|
|
|
@ -34,8 +34,12 @@ const XATOMS_EWMH_WM_STATES = [
|
|||
"_NET_WM_STATE_FULLSCREEN", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_BELOW",
|
||||
"_NET_WM_STATE_DEMANDS_ATTENTION"
|
||||
];
|
||||
const XATOMS = XATOMS_ICCCM.concat(XATOMS_EWMH_WM_STATES)
|
||||
.concat(XATOMS_EWMH_GENERAL).concat(["CARDINAL"]);
|
||||
const XATOMS_EWMH_ROOT = [ "_NET_ACTIVE_WINDOW" ]
|
||||
const XATOMS = XATOMS_ICCCM
|
||||
.concat(XATOMS_EWMH_WM_STATES)
|
||||
.concat(XATOMS_EWMH_GENERAL)
|
||||
.concat(XATOMS_EWMH_ROOT)
|
||||
.concat(["CARDINAL"]);
|
||||
|
||||
|
||||
function x11_defines(lib) {
|
||||
|
@ -127,6 +131,7 @@ function x11_defines(lib) {
|
|||
lib.lazy_bind("XChangeProperty", ctypes.int, this.Display.ptr, this.Window, this.Atom, this.Atom, ctypes.int, ctypes.int, ctypes.unsigned_char.ptr, ctypes.int);
|
||||
lib.lazy_bind("XDefaultRootWindow", this.Window, this.Display.ptr);
|
||||
lib.lazy_bind("XSendEvent", this.Status, this.Display.ptr, this.Window, this.Bool, ctypes.long, this.XEvent.ptr);
|
||||
lib.lazy_bind("XRaiseWindow", ctypes.int, this.Display.ptr, this.Window);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -245,12 +245,23 @@ firetray.Window = {
|
|||
let desktopDest = firetray.Handler.windows[xid].savedDesktop;
|
||||
if (desktopDest === null) return;
|
||||
|
||||
let dataSize = 1;
|
||||
let data = ctypes.long(dataSize);
|
||||
data[0] = desktopDest;
|
||||
this.xSendClientMessgeEvent(xid, x11.current.Atoms._NET_WM_DESKTOP, data, dataSize);
|
||||
|
||||
LOG("restored to desktop: "+desktopDest);
|
||||
delete firetray.Handler.windows[xid].savedDesktop;
|
||||
},
|
||||
|
||||
xSendClientMessgeEvent: function(xid, atom, data, dataSize) {
|
||||
let xev = new x11.XClientMessageEvent;
|
||||
xev.type = x11.ClientMessage;
|
||||
xev.window = x11.Window(xid);
|
||||
xev.message_type = x11.current.Atoms._NET_WM_DESKTOP;
|
||||
xev.message_type = atom;
|
||||
xev.format = 32;
|
||||
xev.data[0] = desktopDest;
|
||||
for (let i=0; i<dataSize; ++i)
|
||||
xev.data[i] = data[i];
|
||||
|
||||
let rootWin = x11.XDefaultRootWindow(x11.current.Display);
|
||||
let propagate = false;
|
||||
|
@ -258,24 +269,25 @@ firetray.Window = {
|
|||
// fortunately, it's OK not to cast xev. ctypes.cast to a void_t doesn't work (length pb)
|
||||
let status = x11.XSendEvent(x11.current.Display, rootWin, propagate, mask, xev.address());
|
||||
// always returns 1 (BadRequest as a coincidence)
|
||||
|
||||
LOG("restored to desktop: "+desktopDest);
|
||||
delete firetray.Handler.windows[xid].savedDesktop;
|
||||
},
|
||||
|
||||
/* 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);
|
||||
}
|
||||
/**
|
||||
* raises window on top and give focus.
|
||||
*/
|
||||
activate: function(xid) {
|
||||
if (!firetray.Utils.prefService.getBoolPref('show_activates'))
|
||||
return;
|
||||
|
||||
let stopPropagation = true; // not usefull
|
||||
return stopPropagation;
|
||||
let dataSize = 3;
|
||||
let data = ctypes.long(dataSize);
|
||||
data[0] = 1; // source indication (0=none, 1=app, 2=pager)
|
||||
data[1] = 0; // timestamp
|
||||
data[2] = 0; // requestor's currently active window, 0 if none
|
||||
this.xSendClientMessgeEvent(xid, x11.current.Atoms._NET_ACTIVE_WINDOW, data, dataSize);
|
||||
|
||||
LOG("window raised");
|
||||
},
|
||||
*/
|
||||
|
||||
/**
|
||||
* YOU MUST x11.XFree() THE VARIABLE RETURNED BY THIS FUNCTION
|
||||
|
@ -303,7 +315,7 @@ firetray.Window = {
|
|||
return [null, null];
|
||||
}
|
||||
if (strEquals(actual_type.value, x11.None)) {
|
||||
WARN("property not found");
|
||||
LOG("property not found");
|
||||
return [null, null];
|
||||
}
|
||||
|
||||
|
@ -315,7 +327,6 @@ firetray.Window = {
|
|||
ERROR("unsupported format: "+actual_format.value);
|
||||
}
|
||||
LOG("format OK");
|
||||
// FIXME: how about https://developer.mozilla.org/en/JavaScript_typed_arrays
|
||||
var props = ctypes.cast(prop_value, ctypes.unsigned_long.array(nitems.value).ptr);
|
||||
LOG("props="+props+", size="+props.constructor.size);
|
||||
|
||||
|
@ -495,6 +506,7 @@ firetray.Handler.showSingleWindow = function(xid) {
|
|||
firetray.Window.restoreWindowStates(xid);
|
||||
firetray.Handler.windows[xid].baseWin.visibility = true; // show
|
||||
firetray.Window.restoreWindowDesktop(xid); // after show
|
||||
firetray.Window.activate(xid);
|
||||
// TODO: we need want to restore to the original monitor (screen)
|
||||
|
||||
firetray.Handler.windows[xid].visibility = true;
|
||||
|
|
Loading…
Reference in New Issue