1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gdk.Keymap;
26 
27 private import gdk.Display;
28 private import gdk.c.functions;
29 public  import gdk.c.types;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 private import gobject.Signals;
33 public  import gtkc.gdktypes;
34 private import std.algorithm;
35 
36 
37 /**
38  * A #GdkKeymap defines the translation from keyboard state
39  * (including a hardware key, a modifier mask, and active keyboard group)
40  * to a keyval. This translation has two phases. The first phase is
41  * to determine the effective keyboard group and level for the keyboard
42  * state; the second phase is to look up the keycode/group/level triplet
43  * in the keymap and see what keyval it corresponds to.
44  */
45 public class Keymap : ObjectG
46 {
47 	/** the main Gtk struct */
48 	protected GdkKeymap* gdkKeymap;
49 
50 	/** Get the main Gtk struct */
51 	public GdkKeymap* getKeymapStruct(bool transferOwnership = false)
52 	{
53 		if (transferOwnership)
54 			ownedRef = false;
55 		return gdkKeymap;
56 	}
57 
58 	/** the main Gtk struct as a void* */
59 	protected override void* getStruct()
60 	{
61 		return cast(void*)gdkKeymap;
62 	}
63 
64 	protected override void setStruct(GObject* obj)
65 	{
66 		gdkKeymap = cast(GdkKeymap*)obj;
67 		super.setStruct(obj);
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GdkKeymap* gdkKeymap, bool ownedRef = false)
74 	{
75 		this.gdkKeymap = gdkKeymap;
76 		super(cast(GObject*)gdkKeymap, ownedRef);
77 	}
78 
79 
80 	/** */
81 	public static GType getType()
82 	{
83 		return gdk_keymap_get_type();
84 	}
85 
86 	/**
87 	 * Returns the #GdkKeymap attached to the default display.
88 	 *
89 	 * Returns: the #GdkKeymap attached to the default display.
90 	 */
91 	public static Keymap getDefault()
92 	{
93 		auto p = gdk_keymap_get_default();
94 
95 		if(p is null)
96 		{
97 			return null;
98 		}
99 
100 		return ObjectG.getDObject!(Keymap)(cast(GdkKeymap*) p);
101 	}
102 
103 	/**
104 	 * Returns the #GdkKeymap attached to @display.
105 	 *
106 	 * Params:
107 	 *     display = the #GdkDisplay.
108 	 *
109 	 * Returns: the #GdkKeymap attached to @display.
110 	 *
111 	 * Since: 2.2
112 	 */
113 	public static Keymap getForDisplay(Display display)
114 	{
115 		auto p = gdk_keymap_get_for_display((display is null) ? null : display.getDisplayStruct());
116 
117 		if(p is null)
118 		{
119 			return null;
120 		}
121 
122 		return ObjectG.getDObject!(Keymap)(cast(GdkKeymap*) p);
123 	}
124 
125 	/**
126 	 * Maps the non-virtual modifiers (i.e Mod2, Mod3, ...) which are set
127 	 * in @state to the virtual modifiers (i.e. Super, Hyper and Meta) and
128 	 * set the corresponding bits in @state.
129 	 *
130 	 * GDK already does this before delivering key events, but for
131 	 * compatibility reasons, it only sets the first virtual modifier
132 	 * it finds, whereas this function sets all matching virtual modifiers.
133 	 *
134 	 * This function is useful when matching key events against
135 	 * accelerators.
136 	 *
137 	 * Params:
138 	 *     state = pointer to the modifier mask to change
139 	 *
140 	 * Since: 2.20
141 	 */
142 	public void addVirtualModifiers(ref GdkModifierType state)
143 	{
144 		gdk_keymap_add_virtual_modifiers(gdkKeymap, &state);
145 	}
146 
147 	/**
148 	 * Returns whether the Caps Lock modifer is locked.
149 	 *
150 	 * Returns: %TRUE if Caps Lock is on
151 	 *
152 	 * Since: 2.16
153 	 */
154 	public bool getCapsLockState()
155 	{
156 		return gdk_keymap_get_caps_lock_state(gdkKeymap) != 0;
157 	}
158 
159 	/**
160 	 * Returns the direction of effective layout of the keymap.
161 	 *
162 	 * Returns: %PANGO_DIRECTION_LTR or %PANGO_DIRECTION_RTL
163 	 *     if it can determine the direction. %PANGO_DIRECTION_NEUTRAL
164 	 *     otherwise.
165 	 */
166 	public PangoDirection getDirection()
167 	{
168 		return gdk_keymap_get_direction(gdkKeymap);
169 	}
170 
171 	/**
172 	 * Returns the keyvals bound to @hardware_keycode.
173 	 * The Nth #GdkKeymapKey in @keys is bound to the Nth
174 	 * keyval in @keyvals. Free the returned arrays with g_free().
175 	 * When a keycode is pressed by the user, the keyval from
176 	 * this list of entries is selected by considering the effective
177 	 * keyboard group and level. See gdk_keymap_translate_keyboard_state().
178 	 *
179 	 * Params:
180 	 *     hardwareKeycode = a keycode
181 	 *     keys = return
182 	 *         location for array of #GdkKeymapKey, or %NULL
183 	 *     keyvals = return
184 	 *         location for array of keyvals, or %NULL
185 	 *
186 	 * Returns: %TRUE if there were any entries
187 	 */
188 	public bool getEntriesForKeycode(uint hardwareKeycode, out GdkKeymapKey[] keys, out uint[] keyvals)
189 	{
190 		GdkKeymapKey* outkeys = null;
191 		uint* outkeyvals = null;
192 		int nEntries;
193 
194 		auto p = gdk_keymap_get_entries_for_keycode(gdkKeymap, hardwareKeycode, &outkeys, &outkeyvals, &nEntries) != 0;
195 
196 		keys = outkeys[0 .. nEntries];
197 		keyvals = outkeyvals[0 .. nEntries];
198 
199 		return p;
200 	}
201 
202 	/**
203 	 * Obtains a list of keycode/group/level combinations that will
204 	 * generate @keyval. Groups and levels are two kinds of keyboard mode;
205 	 * in general, the level determines whether the top or bottom symbol
206 	 * on a key is used, and the group determines whether the left or
207 	 * right symbol is used. On US keyboards, the shift key changes the
208 	 * keyboard level, and there are no groups. A group switch key might
209 	 * convert a keyboard between Hebrew to English modes, for example.
210 	 * #GdkEventKey contains a %group field that indicates the active
211 	 * keyboard group. The level is computed from the modifier mask.
212 	 * The returned array should be freed
213 	 * with g_free().
214 	 *
215 	 * Params:
216 	 *     keyval = a keyval, such as %GDK_KEY_a, %GDK_KEY_Up, %GDK_KEY_Return, etc.
217 	 *     keys = return location
218 	 *         for an array of #GdkKeymapKey
219 	 *
220 	 * Returns: %TRUE if keys were found and returned
221 	 */
222 	public bool getEntriesForKeyval(uint keyval, out GdkKeymapKey[] keys)
223 	{
224 		GdkKeymapKey* outkeys = null;
225 		int nKeys;
226 
227 		auto p = gdk_keymap_get_entries_for_keyval(gdkKeymap, keyval, &outkeys, &nKeys) != 0;
228 
229 		keys = outkeys[0 .. nKeys];
230 
231 		return p;
232 	}
233 
234 	/**
235 	 * Returns the modifier mask the @keymap’s windowing system backend
236 	 * uses for a particular purpose.
237 	 *
238 	 * Note that this function always returns real hardware modifiers, not
239 	 * virtual ones (e.g. it will return #GDK_MOD1_MASK rather than
240 	 * #GDK_META_MASK if the backend maps MOD1 to META), so there are use
241 	 * cases where the return value of this function has to be transformed
242 	 * by gdk_keymap_add_virtual_modifiers() in order to contain the
243 	 * expected result.
244 	 *
245 	 * Params:
246 	 *     intent = the use case for the modifier mask
247 	 *
248 	 * Returns: the modifier mask used for @intent.
249 	 *
250 	 * Since: 3.4
251 	 */
252 	public GdkModifierType getModifierMask(GdkModifierIntent intent)
253 	{
254 		return gdk_keymap_get_modifier_mask(gdkKeymap, intent);
255 	}
256 
257 	/**
258 	 * Returns the current modifier state.
259 	 *
260 	 * Returns: the current modifier state.
261 	 *
262 	 * Since: 3.4
263 	 */
264 	public uint getModifierState()
265 	{
266 		return gdk_keymap_get_modifier_state(gdkKeymap);
267 	}
268 
269 	/**
270 	 * Returns whether the Num Lock modifer is locked.
271 	 *
272 	 * Returns: %TRUE if Num Lock is on
273 	 *
274 	 * Since: 3.0
275 	 */
276 	public bool getNumLockState()
277 	{
278 		return gdk_keymap_get_num_lock_state(gdkKeymap) != 0;
279 	}
280 
281 	/**
282 	 * Returns whether the Scroll Lock modifer is locked.
283 	 *
284 	 * Returns: %TRUE if Scroll Lock is on
285 	 *
286 	 * Since: 3.18
287 	 */
288 	public bool getScrollLockState()
289 	{
290 		return gdk_keymap_get_scroll_lock_state(gdkKeymap) != 0;
291 	}
292 
293 	/**
294 	 * Determines if keyboard layouts for both right-to-left and left-to-right
295 	 * languages are in use.
296 	 *
297 	 * Returns: %TRUE if there are layouts in both directions, %FALSE otherwise
298 	 *
299 	 * Since: 2.12
300 	 */
301 	public bool haveBidiLayouts()
302 	{
303 		return gdk_keymap_have_bidi_layouts(gdkKeymap) != 0;
304 	}
305 
306 	/**
307 	 * Looks up the keyval mapped to a keycode/group/level triplet.
308 	 * If no keyval is bound to @key, returns 0. For normal user input,
309 	 * you want to use gdk_keymap_translate_keyboard_state() instead of
310 	 * this function, since the effective group/level may not be
311 	 * the same as the current keyboard state.
312 	 *
313 	 * Params:
314 	 *     key = a #GdkKeymapKey with keycode, group, and level initialized
315 	 *
316 	 * Returns: a keyval, or 0 if none was mapped to the given @key
317 	 */
318 	public uint lookupKey(GdkKeymapKey* key)
319 	{
320 		return gdk_keymap_lookup_key(gdkKeymap, key);
321 	}
322 
323 	/**
324 	 * Maps the virtual modifiers (i.e. Super, Hyper and Meta) which
325 	 * are set in @state to their non-virtual counterparts (i.e. Mod2,
326 	 * Mod3,...) and set the corresponding bits in @state.
327 	 *
328 	 * This function is useful when matching key events against
329 	 * accelerators.
330 	 *
331 	 * Params:
332 	 *     state = pointer to the modifier state to map
333 	 *
334 	 * Returns: %FALSE if two virtual modifiers were mapped to the
335 	 *     same non-virtual modifier. Note that %FALSE is also returned
336 	 *     if a virtual modifier is mapped to a non-virtual modifier that
337 	 *     was already set in @state.
338 	 *
339 	 * Since: 2.20
340 	 */
341 	public bool mapVirtualModifiers(ref GdkModifierType state)
342 	{
343 		return gdk_keymap_map_virtual_modifiers(gdkKeymap, &state) != 0;
344 	}
345 
346 	/**
347 	 * Translates the contents of a #GdkEventKey into a keyval, effective
348 	 * group, and level. Modifiers that affected the translation and
349 	 * are thus unavailable for application use are returned in
350 	 * @consumed_modifiers.
351 	 * See [Groups][key-group-explanation] for an explanation of
352 	 * groups and levels. The @effective_group is the group that was
353 	 * actually used for the translation; some keys such as Enter are not
354 	 * affected by the active keyboard group. The @level is derived from
355 	 * @state. For convenience, #GdkEventKey already contains the translated
356 	 * keyval, so this function isn’t as useful as you might think.
357 	 *
358 	 * @consumed_modifiers gives modifiers that should be masked outfrom @state
359 	 * when comparing this key press to a hot key. For instance, on a US keyboard,
360 	 * the `plus` symbol is shifted, so when comparing a key press to a
361 	 * `<Control>plus` accelerator `<Shift>` should be masked out.
362 	 *
363 	 * |[<!-- language="C" -->
364 	 * // We want to ignore irrelevant modifiers like ScrollLock
365 	 * #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)
366 	 * gdk_keymap_translate_keyboard_state (keymap, event->hardware_keycode,
367 	 * event->state, event->group,
368 	 * &keyval, NULL, NULL, &consumed);
369 	 * if (keyval == GDK_PLUS &&
370 	 * (event->state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
371 	 * // Control was pressed
372 	 * ]|
373 	 *
374 	 * An older interpretation @consumed_modifiers was that it contained
375 	 * all modifiers that might affect the translation of the key;
376 	 * this allowed accelerators to be stored with irrelevant consumed
377 	 * modifiers, by doing:
378 	 * |[<!-- language="C" -->
379 	 * // XXX Don’t do this XXX
380 	 * if (keyval == accel_keyval &&
381 	 * (event->state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
382 	 * // Accelerator was pressed
383 	 * ]|
384 	 *
385 	 * However, this did not work if multi-modifier combinations were
386 	 * used in the keymap, since, for instance, `<Control>` would be
387 	 * masked out even if only `<Control><Alt>` was used in the keymap.
388 	 * To support this usage as well as well as possible, all single
389 	 * modifier combinations that could affect the key for any combination
390 	 * of modifiers will be returned in @consumed_modifiers; multi-modifier
391 	 * combinations are returned only when actually found in @state. When
392 	 * you store accelerators, you should always store them with consumed
393 	 * modifiers removed. Store `<Control>plus`, not `<Control><Shift>plus`,
394 	 *
395 	 * Params:
396 	 *     hardwareKeycode = a keycode
397 	 *     state = a modifier state
398 	 *     group = active keyboard group
399 	 *     keyval = return location for keyval, or %NULL
400 	 *     effectiveGroup = return location for effective
401 	 *         group, or %NULL
402 	 *     level = return location for level, or %NULL
403 	 *     consumedModifiers = return location for modifiers
404 	 *         that were used to determine the group or level, or %NULL
405 	 *
406 	 * Returns: %TRUE if there was a keyval bound to the keycode/state/group
407 	 */
408 	public bool translateKeyboardState(uint hardwareKeycode, GdkModifierType state, int group, out uint keyval, out int effectiveGroup, out int level, out GdkModifierType consumedModifiers)
409 	{
410 		return gdk_keymap_translate_keyboard_state(gdkKeymap, hardwareKeycode, state, group, &keyval, &effectiveGroup, &level, &consumedModifiers) != 0;
411 	}
412 
413 	protected class OnDirectionChangedDelegateWrapper
414 	{
415 		void delegate(Keymap) dlg;
416 		gulong handlerId;
417 
418 		this(void delegate(Keymap) dlg)
419 		{
420 			this.dlg = dlg;
421 			onDirectionChangedListeners ~= this;
422 		}
423 
424 		void remove(OnDirectionChangedDelegateWrapper source)
425 		{
426 			foreach(index, wrapper; onDirectionChangedListeners)
427 			{
428 				if (wrapper.handlerId == source.handlerId)
429 				{
430 					onDirectionChangedListeners[index] = null;
431 					onDirectionChangedListeners = std.algorithm.remove(onDirectionChangedListeners, index);
432 					break;
433 				}
434 			}
435 		}
436 	}
437 	OnDirectionChangedDelegateWrapper[] onDirectionChangedListeners;
438 
439 	/**
440 	 * The ::direction-changed signal gets emitted when the direction of
441 	 * the keymap changes.
442 	 *
443 	 * Since: 2.0
444 	 */
445 	gulong addOnDirectionChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
446 	{
447 		auto wrapper = new OnDirectionChangedDelegateWrapper(dlg);
448 		wrapper.handlerId = Signals.connectData(
449 			this,
450 			"direction-changed",
451 			cast(GCallback)&callBackDirectionChanged,
452 			cast(void*)wrapper,
453 			cast(GClosureNotify)&callBackDirectionChangedDestroy,
454 			connectFlags);
455 		return wrapper.handlerId;
456 	}
457 
458 	extern(C) static void callBackDirectionChanged(GdkKeymap* keymapStruct, OnDirectionChangedDelegateWrapper wrapper)
459 	{
460 		wrapper.dlg(wrapper.outer);
461 	}
462 
463 	extern(C) static void callBackDirectionChangedDestroy(OnDirectionChangedDelegateWrapper wrapper, GClosure* closure)
464 	{
465 		wrapper.remove(wrapper);
466 	}
467 
468 	protected class OnKeysChangedDelegateWrapper
469 	{
470 		void delegate(Keymap) dlg;
471 		gulong handlerId;
472 
473 		this(void delegate(Keymap) dlg)
474 		{
475 			this.dlg = dlg;
476 			onKeysChangedListeners ~= this;
477 		}
478 
479 		void remove(OnKeysChangedDelegateWrapper source)
480 		{
481 			foreach(index, wrapper; onKeysChangedListeners)
482 			{
483 				if (wrapper.handlerId == source.handlerId)
484 				{
485 					onKeysChangedListeners[index] = null;
486 					onKeysChangedListeners = std.algorithm.remove(onKeysChangedListeners, index);
487 					break;
488 				}
489 			}
490 		}
491 	}
492 	OnKeysChangedDelegateWrapper[] onKeysChangedListeners;
493 
494 	/**
495 	 * The ::keys-changed signal is emitted when the mapping represented by
496 	 * @keymap changes.
497 	 *
498 	 * Since: 2.2
499 	 */
500 	gulong addOnKeysChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
501 	{
502 		auto wrapper = new OnKeysChangedDelegateWrapper(dlg);
503 		wrapper.handlerId = Signals.connectData(
504 			this,
505 			"keys-changed",
506 			cast(GCallback)&callBackKeysChanged,
507 			cast(void*)wrapper,
508 			cast(GClosureNotify)&callBackKeysChangedDestroy,
509 			connectFlags);
510 		return wrapper.handlerId;
511 	}
512 
513 	extern(C) static void callBackKeysChanged(GdkKeymap* keymapStruct, OnKeysChangedDelegateWrapper wrapper)
514 	{
515 		wrapper.dlg(wrapper.outer);
516 	}
517 
518 	extern(C) static void callBackKeysChangedDestroy(OnKeysChangedDelegateWrapper wrapper, GClosure* closure)
519 	{
520 		wrapper.remove(wrapper);
521 	}
522 
523 	protected class OnStateChangedDelegateWrapper
524 	{
525 		void delegate(Keymap) dlg;
526 		gulong handlerId;
527 
528 		this(void delegate(Keymap) dlg)
529 		{
530 			this.dlg = dlg;
531 			onStateChangedListeners ~= this;
532 		}
533 
534 		void remove(OnStateChangedDelegateWrapper source)
535 		{
536 			foreach(index, wrapper; onStateChangedListeners)
537 			{
538 				if (wrapper.handlerId == source.handlerId)
539 				{
540 					onStateChangedListeners[index] = null;
541 					onStateChangedListeners = std.algorithm.remove(onStateChangedListeners, index);
542 					break;
543 				}
544 			}
545 		}
546 	}
547 	OnStateChangedDelegateWrapper[] onStateChangedListeners;
548 
549 	/**
550 	 * The ::state-changed signal is emitted when the state of the
551 	 * keyboard changes, e.g when Caps Lock is turned on or off.
552 	 * See gdk_keymap_get_caps_lock_state().
553 	 *
554 	 * Since: 2.16
555 	 */
556 	gulong addOnStateChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
557 	{
558 		auto wrapper = new OnStateChangedDelegateWrapper(dlg);
559 		wrapper.handlerId = Signals.connectData(
560 			this,
561 			"state-changed",
562 			cast(GCallback)&callBackStateChanged,
563 			cast(void*)wrapper,
564 			cast(GClosureNotify)&callBackStateChangedDestroy,
565 			connectFlags);
566 		return wrapper.handlerId;
567 	}
568 
569 	extern(C) static void callBackStateChanged(GdkKeymap* keymapStruct, OnStateChangedDelegateWrapper wrapper)
570 	{
571 		wrapper.dlg(wrapper.outer);
572 	}
573 
574 	extern(C) static void callBackStateChangedDestroy(OnStateChangedDelegateWrapper wrapper, GClosure* closure)
575 	{
576 		wrapper.remove(wrapper);
577 	}
578 
579 	/**
580 	 * Obtains the upper- and lower-case versions of the keyval @symbol.
581 	 * Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
582 	 *
583 	 * Params:
584 	 *     symbol = a keyval
585 	 *     lower = return location for lowercase version of @symbol
586 	 *     upper = return location for uppercase version of @symbol
587 	 */
588 	public static void keyvalConvertCase(uint symbol, out uint lower, out uint upper)
589 	{
590 		gdk_keyval_convert_case(symbol, &lower, &upper);
591 	}
592 
593 	/**
594 	 * Converts a key name to a key value.
595 	 *
596 	 * The names are the same as those in the
597 	 * `gdk/gdkkeysyms.h` header file
598 	 * but without the leading “GDK_KEY_”.
599 	 *
600 	 * Params:
601 	 *     keyvalName = a key name
602 	 *
603 	 * Returns: the corresponding key value, or %GDK_KEY_VoidSymbol
604 	 *     if the key name is not a valid key
605 	 */
606 	public static uint keyvalFromName(string keyvalName)
607 	{
608 		return gdk_keyval_from_name(Str.toStringz(keyvalName));
609 	}
610 
611 	/**
612 	 * Returns %TRUE if the given key value is in lower case.
613 	 *
614 	 * Params:
615 	 *     keyval = a key value.
616 	 *
617 	 * Returns: %TRUE if @keyval is in lower case, or if @keyval is not
618 	 *     subject to case conversion.
619 	 */
620 	public static bool keyvalIsLower(uint keyval)
621 	{
622 		return gdk_keyval_is_lower(keyval) != 0;
623 	}
624 
625 	/**
626 	 * Returns %TRUE if the given key value is in upper case.
627 	 *
628 	 * Params:
629 	 *     keyval = a key value.
630 	 *
631 	 * Returns: %TRUE if @keyval is in upper case, or if @keyval is not subject to
632 	 *     case conversion.
633 	 */
634 	public static bool keyvalIsUpper(uint keyval)
635 	{
636 		return gdk_keyval_is_upper(keyval) != 0;
637 	}
638 
639 	/**
640 	 * Converts a key value into a symbolic name.
641 	 *
642 	 * The names are the same as those in the
643 	 * `gdk/gdkkeysyms.h` header file
644 	 * but without the leading “GDK_KEY_”.
645 	 *
646 	 * Params:
647 	 *     keyval = a key value
648 	 *
649 	 * Returns: a string containing the name
650 	 *     of the key, or %NULL if @keyval is not a valid key. The string
651 	 *     should not be modified.
652 	 */
653 	public static string keyvalName(uint keyval)
654 	{
655 		return Str.toString(gdk_keyval_name(keyval));
656 	}
657 
658 	/**
659 	 * Converts a key value to lower case, if applicable.
660 	 *
661 	 * Params:
662 	 *     keyval = a key value.
663 	 *
664 	 * Returns: the lower case form of @keyval, or @keyval itself if it is already
665 	 *     in lower case or it is not subject to case conversion.
666 	 */
667 	public static uint keyvalToLower(uint keyval)
668 	{
669 		return gdk_keyval_to_lower(keyval);
670 	}
671 
672 	/**
673 	 * Convert from a GDK key symbol to the corresponding ISO10646 (Unicode)
674 	 * character.
675 	 *
676 	 * Params:
677 	 *     keyval = a GDK key symbol
678 	 *
679 	 * Returns: the corresponding unicode character, or 0 if there
680 	 *     is no corresponding character.
681 	 */
682 	public static uint keyvalToUnicode(uint keyval)
683 	{
684 		return gdk_keyval_to_unicode(keyval);
685 	}
686 
687 	/**
688 	 * Converts a key value to upper case, if applicable.
689 	 *
690 	 * Params:
691 	 *     keyval = a key value.
692 	 *
693 	 * Returns: the upper case form of @keyval, or @keyval itself if it is already
694 	 *     in upper case or it is not subject to case conversion.
695 	 */
696 	public static uint keyvalToUpper(uint keyval)
697 	{
698 		return gdk_keyval_to_upper(keyval);
699 	}
700 
701 	/**
702 	 * Convert from a ISO10646 character to a key symbol.
703 	 *
704 	 * Params:
705 	 *     wc = a ISO10646 encoded character
706 	 *
707 	 * Returns: the corresponding GDK key symbol, if one exists.
708 	 *     or, if there is no corresponding symbol,
709 	 *     wc | 0x01000000
710 	 */
711 	public static uint unicodeToKeyval(uint wc)
712 	{
713 		return gdk_unicode_to_keyval(wc);
714 	}
715 }