#ifndef RENDER_DEVICE_HPP
#define RENDER_DEVICE_HPP

#define X_DISPLAY_MISSING

#define UGLY_FONT_FLICKER_HACK

#include <Imlib2.h>

#include <cc++/thread.h>

#include "config.hpp"

typedef unsigned char UINT8;

// used as superclass of output devices
class Render_device : public ost::Thread
{
public:
  virtual void redraw() = 0;

  virtual void init() = 0;
  virtual void deinit() = 0;

  void wait_for_output_done();
  void output_is_ready();

  void wait_for_not_drawing();

  // dxr3 specific
  // others don't need to overwrite
  virtual void lock() {};
  virtual void unlock() {};

  virtual ~Render_device() {};

  Render_device();

protected:
  Config *conf;
  ost::Event output_ready;
  ost::Event output_done;

  bool drawing;
  bool new_to_draw;

private:
  virtual void run() = 0;
};

#endif
