You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
5.7 KiB
146 lines
5.7 KiB
https://github.com/fcitx/fcitx/issues/241
|
|
https://github.com/fcitx/fcitx/commit/c737618fffa84bfe5a6caf55cee9b9288a791bbf
|
|
https://github.com/fcitx/fcitx/commit/353683e29be4ef26409b9a05e0cb647a5180fa8c
|
|
https://github.com/fcitx/fcitx/commit/fe2732db27a1c2e183400ceeb3283559e10a4ca8
|
|
https://github.com/fcitx/fcitx/commit/440c431d29876a8e4871159d289bc9a573f9a41b
|
|
|
|
--- /src/module/notificationitem/notificationitem.c
|
|
+++ /src/module/notificationitem/notificationitem.c
|
|
@@ -565,8 +565,17 @@
|
|
|
|
boolean FcitxNotificationItemEnable(FcitxNotificationItem* notificationitem, FcitxNotificationItemAvailableCallback callback, void* data)
|
|
{
|
|
- if (!callback || notificationitem->callback)
|
|
+ if (!callback)
|
|
return false;
|
|
+
|
|
+ if (notificationitem->callback == callback) {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ if (notificationitem->callback) {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
if (notificationitem->serviceName) {
|
|
FcitxLog(ERROR, "This should not happen, please report bug.");
|
|
return false;
|
|
--- /src/ui/classic/TrayWindow.c
|
|
+++ /src/ui/classic/TrayWindow.c
|
|
@@ -48,7 +48,7 @@
|
|
Display *dpy = classicui->dpy;
|
|
int iScreen = classicui->iScreen;
|
|
char strWindowName[] = "Fcitx Tray Window";
|
|
- if (!classicui->bUseTrayIcon || classicui->isSuspend)
|
|
+ if (!classicui->bUseTrayIcon || classicui->isSuspend || classicui->notificationItemAvailable)
|
|
return;
|
|
|
|
if (trayWindow->window == None && trayWindow->dockWindow != None) {
|
|
@@ -61,12 +61,12 @@
|
|
wsa.colormap = colormap;
|
|
wsa.background_pixel = 0;
|
|
wsa.border_pixel = 0;
|
|
- trayWindow->window = XCreateWindow(dpy, p, -1, -1, 1, 1,
|
|
+ trayWindow->window = XCreateWindow(dpy, p, -1, -1, 22, 22,
|
|
0, vi->depth, InputOutput, vi->visual,
|
|
CWBackPixmap | CWBackPixel | CWBorderPixel | CWColormap, &wsa);
|
|
} else {
|
|
trayWindow->window = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
|
|
- -1, -1, 1, 1, 0,
|
|
+ -1, -1, 22, 22, 0,
|
|
BlackPixel(dpy, DefaultScreen(dpy)),
|
|
WhitePixel(dpy, DefaultScreen(dpy)));
|
|
XSetWindowBackgroundPixmap(dpy, trayWindow->window, ParentRelative);
|
|
@@ -74,6 +74,7 @@
|
|
if (trayWindow->window == (Window) NULL)
|
|
return;
|
|
|
|
+ trayWindow->size = 22;
|
|
XSizeHints size_hints;
|
|
size_hints.flags = PWinGravity | PBaseSize;
|
|
size_hints.base_width = trayWindow->size;
|
|
@@ -161,7 +162,7 @@
|
|
png_surface = image->image;
|
|
|
|
c = cairo_create(trayWindow->cs);
|
|
- cairo_set_source_rgba(c, 0, 0, 0, 0);
|
|
+ cairo_set_source_rgba(c, 1, 1, 1, 0);
|
|
cairo_set_operator(c, CAIRO_OPERATOR_SOURCE);
|
|
cairo_paint(c);
|
|
|
|
@@ -226,8 +227,6 @@
|
|
if (event->xclient.message_type == trayWindow->atoms[ATOM_MANAGER]
|
|
&& event->xclient.data.l[1] == trayWindow->atoms[ATOM_SELECTION]
|
|
&& trayWindow->dockWindow == None) {
|
|
- if (classicui->notificationItemAvailable)
|
|
- return true;
|
|
trayWindow->dockWindow = event->xclient.data.l[2];
|
|
TrayWindowRelease(trayWindow);
|
|
TrayWindowInit(trayWindow);
|
|
@@ -245,6 +244,7 @@
|
|
int size = event->xconfigure.height;
|
|
if (size != trayWindow->size) {
|
|
trayWindow->size = size;
|
|
+ XResizeWindow(dpy, trayWindow->window, size, size);
|
|
XSizeHints size_hints;
|
|
size_hints.flags = PWinGravity | PBaseSize;
|
|
size_hints.base_width = trayWindow->size;
|
|
@@ -286,6 +286,14 @@
|
|
return true;
|
|
}
|
|
break;
|
|
+ case PropertyNotify:
|
|
+ if (event->xproperty.atom == trayWindow->atoms[ATOM_VISUAL] &&
|
|
+ event->xproperty.window == trayWindow->dockWindow) {
|
|
+ TrayWindowRelease(trayWindow);
|
|
+ TrayWindowInit(trayWindow);
|
|
+ return true;
|
|
+ }
|
|
+ break;
|
|
}
|
|
return false;
|
|
}
|
|
--- /src/ui/classic/classicui.c
|
|
+++ /src/ui/classic/classicui.c
|
|
@@ -168,7 +168,7 @@
|
|
void ClassicUIDelayedInitTray(void* arg) {
|
|
FcitxClassicUI* classicui = (FcitxClassicUI*) arg;
|
|
// FcitxLog(INFO, "yeah we delayed!");
|
|
- if (!classicui->bUseTrayIcon)
|
|
+ if (!classicui->bUseTrayIcon || classicui->isSuspend)
|
|
return;
|
|
/*
|
|
* if this return false, something wrong happened and callback
|
|
@@ -187,7 +187,7 @@
|
|
{
|
|
FcitxClassicUI* classicui = (FcitxClassicUI*) arg;
|
|
classicui->trayTimeout = 0;
|
|
- if (!classicui->bUseTrayIcon)
|
|
+ if (!classicui->bUseTrayIcon || classicui->isSuspend)
|
|
return;
|
|
|
|
if (!classicui->trayWindow->bTrayMapped) {
|
|
--- /src/ui/classic/tray.c
|
|
+++ /src/ui/classic/tray.c
|
|
@@ -106,8 +106,9 @@
|
|
|
|
XWindowAttributes attr;
|
|
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attr);
|
|
- if ((attr.your_event_mask & StructureNotifyMask) != StructureNotifyMask) {
|
|
- XSelectInput(dpy, DefaultRootWindow(dpy), attr.your_event_mask | StructureNotifyMask); // for MANAGER selection
|
|
+ int neededMask = StructureNotifyMask;
|
|
+ if ((attr.your_event_mask & neededMask) != neededMask) {
|
|
+ XSelectInput(dpy, DefaultRootWindow(dpy), attr.your_event_mask | neededMask); // for MANAGER selection
|
|
}
|
|
return True;
|
|
}
|
|
@@ -123,7 +124,7 @@
|
|
Display* dpy = tray->owner->dpy;
|
|
|
|
if (tray->dockWindow != None) {
|
|
- XSelectInput(dpy, tray->dockWindow, StructureNotifyMask);
|
|
+ XSelectInput(dpy, tray->dockWindow, PropertyChangeMask | StructureNotifyMask);
|
|
TraySendOpcode(tray, SYSTEM_TRAY_REQUEST_DOCK, tray->window, 0, 0);
|
|
tray->bTrayMapped = True;
|
|
return 1;
|