Sha256: 5cb0046b9a368b5227c8cc85d355bbfd5fc6cd03bc5c968c1bf35b5167c878a0

Contents?: true

Size: 687 Bytes

Versions: 4

Compression:

Stored size: 687 Bytes

Contents

module Redcar
  class ApplicationSWT
    class EventLoop
      def initialize
        @running = false
      end
      
      # Begins the SWT event loop. Blocks.
      def start
        @running = true
        @display = ApplicationSWT.display
        while @running and not @display.disposed?
          unless read = @display.read_and_dispatch
            @display.sleep
          end
        end
        @display.dispose
      end
      
      # Lets the even loop run until block returns false
      def yield_until
        @display.read_and_dispatch until yield
      end
      
      # Halts the SWT event loop.
      def stop
        @running = false
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redcar-0.5.2dev plugins/application_swt/lib/application_swt/event_loop.rb
redcar-0.5.1dev plugins/application_swt/lib/application_swt/event_loop.rb
redcar-0.4.1 plugins/application_swt/lib/application_swt/event_loop.rb
redcar-0.4 plugins/application_swt/lib/application_swt/event_loop.rb