Ticket #124: 0003-Limit-range-of-monitor-to-avoid-crash.patch

File 0003-Limit-range-of-monitor-to-avoid-crash.patch, 0.9 KB (added by regit, 3 years ago)
  • src/prefs.py

    From 8e837bd2b93d38acfadc31ff40a8384fc6268429 Mon Sep 17 00:00:00 2001
    From: Eric Leblond <eric@inl.fr>
    Date: Mon, 23 Feb 2009 01:49:18 +0100
    Subject: [PATCH] Limit range of monitor to avoid crash.
    
    This patch dynamically fixes the monitor range to avoid a crash if user
    set a unsupported value.
    
    Signed-off-by: Eric Leblond <eric@inl.fr>
    ---
     src/prefs.py |    2 ++
     1 files changed, 2 insertions(+), 0 deletions(-)
    
    diff --git a/src/prefs.py b/src/prefs.py
    index 35f7465..47c8b9e 100644
    a b  
    409409 
    410410        # monitor 
    411411        value = float(self.client.get_int(KEY('/general/monitor'))) 
     412        nmonitors = self.get_widget('monitorinput').get_screen().get_n_monitors() - 1 
     413        self.get_widget('monitorinput').set_range(0, nmonitors) 
    412414        self.get_widget('monitorinput').set_value(value) 
    413415 
    414416        # scrollbar