Skip to content

macOS: Racket threads do not run while dragging a slider% #357

Description

@Bogdanp

Re. Bogdanp/racket-gui-easy#63 (comment).

As the title says, when dragging a slider, threads other than the eventspace thread are suspended. So, the threads in this example end up not running while dragging the slider (or while initiating a drag and holding the slider):

#lang racket/gui

(define f
  (new frame%
       [label "Test"]))

(define thd
  (thread
   (lambda ()
     (let loop ()
       (println `(value ,(thread-receive)))
       (loop)))))

(define tick-thd
  (thread
   (lambda ()
     (let loop ()
       (println 'tick)
       (sleep 1)
       (loop)))))

(define timer
  (new timer%
       [notify-callback
        (lambda ()
          (println 'timer-tick))]
       [interval 1000]))

(define s
  (new slider%
       [parent f]
       [label "Test"]
       [init-value 0]
       [min-value 0]
       [max-value 100]
       [callback (lambda (self _event)
                   (thread-send thd (send self get-value)))]))

(send f show #t)

Surprisingly, the timer% doesn't run either.

As a hack, I've tried setting up a display link to post dummy events between drag start and end (the display link is necessary because changed: does not fire if you just hold the slider after dragging), but that doesn't seem to help. Probably the right solution is a run loop source in queue.rkt for the event tracking mode, but I'm not sure how to do that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions