Tk Source Code

Check-in [569afaba]
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:Made PushButtons display correctly in pressed state.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-0d63621b6c
Files: files | file ages | folders
SHA3-256: 569afaba3ec9f5d63e33b82822829ca803176fb594501d40167d075f316cb82a
User & Date: culler 2019-03-17 03:20:41
Context
2019-03-17
14:13
Fixed error in height computation for BevelButtons. check-in: a8b91a2d user: culler tags: bug-0d63621b6c
03:20
Made PushButtons display correctly in pressed state. check-in: 569afaba user: culler tags: bug-0d63621b6c
2019-03-16
03:55
Fixed a logic error with selected disabled CheckBoxes and RadioButtons. check-in: 5aa31716 user: culler tags: bug-0d63621b6c
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to macosx/ttkMacOSXTheme.c.

   383    383       FillButtonBackground(context, bounds, 5);
   384    384   
   385    385       /*
   386    386        * Fill the button face with the appropriate color.
   387    387        */
   388    388   
   389    389       bounds = CGRectInset(bounds, 1, 1);
   390         -    if (state & TTK_STATE_DISABLED) {
   391         -	faceColor = [NSColor colorWithColorSpace: deviceRGB
   392         -			     components: darkDisabledButtonFace
   393         -				  count: 4];
          390  +    if (kind == kThemePushButton && (state & TTK_STATE_PRESSED)) {
          391  +	GradientFillButtonFace(context, bounds, 4,
          392  +				   darkSelectedGradient, 2);
   394    393       } else {
   395         -	faceColor = [NSColor colorWithColorSpace: deviceRGB
   396         -				 components: darkButtonFace
   397         -				      count: 4];
          394  +	if (state & TTK_STATE_DISABLED) {
          395  +	    faceColor = [NSColor colorWithColorSpace: deviceRGB
          396  +					  components: darkDisabledButtonFace
          397  +					       count: 4];
          398  +	} else {
          399  +	    faceColor = [NSColor colorWithColorSpace: deviceRGB
          400  +					  components: darkButtonFace
          401  +					       count: 4];
          402  +	}
          403  +	SolidFillButtonFace(context, bounds, 4, faceColor);
   398    404       }
   399         -    SolidFillButtonFace(context, bounds, 4, faceColor);
   400         -
          405  +	
   401    406       /*
   402    407        * If this is a popup, draw the arrow button.
   403    408        */
   404    409   
   405    410       if (kind == kThemePopupButton) {
   406    411   	CGFloat x, y;
   407    412   	CGRect arrowBounds = bounds;
................................................................................
   685    690       { kThemeButtonMixed, TTK_STATE_ALTERNATE, 0 },
   686    691       { kThemeButtonOn, TTK_STATE_SELECTED, 0 },
   687    692       { kThemeButtonOff, 0, 0 }
   688    693   /* Others: kThemeDisclosureRight, kThemeDisclosureDown, kThemeDisclosureLeft */
   689    694   };
   690    695   
   691    696   static Ttk_StateTable ButtonAdornmentTable[] = {
   692         -    { kThemeAdornmentDefault| kThemeAdornmentFocus,
   693         -	TTK_STATE_ALTERNATE| TTK_STATE_FOCUS, 0 },
          697  +    { kThemeAdornmentDefault | kThemeAdornmentFocus,
          698  +	TTK_STATE_ALTERNATE | TTK_STATE_FOCUS, 0 },
   694    699       { kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0 },
   695    700       { kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 },
   696         -    { kThemeAdornmentNone, 0, 0 }
   697         -};
          701  +    { kThemeAdornmentNone, 0, 0 }};
   698    702   
   699    703   /*
   700    704    * computeButtonDrawInfo --
   701    705    *    Fill in an appearance manager HIThemeButtonDrawInfo record.
   702    706    */
   703    707   
   704    708   static inline HIThemeButtonDrawInfo computeButtonDrawInfo(
   705    709       ThemeButtonParams *params,
   706    710       Ttk_State state,
   707    711       Tk_Window tkwin)
   708    712   {
   709    713       /*
   710    714        *  See ButtonElementDraw for the explanation of why we always draw
   711         -     *  PushButtons in the active state.  The deprecated BezelButton can be
   712         -     *  faked to at least be usable in Dark Mode if it is always drawn as
   713         -     *  inactive.
          715  +     *  PushButtons in the active state.
   714    716        */
   715    717   
   716    718       SInt32 HIThemeState;
   717    719       switch (params->kind) {
   718    720       case kThemePushButton:
   719    721   	HIThemeState = kThemeStateActive;
   720    722   	break;
   721         -    case kThemeBevelButton:
   722         -	if (TkMacOSXInDarkMode(tkwin)) {
   723         -	    HIThemeState = kThemeStateInactive;
   724         -	    break;
   725         -	}
   726    723       default:
   727    724   	HIThemeState = Ttk_StateTableLookup(ThemeStateTable, state);
   728    725   	break;
   729    726       }
   730    727   	
   731    728       const HIThemeButtonDrawInfo info = {
   732    729   	.version = 0,