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
|
|
| 683 | 683 | """ |
| 684 | 684 | # setting window in all desktops |
| 685 | 685 | self.get_widget('window-root').stick() |
| | 686 | monitor = self.client.get_int(KEY('/general/monitor')) |
| 686 | 687 | |
| 687 | 688 | # add tab must be called before window.show to avoid a |
| 688 | 689 | # blank screen before adding the tab. |
| … |
… |
|
| 691 | 692 | |
| 692 | 693 | window_rect = self.get_final_window_rect() |
| 693 | 694 | self.window.resize(window_rect.width, window_rect.height) |
| 694 | | self.window.show_all() |
| 695 | 695 | self.window.move(window_rect.x, window_rect.y) |
| | 696 | self.window.show_all() |
| 696 | 697 | |
| 697 | 698 | try: |
| 698 | 699 | # does it work in other gtk backends |
| … |
… |
|
| 722 | 723 | """ |
| 723 | 724 | screen = self.window.get_screen() |
| 724 | 725 | 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 |
| 725 | 732 | |
| 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) |
| 730 | 735 | |
| 731 | 736 | window_rect.height = window_rect.height * height / 100 |
| 732 | 737 | return window_rect |
diff --git a/src/prefs.py b/src/prefs.py
index 0afc5fb..35f7465 100644
|
a
|
b
|
|
| 144 | 144 | val = hscale.get_value() |
| 145 | 145 | self.client.set_int(KEY('/general/window_size'), int(val)) |
| 146 | 146 | |
| | 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 | |
| 147 | 153 | # scrolling tab |
| 148 | 154 | |
| 149 | 155 | def on_use_scrollbar_toggled(self, chk): |
| … |
… |
|
| 401 | 407 | value = float(self.client.get_int(KEY('/general/window_size'))) |
| 402 | 408 | self.get_widget('window_size').set_value(value) |
| 403 | 409 | |
| | 410 | # monitor |
| | 411 | value = float(self.client.get_int(KEY('/general/monitor'))) |
| | 412 | self.get_widget('monitorinput').set_value(value) |
| | 413 | |
| 404 | 414 | # scrollbar |
| 405 | 415 | value = self.client.get_bool(KEY('/general/use_scrollbar')) |
| 406 | 416 | self.get_widget('use_scrollbar').set_active(value) |