input-linux: add switch to enable auto-repeat events
Enable with "-input-linux /dev/input/${device},repeat=on".
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1457087116-4379-4-git-send-email-kraxel@redhat.com
			
			
This commit is contained in:
		
							parent
							
								
									46d921bebe
								
							
						
					
					
						commit
						a6ccabd676
					
				@ -132,6 +132,7 @@ typedef struct InputLinux InputLinux;
 | 
				
			|||||||
struct InputLinux {
 | 
					struct InputLinux {
 | 
				
			||||||
    const char  *evdev;
 | 
					    const char  *evdev;
 | 
				
			||||||
    int         fd;
 | 
					    int         fd;
 | 
				
			||||||
 | 
					    bool        repeat;
 | 
				
			||||||
    bool        grab_request;
 | 
					    bool        grab_request;
 | 
				
			||||||
    bool        grab_active;
 | 
					    bool        grab_active;
 | 
				
			||||||
    bool        grab_all;
 | 
					    bool        grab_all;
 | 
				
			||||||
@ -188,7 +189,7 @@ static void input_linux_event_keyboard(void *opaque)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        switch (event.type) {
 | 
					        switch (event.type) {
 | 
				
			||||||
        case EV_KEY:
 | 
					        case EV_KEY:
 | 
				
			||||||
            if (event.value > 1) {
 | 
					            if (event.value > 2 || (event.value > 1 && !il->repeat)) {
 | 
				
			||||||
                /*
 | 
					                /*
 | 
				
			||||||
                 * ignore autorepeat + unknown key events
 | 
					                 * ignore autorepeat + unknown key events
 | 
				
			||||||
                 * 0 == up, 1 == down, 2 == autorepeat, other == undefined
 | 
					                 * 0 == up, 1 == down, 2 == autorepeat, other == undefined
 | 
				
			||||||
@ -316,6 +317,7 @@ int input_linux_init(void *opaque, QemuOpts *opts, Error **errp)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    il->evdev = qemu_opt_get(opts, "evdev");
 | 
					    il->evdev = qemu_opt_get(opts, "evdev");
 | 
				
			||||||
    il->grab_all = qemu_opt_get_bool(opts, "grab-all", false);
 | 
					    il->grab_all = qemu_opt_get_bool(opts, "grab-all", false);
 | 
				
			||||||
 | 
					    il->repeat = qemu_opt_get_bool(opts, "repeat", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!il->evdev) {
 | 
					    if (!il->evdev) {
 | 
				
			||||||
        error_setg(errp, "no input device specified");
 | 
					        error_setg(errp, "no input device specified");
 | 
				
			||||||
@ -374,6 +376,9 @@ static QemuOptsList qemu_input_linux_opts = {
 | 
				
			|||||||
        },{
 | 
					        },{
 | 
				
			||||||
            .name = "grab-all",
 | 
					            .name = "grab-all",
 | 
				
			||||||
            .type = QEMU_OPT_BOOL,
 | 
					            .type = QEMU_OPT_BOOL,
 | 
				
			||||||
 | 
					        },{
 | 
				
			||||||
 | 
					            .name = "repeat",
 | 
				
			||||||
 | 
					            .type = QEMU_OPT_BOOL,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        { /* end of list */ }
 | 
					        { /* end of list */ }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user