1 // Basewindow.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)
25 #endif // HAVE_CONFIG_H
29 #endif // HAVE_SIGNAL_H
31 #ifdef HAVE_SYS_SIGNAL_H
32 # include <sys/signal.h>
33 #endif // HAVE_SYS_SIGNAL_H
37 # define SA_NODEFER SA_INTERRUPT
38 # else // !SA_INTERRUPT
39 # define SA_NODEFER (0)
40 # endif // SA_INTERRUPT
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
) {
53 position
=options
->geometry
;
54 withdrawn
=options
->withdrawn
;
55 iconic
=options
->iconic
;
57 miniMe
=options
->miniMe
;
58 tinyMe
=options
->tinyMe
;
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
) {
94 void Basewindow::setupImageControl() {
95 image_control
= new BImageControl(this,getCurrentScreenInfo(),image_dither
,
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
) {
105 XGetErrorText(d
, e
->error_code
, errtxt
, 128);
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
);