Ticket #122: 0001-Fix-dual-monitor-problem.patch

File 0001-Fix-dual-monitor-problem.patch, 3.5 KB (added by SnapShot, 3 years ago)
  • src/guake.py

    From e49c5cf533efdd6590ad6c627510c39d84dcd7af Mon Sep 17 00:00:00 2001
    From: Aleksandar Krsteski <alekrsteski@gmail.com>
    Date: Fri, 20 Mar 2009 01:07:48 +0100
    Subject: [PATCH] Fix dual monitor problem.
    
    Fix the dual monitor problem that manifested with guake appearing on the
    monitor with the width of the other monitor. The problem was that guake
    assumed that left monitor is always the default monitor, which is not
    always the case, and always appeared on position 0,0 (top left of the
    left monitor). In my case it took the width of the monitor0 1680 but
    appeared on the left monitor which has width of 1280. To fix this,
    rework the get_final_window_size to get_final_window_rect that will
    return the rectangle (x,y,width,height) of the window. Also remove some
    ilogical code that compared the monitor height with height preference
    (height preference is in percents and monitor height is in pixels).
    ---
     src/guake.py |   26 ++++++++++----------------
     1 files changed, 10 insertions(+), 16 deletions(-)
    
    diff --git a/src/guake.py b/src/guake.py
    index cbf400a..bfc79a3 100644
    a b  
    145145        """If the gconf var window_size be changed, this method will 
    146146        be called and will call the resize function in guake. 
    147147        """ 
    148         width, height = self.guake.get_final_window_size() 
    149         self.guake.window.resize(width, height) 
     148        window_rect = self.guake.get_final_window_rect() 
     149        self.guake.window.resize(window_rect.width, window_rect.height) 
    150150 
    151151    def scrollbar_toggled(self, client, connection_id, entry, data): 
    152152        """If the gconf var use_scrollbar be changed, this method will 
     
    689689        if not self.term_list: 
    690690            self.add_tab() 
    691691 
    692         width, height = self.get_final_window_size() 
    693         self.window.resize(width, height) 
     692        window_rect = self.get_final_window_rect() 
     693        self.window.resize(window_rect.width, window_rect.height) 
    694694        self.window.show_all() 
    695         self.window.move(0, 0) 
     695        self.window.move(window_rect.x, window_rect.y) 
    696696 
    697697        try: 
    698698            # does it work in other gtk backends 
     
    714714        """ 
    715715        self.window.hide() # Don't use hide_all here! 
    716716 
    717     def get_final_window_size(self): 
     717    def get_final_window_rect(self): 
    718718        """Gets the final size of the main window of guake. The height 
    719719        is just the window_size property. But width is calculated as 
    720720        100% of the screen and tested against the monitor geometry 
     
    723723        screen = self.window.get_screen() 
    724724        height = self.client.get_int(KEY('/general/window_size')) 
    725725 
    726         # avoiding X Window system error 
    727         max_height = screen.get_height() 
    728         if height > max_height: 
    729             height = max_height 
    730  
    731         # get the width just from the first/default monitor in the 
     726        # get the rectangle just from the first/default monitor in the 
    732727        # future we might create a field to select which monitor you 
    733728        # wanna use 
    734         width = screen.get_monitor_geometry(0).width 
     729        window_rect = screen.get_monitor_geometry(0) 
    735730 
    736         total_height = self.window.get_screen().get_height() 
    737         final_height = total_height * height / 100 
    738         return width, final_height 
     731        window_rect.height = window_rect.height * height / 100 
     732        return window_rect 
    739733 
    740734    # -- configuration -- 
    741735