Skip to content

Commit

Permalink
closes #327. Fix screenshots on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmelt committed Nov 28, 2016
1 parent dfd4825 commit 6c3d671
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/cosmos/gui/utilities/screenshot.rb
Expand Up @@ -15,6 +15,14 @@ class Screenshot

# Take a screenshot of the given window
def self.screenshot_window (window, filename)
if !Kernel.is_windows?()
# Delay for one second to allow any dialogs to fully clear first
start_time = Time.now
while ((Time.now - start_time) < 1.0)
Qt::CoreApplication.processEvents(Qt::EventLoop::AllEvents, 1000)
end
end

# Create a Pixmap to save the screenshot into
pixmap = Qt::Pixmap::grabWindow(window.winId())
pixmap.save(filename)
Expand Down

0 comments on commit 6c3d671

Please sign in to comment.