#ifndef WINDOW_H
#define WINDOW_H

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include <xil/xil.h>

#define LOCAL_VIEW 0
#define FAR_VIEW   1

#define STATE_VIEW 1
#define STATE_ICON 3


typedef struct _WinPropState_ {
  int cur_state;
  Window cur_icon;
} WinPropState;

typedef struct {
    int screen;
    int x, y;
    int w, h;
    int display_depth;
    Display *xdisplay;
    Window xwindow;
    float scale[3], offset[3];
    XilImage image, display, imageYCC;
    XilDitherMask mask;
    XilLookup cmap;
    XilSystemState state;
    int view;
    Atom close_atom;
    Atom state_atom;
    WinPropState win_prop_state;
} WindowState;

extern WindowState *initialize_window(XilSystemState state, int w, int h, char* windowname);
extern void display(WindowState * wstate, XilCis cis);
extern void resize(WindowState * wstate, int w, int h);
extern void close_window(WindowState * wstate);
int check_events(WindowState * ws);

int deiconify_window(WindowState * ws);
int iconify_window(WindowState * ws);

#endif				/* WINDOW_H */
