fixing parse error in execcommand
[bbkeys.git] / src / Basewindow.cc
bloba85ddfab03bd8893efad7a4b516916e0518eac00
1 // Basewindow.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 #ifdef HAVE_SIGNAL_H
28 # include <signal.h>
29 #endif // HAVE_SIGNAL_H
31 #ifdef HAVE_SYS_SIGNAL_H
32 # include <sys/signal.h>
33 #endif // HAVE_SYS_SIGNAL_H
35 #ifndef SA_NODEFER
36 # ifdef SA_INTERRUPT
37 # define SA_NODEFER SA_INTERRUPT
38 # else // !SA_INTERRUPT
39 # define SA_NODEFER (0)
40 # endif // SA_INTERRUPT
41 #endif // SA_NODEFER
43 #include "Basewindow.hh"
44 #include "resource.hh"
46 static int handleXErrors(Display *, XErrorEvent *);
48 Basewindow::Basewindow(int argc,char **argv,struct CMDOPTIONS *options)
49 : BaseDisplay(argv[0], options->display_name) {
50 iargc=argc;
51 iargv=argv;
52 config_filename=NULL;
53 position=options->geometry;
54 withdrawn=options->withdrawn;
55 iconic=options->iconic;
56 noQt=options->noQt;
57 miniMe=options->miniMe;
58 tinyMe=options->tinyMe;
59 shape=options->shape;
60 decorated=options->decorated;
61 config_file=options->config_file;
62 nobb_config=options->nobb_config;
63 current_screen_info = getScreenInfo(DefaultScreen(getXDisplay()));
64 XSetErrorHandler((XErrorHandler) handleXErrors);
66 wm_delete_window = XInternAtom (getXDisplay(), "WM_DELETE_WINDOW",False);
69 Basewindow::~Basewindow() {}
71 void Basewindow::process_event(XEvent *)
75 Bool Basewindow::handleSignal(int sig) {
76 switch (sig) {
77 case SIGHUP:
78 reconfigure();
79 break;
81 case SIGSEGV:
82 case SIGFPE:
83 case SIGINT:
84 case SIGTERM:
85 shutdown();
87 default:
88 return False;
91 return True;
94 void Basewindow::setupImageControl() {
95 image_control = new BImageControl(this,getCurrentScreenInfo(),image_dither,
96 colors_per_channel);
97 image_control->installRootColormap();
101 // X error handler to handle any and all X errors while blackbox is running
102 static int handleXErrors(Display *d, XErrorEvent *e) {
103 #ifdef DEBUG
104 char errtxt[128];
105 XGetErrorText(d, e->error_code, errtxt, 128);
106 fprintf(stderr,
107 "bbkeys: [ X Error event received. ]\n"
108 " X Error of failed request: %d %s\n"
109 " Major/minor opcode of failed request: %d / %d\n"
110 " Resource id in failed request: 0x%lx\n", e->error_code, errtxt,
111 e->request_code, e->minor_code, e->resourceid);
112 #endif
113 return(False);