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)
23 #include "Basewindow.hh"
24 #include "resource.hh"
28 #endif // HAVE_SIGNAL_H
31 # include "../config.h"
32 #endif // HAVE_CONFIG_H
34 #ifdef HAVE_SYS_SIGNAL_H
35 # include <sys/signal.h>
36 #endif // HAVE_SYS_SIGNAL_H
40 # define SA_NODEFER SA_INTERRUPT
41 # else // !SA_INTERRUPT
42 # define SA_NODEFER (0)
43 # endif // SA_INTERRUPT
47 static int handleXErrors(Display
*, XErrorEvent
*);
49 Basewindow::Basewindow(int argc
,char **argv
,struct CMDOPTIONS
*options
)
50 : BaseDisplay(argv
[0], options
->display_name
) {
54 position
=options
->geometry
;
55 withdrawn
=options
->withdrawn
;
56 iconic
=options
->iconic
;
58 miniMe
=options
->miniMe
;
59 tinyMe
=options
->tinyMe
;
61 decorated
=options
->decorated
;
62 config_file
=options
->config_file
;
63 nobb_config
=options
->nobb_config
;
64 current_screen_info
= getScreenInfo(DefaultScreen(getXDisplay()));
65 XSetErrorHandler((XErrorHandler
) handleXErrors
);
67 wm_delete_window
= XInternAtom (getXDisplay(), "WM_DELETE_WINDOW",False
);
70 Basewindow::~Basewindow() {}
72 void Basewindow::process_event(XEvent
*event
)
76 Bool
Basewindow::handleSignal(int sig
) {
95 void Basewindow::setupImageControl() {
96 image_control
= new BImageControl(this,getCurrentScreenInfo(),image_dither
,
98 image_control
->installRootColormap();
102 // X error handler to handle any and all X errors while blackbox is running
103 static int handleXErrors(Display
*d
, XErrorEvent
*e
) {
106 XGetErrorText(d
, e
->error_code
, errtxt
, 128);
108 "bbkeys: [ X Error event received. ]\n"
109 " X Error of failed request: %d %s\n"
110 " Major/minor opcode of failed request: %d / %d\n"
111 " Resource id in failed request: 0x%lx\n", e
->error_code
, errtxt
,
112 e
->request_code
, e
->minor_code
, e
->resourceid
);