Ejemplo n.º 1
0
void change_locked_mods(int mask, Bool lock, virtkey * cvirt){

    if (lock){
        XkbLockModifiers(cvirt->display, XkbUseCoreKbd, mask, mask);
    }
    else{
        XkbLockModifiers(cvirt->display, XkbUseCoreKbd, mask, 0);
    }
    XSync(cvirt->display, False);
}
Ejemplo n.º 2
0
static void control_numlock(Display *dpy, bool flag)
{
	unsigned int mask;

	if( !xkb_init(dpy) )
		return;

	mask = xkb_numlock_mask(dpy);
	if( mask == 0 )
		return;

	if( flag == true )
		XkbLockModifiers ( dpy, XkbUseCoreKbd, mask, mask);
	else
		XkbLockModifiers ( dpy, XkbUseCoreKbd, mask, 0);
}
Ejemplo n.º 3
0
int xkb_toggle()
    {
    unsigned int mask;
    unsigned int numlockState;
    XkbStateRec xkbState;
    if( !xkb_init())
        return 0;
    mask = xkb_numlock_mask();
    if( mask == 0 )
        return 0;
    XkbGetState( dpy, XkbUseCoreKbd, &xkbState);
    numlockState = xkbState.locked_mods & mask;
    if (numlockState)
        XkbLockModifiers ( dpy, XkbUseCoreKbd, mask, 0);
    else
        XkbLockModifiers ( dpy, XkbUseCoreKbd, mask, mask);
    return 1;
    }
Ejemplo n.º 4
0
void toggle_lock(int mask, int state)
{
	int xkb_opcode, xkb_event, xkb_error;
	int xkb_lmaj = XkbMajorVersion;
	int xkb_lmin = XkbMinorVersion;
	if (XkbLibraryVersion(&xkb_lmaj, &xkb_lmin) && XkbQueryExtension(main_window->display, &xkb_opcode, &xkb_event, &xkb_error, &xkb_lmaj, &xkb_lmin))
	{
		/*int status = */XkbLockModifiers (main_window->display, XkbUseCoreKbd, mask, state);
		//log_message(TRACE, _("Set lock state: %d %d, status: %d"), mask, state, status);
	}
}
Ejemplo n.º 5
0
int xkb_set_off()
    {
    unsigned int mask;
    if( !xkb_init())
        return 0;
    mask = xkb_numlock_mask();
    if( mask == 0 )
        return 0;
    XkbLockModifiers ( qt_xdisplay(), XkbUseCoreKbd, mask, 0);
    return 1;
    }
Ejemplo n.º 6
0
int xkb_set_on()
    {
    unsigned int mask;
    if( !xkb_init())
        return 0;
    mask = xkb_numlock_mask();
    if( mask == 0 )
        return 0;
    XkbLockModifiers ( dpy, XkbUseCoreKbd, mask, mask);
    return 1;
    }
Ejemplo n.º 7
0
int xLockModifier(unsigned mask)
{
    /* This one works on my system, but can only modify caps/num lock.
     * where caps lock is 0x02(2) and num lock is 0x10(16):
     * 8 Real Modifier Masks from man page: (1, 2, 4, 8, 16, 32, 64, 128)
     *  ShiftMask   LockMask    ControlMask     Mod1Mask
     *  Mod2Mask    Mod3Mask    Mod4Mask        Mod5Mask
     * It seems that none of them is scroll lock.
     * BTW the shiftmask seems to be a lock too.
     * */
    return XkbLockModifiers(display, XkbUseCoreKbd, mask, mask);
}
Ejemplo n.º 8
0
static BOOL xf_keyboard_set_key_state(xfContext* xfc, BOOL on, int keysym)
{
	int keysymMask;

	if (!xfc->xkbAvailable)
		return FALSE;

	keysymMask = xf_keyboard_get_keymask(xfc, keysym);

	if (!keysymMask)
	{
		return FALSE;
	}

	return XkbLockModifiers(xfc->display, XkbUseCoreKbd, keysymMask, on ? keysymMask : 0);
}
static gboolean
spi_dec_x11_lock_modifiers (SpiDEController *controller, unsigned modifiers)
{
    DEControllerPrivateData *priv = controller->priv;
    
    if (priv->have_xkb) {
        return XkbLockModifiers (spi_get_display (), XkbUseCoreKbd, 
                                  modifiers, modifiers);
    } else {
	int mod_index;
	if (xmkeymap==NULL)
	  xmkeymap = XGetModifierMapping(spi_get_display ());
	for (mod_index=0;mod_index<8;mod_index++)
	    if (modifiers & (1<<mod_index))
	        spi_dec_x11_synth_keycode_press(controller, xmkeymap->modifiermap[mod_index]);
	return TRUE;
    }
}
Ejemplo n.º 10
0
void numlock_off(Display* dpy) {
	unsigned int mask = numlock_mask(dpy);
	if(!mask)
		return;
	XkbLockModifiers(dpy, XkbUseCoreKbd, mask, 0);
}
Ejemplo n.º 11
0
/*EXTL_DOC
 * Latch modifiers. See \code{XkbLatchModifiers}(3) manual page
 * for details.
 */
EXTL_EXPORT
int mod_xkb_lock_modifiers(int affect, int values)
{
	return XkbLockModifiers(ioncore_g.dpy, XkbUseCoreKbd, affect, values);
}
Ejemplo n.º 12
0
int xUnlockModifier(unsigned mask)
{
    return XkbLockModifiers(display, XkbUseCoreKbd, mask, 0);
}
Ejemplo n.º 13
0
void setcaps(int on)
{
   Display* display = XOpenDisplay(NULL);
   XkbLockModifiers(display, XkbUseCoreKbd, CAPSLOCK, on ? CAPSLOCK : 0);
   XCloseDisplay(display);
}
Ejemplo n.º 14
0
void set_modifier(int mod, int on)
{
    Display* display = XOpenDisplay(NULL);
    XkbLockModifiers(display, XkbUseCoreKbd, mod, on ? mod : 0);
    XCloseDisplay(display);
}