devdraw: use indirect impl interface

Setting up for a real window system.
This commit is contained in:
Russ Cox 2020-01-25 14:31:52 -05:00
parent 162d0d5cd9
commit 94d381ec9d
4 changed files with 61 additions and 30 deletions

View file

@ -7,6 +7,7 @@ typedef struct Mousebuf Mousebuf;
typedef struct Tagbuf Tagbuf;
typedef struct Client Client;
typedef struct ClientImpl ClientImpl;
typedef struct DImage DImage;
typedef struct DScreen DScreen;
typedef struct CScreen CScreen;
@ -43,6 +44,18 @@ struct Tagbuf
int wi;
};
struct ClientImpl
{
void (*rpc_resizeimg)(Client*);
void (*rpc_resizewindow)(Client*, Rectangle);
void (*rpc_setcursor)(Client*, Cursor*, Cursor2*);
void (*rpc_setlabel)(Client*, char*);
void (*rpc_setmouse)(Client*, Point);
void (*rpc_topwin)(Client*);
void (*rpc_bouncemouse)(Client*, Mouse);
void (*rpc_flush)(Client*, Rectangle);
};
struct Client
{
int rfd;
@ -82,6 +95,7 @@ struct Client
int nname;
DName* name;
int namevers;
ClientImpl* impl;
// Only accessed/modified by the graphics thread.
const void* view;
@ -196,17 +210,8 @@ void gfx_started(void);
Memimage *rpc_attach(Client*, char*, char*);
char* rpc_getsnarf(void);
void rpc_putsnarf(char*);
void rpc_resizeimg(Client*);
void rpc_resizewindow(Client*, Rectangle);
void rpc_serve(Client*);
void rpc_setcursor(Client*, Cursor*, Cursor2*);
void rpc_setlabel(Client*, char*);
void rpc_setmouse(Client*, Point);
void rpc_shutdown(void);
void rpc_topwin(Client*);
void rpc_main(void);
void rpc_bouncemouse(Client*, Mouse);
void rpc_flush(Client*, Rectangle);
// rpc_gfxdrawlock and rpc_gfxdrawunlock
// are called around drawing operations to lock and unlock