Ticket #124: 0002-Add-capability-to-set-up-monitor-in-multiple-monitor.patch

File 0002-Add-capability-to-set-up-monitor-in-multiple-monitor.patch, 3.1 KB (added by regit, 3 years ago)
  • src/guake.py

    From e2010826e0f06c50688cb66c737c04b043f6a9d0 Mon Sep 17 00:00:00 2001
    From: Eric Leblond <eric@inl.fr>
    Date: Sat, 28 Mar 2009 13:59:08 +0100
    Subject: [PATCH] Add capability to set up monitor in multiple monitor mode.
    
    This patch adds capability to set-up the monitor to use when using
    guake. It adds an item in preferences to set-up monitor.
    
    Signed-off-by: Eric Leblond <eric@inl.fr>
    ---
     src/guake.py |   15 ++++++++++-----
     src/prefs.py |   10 ++++++++++
     2 files changed, 20 insertions(+), 5 deletions(-)
    
    diff --git a/src/guake.py b/src/guake.py
    index a71cb04..f1da2e9 100644
    a b  
    683683        """ 
    684684        # setting window in all desktops 
    685685        self.get_widget('window-root').stick() 
     686        monitor = self.client.get_int(KEY('/general/monitor')) 
    686687 
    687688        # add tab must be called before window.show to avoid a 
    688689        # blank screen before adding the tab. 
     
    691692 
    692693        window_rect = self.get_final_window_rect() 
    693694        self.window.resize(window_rect.width, window_rect.height) 
    694         self.window.show_all() 
    695695        self.window.move(window_rect.x, window_rect.y) 
     696        self.window.show_all() 
    696697 
    697698        try: 
    698699            # does it work in other gtk backends 
     
    722723        """ 
    723724        screen = self.window.get_screen() 
    724725        height = self.client.get_int(KEY('/general/window_size')) 
     726        monitor = self.client.get_int(KEY('/general/monitor')) 
     727 
     728        # avoiding X Window system error 
     729        max_height = screen.get_height() 
     730        if height > max_height: 
     731            height = max_height 
    725732 
    726         # get the rectangle just from the first/default monitor in the 
    727         # future we might create a field to select which monitor you 
    728         # wanna use 
    729         window_rect = screen.get_monitor_geometry(0) 
     733        # get the width from the selected monitor 
     734        window_rect = screen.get_monitor_geometry(monitor) 
    730735 
    731736        window_rect.height = window_rect.height * height / 100 
    732737        return window_rect 
  • src/prefs.py

    diff --git a/src/prefs.py b/src/prefs.py
    index 0afc5fb..35f7465 100644
    a b  
    144144        val = hscale.get_value() 
    145145        self.client.set_int(KEY('/general/window_size'), int(val)) 
    146146 
     147    def on_monitorinput_value_changed(self, monitor): 
     148        """Changes the monitor 
     149        """ 
     150        val = monitor.get_value() 
     151        self.client.set_int(KEY('/general/monitor'), int(val)) 
     152 
    147153    # scrolling tab 
    148154 
    149155    def on_use_scrollbar_toggled(self, chk): 
     
    401407        value = float(self.client.get_int(KEY('/general/window_size'))) 
    402408        self.get_widget('window_size').set_value(value) 
    403409 
     410        # monitor 
     411        value = float(self.client.get_int(KEY('/general/monitor'))) 
     412        self.get_widget('monitorinput').set_value(value) 
     413 
    404414        # scrollbar 
    405415        value = self.client.get_bool(KEY('/general/use_scrollbar')) 
    406416        self.get_widget('use_scrollbar').set_active(value)