#!/usr/local/bin/ruby require 'xlib' require 'xlib/motion_notifier.rb' DIS = Xlib::Display.new ROOT = DIS.root ROOT.extend MotionNotifier PIX = ROOT.new_pixmap ROOT.width/4,ROOT.height/4 DIS.gc.func = Xlib::COPY area = Xlib::Rect.new ROOT.width-PIX.width,0,PIX.width,PIX.height ROOT.copy_area PIX,DIS.gc,area WIN = ROOT.new_window area,true WIN.title = 'eye' WIN.border_width = 0 WIN.lower WIN.show GC = WIN.new_gc GC.fg = DIS.alloc_color 'dark green' start_angle, draw_angle = 0*64, 360*64 size = 48 ex = 0 ey = 0 ROOT.motion_notify_step do |x, y| ex = (area.x + x - WIN.x) * (WIN.width - size) / ROOT.width ey = (area.y + y - WIN.y) * (WIN.height - size) / ROOT.height PIX.copy_area WIN,GC,PIX.rect GC.fill_oval ex,ey,size,size, start_angle,draw_angle end WIN.event 'button_press' do exit end while DIS.event; end