/*
 * src/display.h - X display management
 *
 * Copyright (C) 1999, 2000 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
 *
 * This 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, or (at your option)
 * any later version.
 * 
 * This software 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 package; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.  
 */

#ifndef __DISPLAY_H__
#define __DISPLAY_H__

#if HAVE_CONFIG_H
# include <config.h>
#endif 

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>

/*  #define SHAPE 1 */

#ifdef SHAPE
#include <X11/extensions/shape.h>
#endif

#include <libsizzle/libsizzle.h>

#define SPACE		3
#define MARGIN		5
#define MINSIZE		15

#define ChildMask	(SubstructureRedirectMask|SubstructureNotifyMask)
#define ButtonMask	(ButtonPressMask|ButtonReleaseMask|ButtonMotionMask)
#define MouseMask	(ButtonMask|PointerMotionMask)

#define HOTKEY_MOD (ControlMask|Mod1Mask)

extern char * display_string;
extern Display * display;
extern XFontStruct * font;
extern int default_screen;
extern Window root_window;
extern GC active_gc;
extern GC inactive_gc;
extern GC box_gc;
extern GC inactive_box_gc;
extern GC border_gc;
extern GC invert_gc;
extern GC menu_gc;
extern GC highlight_gc;
extern GC shadow_gc;
extern XFontStruct * font;
extern int titlebar_height;
extern XColor title_active_color; 
extern XColor title_inactive_color;
extern XColor background_color;
extern XColor background_hl_color;
extern XColor background_sh_color;
extern XColor border_color;
extern Atom _XA_WM_STATE;
extern Atom _XA_WM_CHANGE_STATE;
extern Atom _XA_WM_PROTOS;
extern Atom _XA_WM_DELETE;
extern Atom _XA_WM_CMAPWINS;
extern Cursor move_curs;
extern Cursor resize_curs;
extern int border_width;
extern int tab_scroll_speed;
extern char title_font[];

#ifdef SHAPE
extern Bool shape;
extern int shape_event;
#endif

/* Set this to a predicate which determines whether a window should be
   considered a candidate for cycling through.  */
extern zzz_scm_t cycle_candidate_p;

/* Set this to a predicate which determines whether a window should be
   considered a candidate for making sticky.  */
extern zzz_scm_t sticky_candidate_p;

/* Define user variables which can be set in configuration files.  */
void define_display_variables (void);

/* Initialize all X stuff.  Open the display DISPLAY_STRING (global
   variable), set up error and signal handlers, allocate X resources
   etc.  Returns RESULT_SUCCESS on error, and an error code otherwise.  */
result_t initialize_display (void);

/* Query which windows are currently on the server and adopt them, so
   we can manage them properly.  */
void adopt_windows (void);

/* Cache and returns a font cursor. */
Cursor get_font_cursor (unsigned int shape);

#endif /* not __DISPLAY_H__ */

