merge
This commit is contained in:
commit
b1b347a0f4
3 changed files with 34 additions and 21 deletions
|
@ -29,6 +29,9 @@ vncsetdim(Vnc *v, Rectangle dim)
|
||||||
pixbuf = realloc(pixbuf, v->dim.max.x * pixb * v->dim.max.y);
|
pixbuf = realloc(pixbuf, v->dim.max.x * pixb * v->dim.max.y);
|
||||||
if(linebuf == nil || pixbuf == nil)
|
if(linebuf == nil || pixbuf == nil)
|
||||||
sysfatal("can't allocate pix decompression storage");
|
sysfatal("can't allocate pix decompression storage");
|
||||||
|
lockdisplay(display);
|
||||||
|
adjustwin(v, 0);
|
||||||
|
unlockdisplay(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -79,7 +82,7 @@ requestupdate(Vnc *v, int incremental)
|
||||||
r = rectsubpt(screen->r, screen->r.min);
|
r = rectsubpt(screen->r, screen->r.min);
|
||||||
unlockdisplay(display);
|
unlockdisplay(display);
|
||||||
vnclock(v);
|
vnclock(v);
|
||||||
if(incremental == 0 && v->canresize && !eqrect(r, v->dim)){
|
if(incremental == 0 && (v->canresize&2)!=0 && !eqrect(r, v->dim)){
|
||||||
vncwrchar(v, MSetDesktopSize);
|
vncwrchar(v, MSetDesktopSize);
|
||||||
vncwrchar(v, 0);
|
vncwrchar(v, 0);
|
||||||
vncwrpoint(v, r.max);
|
vncwrpoint(v, r.max);
|
||||||
|
|
|
@ -18,6 +18,7 @@ extern Vnc* vnc;
|
||||||
extern int mousefd;
|
extern int mousefd;
|
||||||
|
|
||||||
/* wsys.c */
|
/* wsys.c */
|
||||||
|
extern void adjustwin(Vnc*, int);
|
||||||
extern void readkbd(Vnc*);
|
extern void readkbd(Vnc*);
|
||||||
extern void initmouse(void);
|
extern void initmouse(void);
|
||||||
extern void mousewarp(Point);
|
extern void mousewarp(Point);
|
||||||
|
|
|
@ -10,35 +10,46 @@ struct Mouse {
|
||||||
Point xy;
|
Point xy;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
void
|
||||||
resize(Vnc *v, int first)
|
adjustwin(Vnc *v, int force)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
Point d;
|
Point d;
|
||||||
|
|
||||||
lockdisplay(display);
|
if(force)
|
||||||
if(getwindow(display, Refnone) < 0)
|
d = v->dim.max;
|
||||||
sysfatal("internal error: can't get the window image");
|
else {
|
||||||
if(!v->canresize){
|
|
||||||
/*
|
/*
|
||||||
* limit the window to at most the vnc server's size
|
* limit the window to at most the vnc server's size
|
||||||
*/
|
*/
|
||||||
d = addpt(v->dim.max, Pt(2*Borderwidth, 2*Borderwidth));
|
d = subpt(screen->r.max, screen->r.min);
|
||||||
if(first || d.x < Dx(screen->r) || d.y < Dy(screen->r)){
|
if(d.x > v->dim.max.x){
|
||||||
|
d.x = v->dim.max.x;
|
||||||
|
force = 1;
|
||||||
|
}
|
||||||
|
if(d.y > v->dim.max.y){
|
||||||
|
d.y = v->dim.max.y;
|
||||||
|
force = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(force) {
|
||||||
fd = open("/dev/wctl", OWRITE);
|
fd = open("/dev/wctl", OWRITE);
|
||||||
if(fd >= 0){
|
if(fd >= 0){
|
||||||
fprint(fd, "resize -dx %d -dy %d", d.x, d.y);
|
fprint(fd, "resize -dx %d -dy %d", d.x+2*Borderwidth, d.y+2*Borderwidth);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
unlockdisplay(display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eresized(void)
|
resized(int first)
|
||||||
{
|
{
|
||||||
resize(vnc, 0);
|
lockdisplay(display);
|
||||||
|
if(getwindow(display, Refnone) < 0)
|
||||||
|
sysfatal("internal error: can't get the window image");
|
||||||
|
if((vnc->canresize&2) == 0)
|
||||||
|
adjustwin(vnc, first);
|
||||||
|
unlockdisplay(display);
|
||||||
requestupdate(vnc, 0);
|
requestupdate(vnc, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +141,7 @@ readmouse(Vnc *v)
|
||||||
memmove(curs+2*4, cs->clr, 2*2*16);
|
memmove(curs+2*4, cs->clr, 2*2*16);
|
||||||
write(cursorfd, curs, sizeof curs);
|
write(cursorfd, curs, sizeof curs);
|
||||||
|
|
||||||
resize(v, 1);
|
resized(1);
|
||||||
requestupdate(vnc, 0);
|
|
||||||
start = end = buf;
|
start = end = buf;
|
||||||
len = 0;
|
len = 0;
|
||||||
for(;;){
|
for(;;){
|
||||||
|
@ -155,8 +165,7 @@ readmouse(Vnc *v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
eresized();
|
resized(0);
|
||||||
|
|
||||||
start += EventSize;
|
start += EventSize;
|
||||||
len -= EventSize;
|
len -= EventSize;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue