update linux active pid consistent with other platforms

This commit is contained in:
vcaesar 2018-07-10 21:00:52 +08:00
parent f0c84a23d3
commit 89c3d91e92

View File

@ -43,7 +43,8 @@ func ActivePIDC(pid int32, args ...int) {
} }
// ActivePID makes the window of the PID the active window // ActivePID makes the window of the PID the active window
func ActivePID(pid int32) error { // If args[0] > 0 on the unix platform via a xid to active
func ActivePID(pid int32, args ...int) error {
if xu == nil { if xu == nil {
var err error var err error
xu, err = xgbutil.NewConn() xu, err = xgbutil.NewConn()
@ -52,6 +53,15 @@ func ActivePID(pid int32) error {
} }
} }
if len(args) > 0 {
err := ewmh.ActiveWindowReq(xu, xproto.Window(pid))
if err != nil {
return err
}
return nil
}
xid, err := getXidFromPid(xu, pid) xid, err := getXidFromPid(xu, pid)
if err != nil { if err != nil {
return err return err