Hi all,

I'm trying to debug my (Windows7, 2-button trackpad) system, specifically,
weird behaviour with the mouse.

To help determine what the actual problem is, I wrote a small Racket GUI
progam, that surprised me with the following output:

object:object:my-frame% type:enter pos:(338,32) buttons:(#f #t #f) mods:(#f
#f #f) keys:(<shift><ctrl>)
object:object:list-box% type:enter pos:(337,32) buttons:(#f #f #f) mods:(#f
#f #f) keys:()

The code (given below) has a simple list-box% inside of a frame% and the
frame% overrides on-subwindow-event to receive mouse 'enter and 'leave
events, printing to stdout some information from the mouse event.

The output shows that the mouse was moved into the list-box%, triggering
the two 'enter events, (one for entering the frame%, one for entering the
list-box%) but notice that the mouse-buttons held down and
keyboard-modifiers pressed are different, despite them being part of the
same motion, with no actual mouse buttons pressed and both the shift and
control keys continuously pressed.

The larger problem I'm chasing is under some circumstances the non-existent
middle mouse button gets "stuck" down. This of course gives erratic
behaviour in various programs e.g. left-click on a tab in the tab-bar in
Chrome causes the tab to close rather than give it focus, no  window reacts
as the mouse cursor is moved over their minimize/maximize/close buttons,
nor are those buttons clickable.

A temporary solution I have found that appears to clear the "stuck button"
is to e.g.randomly click on some icons in the windows task bar, until the
minimize/maximize/close buttons of some window again react when the mouse
cursor is moved over them. A more permanent solution is a reboot, which
delays the onset until some as yet unknown trigger. Either way the
"stuck-ghost-mouse-button" situation eventually returns.

Is there a problem in my test code? Any ideas as to the cause of the
weirdness shown in the code output? Why does the second mouse event not
show the same button state and the <shift> and <ctrl> as pressed?

And any ideas as to the cause of the larger "stuck-ghost-mouse-button" or
how to further determine its cause (my current thinking is that it is
something to do with Chrome, but dunno really).

Thanks in advance,

Cheers,

Kieron.

****

#lang racket

(require racket/gui)

(define (queued-printf . msg)
  (let {[print-msg msg]}
    (queue-callback
      (lambda ()
        (apply printf print-msg)
        )
      #t)))

(define (output-event-state t e o)
        (queued-printf
           (format "object:~a type:~a pos:(~a,~a) buttons:(~a ~a ~a)
mods:(~a ~a ~a) keys:(~a)~n"
                       o t
                       (send e get-x) (send e get-y)
                       (send e get-left-down)
                       (send e get-middle-down)
                       (send e get-right-down)
                       (send e get-mod3-down)
                       (send e get-mod4-down)
                       (send e get-mod5-down)
                       (string-append
                         (if (send e get-shift-down) "<shift>" "")
                         (if (send e get-control-down) "<ctrl>" "")
                         (if (send e get-alt-down) "<alt>" "")
                         (if (send e get-meta-down) "<meta>" "")
                         (if (send e get-caps-down) "<caps>" "")
                         ))))

(define my-frame%
  (class frame%
    (super-new)
    (define/override (on-subwindow-event r e)
      (let ([event-type (send e get-event-type)]
            [object-name (object-name r)])
        (when (member event-type (list 'enter 'leave))
          (output-event-state event-type e object-name)))
      #f)
    ))

(define f (new my-frame%
               [label "test list-box"]
               [width 400]
               [height 200]))

(define l (new list-box%
               [parent f]
               [label "options"]
               [choices (list "apple" "pear" "cherry")]
               [stretchable-width #t]
               [stretchable-height #t]))

(send f show #t)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAEEP09AGHXawE1bQYYmRhP%3D%2Bjp9LTufCP%3DqM-Pmr7hTW77PheA%40mail.gmail.com.

Reply via email to