コード例 #1
0
ファイル: winkeybd.c プロジェクト: 4eremuxa/xserver
int
winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
{
  DevicePtr		pDevice = (DevicePtr) pDeviceInt;
  XkbSrvInfoPtr       xkbi;
  XkbControlsPtr      ctrl;

  switch (iState)
    {
    case DEVICE_INIT:
      winConfigKeyboard (pDeviceInt);

      /* FIXME: Maybe we should use winGetKbdLeds () here? */
      defaultKeyboardControl.leds = g_winInfo.keyboard.leds;

      winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
                    " Variant = \"%s\" Options = \"%s\"\n",
                    g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none",
                    g_winInfo.xkb.model ? g_winInfo.xkb.model : "none",
                    g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none",
                    g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none",
                    g_winInfo.xkb.options ? g_winInfo.xkb.options : "none");

      InitKeyboardDeviceStruct (pDeviceInt,
                                &g_winInfo.xkb,
                                winKeybdBell,
                                winKeybdCtrl);

      xkbi = pDeviceInt->key->xkbInfo;
      if ((xkbi != NULL) && (xkbi->desc != NULL))
        {
          ctrl = xkbi->desc->ctrls;
          ctrl->repeat_delay = g_winInfo.keyboard.delay;
          ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate;
        }
      else
        {
          winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat\n");
        }

      break;
      
    case DEVICE_ON: 
      pDevice->on = TRUE;

      // immediately copy the state of this keyboard device to the VCK
      // (which otherwise happens lazily after the first keypress)
      CopyKeyClass(pDeviceInt, inputInfo.keyboard);
      break;

    case DEVICE_CLOSE:
    case DEVICE_OFF: 
      pDevice->on = FALSE;
      break;
    }

  return Success;
}
コード例 #2
0
int
winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
{
  KeySymsRec		keySyms;
  CARD8 		modMap[MAP_LENGTH];
  DevicePtr		pDevice = (DevicePtr) pDeviceInt;
#ifdef XKB
  XkbComponentNamesRec names;
  XkbSrvInfoPtr       xkbi;
  XkbControlsPtr      ctrl;
#endif

  switch (iState)
    {
    case DEVICE_INIT:
      winConfigKeyboard (pDeviceInt);

      winGetKeyMappings (&keySyms, modMap);

#ifdef XKB
      /* FIXME: Maybe we should use winGetKbdLeds () here? */
      defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
#else
      defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
#endif

#ifdef XKB
      if (g_winInfo.xkb.disable) 
	{
#endif
	  InitKeyboardDeviceStruct (pDevice,
				    &keySyms,
				    modMap,
				    winKeybdBell,
				    winKeybdCtrl);
#ifdef XKB
	} 
      else 
	{

	  if (XkbInitialMap) 
	    {
	      names.keymap = XkbInitialMap;
	      names.keycodes = NULL;
	      names.types = NULL;
	      names.compat = NULL;
	      names.symbols = NULL;
	      names.geometry = NULL;
	    } 
	  else 
	    {
	      names.keymap = g_winInfo.xkb.keymap;
	      names.keycodes = g_winInfo.xkb.keycodes;
	      names.types = g_winInfo.xkb.types;
	      names.compat = g_winInfo.xkb.compat;
	      names.symbols = g_winInfo.xkb.symbols;
	      names.geometry = g_winInfo.xkb.geometry;
	    }

	  winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
		 " Variant = \"%s\" Options = \"%s\"\n",
		 g_winInfo.xkb.rules, g_winInfo.xkb.model,
		 g_winInfo.xkb.layout, g_winInfo.xkb.variant,
		 g_winInfo.xkb.options);
          
	  XkbSetRulesDflts (g_winInfo.xkb.rules, g_winInfo.xkb.model, 
			    g_winInfo.xkb.layout, g_winInfo.xkb.variant, 
			    g_winInfo.xkb.options);
	  XkbInitKeyboardDeviceStruct (pDeviceInt, &names, &keySyms,
				       modMap, winKeybdBell, winKeybdCtrl);
	}
#endif

#ifdef XKB
      if (!g_winInfo.xkb.disable)
        {  
          xkbi = pDeviceInt->key->xkbInfo;
          if (xkbi != NULL)
            {  
              ctrl = xkbi->desc->ctrls;
              ctrl->repeat_delay = g_winInfo.keyboard.delay;
              ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate;
            }
          else
            {  
              winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat (No XKB)\n");
            }
        }
#endif

      g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
      break;
      
    case DEVICE_ON: 
      pDevice->on = TRUE;
      g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
      break;

    case DEVICE_CLOSE:
    case DEVICE_OFF: 
      pDevice->on = FALSE;
      g_winInternalModeKeyStatesPtr = NULL;
      break;
    }

  return Success;
}