Ticket #489: choose-windows-by-pid.patch
File choose-windows-by-pid.patch, 2.3 KB (added by , 6 years ago) |
---|
-
xpra/server/server_base.py
138 138 "suspend", "resume", "name", "ungrab", 139 139 "key", "focus", "workspace", "idle-timeout", 140 140 "client", "start", "start-child", 141 "send-file", "print" ]141 "send-file", "print", "restrict"] 142 142 143 143 self.init_encodings() 144 144 self.init_packet_handlers() … … 1367 1367 assert ss.printing 1368 1368 ss.send_file(filename, True, True, ss, maxbitrate, printer, title, options) 1369 1369 return 0, "printing to %s initiated" % client_uuids 1370 elif command=="restrict": 1371 if len(args)<1: 1372 return argn_err(1) 1373 client_uuids = args[0] 1374 pids = [int(x) for x in args[1:]] 1375 sources = get_sources(client_uuids, "file_transfer") 1376 if not sources: 1377 return arg_err("no clients found matching: %s" % client_uuids) 1378 for csource in sources: 1379 csource.only_pids = pids 1380 return 0, "%s sources restricted to pids %s" % (len(sources), pids) 1370 1381 else: 1371 1382 return ServerCore.do_handle_command_request(self, command, args) 1372 1383 -
xpra/server/source.py
273 273 274 274 self.window_sources = {} #WindowSource for each Window ID 275 275 self.suspended = False 276 self.only_pids = None 276 277 277 278 self.uuid = "" 278 279 self.machine_id = "" … … 1549 1550 self.send("window-metadata", wid, metadata) 1550 1551 1551 1552 def can_send_window(self, window): 1553 if self.only_pids: 1554 try: 1555 pid = window.get_property("pid") 1556 log.info("can_send_window(%s) pid=%s, only_pids=%s", window, pid, self.only_pids) 1557 if pid and pid not in self.only_pids: 1558 return False 1559 except: 1560 pass 1552 1561 if self.send_windows and self.system_tray: 1553 1562 #common case shortcut 1554 1563 return True