devdraw: OS X native version
This commit is contained in:
parent
1e77a39450
commit
9142d36228
12 changed files with 2083 additions and 86 deletions
|
|
@ -10,8 +10,7 @@
|
|||
#include <mouse.h>
|
||||
#include <cursor.h>
|
||||
#include "x11-memdraw.h"
|
||||
|
||||
static int parsewinsize(char*, Rectangle*, int*);
|
||||
#include "devdraw.h"
|
||||
|
||||
static void plan9cmap(void);
|
||||
static int setupcmap(XWindow);
|
||||
|
|
@ -729,74 +728,3 @@ _xreplacescreenimage(void)
|
|||
_drawreplacescreenimage(m);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
parsewinsize(char *s, Rectangle *r, int *havemin)
|
||||
{
|
||||
char c, *os;
|
||||
int i, j, k, l;
|
||||
|
||||
os = s;
|
||||
*havemin = 0;
|
||||
*r = Rect(0,0,0,0);
|
||||
if(!isdigit((uchar)*s))
|
||||
goto oops;
|
||||
i = strtol(s, &s, 0);
|
||||
if(*s == 'x'){
|
||||
s++;
|
||||
if(!isdigit((uchar)*s))
|
||||
goto oops;
|
||||
j = strtol(s, &s, 0);
|
||||
r->max.x = i;
|
||||
r->max.y = j;
|
||||
if(*s == 0)
|
||||
return 0;
|
||||
if(*s != '@')
|
||||
goto oops;
|
||||
|
||||
s++;
|
||||
if(!isdigit((uchar)*s))
|
||||
goto oops;
|
||||
i = strtol(s, &s, 0);
|
||||
if(*s != ',' && *s != ' ')
|
||||
goto oops;
|
||||
s++;
|
||||
if(!isdigit((uchar)*s))
|
||||
goto oops;
|
||||
j = strtol(s, &s, 0);
|
||||
if(*s != 0)
|
||||
goto oops;
|
||||
*r = rectaddpt(*r, Pt(i,j));
|
||||
*havemin = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
c = *s;
|
||||
if(c != ' ' && c != ',')
|
||||
goto oops;
|
||||
s++;
|
||||
if(!isdigit((uchar)*s))
|
||||
goto oops;
|
||||
j = strtol(s, &s, 0);
|
||||
if(*s != c)
|
||||
goto oops;
|
||||
s++;
|
||||
if(!isdigit((uchar)*s))
|
||||
goto oops;
|
||||
k = strtol(s, &s, 0);
|
||||
if(*s != c)
|
||||
goto oops;
|
||||
s++;
|
||||
if(!isdigit((uchar)*s))
|
||||
goto oops;
|
||||
l = strtol(s, &s, 0);
|
||||
if(*s != 0)
|
||||
goto oops;
|
||||
*r = Rect(i,j,k,l);
|
||||
*havemin = 1;
|
||||
return 0;
|
||||
|
||||
oops:
|
||||
werrstr("bad syntax in window size '%s'", os);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue