diff options
-rw-r--r-- | sway/input/input-manager.c | 230 |
1 files changed, 127 insertions, 103 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 195acc6f..4fd980c4 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -304,15 +304,19 @@ static void input_manager_libinput_reset_touch( | |||
304 | uint32_t send_events = | 304 | uint32_t send_events = |
305 | libinput_device_config_send_events_get_default_mode(libinput_device); | 305 | libinput_device_config_send_events_get_default_mode(libinput_device); |
306 | sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) send_events_set_mode(%d)", | 306 | sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) send_events_set_mode(%d)", |
307 | input_device->identifier, send_events); | 307 | input_device->identifier, send_events); |
308 | log_libinput_config_status(libinput_device_config_send_events_set_mode( | 308 | log_libinput_config_status(libinput_device_config_send_events_set_mode( |
309 | libinput_device, send_events)); | 309 | libinput_device, send_events)); |
310 | float m[6]; | 310 | |
311 | libinput_device_config_calibration_get_default_matrix(libinput_device, m); | 311 | if (libinput_device_config_calibration_has_matrix(libinput_device)) { |
312 | sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) calibration_set_matrix(%f %f %f %f %f %f)", | 312 | float m[6]; |
313 | input_device->identifier, m[0], m[1], m[2], m[3], m[4], m[5]); | 313 | libinput_device_config_calibration_get_default_matrix(libinput_device, m); |
314 | log_libinput_config_status(libinput_device_config_calibration_set_matrix( | 314 | sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) calibration_set_matrix(" |
315 | "%f %f %f %f %f %f)", input_device->identifier, m[0], m[1], | ||
316 | m[2], m[3], m[4], m[5]); | ||
317 | log_libinput_config_status(libinput_device_config_calibration_set_matrix( | ||
315 | libinput_device, m)); | 318 | libinput_device, m)); |
319 | } | ||
316 | } | 320 | } |
317 | 321 | ||
318 | static void input_manager_libinput_config_pointer( | 322 | static void input_manager_libinput_config_pointer( |
@@ -434,113 +438,133 @@ static void input_manager_libinput_reset_pointer( | |||
434 | struct libinput_device *libinput_device = | 438 | struct libinput_device *libinput_device = |
435 | wlr_libinput_get_device_handle(wlr_device); | 439 | wlr_libinput_get_device_handle(wlr_device); |
436 | 440 | ||
437 | enum libinput_config_accel_profile accel_profile = | 441 | uint32_t send_events = |
438 | libinput_device_config_accel_get_default_profile(libinput_device); | 442 | libinput_device_config_send_events_get_default_mode(libinput_device); |
439 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_profile(%d)", | 443 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) send_events_set_mode(%d)", |
440 | input_device->identifier, accel_profile); | 444 | input_device->identifier, send_events); |
441 | log_libinput_config_status(libinput_device_config_accel_set_profile( | 445 | log_libinput_config_status(libinput_device_config_send_events_set_mode( |
442 | libinput_device, accel_profile)); | 446 | libinput_device, send_events)); |
443 | 447 | ||
444 | enum libinput_config_click_method click_method = | 448 | if (libinput_device_config_tap_get_finger_count(libinput_device) > 0) { |
445 | libinput_device_config_click_get_default_method(libinput_device); | 449 | enum libinput_config_tap_state tap = |
446 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) click_set_method(%d)", | 450 | libinput_device_config_tap_get_default_enabled(libinput_device); |
447 | input_device->identifier, click_method); | 451 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_enabled(%d)", |
448 | log_libinput_config_status(libinput_device_config_click_set_method( | 452 | input_device->identifier, tap); |
449 | libinput_device, click_method)); | 453 | log_libinput_config_status(libinput_device_config_tap_set_enabled( |
454 | libinput_device, tap)); | ||
450 | 455 | ||
451 | enum libinput_config_drag_state drag = | 456 | enum libinput_config_tap_button_map tap_button_map = |
452 | libinput_device_config_tap_get_default_drag_enabled(libinput_device); | 457 | libinput_device_config_tap_get_button_map(libinput_device); |
453 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_drag_enabled(%d)", | 458 | sway_log(SWAY_DEBUG, |
454 | input_device->identifier, drag); | 459 | "libinput_reset_pointer(%s) tap_set_button_map(%d)", |
455 | log_libinput_config_status(libinput_device_config_tap_set_drag_enabled( | 460 | input_device->identifier, tap_button_map); |
456 | libinput_device, drag)); | 461 | log_libinput_config_status(libinput_device_config_tap_set_button_map( |
462 | libinput_device, tap_button_map)); | ||
457 | 463 | ||
458 | enum libinput_config_drag_lock_state drag_lock = | 464 | enum libinput_config_drag_state drag = |
459 | libinput_device_config_tap_get_default_drag_lock_enabled( | 465 | libinput_device_config_tap_get_default_drag_enabled(libinput_device); |
460 | libinput_device); | 466 | sway_log(SWAY_DEBUG, |
461 | sway_log(SWAY_DEBUG, | 467 | "libinput_reset_pointer(%s) tap_set_drag_enabled(%d)", |
462 | "libinput_reset_pointer(%s) tap_set_drag_lock_enabled(%d)", | 468 | input_device->identifier, drag); |
463 | input_device->identifier, drag_lock); | 469 | log_libinput_config_status(libinput_device_config_tap_set_drag_enabled( |
464 | log_libinput_config_status( | 470 | libinput_device, drag)); |
465 | libinput_device_config_tap_set_drag_lock_enabled( | ||
466 | libinput_device, drag_lock)); | ||
467 | |||
468 | enum libinput_config_dwt_state dwt = | ||
469 | libinput_device_config_dwt_get_default_enabled(libinput_device); | ||
470 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) dwt_set_enabled(%d)", | ||
471 | input_device->identifier, dwt); | ||
472 | log_libinput_config_status(libinput_device_config_dwt_set_enabled( | ||
473 | libinput_device, dwt)); | ||
474 | 471 | ||
475 | int left_handed = | 472 | enum libinput_config_drag_lock_state drag_lock = |
476 | libinput_device_config_left_handed_get_default(libinput_device); | 473 | libinput_device_config_tap_get_default_drag_lock_enabled( |
477 | sway_log(SWAY_DEBUG, | 474 | libinput_device); |
478 | "libinput_reset_pointer(%s) left_handed_set_enabled(%d)", | 475 | sway_log(SWAY_DEBUG, |
479 | input_device->identifier, left_handed); | 476 | "libinput_reset_pointer(%s) tap_set_drag_lock_enabled(%d)", |
480 | log_libinput_config_status(libinput_device_config_left_handed_set( | 477 | input_device->identifier, drag_lock); |
481 | libinput_device, left_handed)); | 478 | log_libinput_config_status( |
479 | libinput_device_config_tap_set_drag_lock_enabled( | ||
480 | libinput_device, drag_lock)); | ||
481 | } | ||
482 | 482 | ||
483 | enum libinput_config_middle_emulation_state middle_emulation = | 483 | if (libinput_device_config_accel_is_available(libinput_device)) { |
484 | libinput_device_config_middle_emulation_get_default_enabled( | 484 | double pointer_accel = |
485 | libinput_device); | 485 | libinput_device_config_accel_get_default_speed(libinput_device); |
486 | sway_log(SWAY_DEBUG, | 486 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_speed(%f)", |
487 | "libinput_reset_pointer(%s) middle_emulation_set_enabled(%d)", | 487 | input_device->identifier, pointer_accel); |
488 | input_device->identifier, middle_emulation); | 488 | log_libinput_config_status(libinput_device_config_accel_set_speed( |
489 | log_libinput_config_status( | ||
490 | libinput_device_config_middle_emulation_set_enabled( | ||
491 | libinput_device, middle_emulation)); | ||
492 | |||
493 | int natural_scroll = | ||
494 | libinput_device_config_scroll_get_default_natural_scroll_enabled( | ||
495 | libinput_device); | ||
496 | sway_log(SWAY_DEBUG, | ||
497 | "libinput_reset_pointer(%s) natural_scroll_set_enabled(%d)", | ||
498 | input_device->identifier, natural_scroll); | ||
499 | log_libinput_config_status( | ||
500 | libinput_device_config_scroll_set_natural_scroll_enabled( | ||
501 | libinput_device, natural_scroll)); | ||
502 | |||
503 | double pointer_accel = | ||
504 | libinput_device_config_accel_get_default_speed(libinput_device); | ||
505 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_speed(%f)", | ||
506 | input_device->identifier, pointer_accel); | ||
507 | log_libinput_config_status(libinput_device_config_accel_set_speed( | ||
508 | libinput_device, pointer_accel)); | 489 | libinput_device, pointer_accel)); |
509 | 490 | ||
510 | uint32_t scroll_button = | 491 | enum libinput_config_accel_profile accel_profile = |
511 | libinput_device_config_scroll_get_default_button(libinput_device); | 492 | libinput_device_config_accel_get_default_profile(libinput_device); |
512 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_button(%d)", | 493 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_profile(%d)", |
513 | input_device->identifier, scroll_button); | 494 | input_device->identifier, accel_profile); |
514 | log_libinput_config_status(libinput_device_config_scroll_set_button( | 495 | log_libinput_config_status(libinput_device_config_accel_set_profile( |
515 | libinput_device, scroll_button)); | 496 | libinput_device, accel_profile)); |
497 | } | ||
516 | 498 | ||
517 | enum libinput_config_scroll_method scroll_method = | 499 | if (libinput_device_config_scroll_has_natural_scroll(libinput_device)) { |
518 | libinput_device_config_scroll_get_default_method(libinput_device); | 500 | int natural_scroll = |
519 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_method(%d)", | 501 | libinput_device_config_scroll_get_default_natural_scroll_enabled( |
520 | input_device->identifier, scroll_method); | 502 | libinput_device); |
521 | log_libinput_config_status(libinput_device_config_scroll_set_method( | 503 | sway_log(SWAY_DEBUG, |
522 | libinput_device, scroll_method)); | 504 | "libinput_reset_pointer(%s) natural_scroll_set_enabled(%d)", |
505 | input_device->identifier, natural_scroll); | ||
506 | log_libinput_config_status( | ||
507 | libinput_device_config_scroll_set_natural_scroll_enabled( | ||
508 | libinput_device, natural_scroll)); | ||
509 | } | ||
523 | 510 | ||
524 | uint32_t send_events = | 511 | if (libinput_device_config_left_handed_is_available(libinput_device)) { |
525 | libinput_device_config_send_events_get_default_mode(libinput_device); | 512 | int left_handed = |
526 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) send_events_set_mode(%d)", | 513 | libinput_device_config_left_handed_get_default(libinput_device); |
527 | input_device->identifier, send_events); | 514 | sway_log(SWAY_DEBUG, |
528 | log_libinput_config_status(libinput_device_config_send_events_set_mode( | 515 | "libinput_reset_pointer(%s) left_handed_set_enabled(%d)", |
529 | libinput_device, send_events)); | 516 | input_device->identifier, left_handed); |
517 | log_libinput_config_status(libinput_device_config_left_handed_set( | ||
518 | libinput_device, left_handed)); | ||
519 | } | ||
530 | 520 | ||
531 | enum libinput_config_tap_state tap = | 521 | uint32_t click = libinput_device_config_click_get_methods(libinput_device); |
532 | libinput_device_config_tap_get_default_enabled(libinput_device); | 522 | if ((click & ~LIBINPUT_CONFIG_CLICK_METHOD_NONE) != 0) { |
533 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_enabled(%d)", | 523 | enum libinput_config_click_method click_method = |
534 | input_device->identifier, tap); | 524 | libinput_device_config_click_get_default_method(libinput_device); |
535 | log_libinput_config_status(libinput_device_config_tap_set_enabled( | 525 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) click_set_method(%d)", |
536 | libinput_device, tap)); | 526 | input_device->identifier, click_method); |
527 | log_libinput_config_status(libinput_device_config_click_set_method( | ||
528 | libinput_device, click_method)); | ||
529 | } | ||
537 | 530 | ||
538 | enum libinput_config_tap_button_map tap_button_map = | 531 | if (libinput_device_config_middle_emulation_is_available(libinput_device)) { |
539 | libinput_device_config_tap_get_button_map(libinput_device); | 532 | enum libinput_config_middle_emulation_state middle_emulation = |
540 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_button_map(%d)", | 533 | libinput_device_config_middle_emulation_get_default_enabled( |
541 | input_device->identifier, tap_button_map); | 534 | libinput_device); |
542 | log_libinput_config_status(libinput_device_config_tap_set_button_map( | 535 | sway_log(SWAY_DEBUG, |
543 | libinput_device, tap_button_map)); | 536 | "libinput_reset_pointer(%s) middle_emulation_set_enabled(%d)", |
537 | input_device->identifier, middle_emulation); | ||
538 | log_libinput_config_status( | ||
539 | libinput_device_config_middle_emulation_set_enabled( | ||
540 | libinput_device, middle_emulation)); | ||
541 | } | ||
542 | |||
543 | uint32_t scroll = libinput_device_config_scroll_get_methods(libinput_device); | ||
544 | if ((scroll & ~LIBINPUT_CONFIG_SCROLL_NO_SCROLL) != 0) { | ||
545 | enum libinput_config_scroll_method scroll_method = | ||
546 | libinput_device_config_scroll_get_default_method(libinput_device); | ||
547 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_method(%d)", | ||
548 | input_device->identifier, scroll_method); | ||
549 | log_libinput_config_status(libinput_device_config_scroll_set_method( | ||
550 | libinput_device, scroll_method)); | ||
551 | |||
552 | uint32_t scroll_button = | ||
553 | libinput_device_config_scroll_get_default_button(libinput_device); | ||
554 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_button(%d)", | ||
555 | input_device->identifier, scroll_button); | ||
556 | log_libinput_config_status(libinput_device_config_scroll_set_button( | ||
557 | libinput_device, scroll_button)); | ||
558 | } | ||
559 | |||
560 | if (libinput_device_config_dwt_is_available(libinput_device)) { | ||
561 | enum libinput_config_dwt_state dwt = | ||
562 | libinput_device_config_dwt_get_default_enabled(libinput_device); | ||
563 | sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) dwt_set_enabled(%d)", | ||
564 | input_device->identifier, dwt); | ||
565 | log_libinput_config_status(libinput_device_config_dwt_set_enabled( | ||
566 | libinput_device, dwt)); | ||
567 | } | ||
544 | } | 568 | } |
545 | 569 | ||
546 | static void handle_device_destroy(struct wl_listener *listener, void *data) { | 570 | static void handle_device_destroy(struct wl_listener *listener, void *data) { |