Tk Source Code

Check-in [2db3de5b]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Adjust some whitespace.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256: 2db3de5b41fdbb437c5ddd4b6ccca88a5b1be44480666faeefc14cc8a7d78156
User & Date: culler 2019-04-17 15:02:23
Context
2019-04-17
20:41
Clean up formatting in ttkMacOSXTheme.c. check-in: f160541f user: culler tags: core-8-6-branch
15:10
Merge with (nearly) empty diff. check-in: 5bd3db74 user: culler tags: trunk
15:02
Adjust some whitespace. check-in: 2db3de5b user: culler tags: core-8-6-branch
14:30
Add a couple of blank lines. check-in: 3a29febb user: culler tags: core-8-6-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to macosx/tkMacOSXKeyEvent.c.

662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
...
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
    caret_y = y;
    caret_height = height;
}
 

static unsigned convert_ns_to_X_keysym[] =
{
    NSHomeFunctionKey,          0x50,
    NSLeftArrowFunctionKey,     0x51,
    NSUpArrowFunctionKey,       0x52,
    NSRightArrowFunctionKey,    0x53,
    NSDownArrowFunctionKey,     0x54,
    NSPageUpFunctionKey,        0x55,
    NSPageDownFunctionKey,      0x56,
    NSEndFunctionKey,           0x57,
    NSBeginFunctionKey,         0x58,
    NSSelectFunctionKey,        0x60,
    NSPrintFunctionKey,         0x61,
    NSExecuteFunctionKey,       0x62,
    NSInsertFunctionKey,        0x63,
    NSUndoFunctionKey,          0x65,
    NSRedoFunctionKey,          0x66,
    NSMenuFunctionKey,          0x67,
    NSFindFunctionKey,          0x68,
    NSHelpFunctionKey,          0x6A,
    NSBreakFunctionKey,         0x6B,

    NSF1FunctionKey,            0xBE,
    NSF2FunctionKey,            0xBF,
    NSF3FunctionKey,            0xC0,
    NSF4FunctionKey,            0xC1,
    NSF5FunctionKey,            0xC2,
    NSF6FunctionKey,            0xC3,
    NSF7FunctionKey,            0xC4,
    NSF8FunctionKey,            0xC5,
    NSF9FunctionKey,            0xC6,
    NSF10FunctionKey,           0xC7,
    NSF11FunctionKey,           0xC8,
    NSF12FunctionKey,           0xC9,
    NSF13FunctionKey,           0xCA,
    NSF14FunctionKey,           0xCB,
    NSF15FunctionKey,           0xCC,
    NSF16FunctionKey,           0xCD,
    NSF17FunctionKey,           0xCE,
    NSF18FunctionKey,           0xCF,
    NSF19FunctionKey,           0xD0,
    NSF20FunctionKey,           0xD1,
    NSF21FunctionKey,           0xD2,
    NSF22FunctionKey,           0xD3,
    NSF23FunctionKey,           0xD4,
    NSF24FunctionKey,           0xD5,

    NSBackspaceCharacter,       0x08,  /* 8: Not on some KBs. */
    NSDeleteCharacter,          0xFF,  /* 127: Big 'delete' key upper right. */
    NSDeleteFunctionKey,        0x9F,  /* 63272: Del forw key off main array. */

    NSTabCharacter,		0x09,
    0x19,			0x09,  /* left tab->regular since pass shift */
    NSCarriageReturnCharacter,	0x0D,
    NSNewlineCharacter,		0x0D,
    NSEnterCharacter,		0x8D,

................................................................................
};


static unsigned
isFunctionKey(
    unsigned code)
{
    const unsigned last_keysym = (sizeof (convert_ns_to_X_keysym)
                                / sizeof (convert_ns_to_X_keysym[0]));
    unsigned keysym;

    for (keysym = 0; keysym < last_keysym; keysym += 2) {
	if (code == convert_ns_to_X_keysym[keysym]) {
	    return 0xFF00 | convert_ns_to_X_keysym[keysym+1];
	}
    }
    return 0;
}
 
/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8
 * End:
 */






|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|







 







|
|




|













662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
...
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
    caret_y = y;
    caret_height = height;
}
 

