xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #2154: worksforme.patch

File worksforme.patch, 2.2 KB (added by berserker, 2 years ago)
  • js/Client.js

     
    113113        this.cipher_out_caps = null;
    114114        // detect locale change:
    115115        this.browser_language = Utilities.getFirstBrowserLanguage();
    116         this.browser_language_change_embargo_time = 0;
    117         this.key_layout = null;
     116        this.key_layout = this._get_keyboard_layout();
    118117        // mouse
    119118        this.mousedown_event = null;
    120119        this.last_mouse_x = null;
     
    632631         * This function may ssend the new detected keyboard layout.
    633632         * (ignoring the keyboard_layout preference)
    634633         */
    635         var now = Utilities.monotonicTime();
    636         if (now<this.browser_language_change_embargo_time) {
     634        if (this.key_layout==key_layout)
    637635                return;
     636
     637        this.clog("input language changed from", this.key_layout, "to", key_layout);
     638
     639        var new_layout = key_layout;
     640        if (new_layout==null) {
     641                var kb_layout = this._get_keyboard_layout();
     642                new_layout = this.key_layout == kb_layout ? "us" : kb_layout;
    638643        }
    639         var new_layout = null;
    640         if (key_layout && this.key_layout!=key_layout) {
    641                 this.clog("input language changed from", this.key_layout, "to", key_layout);
    642                 new_layout = key_layout;
    643                 this.key_layout = key_layout;
    644         }
    645         else {
    646                 var l = Utilities.getFirstBrowserLanguage();
    647                 if (l && this.browser_language != l) {
    648                         new_layout = Utilities.getKeyboardLayout();
    649                         this.clog("browser language changed from", this.browser_language, "to", l, ", sending new keyboard layout:", layout);
    650                         this.browser_language = l;
    651                 }
    652         }
    653         if (new_layout!=null) {
    654                 this.send(["layout-changed", new_layout, ""]);
    655                 //changing the language too quickly can cause problems server side,
    656                 //wait at least 2 seconds before checking again:
    657                 this.browser_language_change_embargo_time = now + 2000;
    658         }
    659         else {
    660                 //check again after 100ms minimum
    661                 this.browser_language_change_embargo_time = now + 100;
    662         }
     644
     645        this.key_layout = key_layout;
     646        this.send(["layout-changed", new_layout, ""]);
    663647}
    664648
    665649
     
    12951279        ctx.do_window_mouse_move(e, window);
    12961280}
    12971281XpraClient.prototype.do_window_mouse_move = function(e, window) {
    1298         this._check_browser_language();
    12991282        if (this.server_readonly || this.mouse_grabbed || !this.connected) {
    13001283                return;
    13011284        }