2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
14 #if defined(Q_WS_X11) && defined(HAVE_X11)
17 #include <X11/Xutil.h>
20 void Flash::flash(QWidget
* widget
) {
21 // thanks to Marcin Jakubowski for this code
22 // (taken from http://www.qtforum.org/post/52724/lastpost.html#post52724)
24 Display
*xdisplay
= QX11Info::display();
25 Window rootwin
= QX11Info::appRootWindow();
26 Window winId
= widget
->winId();
28 static Atom demandsAttention
= XInternAtom(xdisplay
, "_NET_WM_STATE_DEMANDS_ATTENTION", true);
29 static Atom wmState
= XInternAtom(xdisplay
, "_NET_WM_STATE", true);
32 e
.xclient
.type
= ClientMessage
;
33 e
.xclient
.message_type
= wmState
;
34 e
.xclient
.display
= xdisplay
;
35 e
.xclient
.window
= winId
;
36 e
.xclient
.format
= 32;
37 e
.xclient
.data
.l
[0] = 1;
38 e
.xclient
.data
.l
[1] = demandsAttention
;
39 e
.xclient
.data
.l
[2] = 0l;
40 e
.xclient
.data
.l
[3] = 0l;
41 e
.xclient
.data
.l
[4] = 0l;
43 XSendEvent(xdisplay
, rootwin
, False
, (SubstructureRedirectMask
| SubstructureNotifyMask
), &e
);
46 #elif defined(Q_WS_WIN)
50 void Flash::flash(QWidget
* widget
) {
53 fi
.cbSize
= sizeof(FLASHWINFO
);
54 fi
.hwnd
= widget
->winId();
55 fi
.dwFlags
= FLASHW_TRAY
;
61 FlashWindow(widget
->winId(), TRUE
);
65 #elif defined(Q_WS_MAC)
67 void Flash::flash(QWidget
* /*widget*/) {
72 void Flash::flash(QWidget
* /*widget*/) {