@@ -1282,8 +1282,8 @@ stdwin_open(sw, args)
12821282}
12831283
12841284static object *
1285- stdwin_getevent ( sw , args )
1286- object * sw ;
1285+ stdwin_get_poll_event ( poll , args )
1286+ int poll ;
12871287 object * args ;
12881288{
12891289 EVENT e ;
@@ -1294,15 +1294,24 @@ stdwin_getevent(sw, args)
12941294 err_setstr (RuntimeError , "cannot getevent() while drawing" );
12951295 return NULL ;
12961296 }
1297- again :
1298- wgetevent (& e );
1297+ /* again: */
1298+ if (poll ) {
1299+ if (!wpollevent (& e )) {
1300+ INCREF (None );
1301+ return None ;
1302+ }
1303+ }
1304+ else
1305+ wgetevent (& e );
12991306 if (e .type == WE_COMMAND && e .u .command == WC_CANCEL ) {
13001307 /* Turn keyboard interrupts into exceptions */
13011308 err_set (KeyboardInterrupt );
13021309 return NULL ;
13031310 }
1311+ /*
13041312 if (e.window == NULL && (e.type == WE_COMMAND || e.type == WE_CHAR))
13051313 goto again;
1314+ */
13061315 if (e .type == WE_COMMAND && e .u .command == WC_CLOSE ) {
13071316 /* Turn WC_CLOSE commands into WE_CLOSE events */
13081317 e .type = WE_CLOSE ;
@@ -1323,11 +1332,15 @@ stdwin_getevent(sw, args)
13231332 w = None ;
13241333 else
13251334 w = (object * )windowlist [tag ];
1335+ #ifdef sgi
1336+ /* XXX Trap for unexplained weird bug */
1337+ if ((long )w == (long )0x80000001 ) {
1338+ err_setstr (SystemError ,
1339+ "bad pointer in stdwin.getevent()" );
1340+ return NULL ;
1341+ }
1342+ #endif
13261343 }
1327- if ((long )w == (long )0x80000001 ) {
1328- err_setstr (SystemError , "bad pointer in stdwin.getevent()" );
1329- return NULL ;
1330- }
13311344 INCREF (w );
13321345 settupleitem (v , 1 , w );
13331346 switch (e .type ) {
@@ -1377,6 +1390,22 @@ return NULL;
13771390 return v ;
13781391}
13791392
1393+ static object *
1394+ stdwin_getevent (sw , args )
1395+ object * sw ;
1396+ object * args ;
1397+ {
1398+ return stdwin_get_poll_event (0 , args );
1399+ }
1400+
1401+ static object *
1402+ stdwin_pollevent (sw , args )
1403+ object * sw ;
1404+ object * args ;
1405+ {
1406+ return stdwin_get_poll_event (1 , args );
1407+ }
1408+
13801409static object *
13811410stdwin_setdefwinpos (sw , args )
13821411 object * sw ;
@@ -1584,6 +1613,7 @@ static struct methodlist stdwin_methods[] = {
15841613 {"menucreate" , stdwin_menucreate },
15851614 {"message" , stdwin_message },
15861615 {"open" , stdwin_open },
1616+ {"pollevent" , stdwin_pollevent },
15871617 {"resetselection" , stdwin_resetselection },
15881618 {"rotatecutbuffers" , stdwin_rotatecutbuffers },
15891619 {"setcutbuffer" , stdwin_setcutbuffer },
0 commit comments