diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-08-09 23:11:43 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-08-09 23:11:43 +0000 |
commit | c364387c6657769e29ade8fe16038a1c9b6fa1e0 (patch) | |
tree | 57e4a0e606ec4c32c70d41b185fe5e399801063d /gtk-recordmydesktop/src/rmdFrame.py | |
parent | b5244639d1b3e38b1c56e03e7f65b8da44970233 (diff) |
rmdConfig.py.in, rmdFrame.py, rmdPrefsWidget.py,
rmdSelectThumb.py, rmdSimple.py, rmdStrings.py,
rmdTrayIcon.py : Added follow mouse option in the
Preferences Widget and all relevant functionality
( save/load , defaults, string/tooltip). Also added
moveFrame method so that the frame can follow
the mouse.
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@406 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'gtk-recordmydesktop/src/rmdFrame.py')
-rw-r--r-- | gtk-recordmydesktop/src/rmdFrame.py | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gtk-recordmydesktop/src/rmdFrame.py b/gtk-recordmydesktop/src/rmdFrame.py index f5187e4..2dc556f 100644 --- a/gtk-recordmydesktop/src/rmdFrame.py +++ b/gtk-recordmydesktop/src/rmdFrame.py @@ -26,19 +26,20 @@ import pygtk pygtk.require('2.0') import gtk +import gobject class rmdFrame: borderwidth=6 outlinewidth=1 - def __init__(self,x,y,w,h): + def __init__(self,x,y,w,h,parent): self.window=gtk.Window(gtk.WINDOW_TOPLEVEL) self.area=gtk.DrawingArea() self.x=x self.y=y self.w=w self.h=h - + self.parent=parent mask = gtk.gdk.Pixmap(None, self.w+self.borderwidth*2, self.h+self.borderwidth*2, @@ -71,6 +72,27 @@ class rmdFrame: self.window.move(self.x-self.borderwidth, self.y-self.borderwidth) self.window.set_resizable(False) + self.disp=gtk.gdk.display_get_default() + self.wroot = gtk.gdk.get_default_root_window() + (self.wwidth, self.wheight) = self.wroot.get_size() + self.timed_id=gobject.timeout_add(10,self.moveFrame) + + def moveFrame(self): + if self.parent.values[15]==0: + npos=gtk.gdk.Display.get_pointer(self.disp) + x=npos[1]-self.w/2 + y=npos[2]-self.h/2 + x=(x>>1)<<1 + y=(y>>1)<<1 + if x<0:x=0 + if y<0:y=0 + if x+self.w>self.wwidth:x=self.wwidth-self.w + if y+self.h>self.wheight:y=self.wheight-self.h + if(x!=self.x or y!= self.y): + self.x=x + self.y=y + self.window.move(self.x-(self.borderwidth),self.y-(self.borderwidth)) + return True def __expose_cb(self, widget, event): |