| 205 | |
| 206 | namespace FEX::CompatInput { |
| 207 | void SetupCompatInput(bool enable) { |
| 208 | // We need to check if these are defined or not. This is a very fresh feature. |
| 209 | #ifndef PR_GET_COMPAT_INPUT |
| 210 | #define PR_GET_COMPAT_INPUT 0x63494e50 |
| 211 | #endif |
| 212 | #ifndef PR_SET_COMPAT_INPUT |
| 213 | #define PR_SET_COMPAT_INPUT 0x43494e50 |
| 214 | #endif |
| 215 | #ifndef PR_SET_COMPAT_INPUT_DISABLE |
| 216 | #define PR_SET_COMPAT_INPUT_DISABLE 0 |
| 217 | #endif |
| 218 | #ifndef PR_SET_COMPAT_INPUT_ENABLE |
| 219 | #define PR_SET_COMPAT_INPUT_ENABLE 1 |
| 220 | #endif |
| 221 | // Check to see if this is supported. |
| 222 | auto Result = prctl(PR_GET_COMPAT_INPUT, 0, 0, 0, 0); |
| 223 | if (Result == -1) { |
| 224 | // Unsupported, early exit. |
| 225 | return; |
| 226 | } |
| 227 | |
| 228 | if (enable) { |
| 229 | prctl(PR_SET_COMPAT_INPUT, PR_SET_COMPAT_INPUT_ENABLE, 0, 0, 0); |
| 230 | } else { |
| 231 | prctl(PR_SET_COMPAT_INPUT, PR_SET_COMPAT_INPUT_DISABLE, 0, 0, 0); |
| 232 | } |
| 233 | } |
| 234 | } // namespace FEX::CompatInput |
| 235 | |
| 236 | namespace FEX::GCS { |