Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1493768
 поиск   регистрация   авторизация 
 
Группа :: Графические оболочки/KDE
Пакет: kdelibs

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: kdelibs-3.2.2-dock.patch


--- kdelibs-3.2.2/kdecore/kwin.cpp.dock	2004-01-17 13:52:59.000000000 +0100
+++ kdelibs-3.2.2/kdecore/kwin.cpp	2004-05-05 11:41:37.511005880 +0200
@@ -196,10 +196,91 @@
 void KWin::setSystemTrayWindowFor( WId trayWin, WId forWin )
 {
 #if defined Q_WS_X11 && ! defined K_WS_QTONLY
-    NETWinInfo info( qt_xdisplay(), trayWin, qt_xrootwin(), 0 );
-    if ( !forWin )
+
+    bool is_kde = true;
+    Display *xdisplay = qt_xdisplay();
+ 
+    NETRootInfo rootinfo( xdisplay, NET::SupportingWMCheck );
+    const char *wmname = rootinfo.wmName();
+    if ((!wmname) || strncmp("KWin", wmname, 4)) {
+      is_kde = false;
+    }
+
+    if ( !forWin ) {
 	forWin = qt_xrootwin();
+    }
+ 
+    NETWinInfo info( xdisplay, trayWin, qt_xrootwin(), 0 );
     info.setKDESystemTrayWinFor( forWin );
+
+    if (! is_kde) {
+      static Atom net_system_tray_selection;
+      static Atom net_system_tray_opcode;
+      static bool atoms_created = false;
+
+      if (!atoms_created){
+	const int max = 20;
+	Atom* atoms[max];
+	const char* names[max];
+	Atom atoms_return[max];
+	int n = 0;
+
+	QCString screenstr;
+	screenstr.setNum(qt_xscreen());
+	QCString trayatom = "_NET_SYSTEM_TRAY_S" + screenstr;
+
+	atoms[n] = &net_system_tray_selection;
+	names[n++] = trayatom;
+
+	atoms[n] = &net_system_tray_opcode;
+	names[n++] = "_NET_SYSTEM_TRAY_OPCODE";
+
+	// we need a const_cast for the shitty X API
+	XInternAtoms( xdisplay, const_cast<char**>(names), n, 
+		      FALSE, atoms_return );
+
+	for (int i = 0; i < n; i++ )
+	    *atoms[i] = atoms_return[i];
+
+	atoms_created = True;
+      }
+
+      XGrabServer (xdisplay);
+      Window manager_window = XGetSelectionOwner (xdisplay,
+						  net_system_tray_selection);
+      
+      if ( manager_window != None ) {
+	XSelectInput (xdisplay,
+		      manager_window, StructureNotifyMask);
+      }
+      
+
+      XUngrabServer (xdisplay);
+      XFlush (xdisplay);	
+
+      if ( manager_window != None ) {
+
+#define SYSTEM_TRAY_REQUEST_DOCK    0
+#define SYSTEM_TRAY_BEGIN_MESSAGE   1
+#define SYSTEM_TRAY_CANCEL_MESSAGE  2
+         
+	XClientMessageEvent ev;
+	memset(&ev, 0, sizeof(ev));
+	ev.type = ClientMessage;
+	ev.window = manager_window;
+	ev.message_type = net_system_tray_opcode;
+	ev.format = 32;
+	ev.data.l[0] = qt_x_time;
+	ev.data.l[1] = SYSTEM_TRAY_REQUEST_DOCK;
+	ev.data.l[2] = trayWin;
+	
+	XSendEvent (xdisplay,
+		    manager_window, false, NoEventMask, (XEvent *)&ev);
+
+	XSync (xdisplay, False);
+      }
+    }
+
 #endif
 }
 
--- kdelibs-3.2.2/kdeui/ksystemtray.cpp.dock	2004-02-28 10:50:00.000000000 +0100
+++ kdelibs-3.2.2/kdeui/ksystemtray.cpp	2004-05-05 11:40:33.599721872 +0200
@@ -110,6 +110,14 @@
         connect(quitAction, SIGNAL(activated()), qApp, SLOT(closeAllWindows()));
 	d->on_all_desktops = false;
     }
+    // Set this for the freedesktop/GNOME System Tray protocol,
+    // which resizes to the minimum height
+    setMinimumSize((minimumWidth() < 25) ? 25 : minimumWidth(),
+		   (minimumHeight() < 25) ? 25 : minimumHeight());
+    if (width() < minimumWidth())
+      resize(minimumWidth(), height());
+    if (height() < minimumHeight())
+      resize(width(), minimumHeight());
 }
 
 KSystemTray::~KSystemTray()
 
design & coding: Vladimir Lettiev aka crux © 2004-2005