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: html-layout-change-back-v2.patch

File html-layout-change-back-v2.patch, 1.5 KB (added by Antoine Martin, 2 years ago)

updated patch

  • html5/js/Client.js

     
    629629        /**
    630630         * Use the "key_language" if we have it,
    631631         * otherwise use the browser's language.
    632          * This function may ssend the new detected keyboard layout.
     632         * This function may send the new detected keyboard layout.
    633633         * (ignoring the keyboard_layout preference)
    634634         */
    635635        var now = Utilities.monotonicTime();
     
    637637                return;
    638638        }
    639639        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);
     640        if (key_layout) {
    642641                new_layout = key_layout;
    643                 this.key_layout = key_layout;
    644642        }
     643        else if (this.key_layout!=null) {
     644                //we needed to set a different key layout for a key,
     645                //and now this key doesn't need it,
     646                //so let's switch back to the original layout:
     647                new_layout = this._get_keyboard_layout() || "us";
     648        }
    645649        else {
    646650                var l = Utilities.getFirstBrowserLanguage();
    647651                if (l && this.browser_language != l) {
     
    650654                        this.browser_language = l;
    651655                }
    652656        }
    653         if (new_layout!=null) {
     657        if (new_layout!=null && this.key_layout!=new_layout) {
     658                this.key_layout = new_layout;
     659                this.clog("input language changed from", this.key_layout, "to", key_layout);
    654660                this.send(["layout-changed", new_layout, ""]);
    655661                //changing the language too quickly can cause problems server side,
    656662                //wait at least 2 seconds before checking again: