mouse "scroll wheel" events behave incorrectly

Issue #1 resolved
Anonymous created an issue

I'm not sure if this is a valid use case since the point of this effort seems to be for 10.8, but I've cloned the repo and have compiled cleanly on my "Mac OS X Lion 10.7.5 (11G63)" system. It seems to work great so far, but the scroll wheel is not behaving correctly.

The symptoms were first noticed in acme where scroll up/down does not consistently work in a window, and often delivers the events to any of the windows in a particular column. This has the unfortunate side effect of having the keyboard focus land wherever the mouse event last went, so typing within a window isn't consistent if the scroll wheel is used.

Testing further in rio looks reasonable at first, but for long rio windows the mouse events seem to teleport up and down by large chunks. Also interesting is a seeming draw oddity in rio terminal windows where long lines that wrap around off the top of the window get repainted inconsistently on scroll-up. As an example, open a new rio window and cat /dev/mouse. Generate enough mouse events to have a reasonable window size. Hit delete, then mouse-up. The result is trippy. Mouse-down and the result is as expected.

I'll keep poking at it, but I wanted to mention it in case you'd prefer to close it as not supported right off the bat.

Comments (18)

  1. Sam Hopkins

    Looks like the y coordinate is not stable on scroll up/down. Here's some output generated by simply pressing scroll up, followed by scroll down, followed by a mouse nudge to generate a position change event.

    arcadia% cat /dev/mouse m 791 819 8 1240165139 m 791 841 8 1240165195 m 791 851 8 1240165243 m 791 855 8 1240165299 m 791 870 8 1240165357 m 791 873 8 1240165402 m 791 878 8 1240165459 m 791 880 8 1240165508 m 791 894 8 1240165563 m 791 898 8 1240165611 m 791 903 8 1240165667 m 791 905 8 1240165725 m 791 905 8 1240165771 m 791 905 8 1240165827 m 791 904 8 1240165883 m 791 900 8 1240165930 m 791 900 8 1240165987 m 791 900 8 1240166035 m 791 899 8 1240166093 m 791 899 8 1240166147 m 791 897 8 1240166195 m 791 896 8 1240166251 m 791 896 8 1240166299 m 791 902 8 1240166355 m 791 902 8 1240166411 m 791 900 8 1240166461 m 791 900 8 1240166515 m 791 903 8 1240166563 m 791 904 8 1240166619 m 791 903 8 1240166675 m 791 903 8 1240166723 m 791 894 8 1240166779 m 791 894 8 1240166827 m 791 894 8 1240166883 m 791 894 8 1240166939 m 791 893 8 1240166987 m 791 892 8 1240167043 m 791 895 8 1240167091 m 791 895 8 1240167147 m 791 898 8 1240167203 m 791 900 8 1240167251 m 791 902 8 1240167307 m 791 904 8 1240167355 m 791 904 8 1240167411 m 791 903 8 1240167459 m 791 902 8 1240167515 m 791 902 8 1240167571 m 791 904 8 1240167619 m 791 904 8 1240167675 m 791 904 8 1240167731 m 791 904 8 1240167778 m 791 904 8 1240167835 m 791 905 8 1240167882 m 791 905 8 1240167939 m 791 906 8 1240167995 m 791 904 8 1240168043 m 791 904 8 1240168099 m 791 905 8 1240168147 m 791 903 8 1240168203 m 791 902 8 1240168259 m 791 901 8 1240168307 m 791 901 8 1240168363 m 791 901 8 1240168419 m 791 903 8 1240168466 m 791 903 8 1240168523 m 791 902 8 1240168571 m 791 903 8 1240168627 m 791 908 8 1240168675 m 791 908 8 1240168731 m 791 909 8 1240168787 m 791 912 8 1240168835 m 791 908 8 1240168891 m 791 909 8 1240168939 m 791 909 8 1240168995 m 791 910 8 1240169051 m 791 908 8 1240169099 m 791 909 8 1240169155 m 791 909 8 1240169211 m 791 908 8 1240169259 m 791 911 8 1240169315 m 791 911 8 1240169366 m 791 911 8 1240169419 m 791 915 8 1240169475 m 791 916 8 1240169523 m 791 914 8 1240169579 m 791 914 8 1240169635 m 791 914 8 1240169683 m 791 914 8 1240169739 m 791 914 8 1240169786 m 791 914 8 1240169843 m 791 909 8 1240169902 m 791 906 8 1240169955 m 791 906 8 1240170003 m 791 906 8 1240170059 m 791 904 8 1240170107 m 791 904 8 1240170163 m 791 903 8 1240170219 m 791 906 8 1240170269 m 791 906 8 1240170323 m 791 908 8 1240170379 m 791 908 8 1240170427 m 791 910 8 1240170485 m 791 913 8 1240170531 m 791 913 8 1240170587 m 791 910 8 1240170643 m 791 906 8 1240170691 m 791 904 8 1240170747 m 791 904 8 1240170803 m 791 904 8 1240170851 m 791 906 8 1240170907 m 791 906 8 1240170963 m 791 911 8 1240171011 m 791 913 8 1240171067 m 791 911 8 1240171123 m 791 915 8 1240171171 m 791 914 8 1240171227 m 791 914 8 1240171275 m 791 911 8 1240171331 m 791 908 8 1240171387 m 791 906 8 1240171435 m 791 905 8 1240171491 m 791 905 8 1240171547 m 791 905 8 1240171595 m 791 906 8 1240171651 m 791 906 8 1240171699 m 791 906 8 1240171755 m 791 909 8 1240171811 m 791 909 8 1240171859 m 791 912 8 1240171915 m 791 912 8 1240171971 m 791 912 8 1240172019 m 791 912 8 1240172075 m 791 913 8 1240172131 m 791 915 8 1240172179 m 791 911 8 1240172235 m 791 909 8 1240172283 m 791 907 8 1240172339 m 791 907 8 1240172395 m 791 907 8 1240172442 m 791 905 8 1240172499 m 791 900 8 1240172547 m 791 898 8 1240172603 m 791 900 8 1240172659 m 791 902 8 1240172707 m 791 903 8 1240172763 m 791 906 8 1240172811 m 791 906 8 1240172867 m 791 907 8 1240172923 m 791 908 8 1240172971 m 791 907 8 1240173027 m 791 912 8 1240173075 m 791 912 8 1240173131 m 791 913 8 1240173179 m 791 916 8 1240173235 m 791 915 8 1240173291 m 791 915 8 1240173339 m 791 916 8 1240173395 m 791 921 8 1240173443 m 791 920 8 1240173499 m 791 918 8 1240173557 m 791 918 8 1240173603 m 791 915 8 1240173659 m 791 916 8 1240173715 m 791 917 8 1240173763 m 791 917 8 1240173819 m 791 917 8 1240173867 m 791 915 8 1240173925 m 791 915 8 1240173979 m 791 915 8 1240174027 m 791 915 8 1240174083 m 791 915 8 1240174131 m 791 914 8 1240174187 m 791 915 8 1240174243 m 791 915 8 1240174296 m 791 915 8 1240174347 m 791 918 8 1240174403 m 791 918 8 1240174451 m 791 918 8 1240174507 m 791 921 8 1240174563 m 791 923 8 1240174611 m 791 919 8 1240174667 m 791 919 8 1240174715 m 791 919 8 1240174771 m 791 919 8 1240174827 m 791 920 8 1240174875 m 791 920 8 1240174931 m 791 918 8 1240174987 m 791 918 8 1240175035 m 791 919 8 1240175091 m 791 917 8 1240175139 m 791 917 8 1240175195 m 791 916 8 1240175251 m 791 915 8 1240175299 m 791 914 8 1240175355 m 791 917 8 1240175403 m 791 913 8 1240175459 m 791 913 8 1240175515 m 791 915 8 1240175563 m 791 914 8 1240175619 m 791 917 8 1240175667 m 791 917 8 1240175723 m 791 917 8 1240175779 m 791 914 8 1240175827 m 791 920 8 1240175883 m 791 920 8 1240175939 m 791 920 8 1240175987 m 791 920 8 1240176043 m 791 920 8 1240176091 m 791 921 8 1240176147 m 791 920 8 1240176203 m 791 919 8 1240176251 m 791 916 8 1240176307 m 791 915 8 1240176363 m 791 915 8 1240176411 m 791 913 8 1240176467 m 791 912 8 1240176515 m 791 910 8 1240176571 m 791 909 8 1240176627 m 791 910 8 1240176675 m 791 911 8 1240176731 m 791 915 8 1240176779 m 791 915 8 1240176835 m 791 916 8 1240176891 m 791 917 8 1240176939 m 791 917 8 1240176997 m 791 921 8 1240177051 m 791 921 8 1240177099 m 791 921 8 1240177155 m 791 922 8 1240177203 m 791 922 8 1240177259 m 791 923 8 1240177316 m 791 923 8 1240177365 m 791 923 8 1240177419 m 791 920 8 1240177475 m 791 917 8 1240177523 m 791 917 8 1240177579 m 791 915 8 1240177627 m 791 916 8 1240177683 m 791 916 8 1240177739 m 791 916 8 1240177787 m 791 918 8 1240177843 m 791 920 8 1240177899 m 791 925 8 1240177947 m 791 925 8 1240178003 m 791 925 8 1240178051 m 791 927 8 1240178107 m 791 927 8 1240178163 m 791 927 8 1240178211 m 791 928 8 1240178267 m 791 928 8 1240178315 m 791 929 8 1240178371 m 791 928 8 1240178427 m 791 926 8 1240178475 m 791 922 8 1240178531 m 791 922 8 1240178579 m 791 922 8 1240178635 m 791 918 8 1240178691 m 791 918 8 1240178739 m 791 915 8 1240178795 m 791 917 8 1240178843 m 791 917 8 1240178905 m 791 926 8 1240179427 m 791 931 8 1240179531 m 791 935 8 1240179587 m 791 940 8 1240179635 m 791 942 8 1240179691 m 791 946 8 1240179747 m 791 945 8 1240179795 m 791 947 8 1240179851 m 791 951 8 1240179899 m 791 951 8 1240179955 m 791 953 8 1240180003 m 791 950 8 1240180059 m 791 952 8 1240180115 m 791 956 8 1240180163 m 791 956 8 1240180219 m 791 959 8 1240180275 m 791 959 8 1240180323 m 791 959 8 1240180379 m 791 959 8 1240180427 m 791 959 8 1240180483 m 791 958 8 1240180531 m 791 956 8 1240180587 m 791 958 8 1240180643 m 791 959 8 1240180691 m 791 959 8 1240180747 m 791 958 8 1240180805 m 791 956 8 1240180851 m 791 958 8 1240180907 m 791 960 8 1240180955 m 791 960 8 1240181011 m 791 962 8 1240181059 m 791 962 8 1240181115 m 791 965 8 1240181173 m 791 968 8 1240181219 m 791 968 8 1240181275 m 791 967 8 1240181331 m 791 967 8 1240181379 m 791 967 8 1240181435 m 791 967 8 1240181483 m 791 967 8 1240181541 m 791 965 8 1240181595 m 791 967 8 1240181643 m 791 968 8 1240181699 m 791 976 8 1240181755 m 791 979 8 1240181803 m 791 983 8 1240181859 m 791 988 8 1240181908 m 791 992 8 1240181963 m 791 994 8 1240182019 m 791 994 8 1240182067 m 791 996 8 1240182123 m 791 1000 8 1240182171 m 791 997 8 1240182227 m 791 996 8 1240182283 m 791 995 8 1240182331 m 791 994 8 1240182387 m 791 994 8 1240182435 m 791 992 8 1240182491 m 791 995 8 1240182539 m 791 991 8 1240182596 m 791 991 8 1240182651 m 791 997 8 1240182699 m 791 997 8 1240182755 m 791 1001 8 1240182803 m 791 1001 8 1240182859 m 791 1002 8 1240182915 m 791 1003 8 1240182963 m 791 1004 8 1240183019 m 791 1008 8 1240183067 m 791 1004 8 1240183123 m 791 1003 8 1240183179 m 791 1002 8 1240183227 m 791 988 8 1240183283 m 791 819 8 1240184508 m 791 819 8 1240184980 m 791 825 8 1240185027 m 791 830 8 1240185083 m 791 840 8 1240185131 m 791 841 8 1240185187 m 791 844 8 1240185235 m 791 843 8 1240185291 m 791 850 8 1240185347 m 791 859 8 1240185395 m 791 858 8 1240185451 m 791 855 8 1240185507 m 791 852 8 1240185555 m 791 850 8 1240185611 m 791 853 8 1240185659 m 791 855 8 1240185715 m 791 862 8 1240185764 m 791 866 8 1240185819 m 791 870 8 1240185875 m 791 873 8 1240185931 m 791 875 8 1240185980 m 791 878 8 1240186035 m 791 877 8 1240186083 m 791 878 8 1240186139 m 791 877 8 1240186196 m 791 874 8 1240186243 m 791 870 8 1240186300 m 791 870 8 1240186355 m 791 867 8 1240186403 m 791 816 16 1240186667 m 791 797 16 1240186723 m 791 778 16 1240186779 m 791 760 16 1240186827 m 791 742 16 1240186883 m 791 726 16 1240186931 m 791 718 16 1240186987 m 791 711 16 1240187035 m 791 667 16 1240187091 m 791 646 16 1240187147 m 791 628 16 1240187203 m 791 615 16 1240187251 m 791 607 16 1240187308 m 791 601 16 1240187355 m 791 588 16 1240187403 m 791 576 16 1240187459 m 791 575 16 1240187516 m 791 576 16 1240187571 m 791 575 16 1240187619 m 791 575 16 1240187675 m 791 563 16 1240187723 m 791 556 16 1240187779 m 791 550 16 1240187836 m 791 542 16 1240187885 m 791 532 16 1240187939 m 791 511 16 1240187987 m 791 505 16 1240188044 m 791 495 16 1240188091 m 791 496 16 1240188148 m 791 496 16 1240188204 m 791 493 16 1240188253 m 791 495 16 1240188307 m 791 493 16 1240188356 m 791 503 16 1240188412 m 791 499 16 1240188459 m 791 501 16 1240188516 m 791 503 16 1240188571 m 791 498 16 1240188622 m 791 501 16 1240188676 m 791 493 16 1240188723 m 791 489 16 1240188779 m 791 479 16 1240188827 m 791 479 16 1240188884 m 791 475 16 1240188939 m 791 465 16 1240188988 m 791 463 16 1240189043 m 791 450 16 1240189091 m 791 450 16 1240189147 m 791 442 16 1240189196 m 791 442 16 1240189252 m 791 434 16 1240189300 m 791 427 16 1240189357 m 791 426 16 1240189411 m 791 418 16 1240189460 m 791 420 16 1240189516 m 791 414 16 1240189563 m 791 418 16 1240189620 m 791 412 16 1240189667 m 791 413 16 1240189725 m 791 412 16 1240189779 m 791 407 16 1240189827 m 791 411 16 1240189884 m 791 407 16 1240189931 m 791 410 16 1240189987 m 791 405 16 1240190035 m 791 410 16 1240190092 m 791 410 16 1240190148 m 791 409 16 1240190196 m 791 414 16 1240190252 m 791 411 16 1240190299 m 791 413 16 1240190356 m 791 408 16 1240190403 m 791 413 16 1240190459 m 791 410 16 1240190507 m 791 410 16 1240190564 m 791 408 16 1240190611 m 791 409 16 1240190667 m 791 407 16 1240190716 m 791 404 16 1240190771 m 791 404 16 1240190819 m 791 402 16 1240190875 m 791 402 16 1240190931 m 791 392 16 1240190979 m 791 398 16 1240191035 m 791 391 16 1240191084 m 791 394 16 1240191140 m 791 395 16 1240191195 m 791 393 16 1240191243 m 791 389 16 1240191299 m 791 390 16 1240191356 m 791 390 16 1240191403 m 791 384 16 1240191459 m 791 383 16 1240191511 m 791 383 16 1240191564 m 791 377 16 1240191612 m 791 382 16 1240191667 m 791 382 16 1240191716 m 791 382 16 1240191772 m 791 388 16 1240191828 m 791 384 16 1240191878 m 791 387 16 1240191931 m 791 384 16 1240191987 m 791 383 16 1240192035 m 791 381 16 1240192092 m 791 378 16 1240192139 m 791 374 16 1240192196 m 791 366 16 1240192245 m 791 373 16 1240192299 m 791 373 16 1240192356 m 791 369 16 1240192403 m 791 373 16 1240192460 m 791 364 16 1240192508 m 791 365 16 1240192564 m 791 362 16 1240192614 m 791 366 16 1240192667 m 791 354 16 1240192716 m 791 347 16 1240192772 m 791 347 16 1240192828 m 791 333 16 1240192875 m 791 335 16 1240192931 m 791 322 16 1240192980 m 791 320 16 1240193036 m 791 313 16 1240193092 m 791 309 16 1240193140 m 791 307 16 1240193196 m 791 299 16 1240193243 m 791 305 16 1240193299 m 791 299 16 1240193348 m 791 305 16 1240193403 m 791 299 16 1240193451 m 791 299 16 1240193508 m 791 303 16 1240193564 m 791 298 16 1240193611 m 791 300 16 1240193667 m 791 293 16 1240193715 m 791 295 16 1240193771 m 791 292 16 1240193820 m 791 303 16 1240193876 m 791 340 16 1240193924 m 789 817 0 1240194779 m 785 817 0 1240194812 arcadia%

  2. Jeff Sickel repo owner

    /dev/mouse isn't the best example as it has some fun wrapping as it produces a fixed length byte stream that doesn't include a '\n' or anything that helps rio position the coordinate system during a scroll. At least that's the case with all the versions I've tested.

    There may be an issue given the 10.7 and 10.8 API differences. I did find that I've not been able to get the scroll magnitude to be passed appropriately on 10.8 using the 'magic pad' or other trackpad devices. Some of that could be that I've just not found the proper Y offset component to properly indicate the change, but I do think that devmouse doesn't quite pick up the coordinates appropriately in the dynamic scroll events.

    Note: on high latency links the large number of mouse events can reduce the overall performance of the display.

  3. Sam Hopkins

    Ah, yes, I should have replicated the scroll-up rio window trippiness with my existing drawterm. It's there as well.

    I don't think this problem is a scroll magnitude issue, but that for some reason on scroll wheel we're changing the y axis of the mouse location on the screen when the mouse isn't moving. I don't have a left/right scroll wheel, but it would be interesting to know if the x axis moved on those scroll events.

  4. michaelian Ennis

    Scroll to the Right:

    m        570         382           0  1374882144 
    m        570         382           0  1374882490 
    m        570         382           0  1374882594 
    m        570         382           0  1374882698 
    m        570         382           0  1374882804 
    m        570         382           0  1374882908
    

    Scroll to the Left:

    m         82         265           0  1375070156 
    m         82         265           0  1375070260 
    m         82         265           0  1375070348 
    m         82         265           0  1375070436 
    m         82         265           0  1375070524 
    m         82         265           0  1375070614 
    m         82         265           0  1375070702
    

    Scroll Wheel Towards The Screen:

    m        355         254          16  1375191839 
    m        355         254          16  1375192183 
    m        355         254          16  1375193701 
    m        355         254          16  1375194353 
    m        355         254          16  1375194897 
    m        355         254          16  1375195781
    

    Scroll Wheel Away From The Screen:

    m        355         256           8  1375207193 
    m        355         256           8  1375207587 
    m        355         256           8  1375208332 
    m        355         256           8  1375209144 
    m        355         256           8  1375209521 
    m        355         256           8  1375210228
    

    OSX Info:

    $ system_profiler SPSoftwareDataType | grep ersion 
          System Version: OS X 10.8.2 (12C3006)
          Kernel Version: Darwin 12.2.1
    
  5. Sam Hopkins

    That's a nice, concise way to show it. :) So I guess it's just my 10.7 system. Info:

    sahs-macbook-3:mud sah$ system_profiler SPSoftwareDataType | grep ersion System Version: Mac OS X 10.7.5 (11G63) Kernel Version: Darwin 11.4.2

  6. Jeff Sickel repo owner

    The fourth column in mennis' post is what determines the scroll up|down. If the delta is positive, it's up 8', otherwise it's down '16'. If you can set up gdb to break in the NSScrollWheel section of getmouse(), near screen.m:962 you should be able to verify if the scroll event on 10.7.5.

  7. Sam Hopkins

    Check the capture I put into my comment above. It's a little messy because I just dumped the direct output, but my scrollup looks like this:

    m 791 382 16 1240191772 
    m 791 388 16 1240191828 
    m 791 384 16 1240191878 
    m 791 387 16 1240191931 
    m 791 384 16 1240191987 
    m 791 383 16 1240192035 
    m 791 381 16 1240192092 
    m 791 378 16 1240192139 
    m 791 374 16 1240192196 
    m 791 366 16 1240192245 
    m 791 373 16 1240192299 
    m 791 373 16 1240192356
    

    and scrolldown:

    m 791 1001 8 1240182803 
    m 791 1001 8 1240182859 
    m 791 1002 8 1240182915 
    m 791 1003 8 1240182963 
    m 791 1004 8 1240183019 
    m 791 1008 8 1240183067 
    m 791 1004 8 1240183123 
    m 791 1003 8 1240183179 
    m 791 1002 8 1240183227 
    m 791 988 8 1240183283 
    m 791 819 8 1240184508 
    m 791 819 8 1240184980 
    m 791 825 8 1240185027 
    m 791 830 8 1240185083
    

    Note the y moves around when the mouse is not. I believe this is the base problem for why acme scrolls different windows as the events are being delivered all over the column.

    FWIW, my mouse events are likely reversed from mennis and yours because I don't buy into the whole "make my laptop scroll like a tablet". :)

  8. Jeff Sickel repo owner

    Here's a question: what's your latency to your Plan 9 cpu? When I've got a ping of 595ms the scroll functionality is horrid. But when the rate is closer to 5ms then scrolling is actually decent. Still annoying, but usable.

    Mousetrack() is very sensitive to network latency right now.

  9. Jeff Sickel repo owner

    If you can run drawterm in gdb break on screen.m:951 to see if that mouse is sending the proper events. If it doesn't break there try screen.m:965 and send the results of 'po e'.

  10. Chris Vitale

    Breakpoint 1, getmouse (e=0x186d6f0) at screen.m:951 951 if([e hasPreciseScrollingDeltas] == NO) (gdb) po e NSEvent: type=ScrollWheel loc=(926,314) time=53374.9 flags=0x100 win=0x1854b00 winNum=854 ctxt=0x1aa2f deltaX=0.000000 deltaY=0.100006 deltaZ=0.000000 phase=None momentumPhase=None

  11. Log in to comment