Home » Archimedes archive » Acorn Computing » 1994 05.adf » 9405 » TechForum/EventFix
TechForum/EventFix
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn Computing » 1994 05.adf » 9405 |
Filename: | TechForum/EventFix |
Read OK: | ✔ |
File size: | 094C bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
The following describes changes to be made to Acorn's RISC_OSLib C library source code, in order to remove several bugs as described in TechForum. This relates to the file c.event, & within that, to the function event__process (note the double _ character). Before: /* Look for menu events */ if (e->e == wimp_EBUT && (wimp_BMID & e->data.but.m.bbits) != 0) { Insert: /*mod by mroz, 19/10/93, re menu opening due to menu click on a menu-button*/ if (e->e == wimp_EBUT && e->data.but.m.i > -1) { wimp_icon ic; wimpt_complain(wimp_get_icon_info(e->data.but.m.w, e->data.but.m.i, &ic)); if ( (ic.flags & (wimp_ITEXT | wimp_ISPRITE | wimp_INDIRECT)) == (wimp_ITEXT | wimp_ISPRITE | wimp_INDIRECT) ) { char buf[256], *pd, *ps; for (pd=buf, ps=ic.data.indirecttext.validstring; pd<buf+255 && *ps>31; pd++, ps++) *pd=*ps; *pd=0; if (strstr(buf, "sgright,pgright")) { wimp_wstate s; e->data.but.m.bbits |= wimp_BMID; /*make this look like a menu button click*/ wimpt_complain(wimp_get_wind_state(e->data.but.m.w, &s)); e->data.but.m.x = s.o.box.x0-s.o.x + ic.box.x1 + 48; /*comply with style guide p96*/ e->data.but.m.y = s.o.box.y1-s.o.y + ic.box.y1; } } } Change: while (1) { e->data.but.m.y += m->height + m->gap; if ((mi->flags & wimp_MLAST) != 0) break; mi++; } To: while (1) { e->data.but.m.y += m->height + m->gap; /*mod by mroz, 19/2/94, re icon bar menu containing dotted line separators - Acorn code was wrong*/ if (mi->flags & wimp_MSEPARATE) e->data.but.m.y += 24; /*end of mod*/ if ((mi->flags & wimp_MLAST) != 0) break; mi++; } Change: event__menux = e->data.but.m.x; event__menuy = e->data.but.m.y; wimpt_complain(wimp_create_menu((wimp_menustr*) m, e->data.but.m.x - 48, e->data.but.m.y)); To: event__menux = e->data.but.m.x-=48; event__menuy = e->data.but.m.y; wimpt_complain(wimp_create_menu((wimp_menustr*) m, e->data.but.m.x, e->data.but.m.y));
00000000 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 |.The following d| 00000010 65 73 63 72 69 62 65 73 20 63 68 61 6e 67 65 73 |escribes changes| 00000020 20 74 6f 20 62 65 20 6d 61 64 65 20 74 6f 20 41 | to be made to A| 00000030 63 6f 72 6e 27 73 20 52 49 53 43 5f 4f 53 4c 69 |corn's RISC_OSLi| 00000040 62 20 43 20 6c 69 62 72 61 72 79 20 73 6f 75 72 |b C library sour| 00000050 63 65 20 63 6f 64 65 2c 20 69 6e 20 6f 72 64 65 |ce code, in orde| 00000060 72 20 74 6f 20 72 65 6d 6f 76 65 0a 73 65 76 65 |r to remove.seve| 00000070 72 61 6c 20 62 75 67 73 20 61 73 20 64 65 73 63 |ral bugs as desc| 00000080 72 69 62 65 64 20 69 6e 20 54 65 63 68 46 6f 72 |ribed in TechFor| 00000090 75 6d 2e 20 54 68 69 73 20 72 65 6c 61 74 65 73 |um. This relates| 000000a0 20 74 6f 20 74 68 65 20 66 69 6c 65 20 63 2e 65 | to the file c.e| 000000b0 76 65 6e 74 2c 20 26 20 77 69 74 68 69 6e 20 74 |vent, & within t| 000000c0 68 61 74 2c 20 74 6f 20 74 68 65 20 66 75 6e 63 |hat, to the func| 000000d0 74 69 6f 6e 0a 65 76 65 6e 74 5f 5f 70 72 6f 63 |tion.event__proc| 000000e0 65 73 73 20 28 6e 6f 74 65 20 74 68 65 20 64 6f |ess (note the do| 000000f0 75 62 6c 65 20 5f 20 63 68 61 72 61 63 74 65 72 |uble _ character| 00000100 29 2e 0a 0a 0a 42 65 66 6f 72 65 3a 0a 0a 20 20 |)....Before:.. | 00000110 20 20 20 2f 2a 20 4c 6f 6f 6b 20 66 6f 72 20 6d | /* Look for m| 00000120 65 6e 75 20 65 76 65 6e 74 73 20 2a 2f 0a 20 20 |enu events */. | 00000130 20 20 20 69 66 20 28 65 2d 3e 65 20 3d 3d 20 77 | if (e->e == w| 00000140 69 6d 70 5f 45 42 55 54 20 26 26 20 28 77 69 6d |imp_EBUT && (wim| 00000150 70 5f 42 4d 49 44 20 26 20 65 2d 3e 64 61 74 61 |p_BMID & e->data| 00000160 2e 62 75 74 2e 6d 2e 62 62 69 74 73 29 20 21 3d |.but.m.bbits) !=| 00000170 20 30 29 20 0a 20 20 20 20 20 7b 0a 0a 49 6e 73 | 0) . {..Ins| 00000180 65 72 74 3a 0a 0a 20 20 20 20 20 20 2f 2a 6d 6f |ert:.. /*mo| 00000190 64 20 62 79 20 6d 72 6f 7a 2c 20 31 39 2f 31 30 |d by mroz, 19/10| 000001a0 2f 39 33 2c 20 72 65 20 6d 65 6e 75 20 6f 70 65 |/93, re menu ope| 000001b0 6e 69 6e 67 20 64 75 65 20 74 6f 20 6d 65 6e 75 |ning due to menu| 000001c0 20 63 6c 69 63 6b 20 6f 6e 20 61 20 6d 65 6e 75 | click on a menu| 000001d0 2d 62 75 74 74 6f 6e 2a 2f 0a 20 20 20 20 20 20 |-button*/. | 000001e0 69 66 20 28 65 2d 3e 65 20 3d 3d 20 77 69 6d 70 |if (e->e == wimp| 000001f0 5f 45 42 55 54 20 26 26 20 65 2d 3e 64 61 74 61 |_EBUT && e->data| 00000200 2e 62 75 74 2e 6d 2e 69 20 3e 20 2d 31 29 20 7b |.but.m.i > -1) {| 00000210 0a 20 20 20 20 20 20 20 20 77 69 6d 70 5f 69 63 |. wimp_ic| 00000220 6f 6e 20 69 63 3b 0a 20 20 20 20 20 20 20 20 77 |on ic;. w| 00000230 69 6d 70 74 5f 63 6f 6d 70 6c 61 69 6e 28 77 69 |impt_complain(wi| 00000240 6d 70 5f 67 65 74 5f 69 63 6f 6e 5f 69 6e 66 6f |mp_get_icon_info| 00000250 28 65 2d 3e 64 61 74 61 2e 62 75 74 2e 6d 2e 77 |(e->data.but.m.w| 00000260 2c 20 65 2d 3e 64 61 74 61 2e 62 75 74 2e 6d 2e |, e->data.but.m.| 00000270 69 2c 20 26 69 63 29 29 3b 0a 20 20 20 20 20 20 |i, &ic));. | 00000280 20 20 69 66 20 28 20 28 69 63 2e 66 6c 61 67 73 | if ( (ic.flags| 00000290 20 26 20 28 77 69 6d 70 5f 49 54 45 58 54 20 7c | & (wimp_ITEXT || 000002a0 20 77 69 6d 70 5f 49 53 50 52 49 54 45 20 7c 20 | wimp_ISPRITE | | 000002b0 77 69 6d 70 5f 49 4e 44 49 52 45 43 54 29 29 20 |wimp_INDIRECT)) | 000002c0 3d 3d 20 28 77 69 6d 70 5f 49 54 45 58 54 20 7c |== (wimp_ITEXT || 000002d0 20 77 69 6d 70 5f 49 53 50 52 49 54 45 20 7c 20 | wimp_ISPRITE | | 000002e0 77 69 6d 70 5f 49 4e 44 49 52 45 43 54 29 20 29 |wimp_INDIRECT) )| 000002f0 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 68 61 | {. cha| 00000300 72 20 62 75 66 5b 32 35 36 5d 2c 20 2a 70 64 2c |r buf[256], *pd,| 00000310 20 2a 70 73 3b 0a 20 20 20 20 20 20 20 20 20 20 | *ps;. | 00000320 66 6f 72 20 28 70 64 3d 62 75 66 2c 20 70 73 3d |for (pd=buf, ps=| 00000330 69 63 2e 64 61 74 61 2e 69 6e 64 69 72 65 63 74 |ic.data.indirect| 00000340 74 65 78 74 2e 76 61 6c 69 64 73 74 72 69 6e 67 |text.validstring| 00000350 3b 20 70 64 3c 62 75 66 2b 32 35 35 20 26 26 20 |; pd<buf+255 && | 00000360 2a 70 73 3e 33 31 3b 20 70 64 2b 2b 2c 20 70 73 |*ps>31; pd++, ps| 00000370 2b 2b 29 20 2a 70 64 3d 2a 70 73 3b 0a 20 20 20 |++) *pd=*ps;. | 00000380 20 20 20 20 20 20 20 2a 70 64 3d 30 3b 0a 20 20 | *pd=0;. | 00000390 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 73 | if (strs| 000003a0 74 72 28 62 75 66 2c 20 22 73 67 72 69 67 68 74 |tr(buf, "sgright| 000003b0 2c 70 67 72 69 67 68 74 22 29 29 20 7b 0a 20 20 |,pgright")) {. | 000003c0 20 20 20 20 20 20 20 20 20 20 77 69 6d 70 5f 77 | wimp_w| 000003d0 73 74 61 74 65 20 73 3b 0a 20 20 20 20 20 20 20 |state s;. | 000003e0 20 20 20 20 20 65 2d 3e 64 61 74 61 2e 62 75 74 | e->data.but| 000003f0 2e 6d 2e 62 62 69 74 73 20 7c 3d 20 77 69 6d 70 |.m.bbits |= wimp| 00000400 5f 42 4d 49 44 3b 20 20 20 2f 2a 6d 61 6b 65 20 |_BMID; /*make | 00000410 74 68 69 73 20 6c 6f 6f 6b 20 6c 69 6b 65 20 61 |this look like a| 00000420 20 6d 65 6e 75 20 62 75 74 74 6f 6e 20 63 6c 69 | menu button cli| 00000430 63 6b 2a 2f 0a 20 20 20 20 20 20 20 20 20 20 20 |ck*/. | 00000440 20 77 69 6d 70 74 5f 63 6f 6d 70 6c 61 69 6e 28 | wimpt_complain(| 00000450 77 69 6d 70 5f 67 65 74 5f 77 69 6e 64 5f 73 74 |wimp_get_wind_st| 00000460 61 74 65 28 65 2d 3e 64 61 74 61 2e 62 75 74 2e |ate(e->data.but.| 00000470 6d 2e 77 2c 20 26 73 29 29 3b 0a 20 20 20 20 20 |m.w, &s));. | 00000480 20 20 20 20 20 20 20 65 2d 3e 64 61 74 61 2e 62 | e->data.b| 00000490 75 74 2e 6d 2e 78 20 3d 20 73 2e 6f 2e 62 6f 78 |ut.m.x = s.o.box| 000004a0 2e 78 30 2d 73 2e 6f 2e 78 20 2b 20 69 63 2e 62 |.x0-s.o.x + ic.b| 000004b0 6f 78 2e 78 31 20 2b 20 34 38 3b 20 2f 2a 63 6f |ox.x1 + 48; /*co| 000004c0 6d 70 6c 79 20 77 69 74 68 20 73 74 79 6c 65 20 |mply with style | 000004d0 67 75 69 64 65 20 70 39 36 2a 2f 0a 20 20 20 20 |guide p96*/. | 000004e0 20 20 20 20 20 20 20 20 65 2d 3e 64 61 74 61 2e | e->data.| 000004f0 62 75 74 2e 6d 2e 79 20 3d 20 73 2e 6f 2e 62 6f |but.m.y = s.o.bo| 00000500 78 2e 79 31 2d 73 2e 6f 2e 79 20 2b 20 69 63 2e |x.y1-s.o.y + ic.| 00000510 62 6f 78 2e 79 31 3b 0a 20 20 20 20 20 20 20 20 |box.y1;. | 00000520 20 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 | }. }. | 00000530 20 20 20 20 7d 0a 0a 0a 43 68 61 6e 67 65 3a 0a | }...Change:.| 00000540 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 00000550 20 77 68 69 6c 65 20 28 31 29 20 0a 20 20 20 20 | while (1) . | 00000560 20 20 20 20 20 20 20 20 20 20 20 20 7b 0a 20 20 | {. | 00000570 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000580 20 65 2d 3e 64 61 74 61 2e 62 75 74 2e 6d 2e 79 | e->data.but.m.y| 00000590 20 2b 3d 20 6d 2d 3e 68 65 69 67 68 74 20 2b 20 | += m->height + | 000005a0 6d 2d 3e 67 61 70 3b 0a 20 20 20 20 20 20 20 20 |m->gap;. | 000005b0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 28 | if ((| 000005c0 6d 69 2d 3e 66 6c 61 67 73 20 26 20 77 69 6d 70 |mi->flags & wimp| 000005d0 5f 4d 4c 41 53 54 29 20 21 3d 20 30 29 20 62 72 |_MLAST) != 0) br| 000005e0 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 |eak;. | 000005f0 20 20 20 20 20 20 20 20 6d 69 2b 2b 3b 0a 20 20 | mi++;. | 00000600 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a | }.| 00000610 0a 54 6f 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 |.To:.. | 00000620 20 20 20 20 20 20 77 68 69 6c 65 20 28 31 29 20 | while (1) | 00000630 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 00000640 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | {. | 00000650 20 20 20 20 20 20 65 2d 3e 64 61 74 61 2e 62 75 | e->data.bu| 00000660 74 2e 6d 2e 79 20 2b 3d 20 6d 2d 3e 68 65 69 67 |t.m.y += m->heig| 00000670 68 74 20 2b 20 6d 2d 3e 67 61 70 3b 0a 20 20 20 |ht + m->gap;. | 00000680 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000690 2f 2a 6d 6f 64 20 62 79 20 6d 72 6f 7a 2c 20 31 |/*mod by mroz, 1| 000006a0 39 2f 32 2f 39 34 2c 20 72 65 20 69 63 6f 6e 20 |9/2/94, re icon | 000006b0 62 61 72 20 6d 65 6e 75 20 63 6f 6e 74 61 69 6e |bar menu contain| 000006c0 69 6e 67 20 64 6f 74 74 65 64 20 6c 69 6e 65 20 |ing dotted line | 000006d0 73 65 70 61 72 61 74 6f 72 73 20 2d 20 41 63 6f |separators - Aco| 000006e0 72 6e 20 63 6f 64 65 20 77 61 73 20 77 72 6f 6e |rn code was wron| 000006f0 67 2a 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 |g*/. | 00000700 20 20 20 20 20 20 20 69 66 20 28 6d 69 2d 3e 66 | if (mi->f| 00000710 6c 61 67 73 20 26 20 77 69 6d 70 5f 4d 53 45 50 |lags & wimp_MSEP| 00000720 41 52 41 54 45 29 20 65 2d 3e 64 61 74 61 2e 62 |ARATE) e->data.b| 00000730 75 74 2e 6d 2e 79 20 2b 3d 20 32 34 3b 0a 20 20 |ut.m.y += 24;. | 00000740 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000750 20 2f 2a 65 6e 64 20 6f 66 20 6d 6f 64 2a 2f 0a | /*end of mod*/.| 00000760 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000770 20 20 20 69 66 20 28 28 6d 69 2d 3e 66 6c 61 67 | if ((mi->flag| 00000780 73 20 26 20 77 69 6d 70 5f 4d 4c 41 53 54 29 20 |s & wimp_MLAST) | 00000790 21 3d 20 30 29 20 62 72 65 61 6b 3b 0a 20 20 20 |!= 0) break;. | 000007a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000007b0 6d 69 2b 2b 3b 0a 20 20 20 20 20 20 20 20 20 20 |mi++;. | 000007c0 20 20 20 20 20 20 7d 0a 0a 0a 43 68 61 6e 67 65 | }...Change| 000007d0 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 65 76 65 |:.. eve| 000007e0 6e 74 5f 5f 6d 65 6e 75 78 20 3d 20 65 2d 3e 64 |nt__menux = e->d| 000007f0 61 74 61 2e 62 75 74 2e 6d 2e 78 3b 0a 20 20 20 |ata.but.m.x;. | 00000800 20 20 20 20 20 20 20 65 76 65 6e 74 5f 5f 6d 65 | event__me| 00000810 6e 75 79 20 3d 20 65 2d 3e 64 61 74 61 2e 62 75 |nuy = e->data.bu| 00000820 74 2e 6d 2e 79 3b 0a 20 20 20 20 20 20 20 20 20 |t.m.y;. | 00000830 20 77 69 6d 70 74 5f 63 6f 6d 70 6c 61 69 6e 28 | wimpt_complain(| 00000840 77 69 6d 70 5f 63 72 65 61 74 65 5f 6d 65 6e 75 |wimp_create_menu| 00000850 28 28 77 69 6d 70 5f 6d 65 6e 75 73 74 72 2a 29 |((wimp_menustr*)| 00000860 20 6d 2c 20 65 2d 3e 64 61 74 61 2e 62 75 74 2e | m, e->data.but.| 00000870 6d 2e 78 20 2d 20 34 38 2c 20 65 2d 3e 64 61 74 |m.x - 48, e->dat| 00000880 61 2e 62 75 74 2e 6d 2e 79 29 29 3b 0a 0a 54 6f |a.but.m.y));..To| 00000890 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 65 76 65 |:.. eve| 000008a0 6e 74 5f 5f 6d 65 6e 75 78 20 3d 20 65 2d 3e 64 |nt__menux = e->d| 000008b0 61 74 61 2e 62 75 74 2e 6d 2e 78 2d 3d 34 38 3b |ata.but.m.x-=48;| 000008c0 0a 20 20 20 20 20 20 20 20 20 20 65 76 65 6e 74 |. event| 000008d0 5f 5f 6d 65 6e 75 79 20 3d 20 65 2d 3e 64 61 74 |__menuy = e->dat| 000008e0 61 2e 62 75 74 2e 6d 2e 79 3b 0a 20 20 20 20 20 |a.but.m.y;. | 000008f0 20 20 20 20 20 77 69 6d 70 74 5f 63 6f 6d 70 6c | wimpt_compl| 00000900 61 69 6e 28 77 69 6d 70 5f 63 72 65 61 74 65 5f |ain(wimp_create_| 00000910 6d 65 6e 75 28 28 77 69 6d 70 5f 6d 65 6e 75 73 |menu((wimp_menus| 00000920 74 72 2a 29 20 6d 2c 20 65 2d 3e 64 61 74 61 2e |tr*) m, e->data.| 00000930 62 75 74 2e 6d 2e 78 2c 20 65 2d 3e 64 61 74 61 |but.m.x, e->data| 00000940 2e 62 75 74 2e 6d 2e 79 29 29 3b 0a |.but.m.y));.| 0000094c