Updated XF86 keys to camel case, and also added a whole lot more of 'em.
Browse files
+168 −36 src/keyboard/keysyms.rs
| @@ -77,22 +77,65 @@ pub const XK_PERIOD: Keysym = 0x002e; | |||
| 77 | pub const XK_SLASH: Keysym = 0x002f; | 77 | pub const XK_SLASH: Keysym = 0x002f; |
| 78 | pub const XK_PRINT: Keysym = 0xff61; | 78 | pub const XK_PRINT: Keysym = 0xff61; |
| 79 | 79 | ||
| 80 | -pub const XK_AMPERSAND: Keysym = 0x26; | 80 | +pub const XF86_AUDIO_MEDIA: Keysym = 0x1008ff32; |
| 81 | -pub const XK_AGRAVE: Keysym = 0xe0; | 81 | +pub const XF86_AUDIO_NEXT: Keysym = 0x1008ff17; |
| 82 | -pub const XK_CCEDILLA: Keysym = 0xe7; | 82 | +pub const XF86_AUDIO_PAUSE: Keysym = 0x1008ff31; |
| 83 | -pub const XK_EGRAVE: Keysym = 0xe8; | 83 | +pub const XF86_AUDIO_PLAY: Keysym = 0x1008ff14; |
| 84 | -pub const XK_EACUTE: Keysym = 0xe9; | 84 | +pub const XF86_AUDIO_PREV: Keysym = 0x1008ff16; |
| 85 | -pub const XK_PARENLEFT: Keysym = 0x28; | ||
| 86 | -pub const XK_PARENRIGHT: Keysym = 0x29; | ||
| 87 | -pub const XK_QUOTEDBL: Keysym = 0x22; | ||
| 88 | -pub const XK_UNDERSCORE: Keysym = 0x5f; | ||
| 89 | -pub const XK_HYPHEN: Keysym = 0xad; | ||
| 90 | - | ||
| 91 | pub const XF86_AUDIO_RAISE_VOLUME: Keysym = 0x1008ff13; | 85 | pub const XF86_AUDIO_RAISE_VOLUME: Keysym = 0x1008ff13; |
| 92 | pub const XF86_AUDIO_LOWER_VOLUME: Keysym = 0x1008ff11; | 86 | pub const XF86_AUDIO_LOWER_VOLUME: Keysym = 0x1008ff11; |
| 93 | pub const XF86_AUDIO_MUTE: Keysym = 0x1008ff12; | 87 | pub const XF86_AUDIO_MUTE: Keysym = 0x1008ff12; |
| 88 | +pub const XF86_AUDIO_MIC_MUTE: Keysym = 0x1008ffb2; | ||
| 89 | +pub const XF86_AUDIO_RECORD: Keysym = 0x1008ff1c; | ||
| 90 | +pub const XF86_AUDIO_REWIND: Keysym = 0x1008ff3e; | ||
| 91 | +pub const XF86_AUDIO_STOP: Keysym = 0x1008ff15; | ||
| 92 | +pub const XF86_BACK: Keysym = 0x1008ff26; | ||
| 93 | +pub const XF86_CALCULATOR: Keysym = 0x1008ff1d; | ||
| 94 | +pub const XF86_CLOSE: Keysym = 0x1008ff56; | ||
| 95 | +pub const XF86_COPY: Keysym = 0x1008ff57; | ||
| 96 | +pub const XF86_CUT: Keysym = 0x1008ff58; | ||
| 97 | +pub const XF86_DOS: Keysym = 0x1008ff5a; | ||
| 98 | +pub const XF86_DISPLAY: Keysym = 0x1008ff59; | ||
| 99 | +pub const XF86_DOCUMENTS: Keysym = 0x1008ff5b; | ||
| 100 | +pub const XF86_EJECT: Keysym = 0x1008ff2c; | ||
| 101 | +pub const XF86_EXPLORER: Keysym = 0x1008ff5d; | ||
| 102 | +pub const XF86_FAVORITES: Keysym = 0x1008ff30; | ||
| 103 | +pub const XF86_FINANCE: Keysym = 0x1008ff3c; | ||
| 104 | +pub const XF86_FORWARD: Keysym = 0x1008ff27; | ||
| 105 | +pub const XF86_GAME: Keysym = 0x1008ff5e; | ||
| 106 | +pub const XF86_GO: Keysym = 0x1008ff5f; | ||
| 107 | +pub const XF86_HOME_PAGE: Keysym = 0x1008ff18; | ||
| 108 | +pub const XF86_MAIL: Keysym = 0x1008ff19; | ||
| 109 | +pub const XF86_MAIL_FORWARD: Keysym = 0x1008ff90; | ||
| 110 | +pub const XF86_MENU_KB: Keysym = 0x1008ff65; | ||
| 111 | +pub const XF86_MESSENGER: Keysym = 0x1008ff8e; | ||
| 94 | pub const XF86_MON_BRIGHTNESS_UP: Keysym = 0x1008ff02; | 112 | pub const XF86_MON_BRIGHTNESS_UP: Keysym = 0x1008ff02; |
| 95 | pub const XF86_MON_BRIGHTNESS_DOWN: Keysym = 0x1008ff03; | 113 | pub const XF86_MON_BRIGHTNESS_DOWN: Keysym = 0x1008ff03; |
| 114 | +pub const XF86_MY_COMPUTER: Keysym = 0x1008ff33; | ||
| 115 | +pub const XF86_NEW: Keysym = 0x1008ff68; | ||
| 116 | +pub const XF86_NEXT_VMODE: Keysym = 0x1008fe22; | ||
| 117 | +pub const XF86_PREV_VMODE: Keysym = 0x1008fe23; | ||
| 118 | +pub const XF86_OPEN: Keysym = 0x1008ff6b; | ||
| 119 | +pub const XF86_PASTE: Keysym = 0x1008ff6d; | ||
| 120 | +pub const XF86_PHONE: Keysym = 0x1008ff6e; | ||
| 121 | +pub const XF86_POWER_OFF: Keysym = 0x1008ff2a; | ||
| 122 | +pub const XF86_RELOAD: Keysym = 0x1008ff73; | ||
| 123 | +pub const XF86_REPLY: Keysym = 0x1008ff72; | ||
| 124 | +pub const XF86_ROTATE_WINDOWS: Keysym = 0x1008ff74; | ||
| 125 | +pub const XF86_SAVE: Keysym = 0x1008ff77; | ||
| 126 | +pub const XF86_SCREEN_SAVER: Keysym = 0x1008ff2d; | ||
| 127 | +pub const XF86_SCROLL_DOWN: Keysym = 0x1008ff79; | ||
| 128 | +pub const XF86_SCROLL_UP: Keysym = 0x1008ff78; | ||
| 129 | +pub const XF86_SEARCH: Keysym = 0x1008ff1b; | ||
| 130 | +pub const XF86_SEND: Keysym = 0x1008ff7b; | ||
| 131 | +pub const XF86_SHOP: Keysym = 0x1008ff36; | ||
| 132 | +pub const XF86_SLEEP: Keysym = 0x1008ff2f; | ||
| 133 | +pub const XF86_TASK_PANE: Keysym = 0x1008ff7f; | ||
| 134 | +pub const XF86_TOOLS: Keysym = 0x1008ff81; | ||
| 135 | +pub const XF86_WWW: Keysym = 0x1008ff2e; | ||
| 136 | +pub const XF86_WAKE_UP: Keysym = 0x1008ff2b; | ||
| 137 | +pub const XF86_WEBCAM: Keysym = 0x1008ff8f; | ||
| 138 | +pub const XF86_XFER: Keysym = 0x1008ff8a; | ||
| 96 | 139 | ||
| 97 | pub fn keysym_from_str(s: &str) -> Option<Keysym> { | 140 | pub fn keysym_from_str(s: &str) -> Option<Keysym> { |
| 98 | match s { | 141 | match s { |
| @@ -171,21 +214,66 @@ pub fn keysym_from_str(s: &str) -> Option<Keysym> { | |||
| 171 | "Period" => Some(XK_PERIOD), | 214 | "Period" => Some(XK_PERIOD), |
| 172 | "Slash" => Some(XK_SLASH), | 215 | "Slash" => Some(XK_SLASH), |
| 173 | "Print" => Some(XK_PRINT), | 216 | "Print" => Some(XK_PRINT), |
| 174 | - "Ampersand" => Some(XK_AMPERSAND), | 217 | + |
| 175 | - "Agrave" => Some(XK_AGRAVE), | 218 | + "XF86AudioMedia" => Some(XF86_AUDIO_MEDIA), |
| 176 | - "Ccedilla" => Some(XK_CCEDILLA), | 219 | + "XF86AudioNext" => Some(XF86_AUDIO_NEXT), |
| 177 | - "Egrave" => Some(XK_EGRAVE), | 220 | + "XF86AudioPause" => Some(XF86_AUDIO_PAUSE), |
| 178 | - "Eacute" => Some(XK_EACUTE), | 221 | + "XF86AudioPlay" => Some(XF86_AUDIO_PLAY), |
| 179 | - "ParenLeft" => Some(XK_PARENLEFT), | 222 | + "XF86AudioPrev" => Some(XF86_AUDIO_PREV), |
| 180 | - "ParenRight" => Some(XK_PARENRIGHT), | 223 | + "XF86AudioRaiseVolume" => Some(XF86_AUDIO_RAISE_VOLUME), |
| 181 | - "QuoteDouble" => Some(XK_QUOTEDBL), | 224 | + "XF86AudioLowerVolume" => Some(XF86_AUDIO_LOWER_VOLUME), |
| 182 | - "Underscore" => Some(XK_UNDERSCORE), | 225 | + "XF86AudioMute" => Some(XF86_AUDIO_MUTE), |
| 183 | - "Hyphen" => Some(XK_HYPHEN), | 226 | + "XF86AudioMicMute" => Some(XF86_AUDIO_MIC_MUTE), |
| 184 | - "AudioRaiseVolume" => Some(XF86_AUDIO_RAISE_VOLUME), | 227 | + "XF86AudioRecord" => Some(XF86_AUDIO_RECORD), |
| 185 | - "AudioLowerVolume" => Some(XF86_AUDIO_LOWER_VOLUME), | 228 | + "XF86AudioRewind" => Some(XF86_AUDIO_REWIND), |
| 186 | - "AudioMute" => Some(XF86_AUDIO_MUTE), | 229 | + "XF86AudioStop" => Some(XF86_AUDIO_STOP), |
| 187 | - "MonBrightnessUp" => Some(XF86_MON_BRIGHTNESS_UP), | 230 | + "XF86Back" => Some(XF86_BACK), |
| 188 | - "MonBrightnessDown" => Some(XF86_MON_BRIGHTNESS_DOWN), | 231 | + "XF86Calculator" => Some(XF86_CALCULATOR), |
| 232 | + "XF86Close" => Some(XF86_CLOSE), | ||
| 233 | + "XF86Copy" => Some(XF86_COPY), | ||
| 234 | + "XF86Cut" => Some(XF86_CUT), | ||
| 235 | + "XF86DOS" => Some(XF86_DOS), | ||
| 236 | + "XF86Display" => Some(XF86_DISPLAY), | ||
| 237 | + "XF86Documents" => Some(XF86_DOCUMENTS), | ||
| 238 | + "XF86Eject" => Some(XF86_EJECT), | ||
| 239 | + "XF86Explorer" => Some(XF86_EXPLORER), | ||
| 240 | + "XF86Favorites" => Some(XF86_FAVORITES), | ||
| 241 | + "XF86Finance" => Some(XF86_FINANCE), | ||
| 242 | + "XF86Forward" => Some(XF86_FORWARD), | ||
| 243 | + "XF86Game" => Some(XF86_GAME), | ||
| 244 | + "XF86Go" => Some(XF86_GO), | ||
| 245 | + "XF86HomePage" => Some(XF86_HOME_PAGE), | ||
| 246 | + "XF86Mail" => Some(XF86_MAIL), | ||
| 247 | + "XF86MailForward" => Some(XF86_MAIL_FORWARD), | ||
| 248 | + "XF86MenuKB" => Some(XF86_MENU_KB), | ||
| 249 | + "XF86Messenger" => Some(XF86_MESSENGER), | ||
| 250 | + "XF86MonBrightnessUp" => Some(XF86_MON_BRIGHTNESS_UP ), | ||
| 251 | + "XF86MonBrightnessDown" => Some(XF86_MON_BRIGHTNESS_DOWN), | ||
| 252 | + "XF86MyComputer" => Some(XF86_MY_COMPUTER), | ||
| 253 | + "XF86New" => Some(XF86_NEW), | ||
| 254 | + "XF86Next_VMode" => Some(XF86_NEXT_VMODE), | ||
| 255 | + "XF86Prev_VMode" => Some(XF86_PREV_VMODE), | ||
| 256 | + "XF86Open" => Some(XF86_OPEN), | ||
| 257 | + "XF86Paste" => Some(XF86_PASTE), | ||
| 258 | + "XF86Phone" => Some(XF86_PHONE), | ||
| 259 | + "XF86PowerOff" => Some(XF86_POWER_OFF), | ||
| 260 | + "XF86Reload" => Some(XF86_RELOAD), | ||
| 261 | + "XF86Reply" => Some(XF86_REPLY), | ||
| 262 | + "XF86RotateWindows" => Some(XF86_ROTATE_WINDOWS), | ||
| 263 | + "XF86Save" => Some(XF86_SAVE), | ||
| 264 | + "XF86ScreenSaver" => Some(XF86_SCREEN_SAVER), | ||
| 265 | + "XF86ScrollDown" => Some(XF86_SCROLL_DOWN), | ||
| 266 | + "XF86ScrollUp" => Some(XF86_SCROLL_UP), | ||
| 267 | + "XF86Search" => Some(XF86_SEARCH), | ||
| 268 | + "XF86Send" => Some(XF86_SEND), | ||
| 269 | + "XF86Shop" => Some(XF86_SHOP), | ||
| 270 | + "XF86Sleep" => Some(XF86_SLEEP), | ||
| 271 | + "XF86TaskPane" => Some(XF86_TASK_PANE), | ||
| 272 | + "XF86Tools" => Some(XF86_TOOLS), | ||
| 273 | + "XF86WWW" => Some(XF86_WWW), | ||
| 274 | + "XF86WakeUp" => Some(XF86_WAKE_UP), | ||
| 275 | + "XF86WebCam" => Some(XF86_WEBCAM), | ||
| 276 | + "XF86Xfer" => Some(XF86_XFER), | ||
| 189 | _ => None, | 277 | _ => None, |
| 190 | } | 278 | } |
| 191 | } | 279 | } |
| @@ -231,21 +319,65 @@ pub fn format_keysym(keysym: Keysym) -> String { | |||
| 231 | XK_APOSTROPHE => "'".to_string(), | 319 | XK_APOSTROPHE => "'".to_string(), |
| 232 | XK_BACKSLASH => "\\".to_string(), | 320 | XK_BACKSLASH => "\\".to_string(), |
| 233 | XK_PRINT => "Print".to_string(), | 321 | XK_PRINT => "Print".to_string(), |
| 234 | - XK_AMPERSAND => "&".to_string(), | 322 | + XF86_AUDIO_MEDIA => "Media".to_string(), |
| 235 | - XK_AGRAVE => "à".to_string(), | 323 | + XF86_AUDIO_NEXT => "Next".to_string(), |
| 236 | - XK_CCEDILLA => "ç".to_string(), | 324 | + XF86_AUDIO_PAUSE => "Pause".to_string(), |
| 237 | - XK_EGRAVE => "è".to_string(), | 325 | + XF86_AUDIO_PLAY => "Play".to_string(), |
| 238 | - XK_EACUTE => "é".to_string(), | 326 | + XF86_AUDIO_PREV => "Prev".to_string(), |
| 239 | - XK_PARENLEFT => "(".to_string(), | ||
| 240 | - XK_PARENRIGHT => ")".to_string(), | ||
| 241 | - XK_QUOTEDBL => "\"".to_string(), | ||
| 242 | - XK_UNDERSCORE => "_".to_string(), | ||
| 243 | - XK_HYPHEN => "-".to_string(), | ||
| 244 | XF86_AUDIO_RAISE_VOLUME => "Vol+".to_string(), | 327 | XF86_AUDIO_RAISE_VOLUME => "Vol+".to_string(), |
| 245 | XF86_AUDIO_LOWER_VOLUME => "Vol-".to_string(), | 328 | XF86_AUDIO_LOWER_VOLUME => "Vol-".to_string(), |
| 246 | XF86_AUDIO_MUTE => "Mute".to_string(), | 329 | XF86_AUDIO_MUTE => "Mute".to_string(), |
| 330 | + XF86_AUDIO_MIC_MUTE => "MicMute".to_string(), | ||
| 331 | + XF86_AUDIO_RECORD => "Record".to_string(), | ||
| 332 | + XF86_AUDIO_REWIND => "Rewind".to_string(), | ||
| 333 | + XF86_AUDIO_STOP => "Stop".to_string(), | ||
| 334 | + XF86_BACK => "Back".to_string(), | ||
| 335 | + XF86_CALCULATOR => "Calculator".to_string(), | ||
| 336 | + XF86_CLOSE => "Close".to_string(), | ||
| 337 | + XF86_COPY => "Copy".to_string(), | ||
| 338 | + XF86_CUT => "Cut".to_string(), | ||
| 339 | + XF86_DOS => "DOS".to_string(), | ||
| 340 | + XF86_DISPLAY => "Display".to_string(), | ||
| 341 | + XF86_DOCUMENTS => "Documents".to_string(), | ||
| 342 | + XF86_EJECT => "Eject".to_string(), | ||
| 343 | + XF86_EXPLORER => "Explorer".to_string(), | ||
| 344 | + XF86_FAVORITES => "Favorites".to_string(), | ||
| 345 | + XF86_FINANCE => "Finance".to_string(), | ||
| 346 | + XF86_FORWARD => "Forward".to_string(), | ||
| 347 | + XF86_GAME => "Game".to_string(), | ||
| 348 | + XF86_GO => "Go".to_string(), | ||
| 349 | + XF86_HOME_PAGE => "HomePage".to_string(), | ||
| 350 | + XF86_MAIL => "Mail".to_string(), | ||
| 351 | + XF86_MAIL_FORWARD => "MailForward".to_string(), | ||
| 352 | + XF86_MENU_KB => "MenuKB".to_string(), | ||
| 353 | + XF86_MESSENGER => "Messenger".to_string(), | ||
| 247 | XF86_MON_BRIGHTNESS_UP => "Bright+".to_string(), | 354 | XF86_MON_BRIGHTNESS_UP => "Bright+".to_string(), |
| 248 | XF86_MON_BRIGHTNESS_DOWN => "Bright-".to_string(), | 355 | XF86_MON_BRIGHTNESS_DOWN => "Bright-".to_string(), |
| 356 | + XF86_MY_COMPUTER => "MyComputer".to_string(), | ||
| 357 | + XF86_NEW => "New".to_string(), | ||
| 358 | + XF86_NEXT_VMODE => "NextVMode".to_string(), | ||
| 359 | + XF86_PREV_VMODE => "PrevVMode".to_string(), | ||
| 360 | + XF86_OPEN => "Open".to_string(), | ||
| 361 | + XF86_PASTE => "Paste".to_string(), | ||
| 362 | + XF86_PHONE => "Phone".to_string(), | ||
| 363 | + XF86_POWER_OFF => "PowerOff".to_string(), | ||
| 364 | + XF86_RELOAD => "Reload".to_string(), | ||
| 365 | + XF86_REPLY => "Reply".to_string(), | ||
| 366 | + XF86_ROTATE_WINDOWS => "RotateWindows".to_string(), | ||
| 367 | + XF86_SAVE => "Save".to_string(), | ||
| 368 | + XF86_SCREEN_SAVER => "ScreenSaver".to_string(), | ||
| 369 | + XF86_SCROLL_DOWN => "ScrollDown".to_string(), | ||
| 370 | + XF86_SCROLL_UP => "ScrollUp".to_string(), | ||
| 371 | + XF86_SEARCH => "Search".to_string(), | ||
| 372 | + XF86_SEND => "Send".to_string(), | ||
| 373 | + XF86_SHOP => "Shop".to_string(), | ||
| 374 | + XF86_SLEEP => "Sleep".to_string(), | ||
| 375 | + XF86_TASK_PANE => "TaskPane".to_string(), | ||
| 376 | + XF86_TOOLS => "Tools".to_string(), | ||
| 377 | + XF86_WWW => "WWW".to_string(), | ||
| 378 | + XF86_WAKE_UP => "WakeUp".to_string(), | ||
| 379 | + XF86_WEBCAM => "WebCam".to_string(), | ||
| 380 | + XF86_XFER => "Xfer".to_string(), | ||
| 249 | XK_A..=XK_Z => { | 381 | XK_A..=XK_Z => { |
| 250 | let ch = (keysym - XK_A + b'A' as u32) as u8 as char; | 382 | let ch = (keysym - XK_A + b'A' as u32) as u8 as char; |
| 251 | ch.to_string() | 383 | ch.to_string() |