bugGNUstep - Bugs: bug #34777, NSMacintoshInterfaceStyle fails to...

Group
 
 

bug #34777: NSMacintoshInterfaceStyle fails to put menues into the main window

Submitter:  julian <julian_>
Submitted:  Tue 08 Nov 2011 04:20:48 PM UTC
   
 
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 24 Oct 2014 08:54:55 AM UTC, comment #18: 

sorry i don't have a reduction of this anymore.

just close the report it is most likely fixed and if not a new bug will be opened.

julian <julian_>
Thu 23 Oct 2014 10:07:00 PM UTC, comment #17: 

How is the situation of this now? Without a sample app we cannot reproduce. Since 2011 the rules of assignment of mac and in-window menus changed.
NSMacintoshInterfaceStyle never puts menus in the main window, as the bug title may suggest. So at best you should state what the current problem is.

Riccardo Mottola <rmottola>
Group Member
Tue 15 Nov 2011 11:50:04 PM UTC, comment #16: 


> If this not solve the problem attach a sample app.


thanks. it doesn't solve it in my app. though i can confirm the problem isn't present in a minimal application doing this. will need to reduce my app and file a seperate bug.

julian <julian_>
Tue 15 Nov 2011 04:53:58 AM UTC, comment #15: 

After call [NSBundle loadNibNamed:]. Send -makeKeyAndOrderFront: to your main window. If this not solve the problem attach a sample app.

Germán Arias <espectador>
Tue 15 Nov 2011 01:23:52 AM UTC, comment #14: 

#ifdef GNUSTEP
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
    return NO; // neccessary when NSMenuInterfaceStyle = NSWindows95InterfaceStyle
}
#endif

this method isn't the problem. it gets called and prevents the app from quitting when the last window closes. the problem is the main menu is not anymore in my main window when i re-open it later on using [NSBundle loadNibNamed:]

if thats not "expected behavior" i can attach a sample app.

julian <julian_>
Tue 15 Nov 2011 01:13:55 AM UTC, comment #13: 

Well, this works for me in Gemas.app (in SVN). Can you put here the code you are using in -applicationShouldTerminateAfterLastWindowClosed:?

Germán Arias <espectador>
Mon 14 Nov 2011 04:03:12 PM UTC, comment #12: 


>your app delegate should implement  - applicationShouldTerminateAfterLastWindowClosed:


ok thanks that turns off the unwanted behavior.
my app continues running although the main window is closed.
however when i show my main window again, the menu isn't attached attached anymore.
is this expected behavior too - if so, how can i turn it off - or a bug?

do i have to re-load MainMenu.xib every time i show my MainWindow? sounds like a bad idea re-instantiating new application delegates (instantiated from the MainMenu.xib) all the time...especially since the old one doesn't even get deallocated

julian <julian_>
Wed 09 Nov 2011 06:10:00 PM UTC, comment #11: 

to to = not to

julian <julian_>
Wed 09 Nov 2011 06:09:08 PM UTC, comment #10: 

great, #34764 doesn't seem to be a problem in this case.

everything is fine, thanks and sorry for the noise.

this bug should be closed as soon as NSWindows95InterfaceStyle is documented:

1.) that it exists
2.) that it changes the behavior so the app is closed with the last window unless you override applicationShouldTerminateAfterLastWindowClosed
3.) that it adds the menu to every window that has canBecomeMainWindow = YES, i.e. to to panels or custom nswindow subclasses that return no

julian <julian_>
Wed 09 Nov 2011 05:59:46 PM UTC, comment #9: 

hm ok its alright because NSPanel returns canBecomeMainWindow:NO by default.

