diff options
| author | Huang Peng <shawn.p.huang@gmail.com> | 2008-06-14 00:26:27 +0800 |
|---|---|---|
| committer | Huang Peng <shawn.p.huang@gmail.com> | 2008-06-14 00:26:27 +0800 |
| commit | 7753e6ded2fa21b10418cf5efdf7bc53499335cb (patch) | |
| tree | 6176ca25a38f1e10b37e81f4b26dbf0eb765d32f | |
| parent | ad600ae81ce32bde12ce6d08ed415abdbeaa4e87 (diff) | |
Modify position function of im menu.
| -rw-r--r-- | panel/panel.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/panel/panel.py b/panel/panel.py index d6e710f..68ddacd 100644 --- a/panel/panel.py +++ b/panel/panel.py @@ -114,15 +114,25 @@ class Panel (ibus.Object): menu_width, menu_height = menu.size_request () + if x + menu_width >= monitor_allocation.width: + x -= menu_width - button.allocation.width + elif x - menu_width <= 0: + pass + else: + if x <= monitor_allocation.width / 2: + pass + else: + x -= menu_width - button.allocation.width + if y + button.allocation.height + menu_height >= monitor_allocation.height: y -= menu_height elif y - menu_height <= 0: y += button.allocation.height else: - if y >= monitor_allocation.height / 2: - y -= menu_height - else: + if y <= monitor_allocation.height / 2: y += button.allocation.height + else: + y -= menu_height return (x, y, False) |
