File: Basewindow.cc

package info (click to toggle)
bbpager 0.1.6-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 460 kB
  • ctags: 543
  • sloc: cpp: 4,335; sh: 327; makefile: 60
file content (70 lines) | stat: -rw-r--r-- 2,399 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//  Basewindow.cc for bbtools.
//
//  Copyright (c) 1998-1999 by John Kennis, jkennis@chello.nl
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// (See the included file COPYING / GPL-2.0)
//
#include "Basewindow.hh"
#include "resource.hh"

static int handleXErrors(Display *, XErrorEvent *);

Basewindow::Basewindow(int argc,char **argv,struct CMDOPTIONS *options)
  : BaseDisplay(options->display_name) {
  iargc=argc;
  iargv=argv;
  config_filename=NULL;
  position=options->geometry;
  withdrawn=options->withdrawn;
  shape=options->shape;
  decorated=options->decorated;
  config_file=options->config_file;
  nobb_config=options->nobb_config;          
  current_screen_info = getScreenInfo(DefaultScreen(getDisplay()));
  XSetErrorHandler((XErrorHandler) handleXErrors);

  wm_delete_window = XInternAtom (getDisplay(), "WM_DELETE_WINDOW",False);
}

Basewindow::~Basewindow() {}

void Basewindow::process_event(XEvent *event)
{
}

void Basewindow::setupImageControl() {
  image_control = new BImageControl(this,getCurrentScreenInfo(),image_dither,
                                    colors_per_channel);
  image_control->installRootColormap();
}


// X error handler to handle any and all X errors while blackbox is running
static int handleXErrors(Display *d, XErrorEvent *e) {
#ifdef DEBUG  
  char errtxt[128];
  XGetErrorText(d, e->error_code, errtxt, 128);
  fprintf(stderr,
          "bbpager:  [ X Error event received. ]\n"
          "  X Error of failed request:  %d %s\n"
          "  Major/minor opcode of failed request:  %d / %d\n"
          "  Resource id in failed request:  0x%lx\n", e->error_code, errtxt,
          e->request_code, e->minor_code, e->resourceid);
#endif
  return(False);
}