|
Lines 20-34
Link Here
|
| 20 |
// $Id: qtraylabel.cpp,v 1.30 2005/02/09 03:34:06 cs19713 Exp $ |
20 |
// $Id: qtraylabel.cpp,v 1.30 2005/02/09 03:34:06 cs19713 Exp $ |
| 21 |
|
21 |
|
| 22 |
// Include all Qt includes before X |
22 |
// Include all Qt includes before X |
| 23 |
#include <qstring.h> |
23 |
#include <tqt3/ntqstring.h> |
| 24 |
#include <qevent.h> |
24 |
#include <tqt3/ntqevent.h> |
| 25 |
#include <qpoint.h> |
25 |
#include <tqt3/ntqpoint.h> |
| 26 |
#include <qtooltip.h> |
26 |
#include <tqt3/ntqtooltip.h> |
| 27 |
#include <qtimer.h> |
27 |
#include <tqt3/ntqtimer.h> |
| 28 |
#include <qimage.h> |
28 |
#include <tqt3/ntqimage.h> |
| 29 |
#include <qpixmap.h> |
29 |
#include <tqt3/ntqpixmap.h> |
| 30 |
#include <qfileinfo.h> |
30 |
#include <tqt3/ntqfileinfo.h> |
| 31 |
#include <qapplication.h> |
31 |
#include <tqt3/ntqapplication.h> |
| 32 |
#include "trace.h" |
32 |
#include "trace.h" |
| 33 |
#include "qtraylabel.h" |
33 |
#include "qtraylabel.h" |
| 34 |
|
34 |
|
|
Lines 53-76
Link Here
|
| 53 |
mDesktop = 666; // setDockedWindow would set it a saner value |
53 |
mDesktop = 666; // setDockedWindow would set it a saner value |
| 54 |
|
54 |
|
| 55 |
// Balloon's properties are set to match a Qt tool tip (see Qt source) |
55 |
// Balloon's properties are set to match a Qt tool tip (see Qt source) |
| 56 |
mBalloon = new QLabel(0, "balloon", WType_TopLevel | WStyle_StaysOnTop | |
56 |
mBalloon = new TQLabel(0, "balloon", WType_TopLevel | WStyle_StaysOnTop | |
| 57 |
WStyle_Customize | WStyle_NoBorder | |
57 |
WStyle_Customize | WStyle_NoBorder | |
| 58 |
WStyle_Tool | WX11BypassWM); |
58 |
WStyle_Tool | WX11BypassWM); |
| 59 |
mBalloon->setFont(QToolTip::font()); |
59 |
mBalloon->setFont(TQToolTip::font()); |
| 60 |
mBalloon->setPalette(QToolTip::palette()); |
60 |
mBalloon->setPalette(TQToolTip::palette()); |
| 61 |
mBalloon->setAlignment(Qt::AlignLeft | Qt::AlignTop); |
61 |
mBalloon->setAlignment(TQt::AlignLeft | TQt::AlignTop); |
| 62 |
mBalloon->setAutoMask(FALSE); |
62 |
mBalloon->setAutoMask(FALSE); |
| 63 |
mBalloon->setAutoResize(true); |
63 |
mBalloon->setAutoResize(true); |
| 64 |
setAlignment(Qt::AlignCenter); |
64 |
setAlignment(TQt::AlignCenter); |
| 65 |
setBackgroundMode(X11ParentRelative); |
65 |
setBackgroundMode(X11ParentRelative); |
| 66 |
|
66 |
|
| 67 |
connect(&mRealityMonitor, SIGNAL(timeout()), this, SLOT(realityCheck())); |
67 |
connect(&mRealityMonitor, SIGNAL(timeout()), this, SLOT(realityCheck())); |
| 68 |
setDockedWindow(mDockedWindow); |
68 |
setDockedWindow(mDockedWindow); |
| 69 |
|
69 |
|
| 70 |
sysTrayStatus(QPaintDevice::x11AppDisplay(), &mSysTray); |
70 |
sysTrayStatus(TQPaintDevice::x11AppDisplay(), &mSysTray); |
| 71 |
// Subscribe to system tray window notifications |
71 |
// Subscribe to system tray window notifications |
| 72 |
if (mSysTray != None) |
72 |
if (mSysTray != None) |
| 73 |
subscribe(QPaintDevice::x11AppDisplay(), mSysTray, |
73 |
subscribe(TQPaintDevice::x11AppDisplay(), mSysTray, |
| 74 |
StructureNotifyMask, true); |
74 |
StructureNotifyMask, true); |
| 75 |
} |
75 |
} |
| 76 |
|
76 |
|
|
Lines 83-101
Link Here
|
| 83 |
return temp; |
83 |
return temp; |
| 84 |
} |
84 |
} |
| 85 |
|
85 |
|
| 86 |
QTrayLabel::QTrayLabel(Window w, QWidget* parent, const QString& text) |
86 |
QTrayLabel::QTrayLabel(Window w, TQWidget* parent, const TQString& text) |
| 87 |
:QLabel(parent, text, WStyle_Customize | WStyle_NoBorder | WStyle_Tool), |
87 |
:TQLabel(parent, text, WStyle_Customize | WStyle_NoBorder | WStyle_Tool), |
| 88 |
mDockedWindow(w), mPid(0) |
88 |
mDockedWindow(w), mPid(0) |
| 89 |
{ |
89 |
{ |
| 90 |
initialize(); |
90 |
initialize(); |
| 91 |
} |
91 |
} |
| 92 |
|
92 |
|
| 93 |
QTrayLabel::QTrayLabel(const QStringList& pname, pid_t pid, QWidget* parent) |
93 |
QTrayLabel::QTrayLabel(const TQStringList& pname, pid_t pid, TQWidget* parent) |
| 94 |
:QLabel(parent, "TrayLabel", WStyle_Customize | WStyle_NoBorder | WStyle_Tool), |
94 |
:TQLabel(parent, "TrayLabel", WStyle_Customize | WStyle_NoBorder | WStyle_Tool), |
| 95 |
mDockedWindow(None), mProgName(pname), mPid(pid) |
95 |
mDockedWindow(None), mProgName(pname), mPid(pid) |
| 96 |
{ |
96 |
{ |
| 97 |
if (pname[0].at(0) != '/' && pname[0].find('/', 1) > 0) |
97 |
if (pname[0].at(0) != '/' && pname[0].find('/', 1) > 0) |
| 98 |
mProgName[0] = QFileInfo(pname[0]).absFilePath(); // convert to absolute |
98 |
mProgName[0] = TQFileInfo(pname[0]).absFilePath(); // convert to absolute |
| 99 |
initialize(); |
99 |
initialize(); |
| 100 |
} |
100 |
} |
| 101 |
|
101 |
|
|
Lines 117-126
Link Here
|
| 117 |
{ |
117 |
{ |
| 118 |
Window r, parent, *children; |
118 |
Window r, parent, *children; |
| 119 |
unsigned nchildren = 0; |
119 |
unsigned nchildren = 0; |
| 120 |
Display *display = QPaintDevice::x11AppDisplay(); |
120 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 121 |
QString ename = QFileInfo(mProgName[0]).fileName(); // strip out the path |
121 |
TQString ename = TQFileInfo(mProgName[0]).fileName(); // strip out the path |
| 122 |
|
122 |
|
| 123 |
XQueryTree(display, qt_xrootwin(), &r, &parent, &children, &nchildren); |
123 |
XQueryTree(display, tqt_xrootwin(), &r, &parent, &children, &nchildren); |
| 124 |
TRACE("%s nchildren=%i", me(), nchildren); |
124 |
TRACE("%s nchildren=%i", me(), nchildren); |
| 125 |
for(unsigned i=0; i<nchildren; i++) |
125 |
for(unsigned i=0; i<nchildren; i++) |
| 126 |
{ |
126 |
{ |
|
Lines 148-159
Link Here
|
| 148 |
if (mSysTray == None) |
148 |
if (mSysTray == None) |
| 149 |
{ |
149 |
{ |
| 150 |
// Check the system tray status if we were docked |
150 |
// Check the system tray status if we were docked |
| 151 |
if (sysTrayStatus(QPaintDevice::x11AppDisplay(), &mSysTray) |
151 |
if (sysTrayStatus(TQPaintDevice::x11AppDisplay(), &mSysTray) |
| 152 |
!= SysTrayPresent) return; // no luck |
152 |
!= SysTrayPresent) return; // no luck |
| 153 |
|
153 |
|
| 154 |
TRACE("%s System tray present", me()); |
154 |
TRACE("%s System tray present", me()); |
| 155 |
dock(); |
155 |
dock(); |
| 156 |
subscribe(QPaintDevice::x11AppDisplay(), mSysTray, |
156 |
subscribe(TQPaintDevice::x11AppDisplay(), mSysTray, |
| 157 |
StructureNotifyMask, true); |
157 |
StructureNotifyMask, true); |
| 158 |
mRealityMonitor.stop(); |
158 |
mRealityMonitor.stop(); |
| 159 |
return; |
159 |
return; |
|
Lines 169-177
Link Here
|
| 169 |
* scan existing client list and dock. I have never seen this happen |
169 |
* scan existing client list and dock. I have never seen this happen |
| 170 |
* but I see it likely to happen during session restoration |
170 |
* but I see it likely to happen during session restoration |
| 171 |
*/ |
171 |
*/ |
| 172 |
Display *display = QPaintDevice::x11AppDisplay(); |
172 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 173 |
XWindowAttributes attr; |
173 |
XWindowAttributes attr; |
| 174 |
XGetWindowAttributes(display, qt_xrootwin(), &attr); |
174 |
XGetWindowAttributes(display, tqt_xrootwin(), &attr); |
| 175 |
|
175 |
|
| 176 |
if (!(attr.your_event_mask & SubstructureNotifyMask)) |
176 |
if (!(attr.your_event_mask & SubstructureNotifyMask)) |
| 177 |
{ |
177 |
{ |
|
Lines 197-205
Link Here
|
| 197 |
void QTrayLabel::showOnAllDesktops(void) |
197 |
void QTrayLabel::showOnAllDesktops(void) |
| 198 |
{ |
198 |
{ |
| 199 |
TRACE("Showing on all desktops"); |
199 |
TRACE("Showing on all desktops"); |
| 200 |
Display *d = QPaintDevice::x11AppDisplay(); |
200 |
Display *d = TQPaintDevice::x11AppDisplay(); |
| 201 |
long l[5] = { -1, 0, 0, 0, 0 }; // -1 = all, 0 = Desktop1, 1 = Desktop2 ... |
201 |
long l[5] = { -1, 0, 0, 0, 0 }; // -1 = all, 0 = Desktop1, 1 = Desktop2 ... |
| 202 |
sendMessage(d, qt_xrootwin(), mDockedWindow, "_NET_WM_DESKTOP", 32, |
202 |
sendMessage(d, tqt_xrootwin(), mDockedWindow, "_NET_WM_DESKTOP", 32, |
| 203 |
SubstructureNotifyMask | SubstructureRedirectMask, l, sizeof(l)); |
203 |
SubstructureNotifyMask | SubstructureRedirectMask, l, sizeof(l)); |
| 204 |
} |
204 |
} |
| 205 |
|
205 |
|
|
Lines 228-234
Link Here
|
| 228 |
return; |
228 |
return; |
| 229 |
} |
229 |
} |
| 230 |
|
230 |
|
| 231 |
Display *display = QPaintDevice::x11AppDisplay(); |
231 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 232 |
Window wid = winId(); |
232 |
Window wid = winId(); |
| 233 |
|
233 |
|
| 234 |
// 1. GNOME and NET WM Specification |
234 |
// 1. GNOME and NET WM Specification |
|
Lines 261-267
Link Here
|
| 261 |
* working with with a delay of as little as 50ms. But since I |
261 |
* working with with a delay of as little as 50ms. But since I |
| 262 |
* dont understand why this delay is required, I am justifiably paranoid |
262 |
* dont understand why this delay is required, I am justifiably paranoid |
| 263 |
*/ |
263 |
*/ |
| 264 |
QTimer::singleShot(500, this, SLOT(show())); |
264 |
TQTimer::singleShot(500, this, SLOT(show())); |
| 265 |
|
265 |
|
| 266 |
// let the world know |
266 |
// let the world know |
| 267 |
emit docked(this); |
267 |
emit docked(this); |
|
Lines 278-284
Link Here
|
| 278 |
{ |
278 |
{ |
| 279 |
TRACE("%s stopping reality monitor", me()); |
279 |
TRACE("%s stopping reality monitor", me()); |
| 280 |
mRealityMonitor.stop(); |
280 |
mRealityMonitor.stop(); |
| 281 |
XUnmapWindow(QPaintDevice::x11AppDisplay(), winId()); |
281 |
XUnmapWindow(TQPaintDevice::x11AppDisplay(), winId()); |
| 282 |
emit undocked(this); |
282 |
emit undocked(this); |
| 283 |
emit undocked(); |
283 |
emit undocked(); |
| 284 |
} |
284 |
} |
|
Lines 292-298
Link Here
|
| 292 |
mWithdrawn = false; |
292 |
mWithdrawn = false; |
| 293 |
if (mDockedWindow == None) return; |
293 |
if (mDockedWindow == None) return; |
| 294 |
|
294 |
|
| 295 |
Display *display = QPaintDevice::x11AppDisplay(); |
295 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 296 |
|
296 |
|
| 297 |
if (mDesktop == -1) |
297 |
if (mDesktop == -1) |
| 298 |
{ |
298 |
{ |
|
Lines 303-309
Link Here
|
| 303 |
* the WM 200ms to do that. We will override that value to -1 (all |
303 |
* the WM 200ms to do that. We will override that value to -1 (all |
| 304 |
* desktops) on showOnAllDesktops(). |
304 |
* desktops) on showOnAllDesktops(). |
| 305 |
*/ |
305 |
*/ |
| 306 |
QTimer::singleShot(200, this, SLOT(showOnAllDesktops())); |
306 |
TQTimer::singleShot(200, this, SLOT(showOnAllDesktops())); |
| 307 |
} |
307 |
} |
| 308 |
|
308 |
|
| 309 |
/* |
309 |
/* |
|
Lines 325-337
Link Here
|
| 325 |
XSetWMNormalHints(display, mDockedWindow, &mSizeHint); |
325 |
XSetWMNormalHints(display, mDockedWindow, &mSizeHint); |
| 326 |
// make it the active window |
326 |
// make it the active window |
| 327 |
long l[5] = { None, CurrentTime, None, 0, 0 }; |
327 |
long l[5] = { None, CurrentTime, None, 0, 0 }; |
| 328 |
sendMessage(display, qt_xrootwin(), mDockedWindow, "_NET_ACTIVE_WINDOW", 32, |
328 |
sendMessage(display, tqt_xrootwin(), mDockedWindow, "_NET_ACTIVE_WINDOW", 32, |
| 329 |
SubstructureNotifyMask | SubstructureRedirectMask, l, sizeof(l)); |
329 |
SubstructureNotifyMask | SubstructureRedirectMask, l, sizeof(l)); |
| 330 |
// skipTaskbar modifies _NET_WM_STATE. Make sure we dont override WMs value |
330 |
// skipTaskbar modifies _NET_WM_STATE. Make sure we dont override WMs value |
| 331 |
QTimer::singleShot(230, this, SLOT(skipTaskbar())); |
331 |
TQTimer::singleShot(230, this, SLOT(skipTaskbar())); |
| 332 |
// disable docking when minized for some time (since we went to Iconic state) |
332 |
// disable docking when minized for some time (since we went to Iconic state) |
| 333 |
mDockWhenMinimized = !mDockWhenMinimized; |
333 |
mDockWhenMinimized = !mDockWhenMinimized; |
| 334 |
QTimer::singleShot(230, this, SLOT(toggleDockWhenMinimized())); |
334 |
TQTimer::singleShot(230, this, SLOT(toggleDockWhenMinimized())); |
| 335 |
} |
335 |
} |
| 336 |
|
336 |
|
| 337 |
void QTrayLabel::withdraw(void) |
337 |
void QTrayLabel::withdraw(void) |
|
Lines 340-346
Link Here
|
| 340 |
mWithdrawn = true; |
340 |
mWithdrawn = true; |
| 341 |
if (mDockedWindow == None) return; |
341 |
if (mDockedWindow == None) return; |
| 342 |
|
342 |
|
| 343 |
Display *display = QPaintDevice::x11AppDisplay(); |
343 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 344 |
int screen = DefaultScreen(display); |
344 |
int screen = DefaultScreen(display); |
| 345 |
long dummy; |
345 |
long dummy; |
| 346 |
|
346 |
|
|
Lines 360-369
Link Here
|
| 360 |
memset(&ev, 0, sizeof(ev)); |
360 |
memset(&ev, 0, sizeof(ev)); |
| 361 |
ev.type = UnmapNotify; |
361 |
ev.type = UnmapNotify; |
| 362 |
ev.display = display; |
362 |
ev.display = display; |
| 363 |
ev.event = qt_xrootwin(); |
363 |
ev.event = tqt_xrootwin(); |
| 364 |
ev.window = mDockedWindow; |
364 |
ev.window = mDockedWindow; |
| 365 |
ev.from_configure = false; |
365 |
ev.from_configure = false; |
| 366 |
XSendEvent(display, qt_xrootwin(), False, |
366 |
XSendEvent(display, tqt_xrootwin(), False, |
| 367 |
SubstructureRedirectMask|SubstructureNotifyMask, (XEvent *)&ev); |
367 |
SubstructureRedirectMask|SubstructureNotifyMask, (XEvent *)&ev); |
| 368 |
XSync(display, False); |
368 |
XSync(display, False); |
| 369 |
} |
369 |
} |
|
Lines 380-386
Link Here
|
| 380 |
unsigned long __attribute__ ((unused)) left; |
380 |
unsigned long __attribute__ ((unused)) left; |
| 381 |
Atom *data = NULL; |
381 |
Atom *data = NULL; |
| 382 |
unsigned long nitems = 0, num_states = 0; |
382 |
unsigned long nitems = 0, num_states = 0; |
| 383 |
Display *display = QPaintDevice::x11AppDisplay(); |
383 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 384 |
|
384 |
|
| 385 |
TRACE("%s", me()); |
385 |
TRACE("%s", me()); |
| 386 |
Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", True); |
386 |
Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", True); |
|
Lines 439-448
Link Here
|
| 439 |
void QTrayLabel::close(void) |
439 |
void QTrayLabel::close(void) |
| 440 |
{ |
440 |
{ |
| 441 |
TRACE("%s", me()); |
441 |
TRACE("%s", me()); |
| 442 |
Display *display = QPaintDevice::x11AppDisplay(); |
442 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 443 |
long l[5] = { 0, 0, 0, 0, 0 }; |
443 |
long l[5] = { 0, 0, 0, 0, 0 }; |
| 444 |
map(); |
444 |
map(); |
| 445 |
sendMessage(display, qt_xrootwin(), mDockedWindow, "_NET_CLOSE_WINDOW", 32, |
445 |
sendMessage(display, tqt_xrootwin(), mDockedWindow, "_NET_CLOSE_WINDOW", 32, |
| 446 |
SubstructureNotifyMask | SubstructureRedirectMask, |
446 |
SubstructureNotifyMask | SubstructureRedirectMask, |
| 447 |
l, sizeof(l)); |
447 |
l, sizeof(l)); |
| 448 |
} |
448 |
} |
|
Lines 450-459
Link Here
|
| 450 |
/* |
450 |
/* |
| 451 |
* Sets the tray icon. If the icon failed to load, we revert to application icon |
451 |
* Sets the tray icon. If the icon failed to load, we revert to application icon |
| 452 |
*/ |
452 |
*/ |
| 453 |
void QTrayLabel::setTrayIcon(const QString& icon) |
453 |
void QTrayLabel::setTrayIcon(const TQString& icon) |
| 454 |
{ |
454 |
{ |
| 455 |
mCustomIcon = icon; |
455 |
mCustomIcon = icon; |
| 456 |
if (QPixmap(mCustomIcon).isNull()) mCustomIcon = QString::null; |
456 |
if (TQPixmap(mCustomIcon).isNull()) mCustomIcon = TQString::null; |
| 457 |
TRACE("%s mCustomIcon=%s", me(), mCustomIcon.latin1()); |
457 |
TRACE("%s mCustomIcon=%s", me(), mCustomIcon.latin1()); |
| 458 |
updateIcon(); |
458 |
updateIcon(); |
| 459 |
} |
459 |
} |
|
Lines 476-482
Link Here
|
| 476 |
if (mDockedWindow == None) mRealityMonitor.start(500); |
476 |
if (mDockedWindow == None) mRealityMonitor.start(500); |
| 477 |
else mRealityMonitor.stop(); |
477 |
else mRealityMonitor.stop(); |
| 478 |
|
478 |
|
| 479 |
Display *d = QPaintDevice::x11AppDisplay(); |
479 |
Display *d = TQPaintDevice::x11AppDisplay(); |
| 480 |
|
480 |
|
| 481 |
// Subscribe for window or root window events |
481 |
// Subscribe for window or root window events |
| 482 |
if (w == None) subscribe(d, None, SubstructureNotifyMask, true); |
482 |
if (w == None) subscribe(d, None, SubstructureNotifyMask, true); |
|
Lines 499-505
Link Here
|
| 499 |
|
499 |
|
| 500 |
if (mWithdrawn) |
500 |
if (mWithdrawn) |
| 501 |
// show the window for sometime before docking |
501 |
// show the window for sometime before docking |
| 502 |
QTimer::singleShot(1000, this, SLOT(withdraw())); |
502 |
TQTimer::singleShot(1000, this, SLOT(withdraw())); |
| 503 |
else map(); |
503 |
else map(); |
| 504 |
dock(); |
504 |
dock(); |
| 505 |
} |
505 |
} |
|
Lines 511-519
Link Here
|
| 511 |
void QTrayLabel::balloonText() |
511 |
void QTrayLabel::balloonText() |
| 512 |
{ |
512 |
{ |
| 513 |
TRACE("%s BalloonText=%s ToolTipText=%s", me(), |
513 |
TRACE("%s BalloonText=%s ToolTipText=%s", me(), |
| 514 |
mBalloon->text().latin1(), QToolTip::textFor(this).latin1()); |
514 |
mBalloon->text().latin1(), TQToolTip::textFor(this).latin1()); |
| 515 |
|
515 |
|
| 516 |
if (mBalloon->text() == QToolTip::textFor(this)) return; |
516 |
if (mBalloon->text() == TQToolTip::textFor(this)) return; |
| 517 |
#if 0 // I_GOT_NETWM_BALLOONING_TO_WORK |
517 |
#if 0 // I_GOT_NETWM_BALLOONING_TO_WORK |
| 518 |
// if you can get NET WM ballooning to work let me know |
518 |
// if you can get NET WM ballooning to work let me know |
| 519 |
static int id = 1; |
519 |
static int id = 1; |
|
Lines 535-552
Link Here
|
| 535 |
} |
535 |
} |
| 536 |
#else |
536 |
#else |
| 537 |
// Manually do ballooning. See the Qt ToolTip code |
537 |
// Manually do ballooning. See the Qt ToolTip code |
| 538 |
QString oldText = mBalloon->text(); |
538 |
TQString oldText = mBalloon->text(); |
| 539 |
mBalloon->setText(QToolTip::textFor(this)); |
539 |
mBalloon->setText(TQToolTip::textFor(this)); |
| 540 |
if (oldText.isEmpty()) return; // dont tool tip the first time |
540 |
if (oldText.isEmpty()) return; // dont tool tip the first time |
| 541 |
QPoint p = mapToGlobal(QPoint(0, -1 - mBalloon->height())); |
541 |
TQPoint p = mapToGlobal(TQPoint(0, -1 - mBalloon->height())); |
| 542 |
if (p.x() + mBalloon->width() > QApplication::desktop()->width()) |
542 |
if (p.x() + mBalloon->width() > TQApplication::desktop()->width()) |
| 543 |
p.setX(p.x() + width() - mBalloon->width()); |
543 |
p.setX(p.x() + width() - mBalloon->width()); |
| 544 |
|
544 |
|
| 545 |
if (p.y() < 0) p.setY(height() + 1); |
545 |
if (p.y() < 0) p.setY(height() + 1); |
| 546 |
|
546 |
|
| 547 |
mBalloon->move(p); |
547 |
mBalloon->move(p); |
| 548 |
mBalloon->show(); |
548 |
mBalloon->show(); |
| 549 |
QTimer::singleShot(mBalloonTimeout, mBalloon, SLOT(hide())); |
549 |
TQTimer::singleShot(mBalloonTimeout, mBalloon, SLOT(hide())); |
| 550 |
#endif |
550 |
#endif |
| 551 |
} |
551 |
} |
| 552 |
|
552 |
|
|
Lines 555-561
Link Here
|
| 555 |
*/ |
555 |
*/ |
| 556 |
void QTrayLabel::handleTitleChange(void) |
556 |
void QTrayLabel::handleTitleChange(void) |
| 557 |
{ |
557 |
{ |
| 558 |
Display *display = QPaintDevice::x11AppDisplay(); |
558 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 559 |
char *window_name = NULL; |
559 |
char *window_name = NULL; |
| 560 |
|
560 |
|
| 561 |
XFetchName(display, mDockedWindow, &window_name); |
561 |
XFetchName(display, mDockedWindow, &window_name); |
|
Lines 566-573
Link Here
|
| 566 |
XClassHint ch; |
566 |
XClassHint ch; |
| 567 |
if (XGetClassHint(display, mDockedWindow, &ch)) |
567 |
if (XGetClassHint(display, mDockedWindow, &ch)) |
| 568 |
{ |
568 |
{ |
| 569 |
if (ch.res_class) mClass = QString(ch.res_class); |
569 |
if (ch.res_class) mClass = TQString(ch.res_class); |
| 570 |
else if (ch.res_name) mClass = QString(ch.res_name); |
570 |
else if (ch.res_name) mClass = TQString(ch.res_name); |
| 571 |
|
571 |
|
| 572 |
if (ch.res_class) XFree(ch.res_class); |
572 |
if (ch.res_class) XFree(ch.res_class); |
| 573 |
if (ch.res_name) XFree(ch.res_name); |
573 |
if (ch.res_name) XFree(ch.res_name); |
|
Lines 584-592
Link Here
|
| 584 |
void QTrayLabel::updateTitle() |
584 |
void QTrayLabel::updateTitle() |
| 585 |
{ |
585 |
{ |
| 586 |
TRACE("%s", me()); |
586 |
TRACE("%s", me()); |
| 587 |
QString text = mTitle + " [" + mClass + "]"; |
587 |
TQString text = mTitle + " [" + mClass + "]"; |
| 588 |
QToolTip::remove(this); |
588 |
TQToolTip::remove(this); |
| 589 |
QToolTip::add(this, text); |
589 |
TQToolTip::add(this, text); |
| 590 |
|
590 |
|
| 591 |
if (mBalloonTimeout) balloonText(); |
591 |
if (mBalloonTimeout) balloonText(); |
| 592 |
} |
592 |
} |
|
Lines 598-604
Link Here
|
| 598 |
TRACE("%s", me()); |
598 |
TRACE("%s", me()); |
| 599 |
if (mDockedWindow == None) return; |
599 |
if (mDockedWindow == None) return; |
| 600 |
|
600 |
|
| 601 |
Display *display = QPaintDevice::x11AppDisplay(); |
601 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 602 |
XWMHints *wm_hints = XGetWMHints(display, mDockedWindow); |
602 |
XWMHints *wm_hints = XGetWMHints(display, mDockedWindow); |
| 603 |
if (wm_hints != NULL) |
603 |
if (wm_hints != NULL) |
| 604 |
{ |
604 |
{ |
|
Lines 614-626
Link Here
|
| 614 |
wm_hints->icon_mask, NULL); |
614 |
wm_hints->icon_mask, NULL); |
| 615 |
XFree(wm_hints); |
615 |
XFree(wm_hints); |
| 616 |
} |
616 |
} |
| 617 |
QImage image; |
617 |
TQImage image; |
| 618 |
if (!window_icon) |
618 |
if (!window_icon) |
| 619 |
{ |
619 |
{ |
| 620 |
if (!image.load(QString(ICONS_PATH) + "/question.png")) |
620 |
if (!image.load(TQString(ICONS_PATH) + "/question.png")) |
| 621 |
image.load(qApp->applicationDirPath() + "/icons/question.png"); |
621 |
image.load(tqApp->applicationDirPath() + "/icons/question.png"); |
| 622 |
} |
622 |
} |
| 623 |
else image = QPixmap((const char **) window_icon).convertToImage(); |
623 |
else image = TQPixmap((const char **) window_icon).convertToImage(); |
| 624 |
if (window_icon) XpmFree(window_icon); |
624 |
if (window_icon) XpmFree(window_icon); |
| 625 |
mAppIcon = image.smoothScale(24, 24); // why? |
625 |
mAppIcon = image.smoothScale(24, 24); // why? |
| 626 |
setMinimumSize(mAppIcon.size()); |
626 |
setMinimumSize(mAppIcon.size()); |
|
Lines 637-650
Link Here
|
| 637 |
TRACE("%s", me()); |
637 |
TRACE("%s", me()); |
| 638 |
setPixmap(mCustomIcon.isEmpty() ? mAppIcon : mCustomIcon); |
638 |
setPixmap(mCustomIcon.isEmpty() ? mAppIcon : mCustomIcon); |
| 639 |
erase(); |
639 |
erase(); |
| 640 |
QPaintEvent pe(rect()); |
640 |
TQPaintEvent pe(rect()); |
| 641 |
paintEvent(&pe); |
641 |
paintEvent(&pe); |
| 642 |
} |
642 |
} |
| 643 |
|
643 |
|
| 644 |
/* |
644 |
/* |
| 645 |
* Mouse activity on our label. RightClick = Menu. LeftClick = Toggle Map |
645 |
* Mouse activity on our label. RightClick = Menu. LeftClick = Toggle Map |
| 646 |
*/ |
646 |
*/ |
| 647 |
void QTrayLabel::mouseReleaseEvent(QMouseEvent * ev) |
647 |
void QTrayLabel::mouseReleaseEvent(TQMouseEvent * ev) |
| 648 |
{ |
648 |
{ |
| 649 |
emit clicked(ev->button(), ev->globalPos()); |
649 |
emit clicked(ev->button(), ev->globalPos()); |
| 650 |
} |
650 |
} |
|
Lines 652-658
Link Here
|
| 652 |
/* |
652 |
/* |
| 653 |
* Track drag event |
653 |
* Track drag event |
| 654 |
*/ |
654 |
*/ |
| 655 |
void QTrayLabel::dragEnterEvent(QDragEnterEvent *ev) |
655 |
void QTrayLabel::dragEnterEvent(TQDragEnterEvent *ev) |
| 656 |
{ |
656 |
{ |
| 657 |
ev->accept(); |
657 |
ev->accept(); |
| 658 |
map(); |
658 |
map(); |
|
Lines 702-712
Link Here
|
| 702 |
|
702 |
|
| 703 |
TRACE("%s Will analyze window 0x%x", me(), (int)((XMapEvent *)event)->window); |
703 |
TRACE("%s Will analyze window 0x%x", me(), (int)((XMapEvent *)event)->window); |
| 704 |
// Check if this window is the soulmate we are looking for |
704 |
// Check if this window is the soulmate we are looking for |
| 705 |
Display *display = QPaintDevice::x11AppDisplay(); |
705 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 706 |
Window w = XmuClientWindow(display, ((XMapEvent *) event)->window); |
706 |
Window w = XmuClientWindow(display, ((XMapEvent *) event)->window); |
| 707 |
if (!isNormalWindow(display, w)) return FALSE; |
707 |
if (!isNormalWindow(display, w)) return FALSE; |
| 708 |
if (!analyzeWindow(display, w, mPid, |
708 |
if (!analyzeWindow(display, w, mPid, |
| 709 |
QFileInfo(mProgName[0]).fileName().latin1())) return FALSE; |
709 |
TQFileInfo(mProgName[0]).fileName().latin1())) return FALSE; |
| 710 |
// All right. Lets dock this baby |
710 |
// All right. Lets dock this baby |
| 711 |
setDockedWindow(w); |
711 |
setDockedWindow(w); |
| 712 |
return true; |
712 |
return true; |
|
Lines 727-733
Link Here
|
| 727 |
|
727 |
|
| 728 |
void QTrayLabel::propertyChangeEvent(Atom property) |
728 |
void QTrayLabel::propertyChangeEvent(Atom property) |
| 729 |
{ |
729 |
{ |
| 730 |
Display *display = QPaintDevice::x11AppDisplay(); |
730 |
Display *display = TQPaintDevice::x11AppDisplay(); |
| 731 |
static Atom WM_NAME = XInternAtom(display, "WM_NAME", True); |
731 |
static Atom WM_NAME = XInternAtom(display, "WM_NAME", True); |
| 732 |
static Atom WM_ICON = XInternAtom(display, "WM_ICON", True); |
732 |
static Atom WM_ICON = XInternAtom(display, "WM_ICON", True); |
| 733 |
static Atom WM_STATE = XInternAtom(display, "WM_STATE", True); |
733 |
static Atom WM_STATE = XInternAtom(display, "WM_STATE", True); |
|
Lines 764-770
Link Here
|
| 764 |
} |
764 |
} |
| 765 |
|
765 |
|
| 766 |
// Session Management |
766 |
// Session Management |
| 767 |
bool QTrayLabel::saveState(QSettings &settings) |
767 |
bool QTrayLabel::saveState(TQSettings &settings) |
| 768 |
{ |
768 |
{ |
| 769 |
TRACE("%s saving state", me()); |
769 |
TRACE("%s saving state", me()); |
| 770 |
settings.writeEntry("/Application", mProgName.join(" ")); |
770 |
settings.writeEntry("/Application", mProgName.join(" ")); |
|
Lines 776-782
Link Here
|
| 776 |
return true; |
776 |
return true; |
| 777 |
} |
777 |
} |
| 778 |
|
778 |
|
| 779 |
bool QTrayLabel::restoreState(QSettings &settings) |
779 |
bool QTrayLabel::restoreState(TQSettings &settings) |
| 780 |
{ |
780 |
{ |
| 781 |
TRACE("%s restoring state", me()); |
781 |
TRACE("%s restoring state", me()); |
| 782 |
mCustomIcon = settings.readEntry("/CustomIcon"); |
782 |
mCustomIcon = settings.readEntry("/CustomIcon"); |
|
Lines 795-801
Link Here
|
| 795 |
* the application really shows itself up before we do a scan (the reason |
795 |
* the application really shows itself up before we do a scan (the reason |
| 796 |
* why we have 2s |
796 |
* why we have 2s |
| 797 |
*/ |
797 |
*/ |
| 798 |
if (!mPid) QTimer::singleShot(2000, this, SLOT(scanClients())); |
798 |
if (!mPid) TQTimer::singleShot(2000, this, SLOT(scanClients())); |
| 799 |
|
799 |
|
| 800 |
return true; |
800 |
return true; |
| 801 |
} |
801 |
} |