revert previous commit, not ready yet
This commit is contained in:
parent
24e7384007
commit
20fe277f38
5 changed files with 146 additions and 95 deletions
|
@ -172,6 +172,7 @@ struct Window
|
||||||
char *dir;
|
char *dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int winborder(Window*, Point);
|
||||||
void winctl(void*);
|
void winctl(void*);
|
||||||
void winshell(void*);
|
void winshell(void*);
|
||||||
Window* wlookid(int);
|
Window* wlookid(int);
|
||||||
|
|
|
@ -4,7 +4,7 @@ void freescrtemps(void);
|
||||||
int parsewctl(char**, Rectangle, Rectangle*, int*, int*, int*, int*, char**, char*, char*);
|
int parsewctl(char**, Rectangle, Rectangle*, int*, int*, int*, int*, char**, char*, char*);
|
||||||
int writewctl(Xfid*, char*);
|
int writewctl(Xfid*, char*);
|
||||||
Window *new(Image*, int, int, int, char*, char*, char**);
|
Window *new(Image*, int, int, int, char*, char*, char**);
|
||||||
void riosetcursor(Cursor*);
|
void riosetcursor(Cursor*, int);
|
||||||
int min(int, int);
|
int min(int, int);
|
||||||
int max(int, int);
|
int max(int, int);
|
||||||
Rune* strrune(Rune*, Rune);
|
Rune* strrune(Rune*, Rune);
|
||||||
|
@ -28,7 +28,6 @@ void putsnarf(void);
|
||||||
void getsnarf(void);
|
void getsnarf(void);
|
||||||
void timerinit(void);
|
void timerinit(void);
|
||||||
int goodrect(Rectangle);
|
int goodrect(Rectangle);
|
||||||
int inborder(Rectangle, Point);
|
|
||||||
|
|
||||||
#define runemalloc(n) malloc((n)*sizeof(Rune))
|
#define runemalloc(n) malloc((n)*sizeof(Rune))
|
||||||
#define runerealloc(a, n) realloc(a, (n)*sizeof(Rune))
|
#define runerealloc(a, n) realloc(a, (n)*sizeof(Rune))
|
||||||
|
|
|
@ -355,51 +355,11 @@ keyboardthread(void*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
inborder(Rectangle r, Point xy)
|
|
||||||
{
|
|
||||||
return ptinrect(xy, r) && !ptinrect(xy, insetrect(r, Selborder));
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle
|
|
||||||
whichrect(Rectangle r, Point p, int which)
|
|
||||||
{
|
|
||||||
switch(which){
|
|
||||||
case 0: /* top left */
|
|
||||||
r = Rect(p.x, p.y, r.max.x, r.max.y);
|
|
||||||
break;
|
|
||||||
case 2: /* top right */
|
|
||||||
r = Rect(r.min.x, p.y, p.x+1, r.max.y);
|
|
||||||
break;
|
|
||||||
case 6: /* bottom left */
|
|
||||||
r = Rect(p.x, r.min.y, r.max.x, p.y+1);
|
|
||||||
break;
|
|
||||||
case 8: /* bottom right */
|
|
||||||
r = Rect(r.min.x, r.min.y, p.x+1, p.y+1);
|
|
||||||
break;
|
|
||||||
case 1: /* top edge */
|
|
||||||
r = Rect(r.min.x, p.y, r.max.x, r.max.y);
|
|
||||||
break;
|
|
||||||
case 5: /* right edge */
|
|
||||||
r = Rect(r.min.x, r.min.y, p.x+1, r.max.y);
|
|
||||||
break;
|
|
||||||
case 7: /* bottom edge */
|
|
||||||
r = Rect(r.min.x, r.min.y, r.max.x, p.y+1);
|
|
||||||
break;
|
|
||||||
case 3: /* left edge */
|
|
||||||
r = Rect(p.x, r.min.y, r.max.x, r.max.y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return canonrect(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
portion(int x, int lo, int hi)
|
portion(int x, int lo, int hi)
|
||||||
{
|
{
|
||||||
x -= lo;
|
x -= lo;
|
||||||
hi -= lo;
|
hi -= lo;
|
||||||
if(hi < 20)
|
|
||||||
return x > 0 ? 2 : 0;
|
|
||||||
if(x < 20)
|
if(x < 20)
|
||||||
return 0;
|
return 0;
|
||||||
if(x > hi-20)
|
if(x > hi-20)
|
||||||
|
@ -408,15 +368,24 @@ portion(int x, int lo, int hi)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
whichcorner(Rectangle r, Point p)
|
whichcorner(Window *w, Point p)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
i = portion(p.x, r.min.x, r.max.x);
|
i = portion(p.x, w->screenr.min.x, w->screenr.max.x);
|
||||||
j = portion(p.y, r.min.y, r.max.y);
|
j = portion(p.y, w->screenr.min.y, w->screenr.max.y);
|
||||||
return 3*j+i;
|
return 3*j+i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cornercursor(Window *w, Point p, int force)
|
||||||
|
{
|
||||||
|
if(w!=nil && winborder(w, p))
|
||||||
|
riosetcursor(corners[whichcorner(w, p)], force);
|
||||||
|
else
|
||||||
|
wsetcursor(w, force);
|
||||||
|
}
|
||||||
|
|
||||||
/* thread to allow fsysproc to synchronize window closing with main proc */
|
/* thread to allow fsysproc to synchronize window closing with main proc */
|
||||||
void
|
void
|
||||||
winclosethread(void*)
|
winclosethread(void*)
|
||||||
|
@ -480,7 +449,7 @@ keyboardhide(void)
|
||||||
void
|
void
|
||||||
mousethread(void*)
|
mousethread(void*)
|
||||||
{
|
{
|
||||||
int sending, inside, scrolling, moving;
|
int sending, inside, scrolling, moving, band;
|
||||||
Window *w, *winput;
|
Window *w, *winput;
|
||||||
Image *i;
|
Image *i;
|
||||||
Point xy;
|
Point xy;
|
||||||
|
@ -540,7 +509,7 @@ mousethread(void*)
|
||||||
else
|
else
|
||||||
scrolling = mouse->buttons && ptinrect(xy, winput->scrollr);
|
scrolling = mouse->buttons && ptinrect(xy, winput->scrollr);
|
||||||
/* topped will be zero or less if window has been bottomed */
|
/* topped will be zero or less if window has been bottomed */
|
||||||
if(sending == FALSE && !scrolling && inborder(winput->screenr, mouse->xy) && winput->topped>0){
|
if(sending == FALSE && !scrolling && winborder(winput, mouse->xy) && winput->topped>0){
|
||||||
moving = TRUE;
|
moving = TRUE;
|
||||||
}else if(inside && (scrolling || winput->mouseopen || (mouse->buttons&1)))
|
}else if(inside && (scrolling || winput->mouseopen || (mouse->buttons&1)))
|
||||||
sending = TRUE;
|
sending = TRUE;
|
||||||
|
@ -548,31 +517,42 @@ mousethread(void*)
|
||||||
sending = FALSE;
|
sending = FALSE;
|
||||||
if(sending){
|
if(sending){
|
||||||
Sending:
|
Sending:
|
||||||
if(mouse->buttons == 0)
|
if(mouse->buttons == 0){
|
||||||
|
cornercursor(winput, mouse->xy, 0);
|
||||||
sending = FALSE;
|
sending = FALSE;
|
||||||
|
}else
|
||||||
|
wsetcursor(winput, 0);
|
||||||
tmp = mousectl->Mouse;
|
tmp = mousectl->Mouse;
|
||||||
tmp.xy = xy;
|
tmp.xy = xy;
|
||||||
send(winput->mc.c, &tmp);
|
send(winput->mc.c, &tmp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
w = wpointto(mouse->xy);
|
||||||
|
/* change cursor if over anyone's border */
|
||||||
|
if(w != nil)
|
||||||
|
cornercursor(w, mouse->xy, 0);
|
||||||
|
else
|
||||||
|
riosetcursor(nil, 0);
|
||||||
if(moving && (mouse->buttons&7)){
|
if(moving && (mouse->buttons&7)){
|
||||||
incref(winput);
|
incref(winput);
|
||||||
sweeping = TRUE;
|
band = mouse->buttons & 3;
|
||||||
if(mouse->buttons & 3)
|
sweeping = 1;
|
||||||
|
if(band)
|
||||||
i = bandsize(winput);
|
i = bandsize(winput);
|
||||||
else
|
else
|
||||||
i = drag(winput);
|
i = drag(winput);
|
||||||
sweeping = FALSE;
|
sweeping = 0;
|
||||||
if(i != nil)
|
if(i != nil){
|
||||||
wsendctlmesg(winput, Reshaped, i->r, i);
|
wsendctlmesg(winput, Reshaped, i->r, i);
|
||||||
wclose(winput);
|
cornercursor(winput, mouse->xy, 1);
|
||||||
continue;
|
}
|
||||||
|
if(wclose(winput) == 0)
|
||||||
|
w = winput;
|
||||||
|
else {
|
||||||
|
riosetcursor(nil, 0);
|
||||||
|
w = winput = nil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w = wpointto(mouse->xy);
|
|
||||||
if(w!=nil && inborder(w->screenr, mouse->xy))
|
|
||||||
riosetcursor(corners[whichcorner(w->screenr, mouse->xy)]);
|
|
||||||
else
|
|
||||||
wsetcursor(w, FALSE);
|
|
||||||
/* we're not sending the event, but if button is down maybe we should */
|
/* we're not sending the event, but if button is down maybe we should */
|
||||||
if(mouse->buttons){
|
if(mouse->buttons){
|
||||||
/* w->topped will be zero or less if window has been bottomed */
|
/* w->topped will be zero or less if window has been bottomed */
|
||||||
|
@ -590,7 +570,7 @@ mousethread(void*)
|
||||||
}else{
|
}else{
|
||||||
/* if button 1 event in the window, top the window and wait for button up. */
|
/* if button 1 event in the window, top the window and wait for button up. */
|
||||||
/* otherwise, top the window and pass the event on */
|
/* otherwise, top the window and pass the event on */
|
||||||
if(wtop(mouse->xy) && (mouse->buttons!=1 || inborder(w->screenr, mouse->xy)))
|
if(wtop(mouse->xy) && (mouse->buttons!=1 || winborder(w, mouse->xy)))
|
||||||
goto Again;
|
goto Again;
|
||||||
goto Drain;
|
goto Drain;
|
||||||
}
|
}
|
||||||
|
@ -746,7 +726,7 @@ button3menu(void)
|
||||||
free(menu3str[i]);
|
free(menu3str[i]);
|
||||||
menu3str[i] = nil;
|
menu3str[i] = nil;
|
||||||
}
|
}
|
||||||
sweeping = TRUE;
|
sweeping = 1;
|
||||||
switch(i = menuhit(3, mousectl, &menu3, wscreen)){
|
switch(i = menuhit(3, mousectl, &menu3, wscreen)){
|
||||||
case -1:
|
case -1:
|
||||||
break;
|
break;
|
||||||
|
@ -775,7 +755,7 @@ button3menu(void)
|
||||||
unhide(i);
|
unhide(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sweeping = FALSE;
|
sweeping = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -856,7 +836,7 @@ sweep(void)
|
||||||
|
|
||||||
i = nil;
|
i = nil;
|
||||||
menuing = TRUE;
|
menuing = TRUE;
|
||||||
riosetcursor(&crosscursor);
|
riosetcursor(&crosscursor, 1);
|
||||||
while(mouse->buttons == 0)
|
while(mouse->buttons == 0)
|
||||||
readmouse(mousectl);
|
readmouse(mousectl);
|
||||||
p0 = onscreen(mouse->xy);
|
p0 = onscreen(mouse->xy);
|
||||||
|
@ -868,7 +848,6 @@ sweep(void)
|
||||||
if(!eqpt(mouse->xy, p)){
|
if(!eqpt(mouse->xy, p)){
|
||||||
p = onscreen(mouse->xy);
|
p = onscreen(mouse->xy);
|
||||||
r = canonrect(Rpt(p0, p));
|
r = canonrect(Rpt(p0, p));
|
||||||
r = whichrect(r, p, whichcorner(r, p));
|
|
||||||
if(Dx(r)>5 && Dy(r)>5){
|
if(Dx(r)>5 && Dy(r)>5){
|
||||||
i = allocwindow(wscreen, r, Refnone, DNofill);
|
i = allocwindow(wscreen, r, Refnone, DNofill);
|
||||||
freeimage(oi);
|
freeimage(oi);
|
||||||
|
@ -890,18 +869,18 @@ sweep(void)
|
||||||
freeimage(oi);
|
freeimage(oi);
|
||||||
if(i == nil)
|
if(i == nil)
|
||||||
goto Rescue;
|
goto Rescue;
|
||||||
riosetcursor(corners[whichcorner(i->r, mouse->xy)]);
|
cornercursor(input, mouse->xy, 1);
|
||||||
goto Return;
|
goto Return;
|
||||||
|
|
||||||
Rescue:
|
Rescue:
|
||||||
riosetcursor(nil);
|
|
||||||
freeimage(i);
|
freeimage(i);
|
||||||
i = nil;
|
i = nil;
|
||||||
flushimage(display, 1);
|
cornercursor(input, mouse->xy, 1);
|
||||||
while(mouse->buttons)
|
while(mouse->buttons)
|
||||||
readmouse(mousectl);
|
readmouse(mousectl);
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
|
moveto(mousectl, mouse->xy); /* force cursor update; ugly */
|
||||||
menuing = FALSE;
|
menuing = FALSE;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -946,11 +925,11 @@ drag(Window *w)
|
||||||
Rectangle r;
|
Rectangle r;
|
||||||
|
|
||||||
menuing = TRUE;
|
menuing = TRUE;
|
||||||
riosetcursor(&boxcursor);
|
|
||||||
om = mouse->xy;
|
om = mouse->xy;
|
||||||
dm = subpt(om, w->screenr.min);
|
riosetcursor(&boxcursor, 1);
|
||||||
|
dm = subpt(mouse->xy, w->screenr.min);
|
||||||
d = subpt(w->screenr.max, w->screenr.min);
|
d = subpt(w->screenr.max, w->screenr.min);
|
||||||
op = subpt(om, dm);
|
op = subpt(mouse->xy, dm);
|
||||||
drawborder(Rect(op.x, op.y, op.x+d.x, op.y+d.y), 1);
|
drawborder(Rect(op.x, op.y, op.x+d.x, op.y+d.y), 1);
|
||||||
while(mouse->buttons==4){
|
while(mouse->buttons==4){
|
||||||
p = subpt(mouse->xy, dm);
|
p = subpt(mouse->xy, dm);
|
||||||
|
@ -962,11 +941,10 @@ drag(Window *w)
|
||||||
}
|
}
|
||||||
r = Rect(op.x, op.y, op.x+d.x, op.y+d.y);
|
r = Rect(op.x, op.y, op.x+d.x, op.y+d.y);
|
||||||
drawborder(r, 0);
|
drawborder(r, 0);
|
||||||
p = mouse->xy;
|
cornercursor(w, mouse->xy, 1);
|
||||||
riosetcursor(inborder(r, p) ? corners[whichcorner(r, p)] : nil);
|
moveto(mousectl, mouse->xy); /* force cursor update; ugly */
|
||||||
menuing = FALSE;
|
menuing = FALSE;
|
||||||
if(mouse->buttons!=0 || !goodrect(r) || eqrect(r, screen->r)){
|
if(mouse->buttons!=0 || !goodrect(r)){
|
||||||
flushimage(display, 1);
|
|
||||||
while(mouse->buttons)
|
while(mouse->buttons)
|
||||||
readmouse(mousectl);
|
readmouse(mousectl);
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -974,6 +952,70 @@ drag(Window *w)
|
||||||
return allocwindow(wscreen, r, Refbackup, DNofill);
|
return allocwindow(wscreen, r, Refbackup, DNofill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Point
|
||||||
|
cornerpt(Rectangle r, Point p, int which)
|
||||||
|
{
|
||||||
|
switch(which){
|
||||||
|
case 0: /* top left */
|
||||||
|
p = Pt(r.min.x, r.min.y);
|
||||||
|
break;
|
||||||
|
case 2: /* top right */
|
||||||
|
p = Pt(r.max.x,r.min.y);
|
||||||
|
break;
|
||||||
|
case 6: /* bottom left */
|
||||||
|
p = Pt(r.min.x, r.max.y);
|
||||||
|
break;
|
||||||
|
case 8: /* bottom right */
|
||||||
|
p = Pt(r.max.x, r.max.y);
|
||||||
|
break;
|
||||||
|
case 1: /* top edge */
|
||||||
|
p = Pt(p.x,r.min.y);
|
||||||
|
break;
|
||||||
|
case 5: /* right edge */
|
||||||
|
p = Pt(r.max.x, p.y);
|
||||||
|
break;
|
||||||
|
case 7: /* bottom edge */
|
||||||
|
p = Pt(p.x, r.max.y);
|
||||||
|
break;
|
||||||
|
case 3: /* left edge */
|
||||||
|
p = Pt(r.min.x, p.y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
whichrect(Rectangle r, Point p, int which)
|
||||||
|
{
|
||||||
|
switch(which){
|
||||||
|
case 0: /* top left */
|
||||||
|
r = Rect(p.x, p.y, r.max.x, r.max.y);
|
||||||
|
break;
|
||||||
|
case 2: /* top right */
|
||||||
|
r = Rect(r.min.x, p.y, p.x, r.max.y);
|
||||||
|
break;
|
||||||
|
case 6: /* bottom left */
|
||||||
|
r = Rect(p.x, r.min.y, r.max.x, p.y);
|
||||||
|
break;
|
||||||
|
case 8: /* bottom right */
|
||||||
|
r = Rect(r.min.x, r.min.y, p.x, p.y);
|
||||||
|
break;
|
||||||
|
case 1: /* top edge */
|
||||||
|
r = Rect(r.min.x, p.y, r.max.x, r.max.y);
|
||||||
|
break;
|
||||||
|
case 5: /* right edge */
|
||||||
|
r = Rect(r.min.x, r.min.y, p.x, r.max.y);
|
||||||
|
break;
|
||||||
|
case 7: /* bottom edge */
|
||||||
|
r = Rect(r.min.x, r.min.y, r.max.x, p.y);
|
||||||
|
break;
|
||||||
|
case 3: /* left edge */
|
||||||
|
r = Rect(p.x, r.min.y, r.max.x, r.max.y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return canonrect(r);
|
||||||
|
}
|
||||||
|
|
||||||
Image*
|
Image*
|
||||||
bandsize(Window *w)
|
bandsize(Window *w)
|
||||||
{
|
{
|
||||||
|
@ -983,8 +1025,10 @@ bandsize(Window *w)
|
||||||
|
|
||||||
p = mouse->xy;
|
p = mouse->xy;
|
||||||
but = mouse->buttons;
|
but = mouse->buttons;
|
||||||
which = whichcorner(w->screenr, p);
|
which = whichcorner(w, p);
|
||||||
riosetcursor(corners[which]);
|
p = cornerpt(w->screenr, p, which);
|
||||||
|
wmovemouse(w, p);
|
||||||
|
readmouse(mousectl);
|
||||||
r = whichrect(w->screenr, p, which);
|
r = whichrect(w->screenr, p, which);
|
||||||
drawborder(r, 1);
|
drawborder(r, 1);
|
||||||
or = r;
|
or = r;
|
||||||
|
@ -1001,13 +1045,14 @@ bandsize(Window *w)
|
||||||
}
|
}
|
||||||
p = mouse->xy;
|
p = mouse->xy;
|
||||||
drawborder(or, 0);
|
drawborder(or, 0);
|
||||||
if(mouse->buttons!=0 || !goodrect(or) || eqrect(or, w->screenr)
|
wsetcursor(w, 1);
|
||||||
|| abs(p.x-startp.x)+abs(p.y-startp.y) <= 1){
|
if(mouse->buttons!=0 || !goodrect(or)){
|
||||||
flushimage(display, 1);
|
|
||||||
while(mouse->buttons)
|
while(mouse->buttons)
|
||||||
readmouse(mousectl);
|
readmouse(mousectl);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
if(abs(p.x-startp.x)+abs(p.y-startp.y) <= 1)
|
||||||
|
return nil;
|
||||||
return allocwindow(wscreen, or, Refbackup, DNofill);
|
return allocwindow(wscreen, or, Refbackup, DNofill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1017,7 +1062,7 @@ pointto(int wait)
|
||||||
Window *w;
|
Window *w;
|
||||||
|
|
||||||
menuing = TRUE;
|
menuing = TRUE;
|
||||||
riosetcursor(&sightcursor);
|
riosetcursor(&sightcursor, 1);
|
||||||
while(mouse->buttons == 0)
|
while(mouse->buttons == 0)
|
||||||
readmouse(mousectl);
|
readmouse(mousectl);
|
||||||
if(mouse->buttons == 4)
|
if(mouse->buttons == 4)
|
||||||
|
@ -1027,7 +1072,7 @@ pointto(int wait)
|
||||||
if(wait){
|
if(wait){
|
||||||
while(mouse->buttons){
|
while(mouse->buttons){
|
||||||
if(mouse->buttons!=4 && w !=nil){ /* cancel */
|
if(mouse->buttons!=4 && w !=nil){ /* cancel */
|
||||||
riosetcursor(nil);
|
cornercursor(input, mouse->xy, 0);
|
||||||
w = nil;
|
w = nil;
|
||||||
}
|
}
|
||||||
readmouse(mousectl);
|
readmouse(mousectl);
|
||||||
|
@ -1035,7 +1080,8 @@ pointto(int wait)
|
||||||
if(w != nil && wpointto(mouse->xy) != w)
|
if(w != nil && wpointto(mouse->xy) != w)
|
||||||
w = nil;
|
w = nil;
|
||||||
}
|
}
|
||||||
riosetcursor(nil);
|
cornercursor(input, mouse->xy, 0);
|
||||||
|
moveto(mousectl, mouse->xy); /* force cursor update; ugly */
|
||||||
menuing = FALSE;
|
menuing = FALSE;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
@ -1079,6 +1125,7 @@ move(void)
|
||||||
i = drag(w);
|
i = drag(w);
|
||||||
if(i)
|
if(i)
|
||||||
wsendctlmesg(w, Reshaped, i->r, i);
|
wsendctlmesg(w, Reshaped, i->r, i);
|
||||||
|
cornercursor(w, mouse->xy, 1);
|
||||||
wclose(w);
|
wclose(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -687,7 +687,7 @@ wkeyctl(Window *w, Rune r)
|
||||||
--w->holding;
|
--w->holding;
|
||||||
else
|
else
|
||||||
w->holding++;
|
w->holding++;
|
||||||
wsetcursor(w, FALSE);
|
wsetcursor(w, 0);
|
||||||
wrepaint(w);
|
wrepaint(w);
|
||||||
if(r == Kesc)
|
if(r == Kesc)
|
||||||
return;
|
return;
|
||||||
|
@ -871,9 +871,9 @@ wplumb(Window *w)
|
||||||
m->data = runetobyte(w->r+p0, p1-p0, &m->ndata);
|
m->data = runetobyte(w->r+p0, p1-p0, &m->ndata);
|
||||||
if(plumbsend(fd, m) < 0){
|
if(plumbsend(fd, m) < 0){
|
||||||
c = lastcursor;
|
c = lastcursor;
|
||||||
riosetcursor(&query);
|
riosetcursor(&query, 1);
|
||||||
sleep(300);
|
sleep(300);
|
||||||
riosetcursor(c);
|
riosetcursor(c, 1);
|
||||||
}
|
}
|
||||||
plumbfree(m);
|
plumbfree(m);
|
||||||
}
|
}
|
||||||
|
@ -903,6 +903,12 @@ wlook(Window *w)
|
||||||
wshow(w, i);
|
wshow(w, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
winborder(Window *w, Point xy)
|
||||||
|
{
|
||||||
|
return ptinrect(xy, w->screenr) && !ptinrect(xy, insetrect(w->screenr, Selborder));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wmousectl(Window *w)
|
wmousectl(Window *w)
|
||||||
{
|
{
|
||||||
|
@ -1193,7 +1199,7 @@ wctlmesg(Window *w, int m, Rectangle r, void *p)
|
||||||
if(w->i==nil)
|
if(w->i==nil)
|
||||||
break;
|
break;
|
||||||
if(w==input)
|
if(w==input)
|
||||||
wsetcursor(w, FALSE);
|
wsetcursor(w, 0);
|
||||||
wrepaint(w);
|
wrepaint(w);
|
||||||
flushimage(display, 1);
|
flushimage(display, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -1293,8 +1299,6 @@ wsetcursor(Window *w, int force)
|
||||||
{
|
{
|
||||||
Cursor *p;
|
Cursor *p;
|
||||||
|
|
||||||
if(menuing || sweeping)
|
|
||||||
return;
|
|
||||||
if(w==nil || w->i==nil || Dx(w->screenr)<=0)
|
if(w==nil || w->i==nil || Dx(w->screenr)<=0)
|
||||||
p = nil;
|
p = nil;
|
||||||
else if(wpointto(mouse->xy) == w){
|
else if(wpointto(mouse->xy) == w){
|
||||||
|
@ -1303,20 +1307,20 @@ wsetcursor(Window *w, int force)
|
||||||
p = &whitearrow;
|
p = &whitearrow;
|
||||||
}else
|
}else
|
||||||
p = nil;
|
p = nil;
|
||||||
if(force) /* force cursor reload */
|
if(!menuing)
|
||||||
lastcursor = nil;
|
riosetcursor(p, force && !menuing);
|
||||||
riosetcursor(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
riosetcursor(Cursor *p)
|
riosetcursor(Cursor *p, int force)
|
||||||
{
|
{
|
||||||
if(p==lastcursor)
|
if(!force && p==lastcursor)
|
||||||
return;
|
return;
|
||||||
setcursor(mousectl, p);
|
setcursor(mousectl, p);
|
||||||
lastcursor = p;
|
lastcursor = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wtopme(Window *w)
|
wtopme(Window *w)
|
||||||
{
|
{
|
||||||
|
@ -1373,7 +1377,7 @@ wclunk(Window *w)
|
||||||
w->deleted = TRUE;
|
w->deleted = TRUE;
|
||||||
if(w == input){
|
if(w == input){
|
||||||
input = nil;
|
input = nil;
|
||||||
wsetcursor(w, FALSE);
|
wsetcursor(w, 0);
|
||||||
}
|
}
|
||||||
if(w == wkeyboard)
|
if(w == wkeyboard)
|
||||||
wkeyboard = nil;
|
wkeyboard = nil;
|
||||||
|
|
|
@ -478,7 +478,7 @@ xfidwrite(Xfid *x)
|
||||||
memmove(w->cursor.clr, x->data+2*4, 2*2*16);
|
memmove(w->cursor.clr, x->data+2*4, 2*2*16);
|
||||||
w->cursorp = &w->cursor;
|
w->cursorp = &w->cursor;
|
||||||
}
|
}
|
||||||
wsetcursor(w, !sweeping && !menuing);
|
wsetcursor(w, !sweeping);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qlabel:
|
case Qlabel:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue