module win;

import st;
import patches;

enum WinMode : uint {
    VISIBLE     = 1 << 0,
    FOCUSED     = 1 << 1,
    APPKEYPAD   = 1 << 2,
    MOUSEBTN    = 1 << 3,
    MOUSEMOTION = 1 << 4,
    REVERSE     = 1 << 5,
    KBDLOCK     = 1 << 6,
    HIDE        = 1 << 7,
    APPCURSOR   = 1 << 8,
    MOUSESGR    = 1 << 9,
    MODE_8BIT   = 1 << 10,
    BLINK       = 1 << 11,
    FBLINK      = 1 << 12,
    FOCUS       = 1 << 13,
    MOUSEX10    = 1 << 14,
    MOUSEMANY   = 1 << 15,
    BRCKTPASTE  = 1 << 16,
    NUMLOCK     = 1 << 17,
    PLACEHOLDER = 1 << 18,
}

static if (isPatchEnabled!"KEYBOARDSELECT_PATCH") {
    enum WinMode KBDSELECT = cast(WinMode)(1 << 19);
}

enum WinMode MOUSE = WinMode.MOUSEBTN | WinMode.MOUSEMOTION | WinMode.MOUSEX10 | WinMode.MOUSEMANY;

extern(C):

void xbell();
void xclipcopy();

static if (isPatchEnabled!"LIGATURES_PATCH") {
    void xdrawcursor(int, int, Glyph, int, int, Glyph, Line, int);
} else {
    void xdrawcursor(int, int, Glyph, int, int, Glyph);
}

void xdrawline(Line, int, int, int);
void xfinishdraw();
void xloadcols();
int xsetcolorname(int, const(char)*);
void xseticontitle(char*);

static if (isPatchEnabled!"CSI_22_23_PATCH") {
    void xfreetitlestack();
    void xsettitle(char*, int);
    void xpushtitle();
} else {
    void xsettitle(char*);
}

int xsetcursor(int);
void xsetmode(int, uint);
void xsetpointermotion(int);
void xsetsel(char*);
int xstartdraw();
void xximspot(int, int);
void xclearwin();

static if (isPatchEnabled!"REFLOW_PATCH" && isPatchEnabled!"KEYBOARDSELECT_PATCH") {
    void xdrawglyph(Glyph, int, int);
}