view ui.h @ 490:9141f13be70c dev-1_0_3

Don't set conn->err if we are handling EINTR and it isn't supposed to get to higher level. Fixes NNChat quitting unexpectedly when resizing a terminal window causes EINTR for select() in the network polling.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 27 May 2012 09:23:12 +0300
parents 607bd4491e79
children 56689f94e827
line wrap: on
line source

/*
 * NNChat - Custom chat client for NewbieNudes.com chatrooms
 * Written by Matti 'ccr' Hämäläinen
 * (C) Copyright 2008-2012 Tecnic Software productions (TNSP)
 */
#ifndef LIBNNUI_H
#define LIBNNUI_H

#ifdef __WIN32
// Undefine because both windows.h and curses.h #define it
#undef MOUSE_MOVED
#endif
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif
#include "th_types.h"
#include "th_string.h"


#define SET_MAX_WINDOWS (32)
#define NN_BACKBUF_LEN    (512)       // Backbuffer size (in lines)

typedef struct
{
    qringbuf_t *data;   // "Backbuffer" data for this window
    int pos;            // Current position in the window, 0 = real time
    BOOL dirty;

    char *id;           // Chatter ID, NULL = main window
    int num;		// Window number

    char *buf;
    size_t len, bufsize;
    size_t chlen;
} nn_window_t;


extern nn_window_t *currWin;
extern BOOL cursesInit;
extern WINDOW *mainWin, *statusWin, *editWin;

BOOL nnwin_init(int delay);
void nnwin_shutdown();

BOOL nnwin_init_windows(void);
void nnwin_close_windows(void);

nn_window_t *nnwin_main_window();
nn_window_t *nnwin_get(const int index);
nn_window_t *nnwin_find(const char *id);

BOOL     nnwin_open(const char *name, BOOL curwin);
void     nnwin_close(nn_window_t *win);

void     nnwin_update_statusline(char *optUserName, int optUserColor);
void     nnwin_update_editbuf(nn_editbuf_t *buf);
int      nnwin_print(WINDOW *win, const char *fmt);
int      nnwin_print_buf(nn_window_t *win, const char *fmt);
void     nnwin_update_all(void);
char *   nnwin_prompt_requester(WINDOW *win, const char *info, BOOL allowEmpty);
BOOL     nnwin_update_main(BOOL force);


#endif