<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Excluding only the mouse events from triggering a refresh would
    probably be the most elegant solution.<br>
    My canvas should only ever listen to a timer, though, so they might
    as well share some insider information:<br>
    <br>
    #lang racket/gui<br>
    <br>
    (require sgl)<br>
    <br>
    (define c%<br>
      (class canvas%<br>
        (inherit with-gl-context swap-gl-buffers refresh)<br>
        (define asked-nicely? #f)<br>
        (define (please)    (set! asked-nicely? #t))<br>
        (define (thank-you) (set! asked-nicely? #f))<br>
        (define/public (please-refresh)<br>
          (please)<br>
          (refresh))<br>
        (define/override (on-paint)<br>
          (when asked-nicely?<br>
            (with-gl-context<br>
             (lambda ()<br>
               (gl-clear-color (random) (random) (random) 1)<br>
               (gl-clear 'color-buffer-bit)<br>
               (swap-gl-buffers)<br>
               (gl-flush)))<br>
            (thank-you)))<br>
        (super-new (style '(gl)))))<br>
    <br>
    (define t%<br>
      (class timer%<br>
        (define/override (notify)<br>
          (send c please-refresh))<br>
        (super-new)))<br>
    <br>
    (define f (new frame% [label ""] [width 100] [height 100]))<br>
    (define c (new c% [parent f]))<br>
    (define t (new t% [interval 1000]))<br>
    (send f show #t)<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 12.02.13 20:04, Robby Findler wrote:<br>
    </div>
    <blockquote
cite="mid:CAL3TdOOoZkoX-ObhFuOvH6qpb6PTJAgy6JnfQfiYPcWH36=K8w@mail.gmail.com"
      type="cite">
      <div dir="ltr">Could you work around this by tracking mouse
        movements and, when you see a refresh call that comes with a
        mouse movement doing something different than drawing? (I guess
        you'd need to set a timer that expired in a short time and
        refresh then, just in case it was a "real" refresh, but at least
        you could work around the performance issue.)
        <div>
          <br>
        </div>
        <div style="">Robby</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Tue, Feb 12, 2013 at 1:02 PM, Robby
          Findler <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">I was using os x 10.7.5 (and saw the same
              flashing).</div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra">
                  <br>
                  <br>
                  <div class="gmail_quote">On Tue, Feb 12, 2013 at 12:59
                    PM, Philipp Dikmann <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="mailto:philipp@dikmann.de" target="_blank">philipp@dikmann.de</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">The
                      OS here is Mac OS 10.6.8, running Racket 5.3.1 -<br>
                      so I guess its an issue with the OpenGL
                      implementation.<br>
                      Thanks for taking a look, though :)
                      <div>
                        <div><br>
                          <br>
                          <br>
                          On 12.02.13 19:37, Michael Wilber wrote:<br>
                          <blockquote class="gmail_quote"
                            style="margin:0 0 0 .8ex;border-left:1px
                            #ccc solid;padding-left:1ex">
                            Your OpenGL example still doesn't flash for
                            me when I move the mouse<br>
                            over it, on 64-bit linux.<br>
                            <br>
                            It does, however, flash when I change window
                            focus... for some reason?<br>
                            <br>
                            What OS are you using?<br>
                            <br>
                            Philipp Dikmann &lt;<a
                              moz-do-not-send="true"
                              href="mailto:philipp@dikmann.de"
                              target="_blank">philipp@dikmann.de</a>&gt;
                            writes:<br>
                            <blockquote class="gmail_quote"
                              style="margin:0 0 0 .8ex;border-left:1px
                              #ccc solid;padding-left:1ex">
                              I'm sorry, I should have been more
                              specific – it happens when using a<br>
                              gl-enabled canvas (example below).<br>
                              I hope that does not turn it into a
                              dragons' den? ;)<br>
                              <br>
                              Philipp<br>
                              <br>
                              #lang racket/gui<br>
                              <br>
                              (require sgl)<br>
                              <br>
                              (define c%<br>
                                  (class canvas%<br>
                                    (inherit with-gl-context
                              swap-gl-buffers)<br>
                                    (define/override (on-paint)<br>
                                      (with-gl-context<br>
                                       (lambda ()<br>
                                         (gl-clear-color (random)
                              (random) (random) 1)<br>
                                         (gl-clear 'color-buffer-bit)<br>
                                         (swap-gl-buffers)<br>
                                         (gl-flush))))<br>
                                    (super-new (style '(gl
                              no-autoclear)))))<br>
                              <br>
                              (define f (new frame% [label ""] [width
                              100] [height 100]))<br>
                              (define c (new c% [parent f]))<br>
                              (send f show #t)<br>
                              <br>
                              <br>
                              On 11.02.13 22:39, Robby Findler wrote:<br>
                              <blockquote class="gmail_quote"
                                style="margin:0 0 0 .8ex;border-left:1px
                                #ccc solid;padding-left:1ex">
                                I don't think it does that. The program
                                below, at least for me,<br>
                                doesn't do crazy colors when I move the
                                mouse around (it does when<br>
                                resizing, tho).<br>
                                <br>
                                Robby<br>
                                <br>
                                #lang racket/gui<br>
                                <br>
                                (define c%<br>
                                   (class canvas%<br>
                                     (inherit get-client-size get-dc)<br>
                                     (define/override (on-paint)<br>
                                       (define-values (w h)
                                (get-client-size))<br>
                                       (define dc (get-dc))<br>
                                       (define c (make-object color%
                                (random 255) (random 255) (random<br>
                                255)))<br>
                                       (send dc set-brush c 'solid)<br>
                                       (send dc set-pen "black" 1
                                'transparent)<br>
                                       (send dc draw-ellipse 0 0 w h))<br>
                                     (super-new)))<br>
                                <br>
                                (define f (new frame% [label ""] [width
                                100] [height 100]))<br>
                                (define c (new c% [parent f]))<br>
                                (send f show #t)<br>
                                <br>
                                <br>
                                On Mon, Feb 11, 2013 at 9:41 AM, Philipp
                                Dikmann &lt;<a moz-do-not-send="true"
                                  href="mailto:philipp@dikmann.de"
                                  target="_blank">philipp@dikmann.de</a><br>
                                &lt;mailto:<a moz-do-not-send="true"
                                  href="mailto:philipp@dikmann.de"
                                  target="_blank">philipp@dikmann.de</a>&gt;&gt;
                                wrote:<br>
                                <br>
                                     It appears that the GUI canvas%
                                refreshes itself whenever it<br>
                                     receives a mouse-event%.<br>
                                     I intend to refresh the canvas at a
                                steady pace (using a timer%)<br>
                                     and independently of any
                                mouse-events instead.<br>
                                     Is there a reasonable way to
                                suppress the default behavior?<br>
                                <br>
                                     Thanks for your time,<br>
                                     Philipp<br>
                                     ____________________<br>
                                      Racket Users list:<br>
                                     <a moz-do-not-send="true"
                                  href="http://lists.racket-lang.org/users"
                                  target="_blank">http://lists.racket-lang.org/users</a><br>
                                <br>
                                <br>
                              </blockquote>
                              ____________________<br>
                                 Racket Users list:<br>
                                 <a moz-do-not-send="true"
                                href="http://lists.racket-lang.org/users"
                                target="_blank">http://lists.racket-lang.org/users</a><br>
                            </blockquote>
                          </blockquote>
                          <br>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>