// vn,  TCVN 5712:1993
// Le Hong Boi <le.hong.boi@bigfoot.com>
// August 1999
// Further modified by Ashley Clark <aclark@debian.org>
// July 2000 for X 4.0
//
// Symbols definition for a very simple US and VN keyboard layout.
// This is a terrible hack, I use temporarily for myself:
// Instead of using VN char keysyms (which requires hacking X source
// and recompile) it use the latin-1 keysyms at the same code
//
// toggle US and VN keyboard by Shift + Caps_Lock key
//
// --------
// aclark (2000-07-27)
// I've modified this to refer to the correct keysyms in the server
//
// $XFree86: xc/programs/xkbcomp/symbols/vn,v 1.5 2003/02/04 02:32:48 dawes Exp $

partial modifier_keys
xkb_symbols "toggle" {
    include "vn(basic)"
    key <CAPS> {	[ Control_L,		ISO_Next_Group] };
    modifier_map Control { <CAPS>, <LCTL> };
};


//partial hidden alphanumeric_keys modifier_keys 
partial default alphanumeric_keys  
xkb_symbols "basic" {

    include "srvr_ctrl(xfree86)"

    name[Group1]= "US/ASCII";
    name[Group2]= "Vietnamese";
    
    key <ESC>  {	[ Escape			]	};

    // Alphanumeric section
    key <TLDE> {	[ quoteleft,	asciitilde	],
			[ quoteleft,	asciitilde	]	};
    key <AE01> {	[	  1,	exclam 		],
			[    abreve,	Abreve		]	};
    key <AE02> {	[	  2,	at		],
			[ acircumflex,	Acircumflex	]	};
    key <AE03> {	[	  3,	numbersign	],
			[ ecircumflex,	Ecircumflex	]	};
    key <AE04> {	[	  4,	dollar		],
			[ ocircumflex,	Ocircumflex	]	};
    key <AE05> {	[	  5,	percent		],
			[ dead_grave,	percent		]	};
    key <AE06> {	[	  6,	asciicircum	],	
			[ dead_hook,	asciicircum	]	};
    key <AE07> {	[	  7,	ampersand	],
			[ dead_tilde,	ampersand	]	};
    key <AE08> {	[	  8,	asterisk	],
			[ dead_acute,	asterisk	]	};
    key <AE09> {	[	  9,	parenleft	],
			[ dead_belowdot,parenleft	]	};
    key <AE10> {	[	  0,	parenright	],
			[   dstroke,	Dstroke		]	};
    key <AE11> {	[     minus,	underscore	],
			[     minus,	underscore	]	};
    key <AE12> {	[     equal,	plus		],
			[     equal,	plus		]	};
    key <BKSP> {
	type="CTRL+ALT",
	symbols[Group1]= [ BackSpace,	Terminate_Server ]
    };

    key  <TAB> {	[ 	Tab,	ISO_Left_Tab	],
			[	Tab,	ISO_Left_Tab	]	};
    key <AD01> {	[	  q,	Q 		],
			[	  q,	Q		]	};
    key <AD02> {	[	  w,	W		],
			[	  w,	W		]	};
    key <AD03> {	[	  e,	E		],
			[	  e,	E		]	};
    key <AD04> {	[	  r,	R		],
			[	  r,	R		]	};
    key <AD05> {	[	  t,	T		],
			[	  t,	T		]	};
    key <AD06> {	[	  y,	Y		],
			[	  y,	Y		]	};
    key <AD07> {	[	  u,	U		],
			[	  u,	U		]	};
    key <AD08> {	[	  i,	I		],
			[	  i,	I		]	};
    key <AD09> {	[	  o,	O		],
			[	  o,	O		]	};
    key <AD10> {	[	  p,	P		],
			[	  p,	P		]	};
    key <AD11> {	[ bracketleft,	braceleft	],
			[ 0x10001b0,	0x10001af	]	};
    key <AD12> {	[ bracketright,	braceright	],
			[ 0x10001a1,	0x10001a0	]	};
    key <RTRN> {	[ Return			],
			[ Return			]	};

    key <AC01> {	[	  a,	A 		],
			[	  a,	A		]	};
    key <AC02> {	[	  s,	S		],
			[	  s,	S		]	};
    key <AC03> {	[	  d,	D		],
			[	  d,	D		]	};
    key <AC04> {	[	  f,	F		],
			[	  f,	F		]	};
    key <AC05> {	[	  g,	G		],
			[	  g,	G		]	};
    key <AC06> {	[	  h,	H		],
			[	  h,	H		]	};
    key <AC07> {	[	  j,	J		],
			[	  j,	J		]	};
    key <AC08> {	[	  k,	K		],
			[	  k,	K		]	};
    key <AC09> {	[	  l,	L		],
			[	  l,	L		]	};
    key <AC10> {	[ semicolon,	colon		],
			[ semicolon,	colon		]	};
    key <AC11> {	[ quoteright,	quotedbl	],
			[ quoteright,	quotedbl	]	};

    key <LFSH> {	[ 	 Shift_L		],
			[	 Shift_L		]	};
    key <AB01> {	[	  z,	Z 		],
			[	  z,	Z		]	};
    key <AB02> {	[	  x,	X		],
			[	  x,	X		]	};
    key <AB03> {	[	  c,	C		],
			[	  c,	C		]	};
    key <AB04> {	[	  v,	V		],
			[	  v,	V		]	};
    key <AB05> {	[	  b,	B		],
			[	  b,	B		]	};
    key <AB06> {	[	  n,	N		],
			[	  n,	N		]	};
    key <AB07> {	[	  m,	M		],
			[	  m,	M		]	};
    key <AB08> {	[     comma,	less		],
			[     comma,	less		]	};
    key <AB09> {	[    period,	greater		],
			[    period,	greater		]	};
    key <AB10> {	[     slash,	question	],
			[     slash,	question	]	};
    key <BKSL> {	[ backslash,	bar		],
			[ backslash,	bar		]	};

    key <LCTL> {	[ 	 Control_L		],
			[	 Control_L		]	};
    key <SPCE> {	[ 	 space			],
			[	 space			]	};
    // End alphanumeric section

    // begin modifier mappings
    modifier_map Shift  { Shift_L };
    modifier_map Lock   { Caps_Lock };
    modifier_map Control{ Control_L };
};

// definition of a US/ASCII layout for a typical 101-key keyboard. 
// Includes the basic alphanumeric and punctuation keys and then 
// defines the "extra" (right) modifier keys, function keys, cursor,
// edit, and keypad keys.
xkb_symbols "generic101" {
    include "vn(basic)"
    key <RTSH> {	[ 	Shift_R		],
			[	Shift_R		]	};
    key <LALT> {	[ 	Alt_L	 	],
			[	Alt_L		]	};
    key <RCTL> {	[ 	Control_R	],
			[	Control_R	]	};
    key <RALT> {	[	Alt_R		],
			[	Alt_R		]	};

    // Begin "Function" section
    key <FK01> {	[ 	 F1		],
			[	 F1		]	};
    key <FK02> {	[	 F2		],
			[	 F2		]	};
    key <FK03> {	[	 F3		],
			[	 F3		]	};
    key <FK04> {	[	 F4		],
			[	 F4		]	};
    key <FK05> {	[	 F5		],
			[	 F5		]	};
    key <FK06> {	[	 F6		],
			[	 F6		]	};
    key <FK07> {	[	 F7		],
			[	 F7		]	};
    key <FK08> {	[	 F8		],
			[	 F8		]	};
    key <FK09> {	[        F9		],
			[	 F9		]	};
    key <FK10> {	[        F10		],
			[	 F10		]	};
    key <FK11> {	[        F11		],
			[	 F11		]	};
    key <FK12> {	[ 	 F12		],
			[	 F12		]	};
    // End "Function" section

    // Begin "Editing" section
    key <PRSC> {
	type= "PC_SYSRQ",
	symbols[Group1]= [ Print, Execute ]
    };
    key <SCLK> {  [  Scroll_Lock	],
		  [  Scroll_Lock	]	};
    key <PAUS> {
	type= "PC_BREAK",
	symbols[Group1]= [ Pause, Break ]
    };
    key  <INS> {  [  Insert		],
		  [  Insert		]	};
    key <HOME> {	[  Home			],
			[  Home			]	};
    key <PGUP> {	[  Prior		],
			[  Prior		]	};
    key <DELE> { 	[  Delete		],
			[  Delete		]	};
    key  <END> {	[  End			],
			[  End			]	};
    key <PGDN> {	[  Next			],
			[  Next			]	};

    key   <UP> {	[  Up			],
			[  Up			]	};
    key <LEFT> {	[  Left			],
			[  Left			]	};
    key <DOWN> {	[  Down			],
			[  Down			]	};
    key <RGHT> {	[  Right		],
			[  Right		]	};

    // End "Editing" section, begin "Keypad"
    key <NMLK> {	[  Num_Lock, Pointer_EnableKeys	],
			[  Num_Lock, Pointer_EnableKeys	]	};
    key <KPDV> {	[  KP_Divide		],
			[  KP_Divide		]	};
    key <KPMU> {	[  KP_Multiply		],
			[  KP_Multiply		]	};
    key <KPSU> {	[  KP_Subtract		],
			[  KP_Subtract		]	};

    key  <KP7> {	[  KP_Home,	KP_7	],
			[  KP_Home,	KP_7	]	};
    key  <KP8> {	[  KP_Up,	KP_8	],
			[  KP_Up,	KP_8	]	};
    key  <KP9> {	[  KP_Prior,	KP_9	],
			[  KP_Prior,	KP_9	]	};
    key <KPAD> {	[  	KP_Add		],
			[	KP_Add		]	};

    key  <KP4> {	[  KP_Left,	KP_4	],
			[  KP_Left,	KP_4	]	};
    key  <KP5> {	[  KP_Begin,	KP_5	],
			[  KP_Begin,	KP_5	]	};
    key  <KP6> {	[  KP_Right,	KP_6	],
			[  KP_Right,	KP_6	]	};

    key  <KP1> {	[  KP_End,	KP_1	],
			[  KP_End,	KP_1	]	};
    key  <KP2> {	[  KP_Down,	KP_2	],
			[  KP_Down,	KP_2	]	};
    key  <KP3> {	[  KP_Next,	KP_3	],
			[  KP_Next,	KP_3	]	};
    key <KPEN> {	[  	KP_Enter	],
			[	KP_Enter	]	};

    key  <KP0> {	[  KP_Insert,	KP_0	],
			[  KP_Insert,	KP_0	]	};
    key <KPDL> {  	[  KP_Delete,	KP_Decimal ],
			[  KP_Delete,	KP_Decimal ]	};
    // End "Keypad" section


    // begin modifier mappings
    modifier_map Shift  { Shift_R };
    modifier_map Control{ Control_R };
    modifier_map Mod1   { Alt_L, Alt_R };
    modifier_map Mod2   { Num_Lock };
    modifier_map Mod5   { Scroll_Lock };
};

