Ejemplo n.º 1
0
static unsigned int detect_keyboard(void* dpy, unsigned int keyboardLayoutID, char* xkbfile, size_t xkbfilelength)
{
	xkbfile[0] = '\0';

	if (keyboardLayoutID != 0)
		DEBUG_KBD("keyboard layout configuration: %X", keyboardLayoutID);

#if defined(sun)
	if (keyboardLayoutID == 0)
	{
		keyboardLayoutID = detect_keyboard_type_and_layout_sunos(xkbfile, xkbfilelength);
		DEBUG_KBD("detect_keyboard_type_and_layout_sunos: %X %s", keyboardLayoutID, xkbfile);
	}
#endif

	if (keyboardLayoutID == 0)
	{
		keyboardLayoutID = detect_keyboard_layout_from_locale();
		DEBUG_KBD("detect_keyboard_layout_from_locale: %X", keyboardLayoutID);
	}

	if (keyboardLayoutID == 0)
	{
		keyboardLayoutID = 0x0409;
		DEBUG_KBD("using default keyboard layout: %X", keyboardLayoutID);
	}

	if (xkbfile[0] == '\0')
	{
		strncpy(xkbfile, "base", xkbfilelength);
		DEBUG_KBD("using default keyboard layout: %s", xkbfile);
	}

	return keyboardLayoutID;
}
Ejemplo n.º 2
0
static unsigned int
detect_keyboard(unsigned int keyboardLayoutID, char *xkbfile, size_t xkbfilelength)
{
	xkbfile[0] = '\0';

	if (keyboardLayoutID != 0)
		printf("keyboard layout configuration: %X\n", keyboardLayoutID);

#if defined(sun)
	if(keyboardLayoutID == 0)
	{
		keyboardLayoutID = detect_keyboard_type_and_layout_sunos(xkbfile, xkbfilelength);
		printf("detect_keyboard_type_and_layout_sunos: %X %s\n", keyboardLayoutID, xkbfile);
	}
#endif

	if(keyboardLayoutID == 0)
	{
		keyboardLayoutID = detect_keyboard_layout_from_xkb();
		printf("detect_keyboard_layout_from_xkb: %X\n", keyboardLayoutID);
	}

	if(keyboardLayoutID == 0)
	{
		keyboardLayoutID = detect_keyboard_layout_from_locale();
		printf("detect_keyboard_layout_from_locale: %X\n", keyboardLayoutID);
	}

	if (keyboardLayoutID == 0)
	{
		keyboardLayoutID = 0x0409;
		printf("using default keyboard layout: %X\n", keyboardLayoutID);
	}

	if (xkbfile[0] == '\0')
	{
		detect_keyboard_type_from_xkb(xkbfile, xkbfilelength);
		printf("detect_keyboard_type_from_xkb: %s\n", xkbfile);
	}

	return keyboardLayoutID;
}