[fcitx] 1. Support GNOME 3 tray icon 2. Fix that main window is covered by GNOME Shell
Liang Suilong
liangsuilong at fedoraproject.org
Sat Jul 2 16:57:47 UTC 2011
commit 0bd7f717468e13682e993e49d56da0c6f33cda81
Author: Fedora <fedora at fedora-desktop.(none)>
Date: Sun Jul 3 00:56:08 2011 +0800
1. Support GNOME 3 tray icon
2. Fix that main window is covered by GNOME Shell
fcitx.spec | 18 ++-
gnome3-mainwindow-pos-walkaround.patch | 12 +
gnome3-tray-fix.patch | 366 ++++++++++++++++++++++++++++++++
sources | 1 -
4 files changed, 391 insertions(+), 6 deletions(-)
---
diff --git a/fcitx.spec b/fcitx.spec
index b35c210..3a7bb04 100644
--- a/fcitx.spec
+++ b/fcitx.spec
@@ -3,14 +3,18 @@
Name: fcitx
Summary: Free Chinese Input Toy for X (XIM)
Version: 4.0.1
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv2+
Group: User Interface/Desktops
URL: http://code.google.com/p/%{name}/
Source0: http://%{name}.googlecode.com/files/%{name}-%{version}_all.tar.gz
Source1: xinput-%{name}
+Patch0: gnome3-tray-fix.patch
+Patch1: gnome3-mainwindow-pos-walkaround.patch
+# These two patches are provide by Weng Xuetian, who is fcitx's author.
BuildRequires: pango-devel dbus-devel
-BuildRequires: wget intltool chrpath
+BuildRequires: wget intltool chrpath sysconftool
+BuildRequires: automake, autoconf, libtool
Requires: %{name}-libs = %{version}-%{release}
Requires: imsettings
Requires(post): %{_sbindir}/alternatives
@@ -40,8 +44,11 @@ developing programs using FCITX libraries.
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
%build
+./autogen.sh
%configure --disable-static \
--enable-dbus \
--enable-tray
@@ -117,12 +124,13 @@ fi
%{_includedir}/fcitx*
%changelog
+* Sun Jul 03 2011 Liang Suilong <liangsuilong at gmail.com> - 4.0.1-3
+- Support GNOME 3 tray icon
+- Fix that main window is covered by GNOME Shell
+
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
-* Fri Dec 17 2010 Liang Suilong <liangsuilong at gmail.com> - 4.0.1-1
-- Update to 4.0.1
-
* Fri Nov 19 2010 Chen Lei <supercyper at 163.com> - 4.0.0-1
- Update to 4.0.0
diff --git a/gnome3-mainwindow-pos-walkaround.patch b/gnome3-mainwindow-pos-walkaround.patch
new file mode 100644
index 0000000..b54b779
--- /dev/null
+++ b/gnome3-mainwindow-pos-walkaround.patch
@@ -0,0 +1,12 @@
+diff -r e9b9346cfabf data/profile.desc
+--- a/data/profile.desc Fri Dec 17 14:06:14 2010 +0800
++++ b/data/profile.desc Sat Jul 02 00:25:48 2011 +0800
+@@ -6,7 +6,7 @@
+ [Profile/MainWindowOffsetY]
+ Description=Main Window Position Y
+ Type=Integer
+-DefaultValue=1
++DefaultValue=40
+
+ [Profile/InputWindowOffsetX]
+ Description=Input Window Position X
diff --git a/gnome3-tray-fix.patch b/gnome3-tray-fix.patch
new file mode 100644
index 0000000..1d69c29
--- /dev/null
+++ b/gnome3-tray-fix.patch
@@ -0,0 +1,366 @@
+diff -r e9b9346cfabf -r b8f3463f19b5 ChangeLog
+--- a/ChangeLog Fri Dec 17 14:06:14 2010 +0800
++++ b/ChangeLog Wed Apr 27 13:36:00 2011 +0800
+@@ -1,3 +1,7 @@
++2011-04-27: CSSlayer <wengxt at gmail.com>
++ * 修复txt2mb在64位系统下的一个bug
++ * 参考Freedesktop.org WM-Spec尝试解决GNOME3窗口显示相关的问题(未验证)
++
+ 2010-12-16: CSSlayer <wengxt at gmail.com>
+ * 增加man
+ * 移除pdf和odt格式的文档,以后fcitx-handbook将分开发布。
+diff -r e9b9346cfabf -r b8f3463f19b5 configure.in
+--- a/configure.in Fri Dec 17 14:06:14 2010 +0800
++++ b/configure.in Wed Apr 27 13:36:00 2011 +0800
+@@ -29,6 +29,10 @@
+ AC_MSG_CHECKING([host platform characteristics])
+
+ case "$host" in
++ *-*-*kfreebsd*)
++ HOST_LIBS="-ldl -lpthread"
++ md5prog=md5sum
++ ;;
+ *-*-*freebsd*)
+ HOST_LIBS="-lexecinfo -pthread"
+ md5prog=gmd5sum
+@@ -37,6 +41,10 @@
+ HOST_LIBS="-ldl -lpthread"
+ md5prog=md5sum
+ ;;
++ *-*-gnu*)
++ HOST_LIBS="-ldl -lpthread"
++ md5prog=md5sum
++ ;;
+ esac
+
+ AC_SUBST(HOST_LIBS)
+diff -r e9b9346cfabf -r b8f3463f19b5 doc/man/createPYMB.1
+--- a/doc/man/createPYMB.1 Fri Dec 17 14:06:14 2010 +0800
++++ b/doc/man/createPYMB.1 Wed Apr 27 13:36:00 2011 +0800
+@@ -27,10 +27,10 @@
+ display help and exit
+ .TP
+ \fBPinyin File\fR
+-Pinyin File is a file with pinyin and one character per line, seperated with space. One available file is in the source of fcitx, named \fIgbkpy.org\fR.
++Pinyin File is a file with pinyin and one character per line, separated with space. One available file is in the source of fcitx, named \fIgbkpy.org\fR.
+ .TP
+ \fBPhrase File\fR
+-Phrase File is a file with full pinyin seperated with ' and the corresponding phrase. The default phrase file of fcitx can be downloaded at http://fcitx.googlecode.com/files/pinyin.tar.gz.
++Phrase File is a file with full pinyin separated with ' and the corresponding phrase. The default phrase file of fcitx can be downloaded at http://fcitx.googlecode.com/files/pinyin.tar.gz.
+ .TP
+ \fBPinyin MB File\fR
+ Pinyin MB File is the binary format of Pinyin File.
+diff -r e9b9346cfabf -r b8f3463f19b5 src/im/special/vk.c
+--- a/src/im/special/vk.c Fri Dec 17 14:06:14 2010 +0800
++++ b/src/im/special/vk.c Wed Apr 27 13:36:00 2011 +0800
+@@ -271,7 +271,7 @@
+ return True;
+ }
+ else if (x >= 99 && x < 270) //空格
+- strcpy (strKey, "\xa1\xa1");
++ strcpy (strKey, " ");
+ else if (x >= 312 && x <= 350) { //ESC
+ SwitchVK ();
+ pstr = (char *) NULL;
+diff -r e9b9346cfabf -r b8f3463f19b5 src/ui/AboutWindow.c
+--- a/src/ui/AboutWindow.c Fri Dec 17 14:06:14 2010 +0800
++++ b/src/ui/AboutWindow.c Wed Apr 27 13:36:00 2011 +0800
+@@ -41,7 +41,7 @@
+ char strTitle[100];
+
+ AboutWindow aboutWindow;
+-extern Atom killAtom, windowTypeAtom, typeDialogAtom;
++extern Atom killAtom;
+ static void InitAboutWindowProperty (void);
+
+ Bool CreateAboutWindow (void)
+@@ -74,18 +74,9 @@
+ {
+ XSetTransientForHint (dpy, aboutWindow.window, DefaultRootWindow (dpy));
+
+- XChangeProperty (dpy, aboutWindow.window, windowTypeAtom, XA_ATOM, 32, PropModeReplace, (void *) &typeDialogAtom, 1);
++ SetWindowProperty(dpy, aboutWindow.window, FCITX_WINDOW_DIALOG, AboutCaption);
+
+ XSetWMProtocols (dpy, aboutWindow.window, &killAtom, 1);
+-
+- char *p;
+-
+- p = AboutCaption;
+-
+- XTextProperty tp;
+- Xutf8TextListToTextProperty(dpy, &p, 1, XUTF8StringStyle, &tp);
+- XSetWMName (dpy, aboutWindow.window, &tp);
+- XFree(tp.value);
+ }
+
+ void DisplayAboutWindow (void)
+diff -r e9b9346cfabf -r b8f3463f19b5 src/ui/InputWindow.c
+--- a/src/ui/InputWindow.c Fri Dec 17 14:06:14 2010 +0800
++++ b/src/ui/InputWindow.c Wed Apr 27 13:36:00 2011 +0800
+@@ -77,7 +77,6 @@
+ {
+ XSetWindowAttributes attrib;
+ unsigned long attribmask;
+- XTextProperty tp;
+ char strWindowName[]="Fcitx Input Window";
+ int depth;
+ Colormap cmap;
+@@ -127,12 +126,7 @@
+ LoadInputMessage();
+ XSelectInput (dpy, inputWindow.window, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask);
+
+- /* Set the name of the window */
+- tp.value = (void *)strWindowName;
+- tp.encoding = XA_STRING;
+- tp.format = 16;
+- tp.nitems = strlen(strWindowName);
+- XSetWMName (dpy, inputWindow.window, &tp);
++ SetWindowProperty(dpy, inputWindow.window, FCITX_WINDOW_DOCK, strWindowName);
+
+ return True;
+ }
+diff -r e9b9346cfabf -r b8f3463f19b5 src/ui/MainWindow.c
+--- a/src/ui/MainWindow.c Fri Dec 17 14:06:14 2010 +0800
++++ b/src/ui/MainWindow.c Wed Apr 27 13:36:00 2011 +0800
+@@ -118,13 +118,7 @@
+ XSelectInput (dpy, mainWindow.window, ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | LeaveWindowMask);
+
+
+- XTextProperty tp;
+- /* Set the name of the window */
+- tp.value = (void *)strWindowName;
+- tp.encoding = XA_STRING;
+- tp.format = 16;
+- tp.nitems = strlen(strWindowName);
+- XSetWMName (dpy, mainWindow.window, &tp);
++ SetWindowProperty(dpy, mainWindow.window, FCITX_WINDOW_DOCK, strWindowName);
+
+ return True;
+ }
+diff -r e9b9346cfabf -r b8f3463f19b5 src/ui/MessageWindow.c
+--- a/src/ui/MessageWindow.c Fri Dec 17 14:06:14 2010 +0800
++++ b/src/ui/MessageWindow.c Wed Apr 27 13:36:00 2011 +0800
+@@ -33,7 +33,7 @@
+
+ extern Display *dpy;
+ extern int iScreen;
+-extern Atom killAtom, windowTypeAtom, typeDialogAtom;
++extern Atom killAtom;
+
+ MessageWindow messageWindow;
+
+@@ -67,7 +67,7 @@
+ {
+ XSetTransientForHint (dpy, messageWindow.window, DefaultRootWindow (dpy));
+
+- XChangeProperty (dpy, messageWindow.window, windowTypeAtom, XA_ATOM, 32, PropModeReplace, (void *) &typeDialogAtom, 1);
++ SetWindowProperty(dpy, messageWindow.window, FCITX_WINDOW_DIALOG, "Fcitx - Message");
+
+ XSetWMProtocols(dpy, messageWindow.window, &killAtom, 1);
+ }
+diff -r e9b9346cfabf -r b8f3463f19b5 src/ui/TrayWindow.c
+--- a/src/ui/TrayWindow.c Fri Dec 17 14:06:14 2010 +0800
++++ b/src/ui/TrayWindow.c Wed Apr 27 13:36:00 2011 +0800
+@@ -43,7 +43,6 @@
+ extern int iScreen;
+
+ Bool CreateTrayWindow() {
+- XTextProperty tp;
+ char strWindowName[]="Fcitx Tray Window";
+ if ( !fc.bUseTrayIcon )
+ return False;
+@@ -80,13 +79,6 @@
+ size_hints.base_height = tray.size;
+ XSetWMNormalHints(dpy, tray.window, &size_hints);
+
+- //Set the name of the window
+- tp.value = (void *)strWindowName;
+- tp.encoding = XA_STRING;
+- tp.format = 16;
+- tp.nitems = strlen(strWindowName);
+- XSetWMName (dpy, tray.window, &tp);
+-
+ if (vi && vi->visual)
+ tray.cs = cairo_xlib_surface_create(dpy, tray.window, tray.visual.visual, 200, 200);
+ else
+@@ -98,6 +90,8 @@
+ XSelectInput (dpy, tray.window, ExposureMask | KeyPressMask | \
+ ButtonPressMask | ButtonReleaseMask | StructureNotifyMask \
+ | EnterWindowMask | PointerMotionMask | LeaveWindowMask | VisibilityChangeMask);
++
++ SetWindowProperty(dpy, tray.window, FCITX_WINDOW_DOCK, strWindowName);
+ return True;
+ }
+
+diff -r e9b9346cfabf -r b8f3463f19b5 src/ui/skin.c
+--- a/src/ui/skin.c Fri Dec 17 14:06:14 2010 +0800
++++ b/src/ui/skin.c Wed Apr 27 13:36:00 2011 +0800
+@@ -600,9 +600,6 @@
+ void LoadInputMessage()
+ {
+ int i = 0;
+- int fontSize;
+-
+- fontSize=sc.skinFont.fontSize;
+
+ ConfigColor cursorColor = sc.skinInputBar.cursorColor;
+ //输入条背景图画笔
+diff -r e9b9346cfabf -r b8f3463f19b5 src/ui/ui.c
+--- a/src/ui/ui.c Fri Dec 17 14:06:14 2010 +0800
++++ b/src/ui/ui.c Wed Apr 27 13:36:00 2011 +0800
+@@ -25,6 +25,7 @@
+
+ #include <X11/Xlocale.h>
+ #include <X11/Xutil.h>
++#include <X11/Xatom.h>
+
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -72,7 +73,9 @@
+ Atom windowTypeAtom;
+ Atom typeMenuAtom;
+ Atom typeDialogAtom;
++Atom typeDockAtom;
+ Atom compManagerAtom;
++Atom pidAtom;
+ Window compManager;
+
+ // added by yunfan
+@@ -94,9 +97,45 @@
+ windowTypeAtom = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE", False);
+ typeMenuAtom = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE_MENU", False);
+ typeDialogAtom = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
++ typeDockAtom = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
++ pidAtom = XInternAtom(dpy, "_NET_WM_PID", False);
+ return True;
+ }
+
++void SetWindowProperty(Display* dpy, Window window, FcitxXWindowType type, char *windowTitle)
++{
++ Atom* wintype = NULL;
++ switch(type)
++ {
++ case FCITX_WINDOW_DIALOG:
++ wintype = &typeDialogAtom;
++ break;
++ case FCITX_WINDOW_DOCK:
++ wintype = &typeDockAtom;
++ break;
++ case FCITX_WINDOW_MENU:
++ wintype = &typeMenuAtom;
++ break;
++ default:
++ wintype = NULL;
++ break;
++ }
++ if (wintype)
++ XChangeProperty (dpy, window, windowTypeAtom, XA_ATOM, 32, PropModeReplace, (void *) wintype, 1);
++
++ pid_t pid = getpid();
++ XChangeProperty(dpy, window, pidAtom, XA_CARDINAL, 32,
++ PropModeReplace, (unsigned char *)&pid, 1);
++
++ if (windowTitle)
++ {
++ XTextProperty tp;
++ Xutf8TextListToTextProperty(dpy, &windowTitle, 1, XUTF8StringStyle, &tp);
++ XSetWMName (dpy, window, &tp);
++ XFree(tp.value);
++ }
++}
++
+ /*
+ * 有关界面的消息都在这里处理
+ * 有关tray重画的问题,此处的解决方案似乎很dirt
+@@ -985,6 +1024,7 @@
+ pango_font_description_set_family(desc, font);
+ return desc;
+ }
++#endif
+
+ Visual * FindARGBVisual (Display *dpy, int scr)
+ {
+@@ -1018,6 +1058,3 @@
+ XFree (xvi);
+ return visual;
+ }
+-
+-
+-#endif
+diff -r e9b9346cfabf -r b8f3463f19b5 src/ui/ui.h
+--- a/src/ui/ui.h Fri Dec 17 14:06:14 2010 +0800
++++ b/src/ui/ui.h Wed Apr 27 13:36:00 2011 +0800
+@@ -30,7 +30,15 @@
+ #include "core/fcitx.h"
+ #include "fcitx-config/fcitx-config.h"
+
++typedef enum FcitxXWindowType {
++ FCITX_WINDOW_UNKNOWN,
++ FCITX_WINDOW_DOCK,
++ FCITX_WINDOW_MENU,
++ FCITX_WINDOW_DIALOG
++} FcitxXWindowType;
++
+ Bool InitX (void);
++void SetWindowProperty(Display* dpy, Window window, FcitxXWindowType type, char *windowTitle);
+ void MyXEventHandler (XEvent * event);
+
+ void OutputString (cairo_t* c, const char *str, const char *font, int fontSize, int x, int y, ConfigColor* color);
+diff -r e9b9346cfabf -r b8f3463f19b5 tools/txt2mb.c
+--- a/tools/txt2mb.c Fri Dec 17 14:06:14 2010 +0800
++++ b/tools/txt2mb.c Wed Apr 27 13:36:00 2011 +0800
+@@ -357,20 +357,20 @@
+ continue;
+ }
+
+- bPY = False;
++ bPY = False;
++ pstr = strCode;
+ if (strCode[0] == cPinyinKey) {
+- size_t length = strlen(strCode);
+- memmove (strCode, strCode + 1, length);
++ pstr ++;
+ bPY = True;
+ }
+
+ //查找是否重复
+ temp = current;
+ if (temp != head) {
+- if (strcmp (temp->strCode, strCode) >= 0) {
+- while (temp != head && strcmp (temp->strCode, strCode) >= 0) {
+- if (!strcmp (temp->strHZ, strHZ) && !strcmp (temp->strCode, strCode)) {
+- printf ("Delete: %s %s\n", strCode, strHZ);
++ if (strcmp (temp->strCode, pstr) >= 0) {
++ while (temp != head && strcmp (temp->strCode, pstr) >= 0) {
++ if (!strcmp (temp->strHZ, strHZ) && !strcmp (temp->strCode, pstr)) {
++ printf ("Delete: %s %s\n", pstr, strHZ);
+ goto _next;
+ }
+ temp = temp->prev;
+@@ -379,13 +379,13 @@
+ if (temp == head)
+ temp = temp->next;
+
+- while (temp != head && strcmp (temp->strCode, strCode) <= 0)
++ while (temp != head && strcmp (temp->strCode, pstr) <= 0)
+ temp = temp->next;
+ }
+ else {
+- while (temp != head && strcmp (temp->strCode, strCode) <= 0) {
+- if (!strcmp (temp->strHZ, strHZ) && !strcmp (temp->strCode, strCode)) {
+- printf ("Delete: %s %s\n", strCode, strHZ);
++ while (temp != head && strcmp (temp->strCode, pstr) <= 0) {
++ if (!strcmp (temp->strHZ, strHZ) && !strcmp (temp->strCode, pstr)) {
++ printf ("Delete: %s %s\n", pstr, strHZ);
+ goto _next;
+ }
+ temp = temp->next;
+@@ -397,7 +397,7 @@
+ newRec = (RECORD *) malloc (sizeof (RECORD));
+ newRec->strCode = (char *) malloc (sizeof (char) * (iPYCodeLength + 1));
+ newRec->strHZ = (char *) malloc (sizeof (char) * strlen (strHZ) + 1);
+- strcpy (newRec->strCode, strCode);
++ strcpy (newRec->strCode, pstr);
+ strcpy (newRec->strHZ, strHZ);
+ newRec->bPinyin = bPY;
+ newRec->iHit = 0;
diff --git a/sources b/sources
index 0fe6a9b..d3ca6de 100644
--- a/sources
+++ b/sources
@@ -1,2 +1 @@
-ce1156b19c719b04bd077f53fc4bd980 fcitx-4.0.0_all.tar.gz
844f6a382ca970d6c3343e12148be641 fcitx-4.0.1_all.tar.gz
More information about the scm-commits
mailing list