Guest User

Untitled

a guest
Nov 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. #ifdef MAC_OS_X_VERSION_10_6
  2. //Show again menu & dock if needed
  3. if ([[m_window screen] isEqual:[NSScreen mainScreen]])
  4. {
  5. [NSApp setPresentationOptions:NSApplicationPresentationDefault];
  6. }
  7. //Make window normal and resize it
  8. [m_window setStyleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)];
  9. [m_window setFrame:[[m_window screen] visibleFrame] display:YES];
  10. //TODO for 10.6 only : window title is forgotten after the style change
  11. [m_window makeFirstResponder:m_openGLView];
  12. #else
  13. //With 10.5, we need to create a new window to change its style to borderless
  14. //Show menu & dock if needed
  15. if ([[m_window screen] isEqual:[NSScreen mainScreen]])
  16. {
  17. //Cocoa function in 10.5 does not allow to set the menu bar in auto-show mode [NSMenu setMenuBarVisible:YES];
  18. SetSystemUIMode(kUIModeNormal, 0); //One of the very few 64bit compatible Carbon function
  19. }
  20. //Create a fullscreen borderless window
  21. CocoaWindow *tmpWindow = [[CocoaWindow alloc]
  22. initWithContentRect:[[m_window screen] frame]
  23. styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)
  24. backing:NSBackingStoreBuffered
  25. defer:YES];
  26. //Copy current window parameters
  27. [tmpWindow setTitle:[m_window title]];
  28. [tmpWindow setRepresentedFilename:[m_window representedFilename]];
  29. [tmpWindow setReleasedWhenClosed:NO];
  30. [tmpWindow setAcceptsMouseMovedEvents:YES];
  31. [tmpWindow setDelegate:[m_window delegate]];
  32. [tmpWindow setSystemAndWindowCocoa:[m_window systemCocoa] windowCocoa:this];
  33. [tmpWindow registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType,
  34. NSStringPboardType, NSTIFFPboardType, nil]];
  35. //Forbid to resize the window below the blender defined minimum one
  36. [tmpWindow setContentMinSize:NSMakeSize(320, 240)];
  37.  
  38. //Assign the openGL view to the new window
  39. [tmpWindow setContentView:m_openGLView];
  40.  
  41. //Show the new window
  42. [tmpWindow makeKeyAndOrderFront:nil];
  43. //Close and release old window
  44. [m_window setDelegate:nil]; // To avoid the notification of "window closed" event
  45. [m_window close];
  46. [m_window release];
  47. m_window = tmpWindow;
  48. #endif
Add Comment
Please, Sign In to add comment