// definition for the PC-AT type 101 key keyboard
//default 
xkb_symbols "pc101" {
    include "vn(generic101)"
    key <LALT> {	[ 	Alt_L,	Meta_L 		],
			[	Alt_L,	Meta_L		]	};
    key <RALT> {	[	Alt_R,	Meta_R		],
			[	Alt_R,	Meta_R		]	};

    // begin modifier mappings
    modifier_map Mod1   { Alt_L, Alt_R, Meta_L, Meta_R };
};

// definition for the extra key on 102-key keyboards
xkb_symbols "pc102" {
    include "vn(pc101)"
    key <LSGT> {	[      less,    greater		],
			[      less,	greater		]	};
};

// definition of Euro-style, Alt_R == [Mode_switch, Multi_key]
xkb_symbols "pc101euro" {
    include "vn(generic101)"
    key <LALT> {	[ 	Alt_L,	Meta_L 		],
			[	Alt_L,	Meta_L		]	};
    key <RALT> {	[ Mode_switch,	Multi_key	],
			[ Mode_switch,	Multi_key	]	};

    // begin modifier mappings
    modifier_map Mod1   { Alt_L, Meta_L };
};

// definition of Alternate Euro-style, Alt_R == [Multi_key]
xkb_symbols "pc101compose" {
    include "vn(generic101)"
    key <LALT> {	[ 	Alt_L,	Meta_L 		],
			[	Alt_L,	Meta_L		]	};
    key <RALT> {	[ 	Multi_key		],
			[	Multi_key		]	};

    // begin modifier mappings
    modifier_map Mod1   { Alt_L, Meta_L };
};

xkb_symbols "pc102euro" {
    include "us(pc101euro)"
    key <LSGT> {	[      less,    greater		]	};
};

xkb_symbols "pc102compose" {
    include "us(pc101compose)"
    key <LSGT> {	[      less,    greater		]	};
};

// definition for the extra keys on 104-key "Windows95" keyboards
xkb_symbols "pc104" {
    include "vn(generic101)"
    key <LALT> {	[ 	Alt_L		],
			[	Alt_L		]	};
    key <RALT> {	[	Alt_R		],
			[	Alt_R		]	};
    key <LWIN> {	[	Meta_L		],
			[	Meta_L		]	};
    key <RWIN> {	[	Meta_R		],
			[	Meta_R		]	};
    key <MENU> {	[	Menu		],
			[	Menu		]	};

    // modifier mappings
    modifier_map Mod1   { Alt_L, Alt_R };
    modifier_map Mod4   { Meta_L, Meta_R };
};

// definition of Euro-style, Right "logo" key == [Mode_switch, Multi_key]
xkb_symbols "pc104euro" {
    include "vn(pc104)"
    key <RWIN> {	[	Mode_switch, Multi_key	],
			[	Mode_switch, Multi_key	]	};
};

// put the compose key on the right "logo" key
xkb_symbols "pc104compose" {
    include "vn(pc104)"
    key <RWIN> {	[	Multi_key	],
			[	Multi_key	]	};
};

// defintion which includes both the Windows95 keyboards _and_
// the extra key on most European keyboards.
xkb_symbols "pc105" {
    include "us(pc104)"
    key <LSGT> {	[      less,    greater		]	};
};
xkb_symbols "pc105euro" {
    include "us(pc104euro)"
    key <LSGT> {	[      less,    greater		]	};
};
xkb_symbols "pc105compose" {
    include "us(pc104compose)"
    key <LSGT> {	[      less,    greater		]	};
};
// universam maps are identical to pc105; wish we had aliases for map names.
xkb_symbols "pc_universal" {
    include "us(pc104)"
    key <LSGT> {	[      less,    greater		]	};
};
xkb_symbols "pc105euro" {
    include "us(pc104euro)"
    key <LSGT> {	[      less,    greater		]	};
};
xkb_symbols "pc105compose" {
    include "us(pc104compose)"
    key <LSGT> {	[      less,    greater		]	};
};
