|
Fvwm 的 FAQ 有个自动隐藏的例子,但不能处理两个以上隐藏窗口。
下面是我改进的代码:
#############audohide
DestroyFunc autohide
AddToFunc autohide
+ I SetEnv temp $0
+ I Test (EnvMatch temp $1) autohide_show $1 $2
+ I TestRc (!Match) autohide_hide $1 $3 $4
DestroyFunc autohide_show
AddToFunc autohide_show
+ I WindowId $0 Deschedule -$0
+ I Schedule $1 $0 WindowId $0 WindowShade False
DestroyFunc autohide_hide
AddToFunc autohide_hide
+ I WindowId $0 Deschedule $0
+ I WindowId $0 Deschedule -$0
+ I WindowId $0 (!shaded) Schedule $1 -$0 WindowShade $2
AddToFunc StartFunction
[color="Green"]+ I schedule 5000 All (FvwmPager) SetEnv pgid $[w.id]
+ I schedule 5000 All (MyButtons) SetEnv mbid $[w.id]
+ I schedule 5000 All (PanelButtons) SetEnv pbid $[w.id]
+ I Module FvwmAuto 1 -menter enter_handler
DestroyFunc enter_handler
AddToFunc enter_handler
#+ I ThisWindow
#+ I TestRc (!Match) Echo root window
[color="Green"]+ I autohide $[w.id] $[mbid] 200 500 NW
+ I autohide $[w.id] $[pbid] 200 500 N
+ I autohide $[w.id] $[pgid] 200 500 NE
上面绿色几行是根据自己情况要修改的地方。
这个代码比FAQ中的要做多了点工作,要在开始函数中取window id到一些全局变量,schedule 5000(延时5秒)是因为开始时窗口未建立好,太快取id会失败。
fvwm 写这些逻辑很别扭,又没有局部变量,判断的方式又太少。
狂晕中。:yun: |
|