bugGNUstep - Bugs: bug #29635, NSMenuItem -initWithCoder: should...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #29635: NSMenuItem -initWithCoder: should set modifier mask to 0 if NSKeyEquivModMask not defined

Submitted by:  Eric Wasylishen <ericw>
Submitted on:  Wed 21 Apr 2010 10:04:34 PM UTC  
 
Category: Gui/AppKitSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sat 24 Apr 2010 06:00:39 PM UTC, comment #4:

This should be fixed now. :-)
(I don't seem to have permission to mark this bug report as fixed)

Eric Wasylishen <ericw>
Project Member
Fri 23 Apr 2010 08:11:10 AM UTC, comment #3:

Sure, go ahead.

Fred Kiefer <FredKiefer>
Project Member
Thu 22 Apr 2010 04:33:04 PM UTC, comment #2:

I checked and –[NSMenuItem initWithTitle:action:keyEquivalent:] on Cocoa uses a default of NSCommandKeyModifierMask, so GNUstep is correct.

Is it okay if I commit this then?

Eric Wasylishen <ericw>
Project Member
Thu 22 Apr 2010 08:04:08 AM UTC, comment #1:

The aim of this patch looks correct to me. But could you first check what will be the default modifier mask of a menu item on Cocoa? If this isn't NSCommandKeyModifierMask, then we should fix this whole issue on a different level.
In that case we may have to correct all manually created menu items :-(

You wont have to worry about Gorm file, whether in gorm or nib format, in both cases we will have stored the modifier mask in the file.

Fred Kiefer <FredKiefer>
Project Member
Wed 21 Apr 2010 10:04:34 PM UTC, original submission:

Menu items created in Interface Builder with no modifier mask will have no NSKeyEquivModMask key in the nib. (e.g. I am porting a Mac app where the Escape key is a key equivalent for one menu item.)

However, when read by GNUstep, -[NSMenuItem initWithCoder:] only sets the modifier mask if [aDecoder containsValueForKey: @"NSKeyEquivModMask"]. So items with no modifier mask get the default modifier mask of NSCommandKeyModifierMask.

The solution is to remove the if ([aDecoder containsValueForKey: @"NSKeyEquivModMask"]) { } and set the modifier mask unconditionally, so if it is not defined in the nib, it gets set to 0.

I posted this as a bug report because I'm not sure if this fix could have other side effects (i.e. break GORM loading?)

Eric Wasylishen <ericw>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by FredKiefer (Posted a comment)
  • -unavailable- added by ericw (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 24 Apr 2010 06:29:22 PM UTCericwStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1