Changeset 127 in xpra
- Timestamp:
- 08/14/11 21:01:07 (22 months ago)
- Location:
- trunk/src/xpra
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/xpra/client.py
r120 r127 326 326 327 327 def __init__(self, conn, compression_level, jpegquality, title, password_file, 328 pulseaudio, clipboard, refresh_delay, max_bandwidth, opts , xkbmap_print, xkbmap_query):328 pulseaudio, clipboard, refresh_delay, max_bandwidth, opts): 329 329 gobject.GObject.__init__(self) 330 330 self._window_to_id = {} … … 336 336 self.refresh_delay = refresh_delay 337 337 self.max_bandwidth = max_bandwidth 338 self.xkbmap_print = xkbmap_print339 self.xkbmap_query = xkbmap_query340 338 if self.max_bandwidth>0.0 and self.jpegquality==0: 341 339 """ jpegquality was not set, use a better start value """ … … 348 346 self._keymap = gtk.gdk.keymap_get_default() 349 347 self._keymap.connect("keys-changed", self._keys_changed) 350 self._ keys_changed()348 self._do_keys_changed() 351 349 352 350 self._xsettings_watcher = None … … 387 385 gtk.main() 388 386 387 def query_xkbmap(self): 388 def get_xkbmap_data(arg): 389 # Find the client's current keymap so we can send it to the server: 390 try: 391 import subprocess 392 cmd = ["setxkbmap", arg] 393 process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) 394 (out,_) = process.communicate(None) 395 if process.returncode==0: 396 return out 397 else: 398 log.error("'setxkbmap %s' failed with exit code %s\n" % (arg, process.returncode)) 399 except Exception, e: 400 log.error("error running 'setxkbmap %s': %s\n" % (arg, e)) 401 return None 402 self.xkbmap_print = get_xkbmap_data("-print") 403 self.xkbmap_query = get_xkbmap_data("-query") 404 389 405 def _keys_changed(self, *args): 406 self._do_keys_changed(True) 407 408 def _do_keys_changed(self, sendkeymap=False): 390 409 self._modifier_map = grok_modifier_map(gtk.gdk.display_get_default()) 410 if sendkeymap: 411 #old clients won't know what to do with it, but that's ok 412 self.query_xkbmap() 413 log.info("keys_changed") 414 self.send(["keymap-changed", self.xkbmap_print, self.xkbmap_query]) 391 415 392 416 def update_focus(self, id, gotit): … … 418 442 if self.jpegquality: 419 443 capabilities_request["jpeg"] = self.jpegquality 444 self.query_xkbmap() 420 445 if self.xkbmap_print: 421 446 capabilities_request["keymap"] = self.xkbmap_print -
trunk/src/xpra/scripts/main.py
r120 r127 289 289 title = "@title@ %s" % opts.title_suffix 290 290 291 def get_xkbmap_data(arg):292 # Find the client's current keymap so we can send it to the server:293 try:294 import subprocess295 cmd = ["setxkbmap", arg]296 process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)297 (out,_) = process.communicate(None)298 if process.returncode==0:299 return out300 else:301 sys.stdout.write("'setxkbmap %s' failed with exit code %s\n" % (arg, process.returncode))302 except Exception, e:303 sys.stdout.write("error running 'setxkbmap %s': %s\n" % (arg, e))304 return None305 xkbmap_print = get_xkbmap_data("-print")306 xkbmap_query = get_xkbmap_data("-query")307 291 app = XpraClient(conn, opts.compression_level, opts.jpegquality, title, opts.password_file, 308 292 opts.pulseaudio, opts.clipboard, 309 opts.auto_refresh_delay, opts.max_bandwidth, opts , xkbmap_print, xkbmap_query)293 opts.auto_refresh_delay, opts.max_bandwidth, opts) 310 294 app.connect("handshake-complete", handshake_complete_msg) 311 295 app.connect("received-gibberish", got_gibberish_msg) -
trunk/src/xpra/server.py
r122 r127 846 846 (_, id) = packet 847 847 self._focus(id) 848 849 def _process_keymap(self, proto, packet): 850 (_, keymap, xkbmap_query) = packet 851 self.set_keymap(keymap, xkbmap_query) 848 852 849 853 def _process_key_action(self, proto, packet): … … 929 933 "focus": _process_focus, 930 934 "key-action": _process_key_action, 935 "keymap-changed": _process_keymap, 931 936 "button-action": _process_button_action, 932 937 "pointer-position": _process_pointer_position,
Note: See TracChangeset
for help on using the changeset viewer.