static unsigned convert_ns_to_X_keysym[] =
{
    NSHomeFunctionKey,		0x50,
    NSLeftArrowFunctionKey,	0x51,
    NSUpArrowFunctionKey,	0x52,
    NSRightArrowFunctionKey,	0x53,
    NSDownArrowFunctionKey,	0x54,
    NSPageUpFunctionKey,	0x55,
    NSPageDownFunctionKey,	0x56,
    NSEndFunctionKey,		0x57,
    NSBeginFunctionKey,		0x58,
    NSSelectFunctionKey,	0x60,
    NSPrintFunctionKey,		0x61,
    NSExecuteFunctionKey,	0x62,
    NSInsertFunctionKey,	0x63,
    NSUndoFunctionKey,		0x65,
    NSRedoFunctionKey,		0x66,
    NSMenuFunctionKey,		0x67,
    NSFindFunctionKey,		0x68,
    NSHelpFunctionKey,		0x6A,
    NSBreakFunctionKey,		0x6B,

    NSF1FunctionKey,		0xBE,
    NSF2FunctionKey,		0xBF,
    NSF3FunctionKey,		0xC0,
    NSF4FunctionKey,		0xC1,
    NSF5FunctionKey,		0xC2,
    NSF6FunctionKey,		0xC3,
    NSF7FunctionKey,		0xC4,
    NSF8FunctionKey,		0xC5,
    NSF9FunctionKey,		0xC6,
    NSF10FunctionKey,		0xC7,
    NSF11FunctionKey,		0xC8,
    NSF12FunctionKey,		0xC9,
    NSF13FunctionKey,		0xCA,
    NSF14FunctionKey,		0xCB,
    NSF15FunctionKey,		0xCC,
    NSF16FunctionKey,		0xCD,
    NSF17FunctionKey,		0xCE,
    NSF18FunctionKey,		0xCF,
    NSF19FunctionKey,		0xD0,
    NSF20FunctionKey,		0xD1,
    NSF21FunctionKey,		0xD2,
    NSF22FunctionKey,		0xD3,
    NSF23FunctionKey,		0xD4,
    NSF24FunctionKey,		0xD5,

    NSBackspaceCharacter,	0x08,  /* 8: Not on some KBs. */
    NSDeleteCharacter,		0xFF,  /* 127: Big 'delete' key upper right. */
    NSDeleteFunctionKey,	0x9F,  /* 63272: Del forw key off main array. */

    NSTabCharacter,		0x09,
    0x19,			0x09,  /* left tab->regular since pass shift */
    NSCarriageReturnCharacter,	0x0D,
    NSNewlineCharacter,		0x0D,
    NSEnterCharacter,		0x8D,

................................................................................
};


static unsigned
isFunctionKey(
    unsigned code)
{
    const unsigned last_keysym = (sizeof(convert_ns_to_X_keysym)
                                / sizeof(convert_ns_to_X_keysym[0]));
    unsigned keysym;

    for (keysym = 0; keysym < last_keysym; keysym += 2) {
	if (code == convert_ns_to_X_keysym[keysym]) {
	    return 0xFF00 | convert_ns_to_X_keysym[keysym + 1];
	}
    }
    return 0;
}
 
/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8
 * End:
 */

Changes to macosx/tkMacOSXMenu.c.

687
688
689
690
691
692
693

694
695
696
697
698
699
700
701
702
703
704

705
706
707
708
709


710
711
712
713
714
715
716
		submenu = nil;
	    } else {
		[submenu setTitle:title];

    		if ([menuItem isEnabled]) {
		    

		    /* This menuItem might have been previously disabled (XXX:
		     * track this), which would have disabled entries; we must
		     * re-enable the entries here.
		     */

		    int i = 0;
		    NSArray *itemArray = [submenu itemArray];

		    for (NSMenuItem *item in itemArray) {
			TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i];


			/* Work around an apparent bug where itemArray can have
			 * more items than the menu's entries[] array.
			 */

			if (i >= menuRefPtr->menuPtr->numEntries) break;


			[item setEnabled: !(submePtr->state == ENTRY_DISABLED)];
			i++;
		    }
		}
	    }
	}
    }






>
|










>
|



|
>
>







687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
		submenu = nil;
	    } else {
		[submenu setTitle:title];

    		if ([menuItem isEnabled]) {
		    
		    /*
		     * This menuItem might have been previously disabled (XXX:
		     * track this), which would have disabled entries; we must
		     * re-enable the entries here.
		     */

		    int i = 0;
		    NSArray *itemArray = [submenu itemArray];

		    for (NSMenuItem *item in itemArray) {
			TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i];

			/*
			 * Work around an apparent bug where itemArray can have
			 * more items than the menu's entries[] array.
			 */

			if (i >= (int) menuRefPtr->menuPtr->numEntries) {
			    break;
			}
			[item setEnabled: !(submePtr->state == ENTRY_DISABLED)];
			i++;
		    }
		}
	    }
	}
    }