aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmagnus19
1 files changed, 16 insertions, 3 deletions
diff --git a/magnus b/magnus
index 1b356fc..298c702 100755
--- a/magnus
+++ b/magnus
@@ -28,10 +28,13 @@ class Main(object):
self.window_metrics_restored = False
self.decorations_height = 0
self.decorations_width = 0
+ self.min_width = 300
+ self.min_height = 300
self.last_x = -1
self.last_y = -1
self.refresh_interval = 250
self.started_by_keypress = False
+ self.force_refresh = False
def handle_shutdown(self, app):
if self.started_by_keypress:
@@ -54,6 +57,15 @@ class Main(object):
print(" Show about dialogue")
print(" --refresh-interval=120")
print(" Set refresh interval in milliseconds (lower is faster)")
+ print(" --force-refresh")
+ print(" Refresh continually (according to refresh interval)")
+ print(" even if the mouse has not moved")
+ return 0
+
+ if "--force-refresh" in args:
+ # If this argument is supplied, refresh the view even if the mouse
+ # has not moved. Useful if the screen content is video.
+ self.force_refresh = True
# Override refresh rate on command line
for arg in args:
@@ -98,7 +110,7 @@ class Main(object):
# the window
self.w = Gtk.ApplicationWindow.new(self.app)
- self.w.set_size_request(300, 300)
+ self.w.set_size_request(self.min_width, self.min_height)
self.w.set_title("Magnus")
self.w.connect("destroy", lambda a: self.app.quit())
self.w.connect("configure-event", self.read_window_size)
@@ -233,7 +245,7 @@ class Main(object):
(screen, x, y, modifier) = display.get_pointer()
if x == self.last_x and y == self.last_y:
# bail if nothing would be different
- if not force_refresh:
+ if not force_refresh and not self.force_refresh:
return True
self.last_x = x
self.last_y = y
@@ -293,7 +305,8 @@ class Main(object):
scr = self.w.get_screen()
sw = float(scr.get_width())
sh = float(scr.get_height())
- self.w.set_size_request(
+ self.w.set_size_request(self.min_width, self.min_height)
+ self.w.resize(
int(sw * metrics["ww"]), int(sh * metrics["wh"]))
self.w.move(int(sw * metrics["wx"]), int(sh * metrics["wy"]))
bgstack15