()
| 3048 | } |
| 3049 | |
| 3050 | _handleExtendedDesktopSize() { |
| 3051 | if (this._sock.rQwait("ExtendedDesktopSize", 4)) { |
| 3052 | return false; |
| 3053 | } |
| 3054 | |
| 3055 | const numberOfScreens = this._sock.rQpeek8(); |
| 3056 | |
| 3057 | let bytes = 4 + (numberOfScreens * 16); |
| 3058 | if (this._sock.rQwait("ExtendedDesktopSize", bytes)) { |
| 3059 | return false; |
| 3060 | } |
| 3061 | |
| 3062 | const firstUpdate = !this._supportsSetDesktopSize; |
| 3063 | this._supportsSetDesktopSize = true; |
| 3064 | |
| 3065 | this._sock.rQskipBytes(1); // number-of-screens |
| 3066 | this._sock.rQskipBytes(3); // padding |
| 3067 | |
| 3068 | for (let i = 0; i < numberOfScreens; i += 1) { |
| 3069 | // Save the id and flags of the first screen |
| 3070 | if (i === 0) { |
| 3071 | this._screenID = this._sock.rQshift32(); // id |
| 3072 | this._sock.rQskipBytes(2); // x-position |
| 3073 | this._sock.rQskipBytes(2); // y-position |
| 3074 | this._sock.rQskipBytes(2); // width |
| 3075 | this._sock.rQskipBytes(2); // height |
| 3076 | this._screenFlags = this._sock.rQshift32(); // flags |
| 3077 | } else { |
| 3078 | this._sock.rQskipBytes(16); |
| 3079 | } |
| 3080 | } |
| 3081 | |
| 3082 | /* |
| 3083 | * The x-position indicates the reason for the change: |
| 3084 | * |
| 3085 | * 0 - server resized on its own |
| 3086 | * 1 - this client requested the resize |
| 3087 | * 2 - another client requested the resize |
| 3088 | */ |
| 3089 | |
| 3090 | if (this._FBU.x === 1) { |
| 3091 | this._pendingRemoteResize = false; |
| 3092 | } |
| 3093 | |
| 3094 | // We need to handle errors when we requested the resize. |
| 3095 | if (this._FBU.x === 1 && this._FBU.y !== 0) { |
| 3096 | let msg = ""; |
| 3097 | // The y-position indicates the status code from the server |
| 3098 | switch (this._FBU.y) { |
| 3099 | case 1: |
| 3100 | msg = "Resize is administratively prohibited"; |
| 3101 | break; |
| 3102 | case 2: |
| 3103 | msg = "Out of resources"; |
| 3104 | break; |
| 3105 | case 3: |
| 3106 | msg = "Invalid screen layout"; |
| 3107 | break; |
no test coverage detected