mirror of
https://github.com/moparisthebest/FireTray
synced 2024-12-23 06:18:48 -05:00
minor refactoring: firetray.Window.setVisibility()
This commit is contained in:
parent
23cf34ea9f
commit
2789844b06
@ -194,25 +194,21 @@ firetray.Window = {
|
|||||||
// try to restore previous state. TODO: z-order respected ?
|
// try to restore previous state. TODO: z-order respected ?
|
||||||
firetray.Window.restorePositionAndSize(xid);
|
firetray.Window.restorePositionAndSize(xid);
|
||||||
firetray.Window.restoreStates(xid);
|
firetray.Window.restoreStates(xid);
|
||||||
|
// better visual effect if visibility set here instead of before
|
||||||
firetray.Handler.windows[xid].baseWin.visibility = true; // show
|
firetray.Handler.windows[xid].baseWin.visibility = true; // show
|
||||||
firetray.Window.restoreDesktop(xid); // after show
|
firetray.Window.restoreDesktop(xid); // after show
|
||||||
firetray.Window.activate(xid);
|
firetray.Window.activate(xid);
|
||||||
|
|
||||||
firetray.Handler.windows[xid].visibility = true;
|
firetray.Window.setVisibility(xid, true);
|
||||||
firetray.Handler.visibleWindowsCount += 1;
|
|
||||||
|
|
||||||
if (firetray.Handler.popupMenuWindowItemsHandled())
|
if (firetray.Handler.popupMenuWindowItemsHandled())
|
||||||
firetray.PopupMenu.hideSingleWindowItemAndSeparatorMaybe(xid);
|
firetray.PopupMenu.hideSingleWindowItemAndSeparatorMaybe(xid);
|
||||||
firetray.Handler.showHideIcon();
|
firetray.Handler.showHideIcon();
|
||||||
},
|
},
|
||||||
|
|
||||||
showSingleStatelessOnce: function(xid) {
|
showSingleStatelessOnce: function(xid) {
|
||||||
LOG("showSingleStateless");
|
LOG("showSingleStateless");
|
||||||
|
|
||||||
firetray.Handler.windows[xid].baseWin.visibility = true; // show
|
firetray.Window.setVisibility(xid, true);
|
||||||
|
|
||||||
firetray.Handler.windows[xid].visibility = true;
|
|
||||||
firetray.Handler.visibleWindowsCount += 1;
|
|
||||||
|
|
||||||
if (firetray.Handler.popupMenuWindowItemsHandled())
|
if (firetray.Handler.popupMenuWindowItemsHandled())
|
||||||
firetray.PopupMenu.hideSingleWindowItemAndSeparatorMaybe(xid);
|
firetray.PopupMenu.hideSingleWindowItemAndSeparatorMaybe(xid);
|
||||||
@ -231,28 +227,21 @@ firetray.Window = {
|
|||||||
firetray.Window.saveStates(xid);
|
firetray.Window.saveStates(xid);
|
||||||
firetray.Window.saveDesktop(xid);
|
firetray.Window.saveDesktop(xid);
|
||||||
|
|
||||||
firetray.Handler.windows[xid].baseWin.visibility = false; // hide
|
firetray.Window.setVisibility(xid, false);
|
||||||
|
|
||||||
firetray.Handler.windows[xid].visibility = false;
|
|
||||||
firetray.Handler.visibleWindowsCount -= 1;
|
|
||||||
|
|
||||||
if (firetray.Handler.popupMenuWindowItemsHandled())
|
if (firetray.Handler.popupMenuWindowItemsHandled())
|
||||||
firetray.PopupMenu.showSingleWindowItem(xid);
|
firetray.PopupMenu.showSingleWindowItem(xid);
|
||||||
firetray.Handler.showHideIcon();
|
firetray.Handler.showHideIcon();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hides without saving window states (position, size, ...) This is needed when
|
* hides without saving window states (position, size, ...) This is needed
|
||||||
* application starts hidden: as windows are not realized, their state is not
|
* when application starts hidden: as windows are not realized, their state
|
||||||
* accurate.
|
* is not accurate.
|
||||||
*/
|
*/
|
||||||
hideSingleStatelessOnce: function(xid) {
|
hideSingleStatelessOnce: function(xid) {
|
||||||
LOG("hideSingleStateless");
|
LOG("hideSingleStateless");
|
||||||
|
|
||||||
firetray.Handler.windows[xid].baseWin.visibility = false; // hide
|
firetray.Window.setVisibility(xid, false);
|
||||||
|
|
||||||
firetray.Handler.windows[xid].visibility = false;
|
|
||||||
firetray.Handler.visibleWindowsCount -= 1;
|
|
||||||
|
|
||||||
if (firetray.Handler.popupMenuWindowItemsHandled())
|
if (firetray.Handler.popupMenuWindowItemsHandled())
|
||||||
firetray.PopupMenu.showSingleWindowItem(xid);
|
firetray.PopupMenu.showSingleWindowItem(xid);
|
||||||
@ -327,6 +316,14 @@ firetray.Window = {
|
|||||||
delete firetray.Handler.windows[xid].savedDesktop;
|
delete firetray.Handler.windows[xid].savedDesktop;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setVisibility: function(xid, visibility) {
|
||||||
|
firetray.Handler.windows[xid].baseWin.visibility = visibility;
|
||||||
|
firetray.Handler.windows[xid].visibility = visibility;
|
||||||
|
firetray.Handler.visibleWindowsCount = visibility ?
|
||||||
|
firetray.Handler.visibleWindowsCount + 1 :
|
||||||
|
firetray.Handler.visibleWindowsCount - 1 ;
|
||||||
|
},
|
||||||
|
|
||||||
xSendClientMessgeEvent: function(xid, atom, data, dataSize) {
|
xSendClientMessgeEvent: function(xid, atom, data, dataSize) {
|
||||||
let xev = new x11.XClientMessageEvent;
|
let xev = new x11.XClientMessageEvent;
|
||||||
xev.type = x11.ClientMessage;
|
xev.type = x11.ClientMessage;
|
||||||
|
Loading…
Reference in New Issue
Block a user