1 // NETInterface.cc for bbtools.
3 // Copyright (c) 1998-1999 by John Kennis, jkennis@chello.nl
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.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 // (See the included file COPYING / GPL-2.0)
24 # include "../config.h"
25 #endif // HAVE_CONFIG_H
27 #include "NETInterface.hh"
29 NETInterface::NETInterface(Basewindow
*basewindow
) {
31 timer
=new BTimer(basewindow
->getCurrentScreenInfo()->getBaseDisplay(),this) ;
34 timer
->setTimeout(10000);
35 timer
->fireOnce(True
);
39 void NETInterface::handleNETEvents(XEvent Event
) {
40 if (Event
.xclient
.message_type
==base
->getBlackboxStructureMessagesAtom()) {
41 if ((unsigned)Event
.xclient
.data
.l
[0]==base
->getBlackboxNotifyStartupAtom()) {
45 else if ((unsigned)Event
.xclient
.data
.l
[0]==
46 base
->getBlackboxNotifyWindowAddAtom()) {
47 NETNotifyWindowAdd(Event
.xclient
.data
.l
[1],Event
.xclient
.data
.l
[2]);
49 else if ((unsigned)Event
.xclient
.data
.l
[0]==
50 base
->getBlackboxNotifyWindowDelAtom()) {
51 NETNotifyDel(Event
.xclient
.data
.l
[1]);
53 else if ((unsigned)Event
.xclient
.data
.l
[0]==
54 base
->getBlackboxAttributesAtom()) {
55 NETNotifyAttributes(Event
.xclient
.data
.l
[1]);
57 else if ((unsigned)Event
.xclient
.data
.l
[0]==
58 base
->getBlackboxNotifyWindowFocusAtom()){
59 NETNotifyFocus(Event
.xclient
.data
.l
[1]);
61 if ((unsigned)Event
.xclient
.data
.l
[0]==
62 base
->getBlackboxNotifyCurrentWorkspaceAtom()){
63 NETNotifyCurrentWorkspace(Event
.xclient
.data
.l
[1]);
65 else if ((unsigned)Event
.xclient
.data
.l
[0]==
66 base
->getBlackboxNotifyWorkspaceCountAtom()) {
67 NETNotifyWorkspaceCount(Event
.xclient
.data
.l
[1]);
72 void NETInterface::timeout() {
74 fprintf(stderr
,"Cannot connect to window manager\n");
75 /* we'll comment it out for now... I'm not so sure I want to just die out...