Added real animations to the Shogi animator.
[tagua.git] / src / flash.cpp
blob50d7d3f034bd53bd13c7b8e6595ddf1255e7a588
1 /*
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.
9 */
11 #include <QWidget>
12 #include "flash.h"
14 #if defined(Q_WS_X11) && defined(HAVE_X11)
16 #include <QX11Info>
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);
31 XEvent e;
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)
48 #include <windows.h>
50 void Flash::flash(QWidget* widget) {
51 #if 0
52 FLASHWINFO fi;
53 fi.cbSize = sizeof(FLASHWINFO);
54 fi.hwnd = widget->winId();
55 fi.dwFlags = FLASHW_TRAY;
56 fi.uCount = 3;
57 fi.dwTimeout = 0;
59 FlashWindowEx(&fi);
60 #else
61 FlashWindow(widget->winId(), TRUE);
62 #endif
65 #elif defined(Q_WS_MAC)
67 void Flash::flash(QWidget* /*widget*/) {
70 #else
72 void Flash::flash(QWidget* /*widget*/) {
75 #endif