the problem is some other bug (#34764) causes custom classes not to be decoded from XIB files ;-(


julian <julian_>
Wed 09 Nov 2011 05:56:17 PM UTC, comment #8: 


>You should configure -canBecomeMainWindow: to return NO in that winodow/panel.


does that mean i have to subclass every window and panel in my app to return NO there (except the one main window of course)? thats not alright. also, won't this have other consequences too?

julian <julian_>
Wed 09 Nov 2011 05:50:49 PM UTC, comment #7: 

Silver theme is configured with NSWindows95InterfaceStyle. You can change this on Info-gnustep.plist file inside the Resources dir.

GNUstep close the app if you close the last window. Even if you have a minimized window at taskbar. But you can configure this with the delegate method: -applicationShouldTerminateAfterLastWindowClosed:

If you don't want a menu in some window or panel. You should configure -canBecomeMainWindow: to return NO in that winodow/panel.

Germán Arias <espectador>
Wed 09 Nov 2011 03:10:33 PM UTC, comment #6: 


>expected behavior


i didn't expect it ;-) when adding documentation that NSWindows95InterfaceStyle exists, this should probably be mentioned (including how to turn it off). i expected it to only change the menubars and nothing else


>applicationShouldTerminateAfterLastWindowClosed


great, thanks

julian <julian_>
Wed 09 Nov 2011 02:39:16 PM UTC, comment #5: 


> using NSWindows95InterfaceStyle makes my app quit after the last widow closed


Yes, that's expected behavior, and seems very reasonable ... with no windows you have no menus, and no way to control the app.

> how can i turn that off?


Use the standard OSX mechanism to control this behavior ... your app delegate should implement -applicationShouldTerminateAfterLastWindowClosed:

Richard Frith-Macdonald <CaS>
Group Member
Wed 09 Nov 2011 02:22:43 PM UTC, comment #4: 

worse yet, using NSWindows95InterfaceStyle makes my app quit after the last widow closed! how can i turn that off?

julian <julian_>
Wed 09 Nov 2011 01:42:21 PM UTC, comment #3: 

lets reuse this bug report for something useful. it seems like NSWindows95InterfaceStyle puts the menu into every window of the app. i think the menu should not be put into NSPanels and into windows that are presented as sheets.

julian <julian_>
Wed 09 Nov 2011 12:13:30 PM UTC, comment #2: 

ok good - seems like the bug is the other way round:

• menues get put into the window even when NSMacintoshInterfaceStyle is specified.

actually it seems like using the "Silver" theme forces the menues to be in the window, regardless of NSMenuInterfaceStyle. so it seems there is no bug here after all (except in "Silver" maybe). obviously that confused me and i thought NSMacintoshInterfaceStyle actually tried to put the menues in the window, when it was the theme after all that did it. sorry for the noise.


• the only real bug here seems to be that NSWindows95InterfaceStyle (which is exactly what i want) is not documented:

http://www.gnustep.org/resources/documentation/User/Gui/DefaultsSummary.html

no mention of NSWindows95InterfaceStyle...

julian <julian_>
Wed 09 Nov 2011 06:28:23 AM UTC, comment #1: 

• modifying NSMacintoshInterfaceStyle so that the menu is always at the top

This is what NSMacintoshInterfaceStyle has always done on GNUstep ... the behavior you are seeing must be a relatively recently introduced bug ... probably a side effect of some theming work someone has done in the last year or so.

• adding a new NSWindowsLinuxInterfaceStyle that always puts the menus into windows and never falls back to displaying them at the top

This is what NSWindows95InterfaceStyle does (or always used to do ... perhaps it has been broken).

Richard Frith-Macdonald <CaS>
Group Member
Tue 08 Nov 2011 04:20:48 PM UTC, original submission:  

hello again

if you set NSMenuInterfaceStyle  to NSMacintoshInterfaceStyle the menus are put into the application window if gnustep finds an appropriate window to put them into, or at the top (mac like) if it can't find a window - which happens too often.

the attached application first loads its main XIB file MainMenu.xib which only contains the menu and then loads Window.xib which contains the main window. even in this very simple case gnustep fails to put the menu into the main window and puts in at the top instead. in cocoa its common to seperate XIB files and only load them on demand so thats not an utopical case.

i do not know why NSMacintoshInterfaceStyle tries to put menues into the windows anyway, since the mac menubar is always at the top.

for deploying applications to gnome/kde/windows its imperative that the menus are always in the windows and never horizontal or at the top, because that looks completely out of place on these environments, in the case of gnome the top menubar even covers/hides the gnome-panel!

i'd suggest:
• modifying NSMacintoshInterfaceStyle so that the menu is always at the top, because thats what the mac menu bar style actually is
• adding a new NSWindowsLinuxInterfaceStyle that always puts the menus into windows and never falls back to displaying them at the top (or horizontally). this new style could be used for deploying apps to windows/linux end users.

note that this bug does not exist in cocotron, it correctly puts the menu into the window although it is loaded after the MainMenu.xib. obviously we can't compare with Mac OS X here because it always has the menu bar at the top.

julian <julian_>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #24329:  gnustepbug.zip added by julian_ (120KiB - application/zip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rmottola (Posted a comment)
  • -email is unavailable- added by espectador (Posted a comment)
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by julian_ (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-10-24 rmottola StatusNone Works For Me
        Open/ClosedOpen Closed
    2011-11-08 julian_ Attached File- Added gnustepbug.zip, #24329

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code