diff --git a/meson.build b/meson.build index c051556..d88d701 100644 --- a/meson.build +++ b/meson.build @@ -52,11 +52,16 @@ endforeach gnome=import('gnome') +incdir = include_directories([ + 'src' +]) + base = [ 'src/base.c', 'src/shell.c', 'src/wayland.c', - 'src/virtual-keyboard.c', + 'src/vkb/virtual-keyboard.c', + 'src/vkb/virtual-keyboard-widgets.c', wayland_targets ] @@ -77,7 +82,8 @@ executable( 'diya-shell', dm_src, session_resource, - dependencies: buil_dep) + dependencies: buil_dep, + include_directories : incdir) login_src = [ base, @@ -91,4 +97,5 @@ executable( 'diya-login-shell', login_src, login_resource, - dependencies: buil_dep) \ No newline at end of file + dependencies: buil_dep, + include_directories : incdir) \ No newline at end of file diff --git a/resources/default-full.keymap b/resources/default-full.keymap deleted file mode 100644 index d9f9140..0000000 --- a/resources/default-full.keymap +++ /dev/null @@ -1,1461 +0,0 @@ -xkb_keymap { -xkb_keycodes "(unnamed)" { - minimum = 8; - maximum = 255; - = 9; - = 10; - = 11; - = 12; - = 13; - = 14; - = 15; - = 16; - = 17; - = 18; - = 19; - = 20; - = 21; - = 22; - = 23; - = 24; - = 25; - = 26; - = 27; - = 28; - = 29; - = 30; - = 31; - = 32; - = 33; - = 34; - = 35; - = 36; - = 37; - = 38; - = 39; - = 40; - = 41; - = 42; - = 43; - = 44; - = 45; - = 46; - = 47; - = 48; - = 49; - = 50; - = 51; - = 52; - = 53; - = 54; - = 55; - = 56; - = 57; - = 58; - = 59; - = 60; - = 61; - = 62; - = 63; - = 64; - = 65; - = 66; - = 67; - = 68; - = 69; - = 70; - = 71; - = 72; - = 73; - = 74; - = 75; - = 76; - = 77; - = 78; - = 79; - = 80; - = 81; - = 82; - = 83; - = 84; - = 85; - = 86; - = 87; - = 88; - = 89; - = 90; - = 91; - = 92; - = 94; - = 95; - = 96; - = 97; - = 98; - = 99; - = 100; - = 101; - = 102; - = 103; - = 104; - = 105; - = 106; - = 107; - = 108; - = 109; - = 110; - = 111; - = 112; - = 113; - = 114; - = 115; - = 116; - = 117; - = 118; - = 119; - = 120; - = 121; - = 122; - = 123; - = 124; - = 125; - = 126; - = 127; - = 128; - = 129; - = 130; - = 131; - = 132; - = 133; - = 134; - = 135; - = 136; - = 137; - = 138; - = 139; - = 140; - = 141; - = 142; - = 143; - = 144; - = 145; - = 146; - = 147; - = 148; - = 149; - = 150; - = 151; - = 152; - = 153; - = 154; - = 155; - = 156; - = 157; - = 158; - = 159; - = 160; - = 161; - = 162; - = 163; - = 164; - = 165; - = 166; - = 167; - = 168; - = 169; - = 170; - = 171; - = 172; - = 173; - = 174; - = 175; - = 176; - = 177; - = 178; - = 179; - = 180; - = 181; - = 182; - = 183; - = 184; - = 185; - = 186; - = 187; - = 188; - = 189; - = 190; - = 191; - = 192; - = 193; - = 194; - = 195; - = 196; - = 197; - = 198; - = 199; - = 200; - = 201; - = 202; - = 203; - = 204; - = 205; - = 206; - = 207; - = 208; - = 209; - = 210; - = 211; - = 212; - = 213; - = 214; - = 215; - = 216; - = 217; - = 218; - = 219; - = 220; - = 221; - = 222; - = 223; - = 224; - = 225; - = 226; - = 227; - = 228; - = 229; - = 230; - = 231; - = 232; - = 233; - = 234; - = 235; - = 236; - = 237; - = 238; - = 239; - = 240; - = 241; - = 242; - = 243; - = 244; - = 245; - = 246; - = 247; - = 248; - = 249; - = 250; - = 251; - = 252; - = 253; - = 254; - = 255; - indicator 1 = "Caps Lock"; - indicator 2 = "Num Lock"; - indicator 3 = "Scroll Lock"; - indicator 4 = "Compose"; - indicator 5 = "Kana"; - indicator 6 = "Sleep"; - indicator 7 = "Suspend"; - indicator 8 = "Mute"; - indicator 9 = "Misc"; - indicator 10 = "Mail"; - indicator 11 = "Charging"; - indicator 12 = "Shift Lock"; - indicator 13 = "Group 2"; - indicator 14 = "Mouse Keys"; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; - alias = ; -}; - -xkb_types "(unnamed)" { - virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; - - type "ONE_LEVEL" { - modifiers= none; - level_name[Level1]= "Any"; - }; - type "TWO_LEVEL" { - modifiers= Shift; - map[Shift]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - }; - type "ALPHABETIC" { - modifiers= Shift+Lock; - map[Shift]= Level2; - map[Lock]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Caps"; - }; - type "SHIFT+ALT" { - modifiers= Shift+Alt; - map[Shift+Alt]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift+Alt"; - }; - type "PC_SUPER_LEVEL2" { - modifiers= Mod4; - map[Mod4]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Super"; - }; - type "PC_CONTROL_LEVEL2" { - modifiers= Control; - map[Control]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Control"; - }; - type "PC_LCONTROL_LEVEL2" { - modifiers= LControl; - map[LControl]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "LControl"; - }; - type "PC_RCONTROL_LEVEL2" { - modifiers= RControl; - map[RControl]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "RControl"; - }; - type "PC_ALT_LEVEL2" { - modifiers= Alt; - map[Alt]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Alt"; - }; - type "PC_LALT_LEVEL2" { - modifiers= LAlt; - map[LAlt]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "LAlt"; - }; - type "PC_RALT_LEVEL2" { - modifiers= RAlt; - map[RAlt]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "RAlt"; - }; - type "CTRL+ALT" { - modifiers= Shift+Control+Alt+LevelThree; - map[Shift]= Level2; - preserve[Shift]= Shift; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - preserve[Shift+LevelThree]= Shift; - map[Control+Alt]= Level5; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "Ctrl+Alt"; - }; - type "LOCAL_EIGHT_LEVEL" { - modifiers= Shift+Lock+Control+LevelThree; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+Lock+LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level4; - map[Control]= Level5; - map[Shift+Lock+Control]= Level5; - map[Shift+Control]= Level6; - map[Lock+Control]= Level6; - map[Control+LevelThree]= Level7; - map[Shift+Lock+Control+LevelThree]= Level7; - map[Shift+Control+LevelThree]= Level8; - map[Lock+Control+LevelThree]= Level8; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Level3"; - level_name[Level4]= "Shift Level3"; - level_name[Level5]= "Ctrl"; - level_name[Level6]= "Shift Ctrl"; - level_name[Level7]= "Level3 Ctrl"; - level_name[Level8]= "Shift Level3 Ctrl"; - }; - type "THREE_LEVEL" { - modifiers= Shift+LevelThree; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Level3"; - }; - type "EIGHT_LEVEL" { - modifiers= Shift+LevelThree+LevelFive; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[LevelFive]= Level5; - map[Shift+LevelFive]= Level6; - map[LevelThree+LevelFive]= Level7; - map[Shift+LevelThree+LevelFive]= Level8; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "X"; - level_name[Level6]= "X Shift"; - level_name[Level7]= "X Alt Base"; - level_name[Level8]= "X Shift Alt"; - }; - type "EIGHT_LEVEL_ALPHABETIC" { - modifiers= Shift+Lock+LevelThree+LevelFive; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level4; - map[Shift+Lock+LevelThree]= Level3; - map[LevelFive]= Level5; - map[Shift+LevelFive]= Level6; - map[Lock+LevelFive]= Level6; - map[LevelThree+LevelFive]= Level7; - map[Shift+LevelThree+LevelFive]= Level8; - map[Lock+LevelThree+LevelFive]= Level8; - map[Shift+Lock+LevelThree+LevelFive]= Level7; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "X"; - level_name[Level6]= "X Shift"; - level_name[Level7]= "X Alt Base"; - level_name[Level8]= "X Shift Alt"; - }; - type "EIGHT_LEVEL_LEVEL_FIVE_LOCK" { - modifiers= Shift+Lock+NumLock+LevelThree+LevelFive; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[LevelFive]= Level5; - map[Shift+LevelFive]= Level6; - preserve[Shift+LevelFive]= Shift; - map[LevelThree+LevelFive]= Level7; - map[Shift+LevelThree+LevelFive]= Level8; - map[NumLock]= Level5; - map[Shift+NumLock]= Level6; - preserve[Shift+NumLock]= Shift; - map[NumLock+LevelThree]= Level7; - map[Shift+NumLock+LevelThree]= Level8; - map[Shift+NumLock+LevelFive]= Level2; - map[NumLock+LevelThree+LevelFive]= Level3; - map[Shift+NumLock+LevelThree+LevelFive]= Level4; - map[Shift+Lock]= Level2; - map[Lock+LevelThree]= Level3; - map[Shift+Lock+LevelThree]= Level4; - map[Lock+LevelFive]= Level5; - map[Shift+Lock+LevelFive]= Level6; - preserve[Shift+Lock+LevelFive]= Shift; - map[Lock+LevelThree+LevelFive]= Level7; - map[Shift+Lock+LevelThree+LevelFive]= Level8; - map[Lock+NumLock]= Level5; - map[Shift+Lock+NumLock]= Level6; - preserve[Shift+Lock+NumLock]= Shift; - map[Lock+NumLock+LevelThree]= Level7; - map[Shift+Lock+NumLock+LevelThree]= Level8; - map[Shift+Lock+NumLock+LevelFive]= Level2; - map[Lock+NumLock+LevelThree+LevelFive]= Level3; - map[Shift+Lock+NumLock+LevelThree+LevelFive]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "X"; - level_name[Level6]= "X Shift"; - level_name[Level7]= "X Alt Base"; - level_name[Level8]= "X Shift Alt"; - }; - type "EIGHT_LEVEL_ALPHABETIC_LEVEL_FIVE_LOCK" { - modifiers= Shift+Lock+NumLock+LevelThree+LevelFive; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[LevelFive]= Level5; - map[Shift+LevelFive]= Level6; - preserve[Shift+LevelFive]= Shift; - map[LevelThree+LevelFive]= Level7; - map[Shift+LevelThree+LevelFive]= Level8; - map[NumLock]= Level5; - map[Shift+NumLock]= Level6; - preserve[Shift+NumLock]= Shift; - map[NumLock+LevelThree]= Level7; - map[Shift+NumLock+LevelThree]= Level8; - map[Shift+NumLock+LevelFive]= Level2; - map[NumLock+LevelThree+LevelFive]= Level3; - map[Shift+NumLock+LevelThree+LevelFive]= Level4; - map[Lock]= Level2; - map[Lock+LevelThree]= Level3; - map[Shift+Lock+LevelThree]= Level4; - map[Lock+LevelFive]= Level5; - map[Shift+Lock+LevelFive]= Level6; - map[Lock+LevelThree+LevelFive]= Level7; - map[Shift+Lock+LevelThree+LevelFive]= Level8; - map[Lock+NumLock]= Level5; - map[Shift+Lock+NumLock]= Level6; - map[Lock+NumLock+LevelThree]= Level7; - map[Shift+Lock+NumLock+LevelThree]= Level8; - map[Lock+NumLock+LevelFive]= Level2; - map[Lock+NumLock+LevelThree+LevelFive]= Level4; - map[Shift+Lock+NumLock+LevelThree+LevelFive]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "X"; - level_name[Level6]= "X Shift"; - level_name[Level7]= "X Alt Base"; - level_name[Level8]= "X Shift Alt"; - }; - type "EIGHT_LEVEL_SEMIALPHABETIC" { - modifiers= Shift+Lock+LevelThree+LevelFive; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level3; - preserve[Lock+LevelThree]= Lock; - map[Shift+Lock+LevelThree]= Level4; - preserve[Shift+Lock+LevelThree]= Lock; - map[LevelFive]= Level5; - map[Shift+LevelFive]= Level6; - map[Lock+LevelFive]= Level6; - preserve[Lock+LevelFive]= Lock; - map[Shift+Lock+LevelFive]= Level6; - preserve[Shift+Lock+LevelFive]= Lock; - map[LevelThree+LevelFive]= Level7; - map[Shift+LevelThree+LevelFive]= Level8; - map[Lock+LevelThree+LevelFive]= Level7; - preserve[Lock+LevelThree+LevelFive]= Lock; - map[Shift+Lock+LevelThree+LevelFive]= Level8; - preserve[Shift+Lock+LevelThree+LevelFive]= Lock; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "X"; - level_name[Level6]= "X Shift"; - level_name[Level7]= "X Alt Base"; - level_name[Level8]= "X Shift Alt"; - }; - type "FOUR_LEVEL" { - modifiers= Shift+LevelThree; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - }; - type "FOUR_LEVEL_ALPHABETIC" { - modifiers= Shift+Lock+LevelThree; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level4; - map[Shift+Lock+LevelThree]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - }; - type "FOUR_LEVEL_SEMIALPHABETIC" { - modifiers= Shift+Lock+LevelThree; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level3; - preserve[Lock+LevelThree]= Lock; - map[Shift+Lock+LevelThree]= Level4; - preserve[Shift+Lock+LevelThree]= Lock; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - }; - type "FOUR_LEVEL_MIXED_KEYPAD" { - modifiers= Shift+NumLock+LevelThree; - map[NumLock]= Level2; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[NumLock+LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Shift+NumLock+LevelThree]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Number"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - }; - type "FOUR_LEVEL_X" { - modifiers= Shift+Control+Alt+LevelThree; - map[LevelThree]= Level2; - map[Shift+LevelThree]= Level3; - map[Control+Alt]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Alt Base"; - level_name[Level3]= "Shift Alt"; - level_name[Level4]= "Ctrl+Alt"; - }; - type "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC" { - modifiers= Shift+Lock+LevelThree; - map[Shift]= Level2; - map[Lock]= Level4; - preserve[Lock]= Lock; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level3; - preserve[Lock+LevelThree]= Lock; - map[Shift+Lock+LevelThree]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "AltGr Base"; - level_name[Level4]= "Shift AltGr"; - }; - type "FOUR_LEVEL_PLUS_LOCK" { - modifiers= Shift+Lock+LevelThree; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock]= Level5; - map[Shift+Lock]= Level2; - map[Lock+LevelThree]= Level3; - map[Shift+Lock+LevelThree]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "Lock"; - }; - type "KEYPAD" { - modifiers= Shift+NumLock; - map[Shift]= Level2; - map[NumLock]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Number"; - }; - type "FOUR_LEVEL_KEYPAD" { - modifiers= Shift+NumLock+LevelThree; - map[Shift]= Level2; - map[NumLock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[NumLock+LevelThree]= Level4; - map[Shift+NumLock+LevelThree]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Number"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Alt Number"; - }; -}; - -xkb_compatibility "(unnamed)" { - virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; - - interpret.useModMapMods= AnyLevel; - interpret.repeat= False; - interpret ISO_Level2_Latch+Exactly(Shift) { - useModMapMods=level1; - action= LatchMods(modifiers=Shift,clearLocks,latchToLock); - }; - interpret Shift_Lock+AnyOf(Shift+Lock) { - action= LockMods(modifiers=Shift); - }; - interpret Num_Lock+AnyOf(all) { - virtualModifier= NumLock; - action= LockMods(modifiers=NumLock); - }; - interpret ISO_Level3_Shift+AnyOf(all) { - virtualModifier= LevelThree; - useModMapMods=level1; - action= SetMods(modifiers=LevelThree,clearLocks); - }; - interpret ISO_Level3_Latch+AnyOf(all) { - virtualModifier= LevelThree; - useModMapMods=level1; - action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); - }; - interpret ISO_Level3_Lock+AnyOf(all) { - virtualModifier= LevelThree; - useModMapMods=level1; - action= LockMods(modifiers=LevelThree); - }; - interpret Alt_L+AnyOf(all) { - virtualModifier= Alt; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Alt_R+AnyOf(all) { - virtualModifier= Alt; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Meta_L+AnyOf(all) { - virtualModifier= Meta; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Meta_R+AnyOf(all) { - virtualModifier= Meta; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Super_L+AnyOf(all) { - virtualModifier= Super; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Super_R+AnyOf(all) { - virtualModifier= Super; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Hyper_L+AnyOf(all) { - virtualModifier= Hyper; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Hyper_R+AnyOf(all) { - virtualModifier= Hyper; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Scroll_Lock+AnyOf(all) { - virtualModifier= ScrollLock; - action= LockMods(modifiers=modMapMods); - }; - interpret ISO_Level5_Shift+AnyOf(all) { - virtualModifier= LevelFive; - useModMapMods=level1; - action= SetMods(modifiers=LevelFive,clearLocks); - }; - interpret ISO_Level5_Latch+AnyOf(all) { - virtualModifier= LevelFive; - useModMapMods=level1; - action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); - }; - interpret ISO_Level5_Lock+AnyOf(all) { - virtualModifier= LevelFive; - useModMapMods=level1; - action= LockMods(modifiers=LevelFive); - }; - interpret Mode_switch+AnyOfOrNone(all) { - virtualModifier= AltGr; - useModMapMods=level1; - action= SetGroup(group=+1); - }; - interpret ISO_Level3_Shift+AnyOfOrNone(all) { - action= SetMods(modifiers=LevelThree,clearLocks); - }; - interpret ISO_Level3_Latch+AnyOfOrNone(all) { - action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); - }; - interpret ISO_Level3_Lock+AnyOfOrNone(all) { - action= LockMods(modifiers=LevelThree); - }; - interpret ISO_Group_Latch+AnyOfOrNone(all) { - virtualModifier= AltGr; - useModMapMods=level1; - action= LatchGroup(group=2); - }; - interpret ISO_Next_Group+AnyOfOrNone(all) { - virtualModifier= AltGr; - useModMapMods=level1; - action= LockGroup(group=+1); - }; - interpret ISO_Prev_Group+AnyOfOrNone(all) { - virtualModifier= AltGr; - useModMapMods=level1; - action= LockGroup(group=-1); - }; - interpret ISO_First_Group+AnyOfOrNone(all) { - action= LockGroup(group=1); - }; - interpret ISO_Last_Group+AnyOfOrNone(all) { - action= LockGroup(group=2); - }; - interpret KP_1+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+1); - }; - interpret KP_End+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+1); - }; - interpret KP_2+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+0,y=+1); - }; - interpret KP_Down+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+0,y=+1); - }; - interpret KP_3+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+1); - }; - interpret KP_Next+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+1); - }; - interpret KP_4+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+0); - }; - interpret KP_Left+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+0); - }; - interpret KP_6+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+0); - }; - interpret KP_Right+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+0); - }; - interpret KP_7+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=-1); - }; - interpret KP_Home+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=-1); - }; - interpret KP_8+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+0,y=-1); - }; - interpret KP_Up+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+0,y=-1); - }; - interpret KP_9+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=-1); - }; - interpret KP_Prior+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=-1); - }; - interpret KP_5+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default); - }; - interpret KP_Begin+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default); - }; - interpret KP_F2+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=1); - }; - interpret KP_Divide+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=1); - }; - interpret KP_F3+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=2); - }; - interpret KP_Multiply+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=2); - }; - interpret KP_F4+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=3); - }; - interpret KP_Subtract+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=3); - }; - interpret KP_Separator+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default,count=2); - }; - interpret KP_Add+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default,count=2); - }; - interpret KP_0+AnyOfOrNone(all) { - repeat= True; - action= LockPtrBtn(button=default,affect=lock); - }; - interpret KP_Insert+AnyOfOrNone(all) { - repeat= True; - action= LockPtrBtn(button=default,affect=lock); - }; - interpret KP_Decimal+AnyOfOrNone(all) { - repeat= True; - action= LockPtrBtn(button=default,affect=unlock); - }; - interpret KP_Delete+AnyOfOrNone(all) { - repeat= True; - action= LockPtrBtn(button=default,affect=unlock); - }; - interpret F25+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=1); - }; - interpret F26+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=2); - }; - interpret F27+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=-1); - }; - interpret F29+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=-1); - }; - interpret F31+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default); - }; - interpret F33+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+1); - }; - interpret F35+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+1); - }; - interpret Pointer_Button_Dflt+AnyOfOrNone(all) { - action= PtrBtn(button=default); - }; - interpret Pointer_Button1+AnyOfOrNone(all) { - action= PtrBtn(button=1); - }; - interpret Pointer_Button2+AnyOfOrNone(all) { - action= PtrBtn(button=2); - }; - interpret Pointer_Button3+AnyOfOrNone(all) { - action= PtrBtn(button=3); - }; - interpret Pointer_DblClick_Dflt+AnyOfOrNone(all) { - action= PtrBtn(button=default,count=2); - }; - interpret Pointer_DblClick1+AnyOfOrNone(all) { - action= PtrBtn(button=1,count=2); - }; - interpret Pointer_DblClick2+AnyOfOrNone(all) { - action= PtrBtn(button=2,count=2); - }; - interpret Pointer_DblClick3+AnyOfOrNone(all) { - action= PtrBtn(button=3,count=2); - }; - interpret Pointer_Drag_Dflt+AnyOfOrNone(all) { - action= LockPtrBtn(button=default); - }; - interpret Pointer_Drag1+AnyOfOrNone(all) { - action= LockPtrBtn(button=1); - }; - interpret Pointer_Drag2+AnyOfOrNone(all) { - action= LockPtrBtn(button=2); - }; - interpret Pointer_Drag3+AnyOfOrNone(all) { - action= LockPtrBtn(button=3); - }; - interpret Pointer_EnableKeys+AnyOfOrNone(all) { - action= LockControls(controls=MouseKeys); - }; - interpret Pointer_Accelerate+AnyOfOrNone(all) { - action= LockControls(controls=MouseKeysAccel); - }; - interpret Pointer_DfltBtnNext+AnyOfOrNone(all) { - action= SetPtrDflt(affect=button,button=+1); - }; - interpret Pointer_DfltBtnPrev+AnyOfOrNone(all) { - action= SetPtrDflt(affect=button,button=-1); - }; - interpret AccessX_Enable+AnyOfOrNone(all) { - action= LockControls(controls=AccessXKeys); - }; - interpret AccessX_Feedback_Enable+AnyOfOrNone(all) { - action= LockControls(controls=AccessXFeedback); - }; - interpret RepeatKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=RepeatKeys); - }; - interpret SlowKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=SlowKeys); - }; - interpret BounceKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=BounceKeys); - }; - interpret StickyKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=StickyKeys); - }; - interpret MouseKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=MouseKeys); - }; - interpret MouseKeys_Accel_Enable+AnyOfOrNone(all) { - action= LockControls(controls=MouseKeysAccel); - }; - interpret Overlay1_Enable+AnyOfOrNone(all) { - action= LockControls(controls=none); - }; - interpret Overlay2_Enable+AnyOfOrNone(all) { - action= LockControls(controls=none); - }; - interpret AudibleBell_Enable+AnyOfOrNone(all) { - action= LockControls(controls=AudibleBell); - }; - interpret Terminate_Server+AnyOfOrNone(all) { - action= Terminate(); - }; - interpret Alt_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Alt,clearLocks); - }; - interpret Alt_R+AnyOfOrNone(all) { - action= SetMods(modifiers=Alt,clearLocks); - }; - interpret Meta_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Meta,clearLocks); - }; - interpret Meta_R+AnyOfOrNone(all) { - action= SetMods(modifiers=Meta,clearLocks); - }; - interpret Super_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Super,clearLocks); - }; - interpret Super_R+AnyOfOrNone(all) { - action= SetMods(modifiers=Super,clearLocks); - }; - interpret Hyper_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Hyper,clearLocks); - }; - interpret Hyper_R+AnyOfOrNone(all) { - action= SetMods(modifiers=Hyper,clearLocks); - }; - interpret Shift_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Shift,clearLocks); - }; - interpret XF86Switch_VT_1+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=1,!same); - }; - interpret XF86Switch_VT_2+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=2,!same); - }; - interpret XF86Switch_VT_3+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=3,!same); - }; - interpret XF86Switch_VT_4+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=4,!same); - }; - interpret XF86Switch_VT_5+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=5,!same); - }; - interpret XF86Switch_VT_6+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=6,!same); - }; - interpret XF86Switch_VT_7+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=7,!same); - }; - interpret XF86Switch_VT_8+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=8,!same); - }; - interpret XF86Switch_VT_9+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=9,!same); - }; - interpret XF86Switch_VT_10+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=10,!same); - }; - interpret XF86Switch_VT_11+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=11,!same); - }; - interpret XF86Switch_VT_12+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=12,!same); - }; - interpret XF86LogGrabInfo+AnyOfOrNone(all) { - repeat= True; - action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x47,data[3]=0x72,data[4]=0x62,data[5]=0x73,data[6]=0x00); - }; - interpret XF86LogWindowTree+AnyOfOrNone(all) { - repeat= True; - action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x57,data[3]=0x69,data[4]=0x6e,data[5]=0x73,data[6]=0x00); - }; - interpret XF86Next_VMode+AnyOfOrNone(all) { - repeat= True; - action= Private(type=0x86,data[0]=0x2b,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); - }; - interpret XF86Prev_VMode+AnyOfOrNone(all) { - repeat= True; - action= Private(type=0x86,data[0]=0x2d,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); - }; - interpret ISO_Level5_Shift+AnyOfOrNone(all) { - action= SetMods(modifiers=LevelFive,clearLocks); - }; - interpret ISO_Level5_Latch+AnyOfOrNone(all) { - action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); - }; - interpret ISO_Level5_Lock+AnyOfOrNone(all) { - action= LockMods(modifiers=LevelFive); - }; - interpret Caps_Lock+AnyOfOrNone(all) { - action= LockMods(modifiers=Lock); - }; - interpret Any+Exactly(Lock) { - action= LockMods(modifiers=Lock); - }; - interpret Any+AnyOf(all) { - action= SetMods(modifiers=modMapMods,clearLocks); - }; - indicator "Caps Lock" { - whichModState= locked; - modifiers= Lock; - }; - indicator "Num Lock" { - whichModState= locked; - modifiers= NumLock; - }; - indicator "Scroll Lock" { - whichModState= locked; - modifiers= ScrollLock; - }; - indicator "Shift Lock" { - whichModState= locked; - modifiers= Shift; - }; - indicator "Group 2" { - groups= 0xfe; - }; - indicator "Mouse Keys" { - controls= MouseKeys; - }; -}; - -xkb_symbols "(unnamed)" { - name[group1]="English (US)"; - - key { [ Escape ] }; - key { [ 1, exclam ] }; - key { [ 2, at ] }; - key { [ 3, numbersign ] }; - key { [ 4, dollar ] }; - key { [ 5, percent ] }; - key { [ 6, asciicircum ] }; - key { [ 7, ampersand ] }; - key { [ 8, asterisk ] }; - key { [ 9, parenleft ] }; - key { [ 0, parenright ] }; - key { [ minus, underscore ] }; - key { [ equal, plus ] }; - key { [ BackSpace, BackSpace ] }; - key { [ Tab, ISO_Left_Tab ] }; - key { [ q, Q, 1 ] }; - key { [ w, W, 2 ] }; - key { [ e, E, 3 ] }; - key { [ r, R, 4 ] }; - key { [ t, T, 5 ] }; - key { [ y, Y, 6 ] }; - key { [ u, U, 7 ] }; - key { [ i, I, 8 ] }; - key { [ o, O, 9 ] }; - key { [ p, P, 0 ] }; - key { [ bracketleft, braceleft ] }; - key { [ bracketright, braceright ] }; - key { [ Return ] }; - key { [ Control_L ] }; - key { [ a, A, minus ] }; - key { [ s, S, at ] }; - key { [ d, D, asterisk ] }; - key { [ f, F, asciicircum ] }; - key { [ g, G, colon ] }; - key { [ h, H, semicolon ] }; - key { [ j, J, parenleft ] }; - key { [ k, K, parenright ] }; - key { [ l, L, asciitilde ] }; - key { [ semicolon, colon ] }; - key { [ apostrophe, quotedbl ] }; - key { [ grave, asciitilde ] }; - key { [ Shift_L ] }; - key { [ backslash, bar ] }; - key { [ z, Z, slash ] }; - key { [ x, X, apostrophe ] }; - key { [ c, C, quotedbl ] }; - key { [ v, V, plus ] }; - key { [ b, B, equal ] }; - key { [ n, N, question ] }; - key { [ m, M, exclam ] }; - key { [ comma, less, backslash] }; - key { [ period, greater, bar ] }; - key { [ slash, question ] }; - key { [ Shift_R ] }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ] - }; - key { [ Alt_L, Meta_L ] }; - key { [ space ] }; - key { [ Caps_Lock ] }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F1, F1, F1, F1, XF86Switch_VT_1 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F2, F2, F2, F2, XF86Switch_VT_2 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F3, F3, F3, F3, XF86Switch_VT_3 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F4, F4, F4, F4, XF86Switch_VT_4 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F5, F5, F5, F5, XF86Switch_VT_5 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F6, F6, F6, F6, XF86Switch_VT_6 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F7, F7, F7, F7, XF86Switch_VT_7 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F8, F8, F8, F8, XF86Switch_VT_8 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F9, F9, F9, F9, XF86Switch_VT_9 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F10, F10, F10, F10, XF86Switch_VT_10 ] - }; - key { [ Num_Lock ] }; - key { [ Scroll_Lock ] }; - key { [ KP_Home, KP_7 ] }; - key { [ KP_Up, KP_8 ] }; - key { [ KP_Prior, KP_9 ] }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ] - }; - key { [ KP_Left, KP_4 ] }; - key { [ KP_Begin, KP_5 ] }; - key { [ KP_Right, KP_6 ] }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ] - }; - key { [ KP_End, KP_1 ] }; - key { [ KP_Down, KP_2 ] }; - key { [ KP_Next, KP_3 ] }; - key { [ KP_Insert, KP_0 ] }; - key { [ KP_Delete, KP_Decimal ] }; - key { [ ISO_Level3_Shift ] }; - key { [ less, greater, bar, brokenbar ] }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F11, F11, F11, F11, XF86Switch_VT_11 ] - }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ F12, F12, F12, F12, XF86Switch_VT_12 ] - }; - key { [ Katakana ] }; - key { [ Hiragana ] }; - key { [ Henkan_Mode ] }; - key { [ Hiragana_Katakana ] }; - key { [ Muhenkan ] }; - key { [ KP_Enter ] }; - key { [ Control_R ] }; - key { - type= "CTRL+ALT", - symbols[Group1]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ] - }; - key { - type= "PC_ALT_LEVEL2", - symbols[Group1]= [ Print, Sys_Req ] - }; - key { - type= "TWO_LEVEL", - symbols[Group1]= [ Alt_R, Meta_R ] - }; - key { [ Linefeed ] }; - key { [ Home ] }; - key { [ Up ] }; - key { [ Prior ] }; - key { [ Left ] }; - key { [ Right ] }; - key { [ End ] }; - key { [ Down ] }; - key { [ Next ] }; - key { [ Insert ] }; - key { [ Delete ] }; - key { [ XF86AudioMute ] }; - key { [ XF86AudioLowerVolume ] }; - key { [ XF86AudioRaiseVolume ] }; - key { [ XF86PowerOff ] }; - key { [ KP_Equal ] }; - key { [ plusminus ] }; - key { - type= "PC_CONTROL_LEVEL2", - symbols[Group1]= [ Pause, Break ] - }; - key { [ XF86LaunchA ] }; - key { [ KP_Decimal, KP_Decimal ] }; - key { [ Hangul ] }; - key { [ Hangul_Hanja ] }; - key { [ Super_L ] }; - key { [ Super_R ] }; - key { [ Menu ] }; - key { [ Cancel ] }; - key { [ Redo ] }; - key { [ SunProps ] }; - key { [ Undo ] }; - key { [ SunFront ] }; - key { [ XF86Copy ] }; - key { [ XF86Open ] }; - key { [ XF86Paste ] }; - key { [ Find ] }; - key { [ XF86Cut ] }; - key { [ Help ] }; - key { [ XF86MenuKB ] }; - key { [ XF86Calculator ] }; - key { [ XF86Sleep ] }; - key { [ XF86WakeUp ] }; - key { [ XF86Explorer ] }; - key { [ XF86Send ] }; - key { [ XF86Xfer ] }; - key { [ XF86Launch1 ] }; - key { [ XF86Launch2 ] }; - key { [ XF86WWW ] }; - key { [ XF86DOS ] }; - key { [ XF86ScreenSaver ] }; - key { [ XF86RotateWindows ] }; - key { [ XF86TaskPane ] }; - key { [ XF86Mail ] }; - key { [ XF86Favorites ] }; - key { [ XF86MyComputer ] }; - key { [ XF86Back ] }; - key { [ XF86Forward ] }; - key { [ XF86Eject ] }; - key { [ XF86Eject, XF86Eject ] }; - key { [ XF86AudioNext ] }; - key { [ XF86AudioPlay, XF86AudioPause ] }; - key { [ XF86AudioPrev ] }; - key { [ XF86AudioStop, XF86Eject ] }; - key { [ XF86AudioRecord ] }; - key { [ XF86AudioRewind ] }; - key { [ XF86Phone ] }; - key { [ XF86Tools ] }; - key { [ XF86HomePage ] }; - key { [ XF86Reload ] }; - key { [ XF86Close ] }; - key { [ XF86ScrollUp ] }; - key { [ XF86ScrollDown ] }; - key { [ parenleft ] }; - key { [ parenright ] }; - key { [ XF86New ] }; - key { [ Redo ] }; - key { [ XF86Tools ] }; - key { [ XF86Launch5 ] }; - key { [ XF86Launch6 ] }; - key { [ XF86Launch7 ] }; - key { [ XF86Launch8 ] }; - key { [ XF86Launch9 ] }; - key { [ XF86AudioMicMute ] }; - key { [ XF86TouchpadToggle ] }; - key { [ XF86TouchpadOn ] }; - key { [ XF86TouchpadOff ] }; - key { [ Mode_switch ] }; - key { [ NoSymbol, Alt_L ] }; - key { [ NoSymbol, Meta_L ] }; - key { [ NoSymbol, Super_L ] }; - key { [ NoSymbol, Hyper_L ] }; - key { [ XF86AudioPlay ] }; - key { [ XF86AudioPause ] }; - key { [ XF86Launch3 ] }; - key { [ XF86Launch4 ] }; - key { [ XF86LaunchB ] }; - key { [ XF86Suspend ] }; - key { [ XF86Close ] }; - key { [ XF86AudioPlay ] }; - key { [ XF86AudioForward ] }; - key { [ Print ] }; - key { [ XF86WebCam ] }; - key { [ XF86AudioPreset ] }; - key { [ XF86Mail ] }; - key { [ XF86Messenger ] }; - key { [ XF86Search ] }; - key { [ XF86Go ] }; - key { [ XF86Finance ] }; - key { [ XF86Game ] }; - key { [ XF86Shop ] }; - key { [ Cancel ] }; - key { [ XF86MonBrightnessDown ] }; - key { [ XF86MonBrightnessUp ] }; - key { [ XF86AudioMedia ] }; - key { [ XF86Display ] }; - key { [ XF86KbdLightOnOff ] }; - key { [ XF86KbdBrightnessDown ] }; - key { [ XF86KbdBrightnessUp ] }; - key { [ XF86Send ] }; - key { [ XF86Reply ] }; - key { [ XF86MailForward ] }; - key { [ XF86Save ] }; - key { [ XF86Documents ] }; - key { [ XF86Battery ] }; - key { [ XF86Bluetooth ] }; - key { [ XF86WLAN ] }; - key { [ XF86UWB ] }; - key { [ XF86WWAN ] }; - key { [ XF86RFKill ] }; - modifier_map Shift { , }; - modifier_map Lock { }; - modifier_map Control { , }; - modifier_map Mod1 { , , }; - modifier_map Mod2 { }; - modifier_map Mod4 { , , , }; - modifier_map Mod5 { , }; -}; - -}; \ No newline at end of file diff --git a/resources/default.keymap b/resources/default.keymap index 8401006..27f673b 100644 --- a/resources/default.keymap +++ b/resources/default.keymap @@ -1,7 +1,1910 @@ xkb_keymap { - xkb_keycodes { include "evdev+aliases(qwerty)" }; - xkb_types { include "complete" }; - xkb_compat { include "complete" }; - xkb_symbols { include "pc+us+inet(evdev)" }; - xkb_geometry { include "pc(pc105)" }; +xkb_keycodes "(unnamed)" { + minimum = 8; + maximum = 708; + = 9; + = 10; + = 11; + = 12; + = 13; + = 14; + = 15; + = 16; + = 17; + = 18; + = 19; + = 20; + = 21; + = 22; + = 23; + = 24; + = 25; + = 26; + = 27; + = 28; + = 29; + = 30; + = 31; + = 32; + = 33; + = 34; + = 35; + = 36; + = 37; + = 38; + = 39; + = 40; + = 41; + = 42; + = 43; + = 44; + = 45; + = 46; + = 47; + = 48; + = 49; + = 50; + = 51; + = 52; + = 53; + = 54; + = 55; + = 56; + = 57; + = 58; + = 59; + = 60; + = 61; + = 62; + = 63; + = 64; + = 65; + = 66; + = 67; + = 68; + = 69; + = 70; + = 71; + = 72; + = 73; + = 74; + = 75; + = 76; + = 77; + = 78; + = 79; + = 80; + = 81; + = 82; + = 83; + = 84; + = 85; + = 86; + = 87; + = 88; + = 89; + = 90; + = 91; + = 92; + = 94; + = 95; + = 96; + = 97; + = 98; + = 99; + = 100; + = 101; + = 102; + = 103; + = 104; + = 105; + = 106; + = 107; + = 108; + = 109; + = 110; + = 111; + = 112; + = 113; + = 114; + = 115; + = 116; + = 117; + = 118; + = 119; + = 120; + = 121; + = 122; + = 123; + = 124; + = 125; + = 126; + = 127; + = 128; + = 129; + = 130; + = 131; + = 132; + = 133; + = 134; + = 135; + = 136; + = 137; + = 138; + = 139; + = 140; + = 141; + = 142; + = 143; + = 144; + = 145; + = 146; + = 147; + = 148; + = 149; + = 150; + = 151; + = 152; + = 153; + = 154; + = 155; + = 156; + = 157; + = 158; + = 159; + = 160; + = 161; + = 162; + = 163; + = 164; + = 165; + = 166; + = 167; + = 168; + = 169; + = 170; + = 171; + = 172; + = 173; + = 174; + = 175; + = 176; + = 177; + = 178; + = 179; + = 180; + = 181; + = 182; + = 183; + = 184; + = 185; + = 186; + = 187; + = 188; + = 189; + = 190; + = 191; + = 192; + = 193; + = 194; + = 195; + = 196; + = 197; + = 198; + = 199; + = 200; + = 201; + = 202; + = 203; + = 204; + = 205; + = 206; + = 207; + = 208; + = 209; + = 210; + = 211; + = 212; + = 213; + = 214; + = 215; + = 216; + = 217; + = 218; + = 219; + = 220; + = 221; + = 222; + = 223; + = 224; + = 225; + = 226; + = 227; + = 228; + = 229; + = 230; + = 231; + = 232; + = 233; + = 234; + = 235; + = 236; + = 237; + = 238; + = 239; + = 240; + = 241; + = 242; + = 243; + = 244; + = 245; + = 246; + = 247; + = 248; + = 249; + = 250; + = 251; + = 252; + = 253; + = 254; + = 255; + = 256; + = 360; + = 361; + = 362; + = 363; + = 364; + = 365; + = 366; + = 367; + = 368; + = 369; + = 370; + = 371; + = 372; + = 373; + = 374; + = 375; + = 376; + = 377; + = 378; + = 379; + = 380; + = 381; + = 382; + = 383; + = 384; + = 385; + = 386; + = 387; + = 388; + = 389; + = 390; + = 391; + = 392; + = 393; + = 394; + = 395; + = 396; + = 397; + = 398; + = 399; + = 400; + = 401; + = 402; + = 403; + = 404; + = 405; + = 406; + = 407; + = 408; + = 409; + = 410; + = 411; + = 412; + = 413; + = 414; + = 415; + = 416; + = 417; + = 418; + = 419; + = 420; + = 421; + = 422; + = 423; + = 424; + = 425; + = 426; + = 427; + = 428; + = 429; + = 430; + = 431; + = 432; + = 433; + = 434; + = 435; + = 436; + = 437; + = 438; + = 439; + = 440; + = 441; + = 442; + = 443; + = 444; + = 445; + = 446; + = 447; + = 448; + = 449; + = 450; + = 452; + = 453; + = 454; + = 456; + = 457; + = 458; + = 459; + = 472; + = 473; + = 474; + = 475; + = 476; + = 477; + = 478; + = 479; + = 480; + = 481; + = 482; + = 483; + = 484; + = 485; + = 486; + = 487; + = 488; + = 489; + = 490; + = 491; + = 492; + = 493; + = 505; + = 506; + = 507; + = 508; + = 509; + = 510; + = 511; + = 512; + = 513; + = 514; + = 520; + = 521; + = 522; + = 523; + = 524; + = 525; + = 526; + = 527; + = 528; + = 529; + = 530; + = 531; + = 532; + = 533; + = 534; + = 535; + = 536; + = 537; + = 538; + = 539; + = 540; + = 541; + = 542; + = 543; + = 544; + = 545; + = 546; + = 547; + = 548; + = 549; + = 550; + = 568; + = 569; + = 584; + = 585; + = 586; + = 587; + = 588; + = 589; + = 590; + = 591; + = 592; + = 593; + = 594; + = 595; + = 596; + = 597; + = 600; + = 601; + = 616; + = 617; + = 618; + = 619; + = 620; + = 621; + = 622; + = 623; + = 624; + = 625; + = 626; + = 627; + = 628; + = 629; + = 630; + = 631; + = 632; + = 633; + = 634; + = 635; + = 636; + = 637; + = 638; + = 639; + = 640; + = 641; + = 642; + = 643; + = 644; + = 645; + = 646; + = 647; + = 648; + = 649; + = 650; + = 651; + = 652; + = 653; + = 654; + = 655; + = 656; + = 657; + = 664; + = 665; + = 666; + = 667; + = 668; + = 669; + = 670; + = 671; + = 672; + = 673; + = 674; + = 675; + = 676; + = 677; + = 678; + = 679; + = 680; + = 681; + = 682; + = 683; + = 684; + = 685; + = 686; + = 687; + = 688; + = 689; + = 690; + = 691; + = 692; + = 693; + = 696; + = 697; + = 698; + = 699; + = 700; + = 701; + = 704; + = 705; + = 706; + = 707; + = 708; + indicator 1 = "Caps Lock"; + indicator 2 = "Num Lock"; + indicator 3 = "Scroll Lock"; + indicator 4 = "Compose"; + indicator 5 = "Kana"; + indicator 6 = "Sleep"; + indicator 7 = "Suspend"; + indicator 8 = "Mute"; + indicator 9 = "Misc"; + indicator 10 = "Mail"; + indicator 11 = "Charging"; + indicator 12 = "Shift Lock"; + indicator 13 = "Group 2"; + indicator 14 = "Mouse Keys"; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; +}; + +xkb_types "(unnamed)" { + virtual_modifiers NumLock,Alt,LevelThree,LevelFive,Meta,Super,Hyper,ScrollLock; + + type "ONE_LEVEL" { + modifiers= none; + level_name[1]= "Any"; + }; + type "TWO_LEVEL" { + modifiers= Shift; + map[Shift]= 2; + level_name[1]= "Base"; + level_name[2]= "Shift"; + }; + type "ALPHABETIC" { + modifiers= Shift+Lock; + map[Shift]= 2; + map[Lock]= 2; + level_name[1]= "Base"; + level_name[2]= "Caps"; + }; + type "PC_ALT_LEVEL2" { + modifiers= Alt; + map[Alt]= 2; + level_name[1]= "Base"; + level_name[2]= "Alt"; + }; + type "PC_SUPER_LEVEL2" { + modifiers= Mod4; + map[Mod4]= 2; + level_name[1]= "Base"; + level_name[2]= "Super"; + }; + type "PC_CONTROL_LEVEL2" { + modifiers= Control; + map[Control]= 2; + level_name[1]= "Base"; + level_name[2]= "Control"; + }; + type "CTRL+ALT" { + modifiers= Shift+Control+Alt+LevelThree; + map[Shift]= 2; + preserve[Shift]= Shift; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + preserve[Shift+LevelThree]= Shift; + map[Control+Alt]= 5; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + level_name[5]= "Ctrl+Alt"; + }; + type "THREE_LEVEL" { + modifiers= Shift+LevelThree; + map[Shift]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 3; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "Level3"; + }; + type "FOUR_LEVEL" { + modifiers= Shift+LevelThree; + map[Shift]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + }; + type "FOUR_LEVEL_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= 2; + map[Lock]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[Lock+LevelThree]= 4; + map[Shift+Lock+LevelThree]= 3; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + }; + type "FOUR_LEVEL_SEMIALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= 2; + map[Lock]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[Lock+LevelThree]= 3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= 4; + preserve[Shift+Lock+LevelThree]= Lock; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + }; + type "FOUR_LEVEL_KEYPAD" { + modifiers= Shift+NumLock+LevelThree; + map[Shift]= 2; + map[NumLock]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[NumLock+LevelThree]= 4; + map[Shift+NumLock+LevelThree]= 3; + level_name[1]= "Base"; + level_name[2]= "Shift/Numlock"; + level_name[3]= "AltGr"; + level_name[4]= "Shift/Numlock AltGr"; + }; + type "FOUR_LEVEL_MIXED_KEYPAD" { + modifiers= Shift+NumLock+LevelThree; + map[Shift]= 2; + map[NumLock]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[NumLock+LevelThree]= 3; + map[Shift+NumLock+LevelThree]= 4; + level_name[1]= "Base"; + level_name[2]= "Number"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + }; + type "FOUR_LEVEL_X" { + modifiers= Shift+Control+Alt+LevelThree; + map[LevelThree]= 2; + map[Shift+LevelThree]= 3; + map[Control+Alt]= 4; + level_name[1]= "Base"; + level_name[2]= "AltGr"; + level_name[3]= "Shift AltGr"; + level_name[4]= "Ctrl+Alt"; + }; + type "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= 2; + map[Lock]= 4; + preserve[Lock]= Lock; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[Lock+LevelThree]= 3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= 3; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Caps / Shift AltGr"; + }; + type "FOUR_LEVEL_PLUS_LOCK" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[Lock]= 5; + map[Shift+Lock]= 2; + map[Lock+LevelThree]= 3; + map[Shift+Lock+LevelThree]= 4; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + level_name[5]= "Lock"; + }; + type "EIGHT_LEVEL" { + modifiers= Shift+LevelThree+LevelFive; + map[Shift]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[LevelFive]= 5; + map[Shift+LevelFive]= 6; + map[LevelThree+LevelFive]= 7; + map[Shift+LevelThree+LevelFive]= 8; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + level_name[5]= "X"; + level_name[6]= "X Shift"; + level_name[7]= "X AltGr"; + level_name[8]= "X Shift AltGr"; + }; + type "EIGHT_LEVEL_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree+LevelFive; + map[Shift]= 2; + map[Lock]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[Lock+LevelThree]= 4; + map[Shift+Lock+LevelThree]= 3; + map[LevelFive]= 5; + map[Shift+LevelFive]= 6; + map[Lock+LevelFive]= 6; + map[Shift+Lock+LevelFive]= 5; + map[LevelThree+LevelFive]= 7; + map[Shift+LevelThree+LevelFive]= 8; + map[Lock+LevelThree+LevelFive]= 8; + map[Shift+Lock+LevelThree+LevelFive]= 7; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + level_name[5]= "X"; + level_name[6]= "X Shift"; + level_name[7]= "X AltGr"; + level_name[8]= "X Shift AltGr"; + }; + type "EIGHT_LEVEL_SEMIALPHABETIC" { + modifiers= Shift+Lock+LevelThree+LevelFive; + map[Shift]= 2; + map[Lock]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[Lock+LevelThree]= 3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= 4; + preserve[Shift+Lock+LevelThree]= Lock; + map[LevelFive]= 5; + map[Shift+LevelFive]= 6; + map[Lock+LevelFive]= 6; + map[Shift+Lock+LevelFive]= 5; + map[LevelThree+LevelFive]= 7; + map[Shift+LevelThree+LevelFive]= 8; + map[Lock+LevelThree+LevelFive]= 7; + preserve[Lock+LevelThree+LevelFive]= Lock; + map[Shift+Lock+LevelThree+LevelFive]= 8; + preserve[Shift+Lock+LevelThree+LevelFive]= Lock; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + level_name[5]= "X"; + level_name[6]= "X Shift"; + level_name[7]= "X AltGr"; + level_name[8]= "X Shift AltGr"; + }; + type "EIGHT_LEVEL_WITH_LEVEL5_LOCK" { + modifiers= Shift+NumLock+LevelThree+LevelFive; + map[Shift]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[LevelFive]= 5; + map[Shift+LevelFive]= 6; + preserve[Shift+LevelFive]= Shift; + map[LevelThree+LevelFive]= 7; + map[Shift+LevelThree+LevelFive]= 8; + map[NumLock]= 5; + map[Shift+NumLock]= 6; + preserve[Shift+NumLock]= Shift; + map[NumLock+LevelThree]= 7; + map[Shift+NumLock+LevelThree]= 8; + map[Shift+NumLock+LevelFive]= 2; + map[NumLock+LevelThree+LevelFive]= 3; + map[Shift+NumLock+LevelThree+LevelFive]= 4; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + level_name[5]= "X"; + level_name[6]= "X Shift"; + level_name[7]= "X AltGr"; + level_name[8]= "X Shift AltGr"; + }; + type "EIGHT_LEVEL_ALPHABETIC_WITH_LEVEL5_LOCK" { + modifiers= Shift+Lock+NumLock+LevelThree+LevelFive; + map[Shift]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[LevelFive]= 5; + map[Shift+LevelFive]= 6; + preserve[Shift+LevelFive]= Shift; + map[LevelThree+LevelFive]= 7; + map[Shift+LevelThree+LevelFive]= 8; + map[NumLock]= 5; + map[Shift+NumLock]= 6; + preserve[Shift+NumLock]= Shift; + map[NumLock+LevelThree]= 7; + map[Shift+NumLock+LevelThree]= 8; + map[Shift+NumLock+LevelFive]= 2; + map[NumLock+LevelThree+LevelFive]= 3; + map[Shift+NumLock+LevelThree+LevelFive]= 4; + map[Lock]= 2; + map[Lock+LevelThree]= 3; + map[Shift+Lock+LevelThree]= 4; + map[Lock+LevelFive]= 5; + map[Shift+Lock+LevelFive]= 6; + map[Lock+LevelThree+LevelFive]= 7; + map[Shift+Lock+LevelThree+LevelFive]= 8; + map[Lock+NumLock]= 5; + map[Shift+Lock+NumLock]= 6; + map[Lock+NumLock+LevelThree]= 7; + map[Shift+Lock+NumLock+LevelThree]= 8; + map[Lock+NumLock+LevelFive]= 2; + map[Lock+NumLock+LevelThree+LevelFive]= 3; + map[Shift+Lock+NumLock+LevelThree+LevelFive]= 4; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "AltGr"; + level_name[4]= "Shift AltGr"; + level_name[5]= "X"; + level_name[6]= "X Shift"; + level_name[7]= "X AltGr"; + level_name[8]= "X Shift AltGr"; + }; + type "EIGHT_LEVEL_BY_CTRL" { + modifiers= Shift+Lock+Control+LevelThree; + map[Shift]= 2; + map[Lock]= 2; + map[LevelThree]= 3; + map[Shift+LevelThree]= 4; + map[Lock+LevelThree]= 4; + map[Shift+Lock+LevelThree]= 3; + map[Control]= 5; + map[Shift+Control]= 6; + map[Lock+Control]= 6; + map[Shift+Lock+Control]= 5; + map[Control+LevelThree]= 7; + map[Shift+Control+LevelThree]= 8; + map[Lock+Control+LevelThree]= 8; + map[Shift+Lock+Control+LevelThree]= 7; + level_name[1]= "Base"; + level_name[2]= "Shift"; + level_name[3]= "Level3"; + level_name[4]= "Shift Level3"; + level_name[5]= "Ctrl"; + level_name[6]= "Shift Ctrl"; + level_name[7]= "Level3 Ctrl"; + level_name[8]= "Shift Level3 Ctrl"; + }; + type "KEYPAD" { + modifiers= Shift+NumLock; + map[NumLock]= 2; + level_name[1]= "Base"; + level_name[2]= "Number"; + }; + type "SHIFT+ALT" { + modifiers= Shift+Alt; + map[Shift+Alt]= 2; + level_name[1]= "Base"; + level_name[2]= "Shift+Alt"; + }; +}; + +xkb_compatibility "(unnamed)" { + virtual_modifiers NumLock,Alt,LevelThree,LevelFive,Meta,Super,Hyper,ScrollLock; + + interpret.useModMapMods= AnyLevel; + interpret.repeat= False; + interpret ISO_Level2_Latch+Exactly(Shift) { + useModMapMods=level1; + action= LatchMods(modifiers=Shift,clearLocks,latchToLock); + }; + interpret Shift_Lock+AnyOf(Shift+Lock) { + action= LockMods(modifiers=Shift); + }; + interpret Num_Lock+AnyOf(all) { + virtualModifier= NumLock; + action= LockMods(modifiers=NumLock); + }; + interpret ISO_Level3_Shift+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= SetMods(modifiers=LevelThree,clearLocks); + }; + interpret ISO_Level3_Latch+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); + }; + interpret ISO_Level3_Lock+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= LockMods(modifiers=LevelThree); + }; + interpret Alt_L+AnyOf(all) { + virtualModifier= Alt; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Alt_R+AnyOf(all) { + virtualModifier= Alt; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Meta_L+AnyOf(all) { + virtualModifier= Meta; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Meta_R+AnyOf(all) { + virtualModifier= Meta; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Super_L+AnyOf(all) { + virtualModifier= Super; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Super_R+AnyOf(all) { + virtualModifier= Super; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Hyper_L+AnyOf(all) { + virtualModifier= Hyper; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Hyper_R+AnyOf(all) { + virtualModifier= Hyper; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Scroll_Lock+AnyOf(all) { + virtualModifier= ScrollLock; + action= LockMods(modifiers=modMapMods); + }; + interpret ISO_Level5_Shift+AnyOf(all) { + virtualModifier= LevelFive; + useModMapMods=level1; + action= SetMods(modifiers=LevelFive,clearLocks); + }; + interpret ISO_Level5_Latch+AnyOf(all) { + virtualModifier= LevelFive; + useModMapMods=level1; + action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); + }; + interpret ISO_Level5_Lock+AnyOf(all) { + virtualModifier= LevelFive; + useModMapMods=level1; + action= LockMods(modifiers=LevelFive); + }; + interpret Mode_switch+AnyOfOrNone(all) { + action= SetGroup(group=+1); + }; + interpret ISO_Level3_Shift+AnyOfOrNone(all) { + action= SetMods(modifiers=LevelThree,clearLocks); + }; + interpret ISO_Level3_Latch+AnyOfOrNone(all) { + action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); + }; + interpret ISO_Level3_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=LevelThree); + }; + interpret ISO_Group_Latch+AnyOfOrNone(all) { + action= LatchGroup(group=2); + }; + interpret ISO_Next_Group+AnyOfOrNone(all) { + action= LockGroup(group=+1); + }; + interpret ISO_Prev_Group+AnyOfOrNone(all) { + action= LockGroup(group=-1); + }; + interpret ISO_First_Group+AnyOfOrNone(all) { + action= LockGroup(group=1); + }; + interpret ISO_Last_Group+AnyOfOrNone(all) { + action= LockGroup(group=2); + }; + interpret KP_1+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret KP_End+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret KP_2+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=+1); + }; + interpret KP_Down+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=+1); + }; + interpret KP_3+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret KP_Next+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret KP_4+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+0); + }; + interpret KP_Left+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+0); + }; + interpret KP_6+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+0); + }; + interpret KP_Right+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+0); + }; + interpret KP_7+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret KP_Home+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret KP_8+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=-1); + }; + interpret KP_Up+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=-1); + }; + interpret KP_9+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret KP_Prior+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret KP_5+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret KP_Begin+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret KP_F2+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret KP_Divide+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret KP_F3+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret KP_Multiply+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret KP_F4+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=3); + }; + interpret KP_Subtract+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=3); + }; + interpret KP_Separator+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default,count=2); + }; + interpret KP_Add+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default,count=2); + }; + interpret KP_0+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=lock); + }; + interpret KP_Insert+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=lock); + }; + interpret KP_Decimal+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=unlock); + }; + interpret KP_Delete+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=unlock); + }; + interpret F25+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret F26+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret F27+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret F29+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret F31+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret F33+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret F35+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret Pointer_Button_Dflt+AnyOfOrNone(all) { + action= PtrBtn(button=default); + }; + interpret Pointer_Button1+AnyOfOrNone(all) { + action= PtrBtn(button=1); + }; + interpret Pointer_Button2+AnyOfOrNone(all) { + action= PtrBtn(button=2); + }; + interpret Pointer_Button3+AnyOfOrNone(all) { + action= PtrBtn(button=3); + }; + interpret Pointer_DblClick_Dflt+AnyOfOrNone(all) { + action= PtrBtn(button=default,count=2); + }; + interpret Pointer_DblClick1+AnyOfOrNone(all) { + action= PtrBtn(button=1,count=2); + }; + interpret Pointer_DblClick2+AnyOfOrNone(all) { + action= PtrBtn(button=2,count=2); + }; + interpret Pointer_DblClick3+AnyOfOrNone(all) { + action= PtrBtn(button=3,count=2); + }; + interpret Pointer_Drag_Dflt+AnyOfOrNone(all) { + action= LockPtrBtn(button=default,affect=both); + }; + interpret Pointer_Drag1+AnyOfOrNone(all) { + action= LockPtrBtn(button=1,affect=both); + }; + interpret Pointer_Drag2+AnyOfOrNone(all) { + action= LockPtrBtn(button=2,affect=both); + }; + interpret Pointer_Drag3+AnyOfOrNone(all) { + action= LockPtrBtn(button=3,affect=both); + }; + interpret Pointer_EnableKeys+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeys); + }; + interpret Pointer_Accelerate+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeysAccel); + }; + interpret Pointer_DfltBtnNext+AnyOfOrNone(all) { + action= SetPtrDflt(affect=button,button=+1); + }; + interpret Pointer_DfltBtnPrev+AnyOfOrNone(all) { + action= SetPtrDflt(affect=button,button=-1); + }; + interpret AccessX_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AccessXKeys); + }; + interpret AccessX_Feedback_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AccessXFeedback); + }; + interpret RepeatKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=RepeatKeys); + }; + interpret SlowKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=SlowKeys); + }; + interpret BounceKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=BounceKeys); + }; + interpret StickyKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=StickyKeys); + }; + interpret MouseKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeys); + }; + interpret MouseKeys_Accel_Enable+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeysAccel); + }; + interpret Overlay1_Enable+AnyOfOrNone(all) { + action= LockControls(controls=none); + }; + interpret Overlay2_Enable+AnyOfOrNone(all) { + action= LockControls(controls=none); + }; + interpret AudibleBell_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AudibleBell); + }; + interpret Terminate_Server+AnyOfOrNone(all) { + action= Terminate(); + }; + interpret Alt_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Alt,clearLocks); + }; + interpret Alt_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Alt,clearLocks); + }; + interpret Meta_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Meta,clearLocks); + }; + interpret Meta_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Meta,clearLocks); + }; + interpret Super_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Super,clearLocks); + }; + interpret Super_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Super,clearLocks); + }; + interpret Hyper_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Hyper,clearLocks); + }; + interpret Hyper_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Hyper,clearLocks); + }; + interpret Shift_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Shift,clearLocks); + }; + interpret Shift_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Shift,clearLocks); + }; + interpret XF86Switch_VT_1+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=1,!same); + }; + interpret XF86Switch_VT_2+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=2,!same); + }; + interpret XF86Switch_VT_3+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=3,!same); + }; + interpret XF86Switch_VT_4+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=4,!same); + }; + interpret XF86Switch_VT_5+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=5,!same); + }; + interpret XF86Switch_VT_6+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=6,!same); + }; + interpret XF86Switch_VT_7+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=7,!same); + }; + interpret XF86Switch_VT_8+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=8,!same); + }; + interpret XF86Switch_VT_9+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=9,!same); + }; + interpret XF86Switch_VT_10+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=10,!same); + }; + interpret XF86Switch_VT_11+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=11,!same); + }; + interpret XF86Switch_VT_12+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=12,!same); + }; + interpret XF86LogGrabInfo+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x47,data[3]=0x72,data[4]=0x62,data[5]=0x73,data[6]=0x00); + }; + interpret XF86LogWindowTree+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x57,data[3]=0x69,data[4]=0x6e,data[5]=0x73,data[6]=0x00); + }; + interpret XF86Next_VMode+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x2b,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); + }; + interpret XF86Prev_VMode+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x2d,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); + }; + interpret ISO_Level5_Shift+AnyOfOrNone(all) { + action= SetMods(modifiers=LevelFive,clearLocks); + }; + interpret ISO_Level5_Latch+AnyOfOrNone(all) { + action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); + }; + interpret ISO_Level5_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=LevelFive); + }; + interpret Caps_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=Lock); + }; + interpret Any+Exactly(Lock) { + action= LockMods(modifiers=Lock); + }; + interpret Any+AnyOf(all) { + action= SetMods(modifiers=modMapMods,clearLocks); + }; + indicator "Caps Lock" { + whichModState= locked; + modifiers= Lock; + }; + indicator "Num Lock" { + whichModState= locked; + modifiers= NumLock; + }; + indicator "Scroll Lock" { + whichModState= locked; + modifiers= ScrollLock; + }; + indicator "Shift Lock" { + whichModState= locked; + modifiers= Shift; + }; + indicator "Group 2" { + groups= 0xfe; + }; + indicator "Mouse Keys" { + controls= MouseKeys; + }; +}; + +xkb_symbols "(unnamed)" { + name[Group1]="English (US)"; + + key { [ Escape ] }; + key { [ 1, exclam ] }; + key { [ 2, at ] }; + key { [ 3, numbersign ] }; + key { [ 4, dollar ] }; + key { [ 5, percent ] }; + key { [ 6, asciicircum ] }; + key { [ 7, ampersand ] }; + key { [ 8, asterisk ] }; + key { [ 9, parenleft ] }; + key { [ 0, parenright ] }; + key { [ minus, underscore ] }; + key { [ equal, plus ] }; + key { [ BackSpace, BackSpace ] }; + key { [ Tab, ISO_Left_Tab ] }; + key { [ q, Q ] }; + key { [ w, W ] }; + key { [ e, E ] }; + key { [ r, R ] }; + key { [ t, T ] }; + key { [ y, Y ] }; + key { [ u, U ] }; + key { [ i, I ] }; + key { [ o, O ] }; + key { [ p, P ] }; + key { [ bracketleft, braceleft ] }; + key { [ bracketright, braceright ] }; + key { [ Return ] }; + key { [ Control_L ] }; + key { [ a, A ] }; + key { [ s, S ] }; + key { [ d, D ] }; + key { [ f, F ] }; + key { [ g, G ] }; + key { [ h, H ] }; + key { [ j, J ] }; + key { [ k, K ] }; + key { [ l, L ] }; + key { [ semicolon, colon ] }; + key { [ apostrophe, quotedbl ] }; + key { [ grave, asciitilde ] }; + key { [ Shift_L ] }; + key { [ backslash, bar ] }; + key { [ z, Z ] }; + key { [ x, X ] }; + key { [ c, C ] }; + key { [ v, V ] }; + key { [ b, B ] }; + key { [ n, N ] }; + key { [ m, M ] }; + key { [ comma, less ] }; + key { [ period, greater ] }; + key { [ slash, question ] }; + key { [ Shift_R ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ] + }; + key { [ Alt_L, Meta_L ] }; + key { [ space ] }; + key { [ Caps_Lock ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F1, F1, F1, F1, XF86Switch_VT_1 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F2, F2, F2, F2, XF86Switch_VT_2 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F3, F3, F3, F3, XF86Switch_VT_3 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F4, F4, F4, F4, XF86Switch_VT_4 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F5, F5, F5, F5, XF86Switch_VT_5 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F6, F6, F6, F6, XF86Switch_VT_6 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F7, F7, F7, F7, XF86Switch_VT_7 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F8, F8, F8, F8, XF86Switch_VT_8 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F9, F9, F9, F9, XF86Switch_VT_9 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F10, F10, F10, F10, XF86Switch_VT_10 ] + }; + key { [ Num_Lock ] }; + key { [ Scroll_Lock ] }; + key { [ KP_Home, KP_7 ] }; + key { [ KP_Up, KP_8 ] }; + key { [ KP_Prior, KP_9 ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ] + }; + key { [ KP_Left, KP_4 ] }; + key { [ KP_Begin, KP_5 ] }; + key { [ KP_Right, KP_6 ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ] + }; + key { [ KP_End, KP_1 ] }; + key { [ KP_Down, KP_2 ] }; + key { [ KP_Next, KP_3 ] }; + key { [ KP_Insert, KP_0 ] }; + key { [ KP_Delete, KP_Decimal ] }; + key { [ ISO_Level3_Shift ] }; + key { [ less, greater, bar, brokenbar ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F11, F11, F11, F11, XF86Switch_VT_11 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F12, F12, F12, F12, XF86Switch_VT_12 ] + }; + key { [ Katakana ] }; + key { [ Hiragana ] }; + key { [ Henkan_Mode ] }; + key { [ Hiragana_Katakana ] }; + key { [ Muhenkan ] }; + key { [ KP_Enter ] }; + key { [ Control_R ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ] + }; + key { + type= "PC_ALT_LEVEL2", + symbols[Group1]= [ Print, Sys_Req ] + }; + key { [ Alt_R, Meta_R ] }; + key { [ Linefeed ] }; + key { [ Home ] }; + key { [ Up ] }; + key { [ Prior ] }; + key { [ Left ] }; + key { [ Right ] }; + key { [ End ] }; + key { [ Down ] }; + key { [ Next ] }; + key { [ Insert ] }; + key { [ Delete ] }; + key { [ XF86AudioMute ] }; + key { [ XF86AudioLowerVolume ] }; + key { [ XF86AudioRaiseVolume ] }; + key { [ XF86PowerOff ] }; + key { [ KP_Equal ] }; + key { [ plusminus ] }; + key { + type= "PC_CONTROL_LEVEL2", + symbols[Group1]= [ Pause, Break ] + }; + key { [ XF86LaunchA ] }; + key { [ KP_Decimal, KP_Decimal ] }; + key { [ Hangul ] }; + key { [ Hangul_Hanja ] }; + key { [ Super_L ] }; + key { [ Super_R ] }; + key { [ Menu ] }; + key { [ Cancel ] }; + key { [ Redo ] }; + key { [ SunProps ] }; + key { [ Undo ] }; + key { [ SunFront ] }; + key { [ XF86Copy ] }; + key { [ XF86Open ] }; + key { [ XF86Paste ] }; + key { [ Find ] }; + key { [ XF86Cut ] }; + key { [ Help ] }; + key { [ XF86MenuKB ] }; + key { [ XF86Calculator ] }; + key { [ XF86Sleep ] }; + key { [ XF86WakeUp ] }; + key { [ XF86Explorer ] }; + key { [ XF86Send ] }; + key { [ XF86Xfer ] }; + key { [ XF86Launch1 ] }; + key { [ XF86Launch2 ] }; + key { [ XF86WWW ] }; + key { [ XF86DOS ] }; + key { [ XF86ScreenSaver ] }; + key { [ XF86RotateWindows ] }; + key { [ XF86TaskPane ] }; + key { [ XF86Mail ] }; + key { [ XF86Favorites ] }; + key { [ XF86MyComputer ] }; + key { [ XF86Back ] }; + key { [ XF86Forward ] }; + key { [ XF86Eject ] }; + key { [ XF86Eject ] }; + key { [ XF86AudioNext ] }; + key { [ XF86AudioPlay, XF86AudioPause ] }; + key { [ XF86AudioPrev ] }; + key { [ XF86AudioStop, XF86Eject ] }; + key { [ XF86AudioRecord ] }; + key { [ XF86AudioRewind ] }; + key { [ XF86Phone ] }; + key { [ XF86Tools ] }; + key { [ XF86HomePage ] }; + key { [ XF86Reload ] }; + key { [ XF86Close ] }; + key { [ XF86ScrollUp ] }; + key { [ XF86ScrollDown ] }; + key { [ parenleft ] }; + key { [ parenright ] }; + key { [ XF86New ] }; + key { [ Redo ] }; + key { [ XF86Tools ] }; + key { [ XF86Launch5 ] }; + key { [ XF86Launch6 ] }; + key { [ XF86Launch7 ] }; + key { [ XF86Launch8 ] }; + key { [ XF86Launch9 ] }; + key { [ XF86AudioMicMute ] }; + key { [ XF86TouchpadToggle ] }; + key { [ XF86TouchpadOn ] }; + key { [ XF86TouchpadOff ] }; + key { [ ISO_Level5_Shift ] }; + key { [ NoSymbol, Alt_L ] }; + key { [ NoSymbol, Meta_L ] }; + key { [ NoSymbol, Super_L ] }; + key { [ NoSymbol, Hyper_L ] }; + key { [ XF86AudioPlay ] }; + key { [ XF86AudioPause ] }; + key { [ XF86Launch3 ] }; + key { [ XF86Launch4 ] }; + key { [ XF86LaunchB ] }; + key { [ XF86Suspend ] }; + key { [ XF86Close ] }; + key { [ XF86AudioPlay ] }; + key { [ XF86AudioForward ] }; + key { [ Print ] }; + key { [ XF86WebCam ] }; + key { [ XF86AudioPreset ] }; + key { [ XF86Mail ] }; + key { [ XF86Messenger ] }; + key { [ XF86Search ] }; + key { [ XF86Go ] }; + key { [ XF86Finance ] }; + key { [ XF86Game ] }; + key { [ XF86Shop ] }; + key { [ Cancel ] }; + key { [ XF86MonBrightnessDown ] }; + key { [ XF86MonBrightnessUp ] }; + key { [ XF86AudioMedia ] }; + key { [ XF86Display ] }; + key { [ XF86KbdLightOnOff ] }; + key { [ XF86KbdBrightnessDown ] }; + key { [ XF86KbdBrightnessUp ] }; + key { [ XF86Send ] }; + key { [ XF86Reply ] }; + key { [ XF86MailForward ] }; + key { [ XF86Save ] }; + key { [ XF86Documents ] }; + key { [ XF86Battery ] }; + key { [ XF86Bluetooth ] }; + key { [ XF86WLAN ] }; + key { [ XF86UWB ] }; + key { [ XF86Next_VMode ] }; + key { [ XF86Prev_VMode ] }; + key { [ XF86MonBrightnessCycle ] }; + key { [ XF86BrightnessAuto ] }; + key { [ XF86DisplayOff ] }; + key { [ XF86WWAN ] }; + key { [ XF86RFKill ] }; + key { [ XF86AudioMicMute ] }; + key { [ XF86Info ] }; + key { [ XF86Favorites ] }; + key { [ XF86CycleAngle ] }; + key { [ XF86FullScreen ] }; + key { [ XF86Keyboard ] }; + key { [ XF86AspectRatio ] }; + key { [ XF86DVD ] }; + key { [ XF86Audio ] }; + key { [ XF86Video ] }; + key { [ XF86Calendar ] }; + key { [ XF86ChannelUp ] }; + key { [ XF86ChannelDown ] }; + key { [ XF86AudioRandomPlay ] }; + key { [ XF86Break ] }; + key { [ XF86VideoPhone ] }; + key { [ XF86Game ] }; + key { [ XF86ZoomIn ] }; + key { [ XF86ZoomOut ] }; + key { [ XF86ZoomReset ] }; + key { [ XF86Word ] }; + key { [ XF86Editor ] }; + key { [ XF86Excel ] }; + key { [ XF86GraphicsEditor ] }; + key { [ XF86Presentation ] }; + key { [ XF86Database ] }; + key { [ XF86News ] }; + key { [ XF86Voicemail ] }; + key { [ XF86Addressbook ] }; + key { [ XF86Messenger ] }; + key { [ XF86DisplayToggle ] }; + key { [ XF86SpellCheck ] }; + key { [ XF86LogOff ] }; + key { [ dollar ] }; + key { [ EuroSign ] }; + key { [ XF86FrameBack ] }; + key { [ XF86FrameForward ] }; + key { [ XF86ContextMenu ] }; + key { [ XF86MediaRepeat ] }; + key { [ XF8610ChannelsUp ] }; + key { [ XF8610ChannelsDown ] }; + key { [ XF86Images ] }; + key { [ XF86NotificationCenter ] }; + key { [ XF86PickupPhone ] }; + key { [ XF86HangupPhone ] }; + key { [ XF86Fn ] }; + key { [ XF86Fn_Esc ] }; + key { [ XF86FnRightShift ] }; + key { [ braille_dot_1 ] }; + key { [ braille_dot_2 ] }; + key { [ braille_dot_3 ] }; + key { [ braille_dot_4 ] }; + key { [ braille_dot_5 ] }; + key { [ braille_dot_6 ] }; + key { [ braille_dot_7 ] }; + key { [ braille_dot_8 ] }; + key { [ braille_dot_9 ] }; + key { [ braille_dot_1 ] }; + key { [ XF86Numeric0 ] }; + key { [ XF86Numeric1 ] }; + key { [ XF86Numeric2 ] }; + key { [ XF86Numeric3 ] }; + key { [ XF86Numeric4 ] }; + key { [ XF86Numeric5 ] }; + key { [ XF86Numeric6 ] }; + key { [ XF86Numeric7 ] }; + key { [ XF86Numeric8 ] }; + key { [ XF86Numeric9 ] }; + key { [ XF86NumericStar ] }; + key { [ XF86NumericPound ] }; + key { [ XF86NumericA ] }; + key { [ XF86NumericB ] }; + key { [ XF86NumericC ] }; + key { [ XF86NumericD ] }; + key { [ XF86CameraFocus ] }; + key { [ XF86WPSButton ] }; + key { [ XF86TouchpadToggle ] }; + key { [ XF86TouchpadOn ] }; + key { [ XF86TouchpadOff ] }; + key { [ XF86CameraZoomIn ] }; + key { [ XF86CameraZoomOut ] }; + key { [ XF86CameraUp ] }; + key { [ XF86CameraDown ] }; + key { [ XF86CameraLeft ] }; + key { [ XF86CameraRight ] }; + key { [ XF86AttendantOn ] }; + key { [ XF86AttendantOff ] }; + key { [ XF86AttendantToggle ] }; + key { [ XF86LightsToggle ] }; + key { [ XF86ALSToggle ] }; + key { [ XF86RotationLockToggle ] }; + key { [ XF86Buttonconfig ] }; + key { [ XF86Taskmanager ] }; + key { [ XF86Journal ] }; + key { [ XF86ControlPanel ] }; + key { [ XF86AppSelect ] }; + key { [ XF86Screensaver ] }; + key { [ XF86VoiceCommand ] }; + key { [ XF86Assistant ] }; + key { [ ISO_Next_Group ] }; + key { [ XF86EmojiPicker ] }; + key { [ XF86Dictate ] }; + key { [ XF86CameraAccessEnable ] }; + key { [ XF86CameraAccessDisable ] }; + key { [ XF86CameraAccessToggle ] }; + key { [ XF86BrightnessMin ] }; + key { [ XF86BrightnessMax ] }; + key { [ XF86KbdInputAssistPrev ] }; + key { [ XF86KbdInputAssistNext ] }; + key { [ XF86KbdInputAssistPrevgroup ] }; + key { [ XF86KbdInputAssistNextgroup ] }; + key { [ XF86KbdInputAssistAccept ] }; + key { [ XF86KbdInputAssistCancel ] }; + key { [ XF86RightUp ] }; + key { [ XF86RightDown ] }; + key { [ XF86LeftUp ] }; + key { [ XF86LeftDown ] }; + key { [ XF86RootMenu ] }; + key { [ XF86MediaTopMenu ] }; + key { [ XF86Numeric11 ] }; + key { [ XF86Numeric12 ] }; + key { [ XF86AudioDesc ] }; + key { [ XF863DMode ] }; + key { [ XF86NextFavorite ] }; + key { [ XF86StopRecord ] }; + key { [ XF86PauseRecord ] }; + key { [ XF86VOD ] }; + key { [ XF86Unmute ] }; + key { [ XF86FastReverse ] }; + key { [ XF86SlowReverse ] }; + key { [ XF86Data ] }; + key { [ XF86OnScreenKeyboard ] }; + key { [ XF86PrivacyScreenToggle ] }; + key { [ XF86SelectiveScreenshot ] }; + key { [ XF86NextElement ] }; + key { [ XF86PreviousElement ] }; + key { [ XF86AutopilotEngageToggle ] }; + key { [ XF86MarkWaypoint ] }; + key { [ XF86Sos ] }; + key { [ XF86NavChart ] }; + key { [ XF86FishingChart ] }; + key { [ XF86SingleRangeRadar ] }; + key { [ XF86DualRangeRadar ] }; + key { [ XF86RadarOverlay ] }; + key { [ XF86TraditionalSonar ] }; + key { [ XF86ClearvuSonar ] }; + key { [ XF86SidevuSonar ] }; + key { [ XF86NavInfo ] }; + key { [ XF86BrightnessAdjust ] }; + key { [ XF86Macro1 ] }; + key { [ XF86Macro2 ] }; + key { [ XF86Macro3 ] }; + key { [ XF86Macro4 ] }; + key { [ XF86Macro5 ] }; + key { [ XF86Macro6 ] }; + key { [ XF86Macro7 ] }; + key { [ XF86Macro8 ] }; + key { [ XF86Macro9 ] }; + key { [ XF86Macro10 ] }; + key { [ XF86Macro11 ] }; + key { [ XF86Macro12 ] }; + key { [ XF86Macro13 ] }; + key { [ XF86Macro14 ] }; + key { [ XF86Macro15 ] }; + key { [ XF86Macro16 ] }; + key { [ XF86Macro17 ] }; + key { [ XF86Macro18 ] }; + key { [ XF86Macro19 ] }; + key { [ XF86Macro20 ] }; + key { [ XF86Macro21 ] }; + key { [ XF86Macro22 ] }; + key { [ XF86Macro23 ] }; + key { [ XF86Macro24 ] }; + key { [ XF86Macro25 ] }; + key { [ XF86Macro26 ] }; + key { [ XF86Macro27 ] }; + key { [ XF86Macro28 ] }; + key { [ XF86Macro29 ] }; + key { [ XF86Macro30 ] }; + key { [ XF86MacroRecordStart ] }; + key { [ XF86MacroRecordStop ] }; + key { [ XF86MacroPresetCycle ] }; + key { [ XF86MacroPreset1 ] }; + key { [ XF86MacroPreset2 ] }; + key { [ XF86MacroPreset3 ] }; + key { [ XF86KbdLcdMenu1 ] }; + key { [ XF86KbdLcdMenu2 ] }; + key { [ XF86KbdLcdMenu3 ] }; + key { [ XF86KbdLcdMenu4 ] }; + key { [ XF86KbdLcdMenu5 ] }; + modifier_map Shift { , }; + modifier_map Lock { }; + modifier_map Control { , }; + modifier_map Mod1 { , , , }; + modifier_map Mod2 { }; + modifier_map Mod3 { }; + modifier_map Mod4 { , , , }; + modifier_map Mod5 { }; +}; + }; \ No newline at end of file diff --git a/resources/login-shell.css b/resources/login-shell.css index e4a31ac..7f92299 100644 --- a/resources/login-shell.css +++ b/resources/login-shell.css @@ -1,4 +1,9 @@ @import url("resource:///dev/iohub/diya/shell/virtual-keyboard.css"); +/* +* { + font-family:DejaVuSans; +} +*/ .diya-login-header { font-size: 16px; diff --git a/resources/tpl.keymap b/resources/tpl.keymap new file mode 100644 index 0000000..afdd4e7 --- /dev/null +++ b/resources/tpl.keymap @@ -0,0 +1,7 @@ +xkb_keymap { + xkb_keycodes { include "evdev+aliases(azerty)" }; + xkb_types { include "complete" }; + xkb_compat { include "complete" }; + xkb_symbols { include "pc+fr+inet(evdev)" }; + xkb_geometry { include "pc(pc105)" }; +}; \ No newline at end of file diff --git a/resources/virtual-keyboard.css b/resources/virtual-keyboard.css index 96105e5..dcf8b96 100644 --- a/resources/virtual-keyboard.css +++ b/resources/virtual-keyboard.css @@ -8,7 +8,7 @@ background-color: white; border: 1px solid #CDC7C2; border-radius: 3px; - min-width: 20px; + min-width: 30px; /*min-height: 30px;*/ } @@ -19,20 +19,22 @@ /* .diya-vkb-btn label { border: 1px solid #b81f2b; + }*/ .diya-vkb-btn-level-1 { color: black; + padding-top: 2px; } .diya-vkb-btn-level-2 { color: gray; - font-size: 10px; + font-size: 9px; padding-left: 3px; } .diya-vkb-btn-level-3 { color: gray; - font-size: 10px; + font-size: 9px; padding-right: 3px; } \ No newline at end of file diff --git a/src/login-shell.c b/src/login-shell.c index 2f9177f..944c8d6 100644 --- a/src/login-shell.c +++ b/src/login-shell.c @@ -3,7 +3,7 @@ #include #include "login-shell.h" -#include "virtual-keyboard.h" +#include "vkb/virtual-keyboard-widgets.h" #define DBUS_SERVER_NAME "dev.iohub.diya.SessionManager" #define DBUS_SERVER_PATH "/dev/iohub/diya/SessionManager" @@ -17,8 +17,8 @@ struct _DiyaLoginShell GtkWidget *password; GtkWidget *status; guint bus_watch_id; - //GtkWindow *window; - GList * windows; + // GtkWindow *window; + GList *windows; }; G_DEFINE_FINAL_TYPE(DiyaLoginShell, diya_login_shell, DIYA_TYPE_SHELL); @@ -35,13 +35,13 @@ static void diya_login_shell_dispose(GObject *object) } g_object_unref(self->lock); } - if(self->windows) + if (self->windows) { // destroyed all windows and free list - GList * it = NULL; - for(it = self->windows; it; it = it->next) + GList *it = NULL; + for (it = self->windows; it; it = it->next) { - if(it->data) + if (it->data) { gtk_window_destroy(GTK_WINDOW(it->data)); } @@ -66,7 +66,6 @@ static void diya_login_shell_init(DiyaLoginShell *self) self->bus_watch_id = 0; } - static void on_method_call_return(GObject *source_object, GAsyncResult *res, gpointer user_data) { (void)source_object; @@ -102,7 +101,7 @@ static void on_method_call_return(GObject *source_object, GAsyncResult *res, gpo gtk_label_set_text(GTK_LABEL(self->status), "Login failed! Please try again."); } g_variant_unref(result); - //g_object_unref(reply); + // g_object_unref(reply); } static void on_name_appeared(GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data) @@ -123,7 +122,7 @@ static void on_name_appeared(GDBusConnection *connection, const gchar *name, con g_dbus_message_set_body(request, g_variant_new("(ss)", username, password)); g_dbus_connection_send_message_with_reply(connection, request, G_DBUS_SEND_MESSAGE_FLAGS_NONE, -1, NULL, NULL, on_method_call_return, self); g_object_unref(request); - g_bus_unwatch_name (self->bus_watch_id); + g_bus_unwatch_name(self->bus_watch_id); self->bus_watch_id = 0; } @@ -168,25 +167,22 @@ static void do_login(GtkButton *button, DiyaLoginShell *self) static void open_vkb(GtkButton *button, DiyaLoginShell *self) { - (void) button; - DiyaVirtualKeyboard* vkb = diya_virtual_keyboard_new(DIYA_SHELL(self), NULL); - if(!vkb) + (void)button; + DiyaVirtualKeyboard *vkb = diya_shell_get_virtual_keyboard(DIYA_SHELL(self)); + if (!vkb) { return; } g_warning("Sending A to: %s", diya_object_to_string(DIYA_OBJECT(vkb))); - diya_virtual_keyboard_send_key(vkb,30, VKB_KEY_STATE_PRESSED); + diya_virtual_keyboard_send_key(vkb, 30, VKB_KEY_STATE_PRESSED); g_usleep(10000); - diya_virtual_keyboard_send_key(vkb,30, VKB_KEY_STATE_RELEASED); + diya_virtual_keyboard_send_key(vkb, 30, VKB_KEY_STATE_RELEASED); g_usleep(10000); - // send example key - g_object_unref(vkb); } - -static void add_new_monitor(DiyaLoginShell* self, GdkMonitor* monitor, gint position) +static void add_new_monitor(DiyaLoginShell *self, GdkMonitor *monitor, gint position) { - GtkWindow* window = GTK_WINDOW(gtk_application_window_new(diya_shell_get_application(DIYA_SHELL(self)))); + GtkWindow *window = GTK_WINDOW(gtk_application_window_new(diya_shell_get_application(DIYA_SHELL(self)))); gtk_session_lock_instance_assign_window_to_monitor(self->lock, window, monitor); GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); @@ -231,7 +227,7 @@ static void add_new_monitor(DiyaLoginShell* self, GdkMonitor* monitor, gint posi GtkWidget *button = gtk_button_new_with_label("Login"); g_signal_connect(button, "clicked", G_CALLBACK(do_login), self); - //gtk_widget_set_can_focus(GTK_WIDGET(button), false); + // gtk_widget_set_can_focus(GTK_WIDGET(button), false); gtk_box_append(GTK_BOX(box), button); // Not displayed, but allows testing that creating popups doesn't crash GTK @@ -246,46 +242,45 @@ static void add_new_monitor(DiyaLoginShell* self, GdkMonitor* monitor, gint posi gtk_widget_set_can_focus(GTK_WIDGET(button), false); gtk_box_append(GTK_BOX(box), button); - DiyaVirtualKeyboardWidget* vkb_widget = diya_virtual_keyboard_widget_new(); + DiyaVirtualKeyboardWidget *vkb_widget = diya_virtual_keyboard_widget_new(diya_shell_get_virtual_keyboard(DIYA_SHELL(self))); gtk_box_append(GTK_BOX(box), GTK_WIDGET(vkb_widget)); gtk_window_set_child(GTK_WINDOW(window), box); gtk_window_present(window); - self->windows = g_list_insert(self->windows,window, position); + self->windows = g_list_insert(self->windows, window, position); } -static void on_monitor_changed(GListModel* monitor_lists,guint position, guint removed,guint added, gpointer object) +static void on_monitor_changed(GListModel *monitor_lists, guint position, guint removed, guint added, gpointer object) { g_debug("Monitor list changed at %d: added %d, removed %d", position, added, removed); - DiyaLoginShell* self = DIYA_LOGIN_SHELL(object); - if(removed > 0) + DiyaLoginShell *self = DIYA_LOGIN_SHELL(object); + if (removed > 0) { for (guint i = 0; i < removed; i++) { - GtkWindow* win = GTK_WINDOW(g_list_nth(self->windows, position)); - if(win) + GtkWindow *win = GTK_WINDOW(g_list_nth(self->windows, position)); + if (win) { gtk_window_destroy(win); self->windows = g_list_remove(self->windows, win); } } } - if(added > 0) + if (added > 0) { for (guint i = 0; i < added; i++) { - GdkMonitor * monitor = g_list_model_get_item(monitor_lists,position + i); + GdkMonitor *monitor = g_list_model_get_item(monitor_lists, position + i); add_new_monitor(self, monitor, position + i); } - } } -static void diya_login_shell_startup(DiyaShell* shell) +static void diya_login_shell_startup(DiyaShell *shell) { - DiyaLoginShell* self = DIYA_LOGIN_SHELL(shell); + DiyaLoginShell *self = DIYA_LOGIN_SHELL(shell); if (!gtk_session_lock_instance_lock(self->lock)) { g_error("gtk_session_lock_instance_lock: Unable to lock the display"); @@ -312,10 +307,10 @@ static void diya_login_shell_startup(DiyaShell* shell) GTK_STYLE_PROVIDER_PRIORITY_USER); g_bytes_unref(bytes); } - GListModel * list = gdk_display_get_monitors(gdk_display_get_default()); - for(guint i = 0; i < g_list_model_get_n_items(list); i++) + GListModel *list = gdk_display_get_monitors(gdk_display_get_default()); + for (guint i = 0; i < g_list_model_get_n_items(list); i++) { - GdkMonitor * monitor = g_list_model_get_item(list,i); + GdkMonitor *monitor = g_list_model_get_item(list, i); add_new_monitor(self, monitor, -1); } } @@ -330,6 +325,5 @@ static void diya_login_shell_class_init(DiyaLoginShellClass *class) DiyaShellClass *base_shell_class = DIYA_SHELL_CLASS(class); base_shell_class->monitor_changed_handle = on_monitor_changed; base_shell_class->startup_handle = diya_login_shell_startup; - //base_shell_class->foreign_register = diya_session_shell_foreign_toplevel_register; - + // base_shell_class->foreign_register = diya_session_shell_foreign_toplevel_register; } \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 296cead..aa9416c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1,7 +1,7 @@ #include #include "shell.h" #include "wayland.h" -#include "virtual-keyboard.h" +#include "vkb/virtual-keyboard.h" enum { NO_PROP, @@ -41,6 +41,10 @@ static void diya_shell_dispose(GObject* object) g_free(priv->name); priv->name = NULL; } + if(priv->vkb) + { + g_object_unref(priv->vkb); + } G_OBJECT_CLASS(diya_shell_parent_class)->dispose(object); if (priv->app) { @@ -147,6 +151,7 @@ static void diya_shell_init(DiyaShell *self) priv->wayland = NULL; priv->app = NULL; priv->name = NULL; + priv->vkb = NULL; } DiyaWayland * diya_shell_get_wayland(DiyaShell* shell) @@ -197,6 +202,16 @@ static void diya_shell_class_init(DiyaShellClass *class) g_object_class_install_properties (gobject_class, N_PROPERTIES, shell_properties); } +DiyaVirtualKeyboard* diya_shell_get_virtual_keyboard(DiyaShell* self) +{ + DiyaShellPrivate* priv = diya_shell_get_instance_private(self); + if(!priv->vkb) + { + priv->vkb = diya_virtual_keyboard_new(self, "/home/diya/tpl.keymap"); + } + return priv->vkb; +} + int diya_shell_run(DiyaShell* shell, int argc, char **argv) { DiyaShellPrivate* priv = diya_shell_get_instance_private(shell); diff --git a/src/shell.h b/src/shell.h index ac54856..c6830bb 100644 --- a/src/shell.h +++ b/src/shell.h @@ -11,6 +11,9 @@ G_DECLARE_DERIVABLE_TYPE(DiyaShell, diya_shell, DIYA, SHELL, DiyaObject) #define DIYA_TYPE_WAYLAND (diya_wayland_get_type ()) G_DECLARE_FINAL_TYPE (DiyaWayland, diya_wayland, DIYA, WAYLAND, DiyaShellObject) +#define DIYA_TYPE_VIRTUAL_KEYBOARD (diya_virtual_keyboard_get_type ()) +G_DECLARE_FINAL_TYPE (DiyaVirtualKeyboard, diya_virtual_keyboard, DIYA, VIRTUAL_KEYBOARD, DiyaShellObject) + struct wl_registry; typedef void (*wl_protocol_manager_register_t)(struct wl_registry*, uint32_t,DiyaShell*); @@ -29,5 +32,7 @@ DiyaWayland * diya_shell_get_wayland(DiyaShell* shell); GtkApplication* diya_shell_get_application(DiyaShell* shell); const char* diya_shell_get_name(DiyaShell* shell); +DiyaVirtualKeyboard* diya_shell_get_virtual_keyboard(DiyaShell* shell); + int diya_shell_run(DiyaShell* shell, int argc, char **argv); #endif \ No newline at end of file diff --git a/src/virtual-keyboard.c b/src/virtual-keyboard.c deleted file mode 100644 index 5abb354..0000000 --- a/src/virtual-keyboard.c +++ /dev/null @@ -1,443 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "virtual-keyboard-unstable-v1.h" -#include "virtual-keyboard.h" -#include "wayland.h" - -/** - * @brief DiyaVkbButton: virtual keyboard button - */ - -struct _DiyaVkbButton -{ - GtkWidget super; - GtkWidget *labels[3]; -}; - -G_DEFINE_FINAL_TYPE(DiyaVkbButton, diya_vkb_button, GTK_TYPE_WIDGET); - -static void diya_vkb_button_dispose(GObject *object) -{ - DiyaVkbButton *self = DIYA_VKB_BUTTON(object); - g_debug("diya_vkb_button_dispose"); - for (int i = 0; i < 3; i++) - { - g_clear_pointer(&self->labels[i], gtk_widget_unparent); - } - // g_clear_pointer (&demo->label, gtk_widget_unparent); - G_OBJECT_CLASS(diya_vkb_button_parent_class)->dispose(object); -} - -static void diya_vkb_button_init(DiyaVkbButton *self) -{ - gchar class_name[32]; /*diya-vkb-btn-level-%d */ - GtkLayoutManager *grid_layout; - grid_layout = gtk_widget_get_layout_manager(GTK_WIDGET(self)); - //gtk_orientable_set_orientation(GTK_ORIENTABLE(box_layout), GTK_ORIENTATION_VERTICAL); - // gtk_box_layout_set_spacing (GTK_BOX_LAYOUT (box_layout), 3); - gtk_widget_add_css_class(GTK_WIDGET(self),"diya-vkb-btn"); - gtk_widget_set_can_focus(GTK_WIDGET(self), false); - // init labels - for (int i = 0; i < 3; i++) - { - self->labels[i] = gtk_label_new(i==0?"X":"x"); - g_snprintf(class_name, sizeof(class_name),"diya-vkb-btn-level-%d",i + 1); - gtk_widget_add_css_class(self->labels[i], class_name); - gtk_widget_set_hexpand(self->labels[i], true); - - gtk_widget_set_parent(self->labels[i], GTK_WIDGET(self)); - - GtkGridLayoutChild *grid_child = GTK_GRID_LAYOUT_CHILD(gtk_layout_manager_get_layout_child(grid_layout,self->labels[i])); - switch (i) - { - case 0: - /* code */ - gtk_grid_layout_child_set_row(grid_child,0); - gtk_grid_layout_child_set_column(grid_child,0); - gtk_grid_layout_child_set_column_span (grid_child,2); - break; - case 1: - gtk_grid_layout_child_set_row(grid_child,1); - gtk_grid_layout_child_set_column(grid_child,0); - gtk_widget_set_halign(self->labels[i],GTK_ALIGN_START); - break; - case 2: - gtk_grid_layout_child_set_row(grid_child,1); - gtk_grid_layout_child_set_column(grid_child,1); - gtk_widget_set_halign(self->labels[i],GTK_ALIGN_END); - break; - default: - break; - } - } -} - - -static void diya_vkb_button_class_init(DiyaVkbButtonClass *class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS(class); - gobject_class->dispose = diya_vkb_button_dispose; - - gtk_widget_class_set_layout_manager_type(GTK_WIDGET_CLASS(class), GTK_TYPE_GRID_LAYOUT); -} - -DiyaVkbButton* diya_vkb_button_new(/**with prameter */) -{ - return DIYA_VKB_BUTTON(g_object_new(DIYA_TYPE_VKB_BUTTON, NULL)); -} - - -/** - * @brief DiyaVirtualKeyboardWidget: Virtual keyboard GTK widget - * - */ - -#define VKB_N_CELLS 145 -#define VKB_ROW_NUM(i) (i/29) -#define VKB_COL_NUM(i) (i % 29) - -struct _DiyaVirtualKeyboardWidget -{ - GtkWidget super; - /** - * row 0: 00 - 13 - * row 1: 14 - 27 - * row 2: 28 - 40 - * row 3: 41 - 53 - * row 4: 54 - 62 - */ - GList *buttons; -}; - -G_DEFINE_FINAL_TYPE(DiyaVirtualKeyboardWidget, diya_virtual_keyboard_widget, GTK_TYPE_WIDGET); - -static void diya_virtual_keyboard_widget_dispose(GObject *object) -{ - DiyaVirtualKeyboardWidget *self = DIYA_VIRTUAL_KEYBOARD_WIDGET(object); - g_debug("diya_virtual_keyboard_widget_dispose"); - if(self->buttons) - { - GList * it = NULL; - for(it = self->buttons; it; it = it->next) - { - if(it->data) - { - g_clear_pointer(&it->data, gtk_widget_unparent); - } - } - } - // g_clear_pointer (&demo->label, gtk_widget_unparent); - G_OBJECT_CLASS(diya_virtual_keyboard_widget_parent_class)->dispose(object); -} - -static void diya_virtual_keyboard_widget_init(DiyaVirtualKeyboardWidget *self) -{ - // gtk_widget_set_size_request(GTK_WIDGET(self), 600, 400); - g_debug("diya_virtual_keyboard_widget_init: Create new widget"); - GtkLayoutManager *grid_layout; - gtk_widget_add_css_class(GTK_WIDGET(self),"diya-vkb"); - grid_layout = gtk_widget_get_layout_manager(GTK_WIDGET(self)); - // gtk_orientable_set_orientation(GTK_ORIENTABLE(grid_layout), GTK_ORIENTATION_VERTICAL); - gtk_grid_layout_set_row_spacing(GTK_GRID_LAYOUT(grid_layout), 2); - gtk_grid_layout_set_column_spacing(GTK_GRID_LAYOUT(grid_layout), 2); - //gtk_grid_layout_set_baseline_row(GTK_GRID_LAYOUT(grid_layout), 4); - // init buttons - for (int i = 0; i < VKB_N_CELLS; i++) - { - gboolean skip = false; - int row = VKB_ROW_NUM(i); - int col = VKB_COL_NUM(i); - switch (row) - { - case 0: - skip = (col %2 != 0) || (col > 26); - break; - case 1: - skip = (col == 1) || (col == 2) || (col != 0 && col % 2 == 0); - break; - case 2: - skip = (col == 1) || (col == 2) || (col != 0 && col%2 == 0) || (col > 25); - break; - case 3: - skip = (col > 0 && col < 5) || (col != 0 && col % 2 == 0); - break; - case 4: - skip = (col > 0 && col < 3) || (col == 4) || (col==6) || (col>7 && col < 19) || (col > 19 && col %2 == 0); - break; - default: - break; - } - - if(skip) - { - continue; - } - - GtkWidget* button = GTK_WIDGET(diya_vkb_button_new()); - self->buttons = g_list_append(self->buttons, button); - gtk_widget_set_parent(button, GTK_WIDGET(self)); - gtk_widget_set_hexpand(button, true); - GtkGridLayoutChild *grid_child = GTK_GRID_LAYOUT_CHILD(gtk_layout_manager_get_layout_child(grid_layout,button)); - - gtk_grid_layout_child_set_row(grid_child,row); - gtk_grid_layout_child_set_column(grid_child,col); - - switch (i) - { - case 26: - case 29: - case 58: - case 116: - gtk_grid_layout_child_set_column_span (grid_child,3); - break; - - case 83: - gtk_grid_layout_child_set_column_span (grid_child,4); - break; - case 87: - gtk_grid_layout_child_set_column_span (grid_child,5); - break; - case 123: - gtk_grid_layout_child_set_column_span (grid_child,12); - break; - - default: - if(i > 0) - gtk_grid_layout_child_set_column_span (grid_child,2); - break; - } - } -} - -static void diya_virtual_keyboard_widget_class_init(DiyaVirtualKeyboardWidgetClass *class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS(class); - gobject_class->dispose = diya_virtual_keyboard_widget_dispose; - - gtk_widget_class_set_layout_manager_type(GTK_WIDGET_CLASS(class), GTK_TYPE_GRID_LAYOUT); -} - -DiyaVirtualKeyboardWidget *diya_virtual_keyboard_widget_new() -{ - DiyaVirtualKeyboardWidget *vkb_widget = g_object_new(DIYA_TYPE_VIRTUAL_KEYBOARD_WIDGET, NULL); - return vkb_widget; -} - -/** - * @brief DiyaVirtualKeyboard class: lowlevel wayland virtual keyboard handle - * - */ - -static struct zwp_virtual_keyboard_manager_v1 *g_virtual_keyboard_manager = NULL; - -struct _DiyaVirtualKeyboard -{ - DiyaShellObject parent; - struct zwp_virtual_keyboard_v1 *keyboard; -}; - -G_DEFINE_FINAL_TYPE(DiyaVirtualKeyboard, diya_virtual_keyboard, DIYA_TYPE_SHELL_OBJECT); - -static void diya_virtual_keyboard_dispose(GObject *object) -{ - DiyaVirtualKeyboard *self = DIYA_VIRTUAL_KEYBOARD(object); - g_debug("diya_virtual_keyboard_dispose"); - if (self->keyboard) - { - zwp_virtual_keyboard_v1_destroy(self->keyboard); - } - G_OBJECT_CLASS(diya_virtual_keyboard_parent_class)->dispose(object); -} - -static void diya_virtual_keyboard_init(DiyaVirtualKeyboard *self) -{ - self->keyboard = NULL; -} - -static const gchar *diya_virtual_keyboard_to_string(DiyaObject *object) -{ - (void)object; - return "Diya virtual keyboard instance"; -} - -static void diya_virtual_keyboard_class_init(DiyaVirtualKeyboardClass *class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS(class); - DiyaObjectClass *base_class = DIYA_OBJECT_CLASS(class); - - gobject_class->dispose = diya_virtual_keyboard_dispose; - // gobject_class->set_property = diya_lock_session_set_property; - // gobject_class->get_property = diya_lock_session_get_property; - base_class->to_string = diya_virtual_keyboard_to_string; -} - -/* -static void randname(char *buf) -{ - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - long r = ts.tv_nsec; - for (int i = 0; i < 6; ++i) - { - buf[i] = 'A' + (r & 15) + (r & 16) * 2; - r >>= 5; - } -} -*/ - -static int create_keymap_fd(off_t size) -{ - static const char name[] = "/diya-shell-keymap-XXXXXX"; - const char *base; - char *path; - int fd; - int ret; - // randname(name + sizeof(name) - 7); - base = getenv("XDG_RUNTIME_DIR"); - if (!base) - { - errno = ENOENT; - return -1; - } - path = malloc(strlen(base) + sizeof(name) + 1); - if (!path) - return -1; - - strcpy(path, base); - strcat(path, name); - g_debug("Create temp file for keymap: %s", path); - - fd = mkstemp(path); - if (fd >= 0) - { - long flags; - flags = fcntl(fd, F_GETFD); - if (flags == -1) - { - g_critical("fcntl Unable to F_GETFD: %s", strerror(errno)); - close(fd); - fd = -1; - } - else if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) - { - g_critical("fcntl Unable to F_SETFD(FD_CLOEXEC): %s", strerror(errno)); - close(fd); - fd = -1; - } - unlink(path); - } - else - { - g_critical("mkstemp Unable to create temp file %s: %s", path, strerror(errno)); - } - free(path); - - if (fd < 0) - return -1; - do - { - ret = ftruncate(fd, size); - } while (ret < 0 && errno == EINTR); - if (ret < 0) - { - close(fd); - return -1; - } - - return fd; -} - -DiyaVirtualKeyboard *diya_virtual_keyboard_new(DiyaShell *shell, const gchar *keymap_file) -{ - gchar *content = NULL; - GError *error = NULL; - GBytes *bytes = NULL; - gsize len = 0; - - if (keymap_file) - { - g_file_get_contents(keymap_file, &content, &len, &error); - if (error != NULL) - { - g_critical("diya_virtual_keyboard_new: Unable to read file %s: %s", keymap_file, error->message); - g_error_free(error); - return NULL; - } - } - else - { - g_warning("No keymap file specified. Loading default keymap from resource"); - GBytes *bytes = g_resources_lookup_data("/dev/iohub/diya/shell/default.keymap", 0, &error); - if (error != NULL) - { - g_critical("Unable to read keymap file from resource %s", error->message); - g_error_free(error); - return NULL; - } - content = (gchar *)g_bytes_get_data(bytes, &len); - } - g_debug("Using default keymap configuration: \n%s", content); - int fd = create_keymap_fd(len); - if (fd == -1) - { - g_critical("diya_virtual_keyboard_new: create temp file"); - if (bytes) - { - g_bytes_unref(bytes); - content = NULL; - } - if (content) - { - g_free(content); - } - } - - void *ptr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (ptr == (void *)-1) - { - g_critical("diya_virtual_keyboard_new: error mmap: %s", strerror(errno)); - close(fd); - if (bytes) - { - g_bytes_unref(bytes); - content = NULL; - } - if (content) - { - g_free(content); - } - } - - strcpy((char *)ptr, content); - - DiyaVirtualKeyboard *vkb = g_object_new(DIYA_TYPE_VIRTUAL_KEYBOARD, "shell", shell, NULL); - DiyaWayland *wayland = diya_shell_get_wayland(shell); - struct wl_seat *seat = diya_wayland_get_seat(wayland); - vkb->keyboard = zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(g_virtual_keyboard_manager, seat); - zwp_virtual_keyboard_v1_keymap(vkb->keyboard, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, fd, len); - - return vkb; -} - -void diya_virtual_keyboard_register(struct wl_registry *registry, uint32_t name, DiyaShell *shell) -{ - (void)shell; - g_virtual_keyboard_manager = wl_registry_bind(registry, name, &zwp_virtual_keyboard_manager_v1_interface, 1); -} - -void diya_virtual_keyboard_send_key(DiyaVirtualKeyboard *self, uint32_t key, diya_vkb_state_t state) -{ - GDateTime *now = g_date_time_new_now_local(); - uint32_t current_time_ms = g_date_time_get_microsecond(now) / 1000; - g_date_time_unref(now); - zwp_virtual_keyboard_v1_key(self->keyboard, current_time_ms, key, (uint32_t)state); -} \ No newline at end of file diff --git a/src/virtual-keyboard.h b/src/virtual-keyboard.h deleted file mode 100644 index bae8808..0000000 --- a/src/virtual-keyboard.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef DIYA_VIRTUAL_KEYBOARD_H -#define DIYA_VIRTUAL_KEYBOARD_H - -#include "shell.h" - -typedef enum -{ - VKB_KEY_STATE_RELEASED = 0 /*WL_KEYBOARD_KEY_STATE_RELEASED*/, - VKB_KEY_STATE_PRESSED = 1 /*WL_KEYBOARD_KEY_STATE_PRESSED*/, -} diya_vkb_state_t; - -#define DIYA_TYPE_VIRTUAL_KEYBOARD (diya_virtual_keyboard_get_type ()) -G_DECLARE_FINAL_TYPE (DiyaVirtualKeyboard, diya_virtual_keyboard, DIYA, VIRTUAL_KEYBOARD, DiyaShellObject) - -DiyaVirtualKeyboard* diya_virtual_keyboard_new(DiyaShell* shell, const gchar* keymap_file); - -void diya_virtual_keyboard_register(struct wl_registry *registry, uint32_t name, DiyaShell *shell); -void diya_virtual_keyboard_send_key(DiyaVirtualKeyboard* vkb, uint32_t key, diya_vkb_state_t state); - -#define DIYA_TYPE_VIRTUAL_KEYBOARD_WIDGET (diya_virtual_keyboard_widget_get_type()) -G_DECLARE_FINAL_TYPE (DiyaVirtualKeyboardWidget, diya_virtual_keyboard_widget, DIYA, VIRTUAL_KEYBOARD_WIDGET, GtkWidget) - -DiyaVirtualKeyboardWidget* diya_virtual_keyboard_widget_new(); - - -#define DIYA_TYPE_VKB_BUTTON (diya_vkb_button_get_type()) -G_DECLARE_FINAL_TYPE (DiyaVkbButton, diya_vkb_button, DIYA, VKB_BUTTON, GtkWidget) - -DiyaVkbButton* diya_vkb_button_new(/**with prameter */); - -#endif \ No newline at end of file diff --git a/src/vkb/virtual-keyboard-widgets.c b/src/vkb/virtual-keyboard-widgets.c new file mode 100644 index 0000000..b044401 --- /dev/null +++ b/src/vkb/virtual-keyboard-widgets.c @@ -0,0 +1,253 @@ +#include "virtual-keyboard-widgets.h" + +/** + * @brief DiyaVkbButton: virtual keyboard button + */ + +struct _DiyaVkbButton +{ + GtkWidget super; + GtkWidget *labels[3]; + DiyaVkbKey *key; +}; + +G_DEFINE_FINAL_TYPE(DiyaVkbButton, diya_vkb_button, GTK_TYPE_WIDGET); + +static void diya_vkb_button_dispose(GObject *object) +{ + DiyaVkbButton *self = DIYA_VKB_BUTTON(object); + g_debug("diya_vkb_button_dispose"); + for (int i = 0; i < 3; i++) + { + g_clear_pointer(&self->labels[i], gtk_widget_unparent); + } + if (self->key) + { + g_object_unref(self->key); + self->key = NULL; + } + // g_clear_pointer (&demo->label, gtk_widget_unparent); + G_OBJECT_CLASS(diya_vkb_button_parent_class)->dispose(object); +} + +static void diya_vkb_button_init(DiyaVkbButton *self) +{ + gchar class_name[32]; /*diya-vkb-btn-level-%d */ + GtkLayoutManager *grid_layout; + self->key = NULL; + grid_layout = gtk_widget_get_layout_manager(GTK_WIDGET(self)); + // gtk_orientable_set_orientation(GTK_ORIENTABLE(box_layout), GTK_ORIENTATION_VERTICAL); + // gtk_box_layout_set_spacing (GTK_BOX_LAYOUT (box_layout), 3); + gtk_widget_add_css_class(GTK_WIDGET(self), "diya-vkb-btn"); + gtk_widget_set_can_focus(GTK_WIDGET(self), false); + // init labels + for (int i = 0; i < 3; i++) + { + self->labels[i] = gtk_label_new(NULL); + g_snprintf(class_name, sizeof(class_name), "diya-vkb-btn-level-%d", i + 1); + gtk_widget_add_css_class(self->labels[i], class_name); + gtk_widget_set_hexpand(self->labels[i], true); + + gtk_widget_set_parent(self->labels[i], GTK_WIDGET(self)); + + GtkGridLayoutChild *grid_child = GTK_GRID_LAYOUT_CHILD(gtk_layout_manager_get_layout_child(grid_layout, self->labels[i])); + switch (i) + { + case 0: + /* code */ + gtk_grid_layout_child_set_row(grid_child, 0); + gtk_grid_layout_child_set_column(grid_child, 0); + gtk_grid_layout_child_set_column_span(grid_child, 2); + break; + case 1: + gtk_grid_layout_child_set_row(grid_child, 1); + gtk_grid_layout_child_set_column(grid_child, 0); + gtk_widget_set_halign(self->labels[i], GTK_ALIGN_START); + break; + case 2: + gtk_grid_layout_child_set_row(grid_child, 1); + gtk_grid_layout_child_set_column(grid_child, 1); + gtk_widget_set_halign(self->labels[i], GTK_ALIGN_END); + break; + default: + break; + } + } +} + +static void diya_vkb_button_class_init(DiyaVkbButtonClass *class) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(class); + gobject_class->dispose = diya_vkb_button_dispose; + + gtk_widget_class_set_layout_manager_type(GTK_WIDGET_CLASS(class), GTK_TYPE_GRID_LAYOUT); +} + +DiyaVkbButton *diya_vkb_button_new(DiyaVkbKey *key) +{ + DiyaVkbButton *btn = DIYA_VKB_BUTTON(g_object_new(DIYA_TYPE_VKB_BUTTON, NULL)); + btn->key = key; + for (uint32_t i = 0; i < 3; i++) + { + const char *cap = diya_vkb_key_get_keycap(key, i); + if (cap) + { + if(i == 1 && diya_vkb_key_is_alphabet(key)) + { + continue; + } + gtk_label_set_text(GTK_LABEL(btn->labels[i]), cap); + } + } + return btn; +} + +/** + * @brief DiyaVirtualKeyboardWidget: Virtual keyboard GTK widget + * + */ + +#define VKB_N_CELLS 145 +#define VKB_ROW_NUM(i) (i / 29) +#define VKB_COL_NUM(i) (i % 29) + +static uint32_t g_vkb_layout[] = { + 49, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 51, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 36, + 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 111, 66, + 9, 206, 64, 65, 0, 108, 113, 116, 114}; + +struct _DiyaVirtualKeyboardWidget +{ + GtkWidget super; + /** + * row 0: 00 - 13 + * row 1: 14 - 27 + * row 2: 28 - 40 + * row 3: 41 - 53 + * row 4: 54 - 62 + */ + GList *buttons; + DiyaVirtualKeyboard *vkb; +}; + +G_DEFINE_FINAL_TYPE(DiyaVirtualKeyboardWidget, diya_virtual_keyboard_widget, GTK_TYPE_WIDGET); + +static void diya_virtual_keyboard_widget_dispose(GObject *object) +{ + DiyaVirtualKeyboardWidget *self = DIYA_VIRTUAL_KEYBOARD_WIDGET(object); + g_debug("diya_virtual_keyboard_widget_dispose"); + if (self->buttons) + { + GList *it = NULL; + for (it = self->buttons; it; it = it->next) + { + if (it->data) + { + g_clear_pointer(&it->data, gtk_widget_unparent); + } + } + } + // g_clear_pointer (&demo->label, gtk_widget_unparent); + G_OBJECT_CLASS(diya_virtual_keyboard_widget_parent_class)->dispose(object); +} + +static void diya_virtual_keyboard_widget_init(DiyaVirtualKeyboardWidget *self) +{ + //gtk_widget_set_size_request(GTK_WIDGET(self), 600, 400); + g_debug("diya_virtual_keyboard_widget_init: Create new widget"); + gtk_widget_add_css_class(GTK_WIDGET(self), "diya-vkb"); + GtkLayoutManager *grid_layout = gtk_widget_get_layout_manager(GTK_WIDGET(self)); + // gtk_orientable_set_orientation(GTK_ORIENTABLE(grid_layout), GTK_ORIENTATION_VERTICAL); + gtk_grid_layout_set_row_spacing(GTK_GRID_LAYOUT(grid_layout), 2); + gtk_grid_layout_set_column_spacing(GTK_GRID_LAYOUT(grid_layout), 2); + // gtk_grid_layout_set_baseline_row(GTK_GRID_LAYOUT(grid_layout), 4); + // init buttons + self->vkb = NULL; +} + +static void diya_virtual_keyboard_widget_class_init(DiyaVirtualKeyboardWidgetClass *class) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(class); + gobject_class->dispose = diya_virtual_keyboard_widget_dispose; + + gtk_widget_class_set_layout_manager_type(GTK_WIDGET_CLASS(class), GTK_TYPE_GRID_LAYOUT); +} + +DiyaVirtualKeyboardWidget *diya_virtual_keyboard_widget_new(DiyaVirtualKeyboard *kb) +{ + DiyaVirtualKeyboardWidget *self = g_object_new(DIYA_TYPE_VIRTUAL_KEYBOARD_WIDGET, NULL); + GtkLayoutManager *grid_layout = gtk_widget_get_layout_manager(GTK_WIDGET(self)); + self->vkb = kb; + + int btn_index = 0; + for (int i = 0; i < VKB_N_CELLS; i++) + { + gboolean skip = false; + int row = VKB_ROW_NUM(i); + int col = VKB_COL_NUM(i); + switch (row) + { + case 0: + skip = (col % 2 != 0) || (col > 26); + break; + case 1: + skip = (col == 1) || (col == 2) || (col != 0 && col % 2 == 0); + break; + case 2: + skip = (col == 1) || (col == 2) || (col != 0 && col % 2 == 0) || (col > 25); + break; + case 3: + skip = (col > 0 && col < 5) || (col != 0 && col % 2 == 0); + break; + case 4: + skip = (col > 0 && col < 3) || (col == 4) || (col == 6) || (col > 7 && col < 19) || (col > 19 && col % 2 == 0); + break; + default: + break; + } + + if (skip) + { + continue; + } + DiyaVkbKey *key = diya_virtual_keyboard_get_key(self->vkb, g_vkb_layout[btn_index]); + g_debug("add: %s", diya_object_to_string(key)); + btn_index++; + GtkWidget *button = GTK_WIDGET(diya_vkb_button_new(key)); + self->buttons = g_list_append(self->buttons, button); + gtk_widget_set_parent(button, GTK_WIDGET(self)); + gtk_widget_set_hexpand(button, true); + GtkGridLayoutChild *grid_child = GTK_GRID_LAYOUT_CHILD(gtk_layout_manager_get_layout_child(grid_layout, button)); + + gtk_grid_layout_child_set_row(grid_child, row); + gtk_grid_layout_child_set_column(grid_child, col); + + switch (i) + { + case 26: + case 29: + case 58: + case 116: + gtk_grid_layout_child_set_column_span(grid_child, 3); + break; + + case 83: + gtk_grid_layout_child_set_column_span(grid_child, 4); + break; + case 87: + gtk_grid_layout_child_set_column_span(grid_child, 5); + break; + case 123: + gtk_grid_layout_child_set_column_span(grid_child, 12); + break; + + default: + if (i > 0) + gtk_grid_layout_child_set_column_span(grid_child, 2); + break; + } + } + return self; +} diff --git a/src/vkb/virtual-keyboard-widgets.h b/src/vkb/virtual-keyboard-widgets.h new file mode 100644 index 0000000..805704c --- /dev/null +++ b/src/vkb/virtual-keyboard-widgets.h @@ -0,0 +1,18 @@ +#ifndef DIYA_VIRTUAL_KEYBOARD_WIDGETS_H +#define DIYA_VIRTUAL_KEYBOARD_WIDGETS_H + +#include "shell.h" +#include "virtual-keyboard.h" + +#define DIYA_TYPE_VIRTUAL_KEYBOARD_WIDGET (diya_virtual_keyboard_widget_get_type()) +G_DECLARE_FINAL_TYPE (DiyaVirtualKeyboardWidget, diya_virtual_keyboard_widget, DIYA, VIRTUAL_KEYBOARD_WIDGET, GtkWidget) + +DiyaVirtualKeyboardWidget* diya_virtual_keyboard_widget_new(); + + +#define DIYA_TYPE_VKB_BUTTON (diya_vkb_button_get_type()) +G_DECLARE_FINAL_TYPE (DiyaVkbButton, diya_vkb_button, DIYA, VKB_BUTTON, GtkWidget) + +DiyaVkbButton* diya_vkb_button_new(DiyaVkbKey* key); + +#endif \ No newline at end of file diff --git a/src/vkb/virtual-keyboard.c b/src/vkb/virtual-keyboard.c new file mode 100644 index 0000000..06b97bf --- /dev/null +++ b/src/vkb/virtual-keyboard.c @@ -0,0 +1,440 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "virtual-keyboard-unstable-v1.h" +#include "virtual-keyboard.h" +#include "wayland.h" + +struct _DiyaVkbKey +{ + DiyaObject parent; + uint32_t code; + gchar *key_caps[3]; + uint32_t syms[3]; + gchar *info; +}; + +G_DEFINE_FINAL_TYPE(DiyaVkbKey, diya_vkb_key, DIYA_TYPE_OBJECT) + +static void diya_vkb_key_dispose(GObject *object) +{ + DiyaVkbKey *self = DIYA_VKB_KEY(object); + g_debug("diya_vkb_key_dispose: %s", diya_object_to_string(object)); + for (int i = 0; i < 3; i++) + { + if (self->key_caps[i]) + { + free(self->key_caps[i]); + } + } + self->code = 0; + if (self->info) + { + free(self->info); + self->info = NULL; + } + G_OBJECT_CLASS(diya_vkb_key_parent_class)->dispose(object); +} + +static void diya_vkb_key_init(DiyaVkbKey *self) +{ + self->code = 0; + memset(self->key_caps, 0, sizeof(self->key_caps)); + memset(self->syms, 0, sizeof(self->syms)); + self->info = NULL; +} + +static const gchar *diya_vkb_key_to_string(DiyaObject *object) +{ + DiyaVkbKey *self = DIYA_VKB_KEY(object); + if (!self->info && self->code != 0) + { + self->info = (char *)malloc(128); + g_snprintf(self->info, 128, + "DiyaVkbKey: %d (0x%.4x: %s, 0x%.4x: %s, 0x%.4x: %s)", + self->code, + self->syms[0], + self->key_caps[0], + self->syms[1], + self->key_caps[1], + self->syms[2], + self->key_caps[2]); + } + return self->info; +} + +static void diya_vkb_key_class_init(DiyaVkbKeyClass *class) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(class); + DiyaObjectClass *base_class = DIYA_OBJECT_CLASS(class); + + gobject_class->dispose = diya_vkb_key_dispose; + // gobject_class->set_property = diya_lock_session_set_property; + // gobject_class->get_property = diya_lock_session_get_property; + base_class->to_string = diya_vkb_key_to_string; +} + +const gchar *diya_vkb_key_get_keycap(DiyaVkbKey *key, uint32_t shift_level) +{ + if (shift_level > 2) + { + return NULL; + } + return key->key_caps[shift_level]; +} + +uint32_t diya_vkb_key_get_code(DiyaVkbKey *key) +{ + return key->code; +} + +uint32_t diya_vkb_key_is_alphabet(DiyaVkbKey* self) +{ + return (self->code >= 24 && self->code <= 33) || + (self->code >= 38 && self->code <= 46) || + (self->code >= 52 && self->code <= 58); +} + +/** + * @brief DiyaVirtualKeyboard class: lowlevel wayland virtual keyboard handle + * + */ + +static struct zwp_virtual_keyboard_manager_v1 *g_virtual_keyboard_manager = NULL; + +struct _DiyaVirtualKeyboard +{ + DiyaShellObject parent; + struct zwp_virtual_keyboard_v1 *keyboard; + struct xkb_context *vkb_ctx; + struct xkb_keymap *vkb_keymap; +}; + +G_DEFINE_FINAL_TYPE(DiyaVirtualKeyboard, diya_virtual_keyboard, DIYA_TYPE_SHELL_OBJECT); + +static void diya_virtual_keyboard_dispose(GObject *object) +{ + DiyaVirtualKeyboard *self = DIYA_VIRTUAL_KEYBOARD(object); + g_debug("diya_virtual_keyboard_dispose"); + if (self->keyboard) + { + zwp_virtual_keyboard_v1_destroy(self->keyboard); + } + if (self->vkb_keymap) + { + xkb_keymap_unref(self->vkb_keymap); + } + if (self->vkb_ctx) + { + xkb_context_unref(self->vkb_ctx); + } + G_OBJECT_CLASS(diya_virtual_keyboard_parent_class)->dispose(object); +} + +static void diya_virtual_keyboard_init(DiyaVirtualKeyboard *self) +{ + self->keyboard = NULL; + self->vkb_ctx = NULL; + self->vkb_keymap = NULL; +} + +static const gchar *diya_virtual_keyboard_to_string(DiyaObject *object) +{ + (void)object; + return "Diya virtual keyboard instance"; +} + +static void diya_virtual_keyboard_class_init(DiyaVirtualKeyboardClass *class) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(class); + DiyaObjectClass *base_class = DIYA_OBJECT_CLASS(class); + + gobject_class->dispose = diya_virtual_keyboard_dispose; + // gobject_class->set_property = diya_lock_session_set_property; + // gobject_class->get_property = diya_lock_session_get_property; + base_class->to_string = diya_virtual_keyboard_to_string; +} + +/* +static void randname(char *buf) +{ + struct timespec ts; + clock_gettime(CLOCK_REALTIME, &ts); + long r = ts.tv_nsec; + for (int i = 0; i < 6; ++i) + { + buf[i] = 'A' + (r & 15) + (r & 16) * 2; + r >>= 5; + } +} +*/ + +static int create_keymap_fd(off_t size) +{ + static const char name[] = "/diya-shell-keymap-XXXXXX"; + const char *base; + char *path; + int fd; + int ret; + // randname(name + sizeof(name) - 7); + base = getenv("XDG_RUNTIME_DIR"); + if (!base) + { + errno = ENOENT; + return -1; + } + path = malloc(strlen(base) + sizeof(name) + 1); + if (!path) + return -1; + + strcpy(path, base); + strcat(path, name); + g_debug("Create temp file for keymap: %s", path); + + fd = mkstemp(path); + if (fd >= 0) + { + long flags; + flags = fcntl(fd, F_GETFD); + if (flags == -1) + { + g_critical("fcntl Unable to F_GETFD: %s", strerror(errno)); + close(fd); + fd = -1; + } + else if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) + { + g_critical("fcntl Unable to F_SETFD(FD_CLOEXEC): %s", strerror(errno)); + close(fd); + fd = -1; + } + unlink(path); + } + else + { + g_critical("mkstemp Unable to create temp file %s: %s", path, strerror(errno)); + } + free(path); + + if (fd < 0) + return -1; + do + { + ret = ftruncate(fd, size); + } while (ret < 0 && errno == EINTR); + if (ret < 0) + { + close(fd); + return -1; + } + + return fd; +} + +DiyaVirtualKeyboard *diya_virtual_keyboard_new(DiyaShell *shell, const gchar *keymap_file) +{ + struct xkb_context *vkb_ctx = NULL; + struct xkb_keymap *vkb_keymap = NULL; + gsize len = 0; + vkb_ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS); + if (!vkb_ctx) + { + g_critical("diya_virtual_keyboard_new: Failed to create XKB context: %s", strerror(errno)); + return NULL; + } + if (keymap_file) + { + g_debug("diya_virtual_keyboard_new: Load keymap from file: %s", keymap_file); + FILE *fp = fopen(keymap_file, "r"); + if (!fp) + { + g_critical("diya_virtual_keyboard_new: Failed to open file %s: %s", keymap_file, strerror(errno)); + xkb_context_unref(vkb_ctx); + return NULL; + } + vkb_keymap = xkb_keymap_new_from_file(vkb_ctx, fp, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); + fclose(fp); + } + else + { + GError *error = NULL; + g_warning("No keymap file specified. Loading default keymap from resource"); + GBytes *bytes = g_resources_lookup_data("/dev/iohub/diya/shell/default.keymap", 0, &error); + if (error != NULL) + { + g_critical("Unable to read keymap file from resource %s", error->message); + g_error_free(error); + xkb_context_unref(vkb_ctx); + return NULL; + } + vkb_keymap = xkb_keymap_new_from_string(vkb_ctx, (gchar *)g_bytes_get_data(bytes, &len), XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); + g_bytes_unref(bytes); + } + + if (!vkb_keymap) + { + g_critical("diya_virtual_keyboard_new: Unable to load keymap: %s", strerror(errno)); + xkb_context_unref(vkb_ctx); + return NULL; + } + + char *content = xkb_keymap_get_as_string(vkb_keymap, XKB_KEYMAP_FORMAT_TEXT_V1); + len = strlen(content); + if (!content) + { + g_critical("diya_virtual_keyboard_new: xkb_keymap_get_as_string: %s", strerror(errno)); + xkb_context_unref(vkb_ctx); + xkb_keymap_unref(vkb_keymap); + return NULL; + } + + int fd = create_keymap_fd(len); + if (fd == -1) + { + g_critical("diya_virtual_keyboard_new: create temp file"); + xkb_context_unref(vkb_ctx); + xkb_keymap_unref(vkb_keymap); + return NULL; + } + + void *ptr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (ptr == (void *)-1) + { + g_critical("diya_virtual_keyboard_new: error mmap: %s", strerror(errno)); + xkb_context_unref(vkb_ctx); + xkb_keymap_unref(vkb_keymap); + close(fd); + return NULL; + } + // g_debug("Using keymap configuration: \n%s", content); + strcpy((char *)ptr, content); + free(content); + + DiyaVirtualKeyboard *vkb = g_object_new(DIYA_TYPE_VIRTUAL_KEYBOARD, "shell", shell, NULL); + vkb->vkb_ctx = vkb_ctx; + vkb->vkb_keymap = vkb_keymap; + DiyaWayland *wayland = diya_shell_get_wayland(shell); + struct wl_seat *seat = diya_wayland_get_seat(wayland); + vkb->keyboard = zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(g_virtual_keyboard_manager, seat); + zwp_virtual_keyboard_v1_keymap(vkb->keyboard, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, fd, len); + + return vkb; +} + +void diya_virtual_keyboard_register(struct wl_registry *registry, uint32_t name, DiyaShell *shell) +{ + (void)shell; + g_virtual_keyboard_manager = wl_registry_bind(registry, name, &zwp_virtual_keyboard_manager_v1_interface, 1); +} + +void diya_virtual_keyboard_send_key(DiyaVirtualKeyboard *self, uint32_t key, diya_vkb_state_t state) +{ + GDateTime *now = g_date_time_new_now_local(); + uint32_t current_time_ms = g_date_time_get_microsecond(now) / 1000; + g_date_time_unref(now); + zwp_virtual_keyboard_v1_key(self->keyboard, current_time_ms, key, (uint32_t)state); +} + +gchar *diya_virtual_keyboard_get_keycap(const xkb_keysym_t *sym) +{ + char buf[32]; + switch (*sym) + { + case XKB_KEY_Escape: + g_snprintf(buf, sizeof(buf), "%s", "Esc"); + break; + case XKB_KEY_BackSpace: + g_snprintf(buf, sizeof(buf), "%s", "⌫"); + break; + case XKB_KEY_Tab: + g_snprintf(buf, sizeof(buf), "%s", "⇥"); + break; + case XKB_KEY_Return: + g_snprintf(buf, sizeof(buf), "%s", "⏎"); + break; + case XKB_KEY_Control_L: + g_snprintf(buf, sizeof(buf), "%s", "Ctrl"); + break; + case XKB_KEY_Shift_L: + g_snprintf(buf, sizeof(buf), "%s", "⇧"); + break; + case XKB_KEY_Caps_Lock: + g_snprintf(buf, sizeof(buf), "%s", "⇪"); + break; + case XKB_KEY_Alt_L: + g_snprintf(buf, sizeof(buf), "%s", "⎇"); + break; + case XKB_KEY_Alt_R: + case XKB_KEY_ISO_Level3_Shift: + g_snprintf(buf, sizeof(buf), "%s", "⇮"); + break; + case XKB_KEY_space: + g_snprintf(buf, sizeof(buf), "%s", "⎵"); + break; + case XKB_KEY_Up: + g_snprintf(buf, sizeof(buf), "%s", "↑"); + break; + case XKB_KEY_Down: + g_snprintf(buf, sizeof(buf), "%s", "↓"); + break; + case XKB_KEY_Left: + g_snprintf(buf, sizeof(buf), "%s", "←"); + break; + case XKB_KEY_Right: + g_snprintf(buf, sizeof(buf), "%s", "→"); + break; + case XKB_KEY_function: + g_snprintf(buf, sizeof(buf), "%s", "Fn"); + break; + case XKB_KEY_Meta_L: + g_snprintf(buf, sizeof(buf), "%s", "⌘"); + break; + case XKB_KEY_Super_L: + g_snprintf(buf, sizeof(buf), "%s", "●"); + break; + case XKB_KEY_dead_circumflex: + g_snprintf(buf, sizeof(buf), "%s", "^"); + break; + case XKB_KEY_dead_diaeresis: + g_snprintf(buf, sizeof(buf), "%s", "¨"); + break; + default: + if (xkb_keysym_to_utf8(*sym, buf, sizeof(buf)) == 0) + { + return NULL; + } + break; + } + return g_strdup(buf); +} + +DiyaVkbKey *diya_virtual_keyboard_get_key(DiyaVirtualKeyboard *self, uint32_t code) +{ + DiyaVkbKey *key = g_object_new(DIYA_TYPE_VKB_KEY, NULL); + key->code = code; + int n_level = xkb_keymap_num_levels_for_key(self->vkb_keymap, code, 0); + if (n_level > 0) + { + n_level = n_level > 3 ? 3 : n_level; + for (int level = 0; level < n_level; level++) + { + const xkb_keysym_t *syms = NULL; + int n_sym = xkb_keymap_key_get_syms_by_level(self->vkb_keymap, code, 0, level, &syms); + if (n_sym <= 0 || syms[0] == key->syms[0] || syms[0] == key->syms[1]) + { + continue; + } + key->syms[level] = syms[0]; + key->key_caps[level] = diya_virtual_keyboard_get_keycap(&syms[0]); + } + } + return key; +} \ No newline at end of file diff --git a/src/vkb/virtual-keyboard.h b/src/vkb/virtual-keyboard.h new file mode 100644 index 0000000..52878a9 --- /dev/null +++ b/src/vkb/virtual-keyboard.h @@ -0,0 +1,25 @@ +#ifndef DIYA_VIRTUAL_KEYBOARD_H +#define DIYA_VIRTUAL_KEYBOARD_H + +#include "shell.h" + +typedef enum +{ + VKB_KEY_STATE_RELEASED = 0 /*WL_KEYBOARD_KEY_STATE_RELEASED*/, + VKB_KEY_STATE_PRESSED = 1 /*WL_KEYBOARD_KEY_STATE_PRESSED*/, +} diya_vkb_state_t; + +#define DIYA_TYPE_VKB_KEY (diya_vkb_key_get_type ()) +G_DECLARE_FINAL_TYPE (DiyaVkbKey, diya_vkb_key, DIYA, VKB_KEY, DiyaObject) +const gchar* diya_vkb_key_get_keycap(DiyaVkbKey* key, uint32_t shift_level); +uint32_t diya_vkb_key_get_code(DiyaVkbKey* key); +uint32_t diya_vkb_key_is_alphabet(DiyaVkbKey* key); + + +DiyaVirtualKeyboard* diya_virtual_keyboard_new(DiyaShell* shell, const gchar* keymap_file); + +void diya_virtual_keyboard_register(struct wl_registry *registry, uint32_t name, DiyaShell *shell); +void diya_virtual_keyboard_send_key(DiyaVirtualKeyboard* vkb, uint32_t key, diya_vkb_state_t state); + +DiyaVkbKey* diya_virtual_keyboard_get_key(DiyaVirtualKeyboard* vkb, uint32_t key); +#endif \ No newline at end of file