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-v3.patch

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

updated patch - don't change from motion events

  • html5/js/Client.js

     
    627627
    628628XpraClient.prototype._check_browser_language = function(key_layout) {
    629629        /**
    630          * Use the "key_language" if we have it,
    631          * otherwise use the browser's language.
    632          * This function may ssend the new detected keyboard layout.
     630         * This function may send the new detected keyboard layout.
    633631         * (ignoring the keyboard_layout preference)
    634632         */
    635633        var now = Utilities.monotonicTime();
     
    637635                return;
    638636        }
    639637        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);
     638        if (key_layout) {
    642639                new_layout = key_layout;
    643                 this.key_layout = key_layout;
    644640        }
    645         else {
     641        else if (this.key_layout!=null) {
     642                //we had used a different layout for a specific key,
     643                //and now this new key doesn't need it anymore,
     644                //so let's switch back to the original layout:
    646645                var l = Utilities.getFirstBrowserLanguage();
    647646                if (l && this.browser_language != l) {
     647                        this.clog("browser language changed from", this.browser_language, "to", l);
     648                        this.browser_language = l;
    648649                        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;
    651650                }
     651                else {
     652                        //this will honour the setting supplied by the user on the connect page
     653                        //or default to Utilities.getKeyboardLayout()
     654                        new_layout = this._get_keyboard_layout() || "us";
     655                }
    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("keyboard layout 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,
    656                 //wait at least 2 seconds before checking again:
    657                 this.browser_language_change_embargo_time = now + 2000;
     662                //wait a bit before checking again:
     663                this.browser_language_change_embargo_time = now + 1000;
    658664        }
    659665        else {
    660666                //check again after 100ms minimum
     
    12951301        ctx.do_window_mouse_move(e, window);
    12961302}
    12971303XpraClient.prototype.do_window_mouse_move = function(e, window) {
    1298         this._check_browser_language();
    12991304        if (this.server_readonly || this.mouse_grabbed || !this.connected) {
    13001305                return;
    13011306        }