Diff

Differences From Artifact [101f176c12]:

To Artifact [108adb8130]:


1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
    if (! (winPtr->flags & CTK_DISPLAYED))  goto nofocus;

    /*
     * Check widget's -takefocus option.
     */

    if (Tcl_VarEval(interp, Tk_PathName(winPtr), " cget -takefocus",
	    (char *) NULL) == TCL_OK  && interp->result[0] != '\0') {
	
	/*
	 * Try to interpret option value as simple 1 or 0.
	 */

	if (interp->result[1] == '\0') {
	    if (interp->result[0] == '1') {
		goto focus;
	    } else if (interp->result[0] == '0') {
		goto nofocus;
	    }
	}
	{
	
	    /*
	     * The -takefocus option is not 1 or 0, append window







|





|
|

|







1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
    if (! (winPtr->flags & CTK_DISPLAYED))  goto nofocus;

    /*
     * Check widget's -takefocus option.
     */

    if (Tcl_VarEval(interp, Tk_PathName(winPtr), " cget -takefocus",
	    (char *) NULL) == TCL_OK  && Tcl_GetStringResult(interp)[0] != '\0') {
	
	/*
	 * Try to interpret option value as simple 1 or 0.
	 */

	if (Tcl_GetStringResult(interp)[1] == '\0') {
	    if (Tcl_GetStringResult(interp)[0] == '1') {
		goto focus;
	    } else if (Tcl_GetStringResult(interp)[0] == '0') {
		goto nofocus;
	    }
	}
	{
	
	    /*
	     * The -takefocus option is not 1 or 0, append window
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
    /*
     * Check widget's -state option.  If value is "disaabled",
     * don't focus.
     */

    if (Tcl_VarEval(interp, Tk_PathName(winPtr), " cget -state",
	    (char *) NULL) == TCL_OK) {
	if (interp->result[0] == 'd'
		&& strcmp(interp->result, "disabled") == 0) goto nofocus;
    }

    /*
     * Check if widget has any Keyboard related bindings (check
     * individual widget tag and its class tag).
     */

    if (Tcl_VarEval(interp, "bind ", Tk_PathName(winPtr), (char *) NULL)
	    != TCL_OK)  return TCL_ERROR;
    if (strstr(interp->result, "Key"))  goto focus;
    if (strstr(interp->result, "Focus"))  goto focus;

    if (Tcl_VarEval(interp, "bind ", Tk_Class(winPtr), (char *) NULL)
	    != TCL_OK)  return TCL_ERROR;
    if (strstr(interp->result, "Key"))  goto focus;
    if (strstr(interp->result, "Focus"))  goto focus;

nofocus:
    *flagPtr = 0;
    return TCL_OK;

focus:
    *flagPtr = 1;







|
|









|
|



|
|







1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
    /*
     * Check widget's -state option.  If value is "disaabled",
     * don't focus.
     */

    if (Tcl_VarEval(interp, Tk_PathName(winPtr), " cget -state",
	    (char *) NULL) == TCL_OK) {
	if (Tcl_GetStringResult(interp)[0] == 'd'
		&& strcmp(Tcl_GetStringResult(interp), "disabled") == 0) goto nofocus;
    }

    /*
     * Check if widget has any Keyboard related bindings (check
     * individual widget tag and its class tag).
     */

    if (Tcl_VarEval(interp, "bind ", Tk_PathName(winPtr), (char *) NULL)
	    != TCL_OK)  return TCL_ERROR;
    if (strstr(Tcl_GetStringResult(interp), "Key"))  goto focus;
    if (strstr(Tcl_GetStringResult(interp), "Focus"))  goto focus;

    if (Tcl_VarEval(interp, "bind ", Tk_Class(winPtr), (char *) NULL)
	    != TCL_OK)  return TCL_ERROR;
    if (strstr(Tcl_GetStringResult(interp), "Key"))  goto focus;
    if (strstr(Tcl_GetStringResult(interp), "Focus"))  goto focus;

nofocus:
    *flagPtr = 0;
    return TCL_OK;

focus:
    *flagPtr = 1;