show a skull & crossbones cursor as a warning when deleting a window. Notes: Fri Mar 10 13:33:37 EST 2006 rsc i'm not convinced by this. i'm sure that rob did away with the skull and crossbones for a reason and i don't want to have to go change this in the rios and sams floating around. i also didn't apply the pointsto change. what if you move the cursor out of the window and back in? if you checked it after the button came up then i think that might be okay. even so, there's already a way to cancel (press another button). Reference: /n/sources/patch/sorry/rio.bones Date: Thu Mar 9 22:25:04 CET 2006 Reviewed-by: rsc --- /sys/src/cmd/rio/dat.h Thu Mar 9 18:43:58 2006 +++ /sys/src/cmd/rio/dat.h Thu Mar 9 18:43:46 2006 @@ -310,6 +310,7 @@ Cursor boxcursor; Cursor crosscursor; Cursor sightcursor; +Cursor deletecursor; Cursor whitearrow; Cursor query; Cursor *corners[9]; --- /sys/src/cmd/rio/data.c Thu Mar 9 18:44:45 2006 +++ /sys/src/cmd/rio/data.c Thu Mar 9 18:44:33 2006 @@ -46,6 +46,18 @@ 0x21, 0x84, 0x31, 0x8C, 0x0F, 0xF0, 0x00, 0x00, } }; +Cursor deletecursor = { + {-7, -7}, + {0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0xE7, 0xE7, + 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0xFC, 0x0F, 0xF0, + 0x0F, 0xF0, 0x37, 0xEC, 0xF7, 0xEF, 0xF7, 0xEF, + 0xE7, 0xE7, 0xC3, 0xC3, 0x00, 0x00, 0x00, 0x00,}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, + 0xE7, 0xE7, 0x3F, 0xFC, 0x0F, 0xF0, 0x0D, 0xB0, + 0x07, 0xE0, 0x06, 0x60, 0x37, 0xEC, 0xE4, 0x27, + 0xC3, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,} +}; + Cursor whitearrow = { {0, 0}, {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFC, --- /sys/src/cmd/rio/rio.c Thu Mar 9 18:45:43 2006 +++ /sys/src/cmd/rio/rio.c Thu Mar 9 18:45:30 2006 @@ -517,7 +517,7 @@ scrolling = mouse->buttons; else scrolling = mouse->buttons && ptinrect(xy, winput->scrollr); - /* topped will be zero if window has been bottomed */ + /* topped will be zero or less if window has been bottomed */ if(sending == FALSE && !scrolling && winborder(winput, mouse->xy) && winput->topped>0){ moving = TRUE; }else if(inside && (scrolling || winput->mouseopen || (mouse->buttons&1))) @@ -566,7 +566,7 @@ cornercursor(w, mouse->xy, 0); /* we're not sending the event, but if button is down maybe we should */ if(mouse->buttons){ - /* w->topped will be zero if window has been bottomed */ + /* w->topped will be zero or less if window has been bottomed */ if(w==nil || (w==winput && w->topped>0)){ if(mouse->buttons & 1){ ; @@ -999,12 +999,12 @@ } Window* -pointto(int wait) +pointto(int wait, Cursor *cursor) { Window *w; menuing = TRUE; - riosetcursor(&sightcursor, 1); + riosetcursor(cursor, 1); while(mouse->buttons == 0) readmouse(mousectl); if(mouse->buttons == 4) @@ -1018,6 +1018,8 @@ w = nil; } readmouse(mousectl); + if(w != nil && wpointto(mouse->xy) != w) + w = nil; } cornercursor(input, mouse->xy, 0); moveto(mousectl, mouse->xy); /* force cursor update; ugly */ @@ -1030,7 +1032,7 @@ { Window *w; - w = pointto(TRUE); + w = pointto(TRUE, &deletecursor); if(w) wsendctlmesg(w, Deleted, ZR, nil); } @@ -1041,7 +1043,7 @@ Window *w; Image *i; - w = pointto(TRUE); + w = pointto(TRUE, &sightcursor); if(w == nil) return; i = sweep(); @@ -1056,7 +1058,7 @@ Image *i; Rectangle r; - w = pointto(FALSE); + w = pointto(FALSE, &sightcursor); if(w == nil) return; i = drag(w, &r); @@ -1105,7 +1107,7 @@ { Window *w; - w = pointto(TRUE); + w = pointto(TRUE, &sightcursor); if(w == nil) return; whide(w);