예제 #1
0
static XkbDescPtr
get_xkb (ClutterKeymapX11 *keymap_x11)
{
  ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);

  if (keymap_x11->max_keycode == 0)
    XDisplayKeycodes (backend_x11->xdpy,
                      &keymap_x11->min_keycode,
                      &keymap_x11->max_keycode);

  if (keymap_x11->xkb_desc == NULL)
    {
      int flags = XkbKeySymsMask
                | XkbKeyTypesMask
                | XkbModifierMapMask
                | XkbVirtualModsMask;

      keymap_x11->xkb_desc = XkbGetMap (backend_x11->xdpy, flags, XkbUseCoreKbd);
      if (G_UNLIKELY (keymap_x11->xkb_desc == NULL))
        {
          g_error ("Failed to get the keymap from XKB");
          return NULL;
        }

      flags = XkbGroupNamesMask | XkbVirtualModNamesMask;
      XkbGetNames (backend_x11->xdpy, flags, keymap_x11->xkb_desc);

      update_modmap (backend_x11->xdpy, keymap_x11);
    }
  else if (keymap_x11->xkb_map_serial != backend_x11->keymap_serial)
    {
      int flags = XkbKeySymsMask
                | XkbKeyTypesMask
                | XkbModifierMapMask
                | XkbVirtualModsMask;

      CLUTTER_NOTE (BACKEND, "Updating XKB keymap");

      XkbGetUpdatedMap (backend_x11->xdpy, flags, keymap_x11->xkb_desc);

      flags = XkbGroupNamesMask | XkbVirtualModNamesMask;
      XkbGetNames (backend_x11->xdpy, flags, keymap_x11->xkb_desc);

      update_modmap (backend_x11->xdpy, keymap_x11);

      keymap_x11->xkb_map_serial = backend_x11->keymap_serial;
    }

  if (keymap_x11->num_lock_mask == 0)
    keymap_x11->num_lock_mask = XkbKeysymToModifiers (backend_x11->xdpy,
                                                      XK_Num_Lock);

  if (keymap_x11->scroll_lock_mask == 0)
    keymap_x11->scroll_lock_mask = XkbKeysymToModifiers (backend_x11->xdpy,
                                                         XK_Scroll_Lock);

  return keymap_x11->xkb_desc;
}
예제 #2
0
static int
_XkbComputeModmap(Display *dpy)
{
register XkbDescPtr xkb;

    xkb= dpy->xkb_info->desc;
    if (XkbGetUpdatedMap(dpy,XkbModifierMapMask,xkb)==Success)
	return 1;
    return 0;
}
예제 #3
0
void
XWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
{
	// get autorepeat info.  we must use the global_auto_repeat told to
	// us because it may have modified by synergy.
	int oldGlobalAutoRepeat = m_keyboardState.global_auto_repeat;
	XGetKeyboardControl(m_display, &m_keyboardState);
	m_keyboardState.global_auto_repeat = oldGlobalAutoRepeat;

#if HAVE_XKB_EXTENSION
	if (m_xkb != NULL) {
		if (XkbGetUpdatedMap(m_display, XkbKeyActionsMask |
				XkbKeyBehaviorsMask | XkbAllClientInfoMask, m_xkb) == Success) {
			updateKeysymMapXKB(keyMap);
			return;
		}
	}
#endif
	updateKeysymMap(keyMap);
}
예제 #4
0
파일: srvmisc.c 프로젝트: aosm/X11libs
unsigned
XkbReadFromServer(Display *dpy,unsigned need,unsigned want,XkbFileInfo *result)
{
unsigned which= need|want;
unsigned tmp = 0;

    if ((result==NULL)||(dpy==NULL))
	return which;

    if (which&XkmSymbolsMask)		tmp= XkbAllMapComponentsMask;
    else if (which&XkmTypesMask)	tmp= XkbKeyTypesMask;
    if (result->xkb==NULL) {
	result->xkb= XkbGetMap(dpy,tmp,XkbUseCoreKbd);
	if (!result->xkb)
	     return which;
	else which&= ~(XkmSymbolsMask|XkmTypesMask|XkmVirtualModsMask);
    }
    else if ((tmp)&&(XkbGetUpdatedMap(dpy,tmp,result->xkb)==Success))
	which&= ~(XkmSymbolsMask|XkmTypesMask|XkmVirtualModsMask);

    if (which&XkmIndicatorsMask) {
	if (XkbGetIndicatorMap(dpy,XkbAllIndicatorsMask,result->xkb)==Success)
	    which&= ~XkmIndicatorsMask;
    }

    if (which&XkmCompatMapMask) {
	if (XkbGetCompatMap(dpy,XkbAllCompatMask,result->xkb)==Success)
	    which&= ~XkmCompatMapMask;
    }
    if (which&XkmGeometryMask) {
	if (XkbGetGeometry(dpy,result->xkb)==Success)
	    which&= ~XkmGeometryMask;
    }
    XkbGetNames(dpy,XkbAllNamesMask,result->xkb);
    return which;
}