summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2009-02-15 15:09:53 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2009-02-15 15:09:53 +0800
commit05f1fc037cd2113da03315fb863352f6cdfceee6 (patch)
tree1c6b24061a86db1d193273a845d856c4632bf9dc /ui
parent06c4f228a3176b88947523bf635d49e0fee9b978 (diff)
downloadibus-05f1fc037cd2113da03315fb863352f6cdfceee6.tar.gz
ibus-05f1fc037cd2113da03315fb863352f6cdfceee6.tar.xz
ibus-05f1fc037cd2113da03315fb863352f6cdfceee6.zip
Make language bar left extend when language is close to right edge of screen.
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/languagebar.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/gtk/languagebar.py b/ui/gtk/languagebar.py
index 3546ef7..99b1af0 100644
--- a/ui/gtk/languagebar.py
+++ b/ui/gtk/languagebar.py
@@ -65,11 +65,11 @@ class LanguageBar(gtk.Toolbar):
root = gdk.get_default_root_window()
try:
- workarea = root.property_get("_NET_WORKAREA")[2]
- right, bottom = workarea[0] + workarea[2], workarea[1] + workarea[3]
+ self.__work_area = root.property_get("_NET_WORKAREA")[2]
except:
- right, bottom = root.get_size()
- self.__position = right - 20, bottom - 20
+ w, h = root.get_size()
+ self.__work_area = 0, 0, w, h
+ self.__position = self.__work_area[0] + self.__work_area[2] - 20, self.__work_area[1] + self.__work_area[3] - 20
self.__toplevel.move(*self.__position)
def __create_ui(self):
@@ -106,7 +106,8 @@ class LanguageBar(gtk.Toolbar):
def __toplevel_size_allocate_cb(self, toplevel, allocation):
x, y = self.__position
- self.__toplevel.move(x - allocation.width, y - allocation.height)
+ if x - self.__work_area[0] >= self.__work_area[2] - 40:
+ self.__toplevel.move(x - allocation.width, y - allocation.height)
def __remove_properties(self):
# reset all properties