Fix problem when start ibus with a window manager.
authorHuang Peng <shawn.p.huang@gmail.com>
Wed, 6 Aug 2008 14:32:04 +0000 (22:32 +0800)
committerHuang Peng <shawn.p.huang@gmail.com>
Wed, 6 Aug 2008 14:32:04 +0000 (22:32 +0800)
configure.ac
icons/Makefile.am
launcher/Makefile.am
launcher/ibus.desktop.in [new file with mode: 0644]
launcher/ibus.in
panel/handle.py
panel/languagebar.py

index 1bfaabff9279117c8e9fc3c3c432339fb1359fd1..3233afcffc7ed230e9d0d7b60e37b451b732f899 100644 (file)
@@ -181,6 +181,7 @@ ibus/interface/Makefile
 daemon/Makefile
 daemon/ibus-daemon
 launcher/ibus
+launcher/ibus.desktop
 launcher/Makefile
 panel/Makefile
 panel/ibus-panel
index 23c0f9f1965b686d833e9ccf64df711324113231..5a6617c9c2eac7967258fdbf3931f99805dfd945 100644 (file)
@@ -31,6 +31,7 @@ icons_DATA = \
 iconsdir = $(pkgdatadir)/icons
 
 sysicons_DATA = \
+       ibus.svg \
        ibus-setup.svg \
        $(NULL)
 
index eaf316719613761ec789497be94ebc59cde20723..807f3314b054ac825f6d3181c8204e875f3cbabd 100644 (file)
 
 bin_SCRIPTS = ibus
 
-CLEANFILES = \
-       $(NULL)
+desktop_DATA = ibus.desktop
+desktopdir = $(datadir)/applications
 
 EXTRA_DIST = \
        ibus.in \
+       ibus.desktop.in \
        $(NULL)
 
+CLEANFILES = \
+       $(NULL)
diff --git a/launcher/ibus.desktop.in b/launcher/ibus.desktop.in
new file mode 100644 (file)
index 0000000..d3c5e89
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=IBus
+Comment=Setup utility for IBus
+Exec=ibus
+Icon=ibus
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=Settings;
index 4142b88ecacbe291a8d468a9b3b2f191b501098d..1257411b93c1a67743119062f99e96ec0f73bbcf 100644 (file)
@@ -18,7 +18,9 @@
 # License along with this program; if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 # Boston, MA  02111-1307  USA
+
 import os
+import os.path
 import sys
 import time
 
@@ -29,6 +31,17 @@ conf = "@prefix@/libexec/ibus-gconf"
 
 daemon_pid = 0
 
+logname = os.path.expanduser("~/.ibus-error")
+os.close(0)
+os.close(1)
+os.close(2)
+try:
+       os.unlink(logname)
+except:
+       pass
+fd = os.open(logname, os.O_CREAT | os.O_WRONLY)
+os.dup2(fd, 1)
+os.dup2(fd, 2)
 try:
     print "start ibus-daemon"
     daemon_pid = os.spawnv (os.P_NOWAIT, daemon, [daemon])
index ccd1890594a2001b84a9c1201be332700d089dce..327a01871fb18219aa84a20447910ff737c438e0 100644 (file)
@@ -37,13 +37,15 @@ class Handle(gtk.EventBox):
         self.__move_begined = False
 
         root = gdk.get_default_root_window()
-        workarea = root.property_get("_NET_WORKAREA")[2]
 
     def do_button_press_event(self, event):
         if event.button == 1:
             root = gdk.get_default_root_window()
-            desktop = root.property_get("_NET_CURRENT_DESKTOP")[2][0]
-            self.__workarea = root.property_get("_NET_WORKAREA")[2][desktop * 4: (desktop + 1) * 4]
+            try:
+                desktop = root.property_get("_NET_CURRENT_DESKTOP")[2][0]
+                self.__workarea = root.property_get("_NET_WORKAREA")[2][desktop * 4: (desktop + 1) * 4]
+            except:
+                self.__workarea = None
             self.__move_begined = True
             toplevel = self.get_toplevel()
             x, y = toplevel.get_position()
@@ -70,6 +72,10 @@ class Handle(gtk.EventBox):
         x  = int(event.x_root - self.__press_pos[0])
         y  = int(event.y_root - self.__press_pos[1])
 
+        if self.__workarea == None:
+            toplevel.move(x, y)
+            return
+
         if x < self.__workarea[0] and x > self.__workarea[0] - 16:
             x = self.__workarea[0]
         if y < self.__workarea[1] and y > self.__workarea[1] - 16:
index ce12834f539d9874c5b742cae4361a19f43e3b29..d3081f1e33ef0d0ece57a59252a723dcf776f002 100644 (file)
@@ -56,8 +56,13 @@ class LanguageBar(gtk.Toolbar):
         self.__toplevel.add(self)
 
         root = gdk.get_default_root_window()
-        workarea = root.property_get("_NET_WORKAREA")[2]
-        self.__toplevel.move(workarea[2] - 200, workarea[3] - 40)
+        try:
+            workarea = root.property_get("_NET_WORKAREA")[2]
+            right, bottom = workarea[2], workarea[3]
+        except:
+            right, bottom = 640, 480
+
+        self.__toplevel.move(right - 200, bottom - 40)
 
     def __create_ui(self):
         # create move handle
@@ -144,6 +149,7 @@ class LanguageBar(gtk.Toolbar):
 
     def focus_in(self):
         self.__im_menu.set_sensitive(True)
+        self.__toplevel.window.raise_()
 
     def focus_out(self):
         self.__im_menu.set_sensitive(False)