Sha256: 78a668c590aa1fc338d998ea8f0a508de699db198f8c8c4cf0fd0ef3d82f8f77

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents


class Blanker 
  
  if RUBY_PLATFORM =~ /java/
    require 'java'
    JFrame = javax.swing.JFrame
    JPanel = javax.swing.JPanel
  
    def self.blank_full_screen!
        # a new screen each time as other jruby doesn't terminate as gracefully as we would like...
        frame = JFrame.new("blanked section") # ltodo pass in param
        frame.default_close_operation = JFrame::EXIT_ON_CLOSE
        frame.set_location(0,0)
        frame.set_size(2000, 2000) # ltodo better coords...
        frame.show
        # lodo on top?
        
        fr = frame
        fr.set_resizable(false)
        
        fr.set_undecorated(true) unless fr.is_displayable
        
        # probably unnecessary
        panel = JPanel.new
        frame.add(panel)
        # frame.set_background()
        panel.repaint
        panel.revalidate
        # too heavy!
        # gd = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
        # gd.set_full_screen_window(fr)
        @fr = fr
        @fr.set_visible(true)
    end
  else
    # MRI fake blanker :)
    def self.blank_full_screen!
      puts 'the screen is now...blank!'      
    end
  
  end
  
  def self.unblank_full_screen!
    if RUBY_PLATFORM =~ /java/
      if @fr
        @fr.dispose
      end
    else
      puts 'the screen is now...visible!'
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sensible-cinema-0.7.7 lib/blanker.rb
sensible-cinema-0.7.5 lib/blanker.rb
sensible-cinema-0.7.4 lib/blanker.rb
sensible-cinema-0.7.3 lib/blanker.rb
sensible-cinema-0.7.2 lib/blanker.rb
sensible-cinema-0.7.1 lib/blanker.rb