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
|
|
| 145 | 145 | """If the gconf var window_size be changed, this method will |
| 146 | 146 | be called and will call the resize function in guake. |
| 147 | 147 | """ |
| 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) |
| 150 | 150 | |
| 151 | 151 | def scrollbar_toggled(self, client, connection_id, entry, data): |
| 152 | 152 | """If the gconf var use_scrollbar be changed, this method will |
| … |
… |
|
| 689 | 689 | if not self.term_list: |
| 690 | 690 | self.add_tab() |
| 691 | 691 | |
| 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) |
| 694 | 694 | self.window.show_all() |
| 695 | | self.window.move(0, 0) |
| | 695 | self.window.move(window_rect.x, window_rect.y) |
| 696 | 696 | |
| 697 | 697 | try: |
| 698 | 698 | # does it work in other gtk backends |
| … |
… |
|
| 714 | 714 | """ |
| 715 | 715 | self.window.hide() # Don't use hide_all here! |
| 716 | 716 | |
| 717 | | def get_final_window_size(self): |
| | 717 | def get_final_window_rect(self): |
| 718 | 718 | """Gets the final size of the main window of guake. The height |
| 719 | 719 | is just the window_size property. But width is calculated as |
| 720 | 720 | 100% of the screen and tested against the monitor geometry |
| … |
… |
|
| 723 | 723 | screen = self.window.get_screen() |
| 724 | 724 | height = self.client.get_int(KEY('/general/window_size')) |
| 725 | 725 | |
| 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 |
| 732 | 727 | # future we might create a field to select which monitor you |
| 733 | 728 | # wanna use |
| 734 | | width = screen.get_monitor_geometry(0).width |
| | 729 | window_rect = screen.get_monitor_geometry(0) |
| 735 | 730 | |
| 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 |
| 739 | 733 | |
| 740 | 734 | # -- configuration -- |
| 741 | 735 | |