- changing MaxInstructions to 100 for cthulhain (crazy nut) =:)
[bbkeys.git] / src / NETInterface.cc
blob285776958d8df4ea991e01e1c53133a7eeaef0d2
1 // NETInterface.cc for bbtools.
2 //
3 // Copyright (c) 1998-1999 by John Kennis, jkennis@chello.nl
4 //
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 //
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)
21 // $Id$
23 #ifdef HAVE_CONFIG_H
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) ;
32 base=basewindow;
33 net_init=False;
34 timer->setTimeout(10000);
35 timer->fireOnce(True);
36 timer->start();
39 void NETInterface::handleNETEvents(XEvent Event) {
40 if (Event.xclient.message_type==base->getBlackboxStructureMessagesAtom()) {
41 if ((unsigned)Event.xclient.data.l[0]==base->getBlackboxNotifyStartupAtom()) {
42 NETNotifyStartup();
43 net_init=True;
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() {
73 if (!net_init) {
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...
76 base->shutdown();