[master] 0f12e96 - macOS platform: facilitate use when another toolkit handles the system menu.

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 0f12e96 - macOS platform: facilitate use when another toolkit handles the system menu. "ManoloFLTK" Sep 24, 2021 top right image
 
commit 0f12e96d138af1ea1fa371b858ee2094401621b7
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Sep 24 17:56:23 2021 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Sep 24 17:56:35 2021 +0200

    macOS platform: facilitate use when another toolkit handles the system menu.

 src/Fl_cocoa.mm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index 92e6d19..7d28d57 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -1716,6 +1716,7 @@ void Fl_Cocoa_Screen_Driver::open_display_platform() {
 
     if (![NSApp isActive]) foreground_and_activate();
     if (![NSApp servicesMenu]) createAppleMenu();
+    else Fl_Sys_Menu_Bar::window_menu_style(Fl_Sys_Menu_Bar::no_window_menu);
     main_screen_height = CGDisplayBounds(CGMainDisplayID()).size.height;
     [[NSNotificationCenter defaultCenter] addObserver:[FLWindowDelegate singleInstance]
                                              selector:@selector(anyWindowWillClose:)
@@ -3459,11 +3460,14 @@ static NSBitmapImageRep *pdf_to_nsbitmapimagerep(NSData *pdfdata) {
                                      hasAlpha:YES
                                      isPlanar:NO
                                colorSpaceName:NSDeviceRGBColorSpace
-                                  bytesPerRow:4 * width
-                                 bitsPerPixel:32];
+                                  bytesPerRow:0
+                                 bitsPerPixel:0];
     NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
     [NSGraphicsContext saveGraphicsState];
     [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];// 10.4
+    [[NSColor clearColor] set];
+    NSRect r = NSMakeRect(0, 0, width, height);
+    NSRectFill(r);
     [image drawInRect:dest_r]; // 10.9
     [NSGraphicsContext restoreGraphicsState];
     [localPool release];
@@ -3611,7 +3615,7 @@ static Fl_RGB_Image* get_image_from_clipboard(Fl_Widget *receiver)
 {
   NSPasteboard *clip = [NSPasteboard generalPasteboard];
   NSArray *present = [clip types]; // types in pasteboard in order of decreasing preference
-  NSArray  *possible = [NSArray arrayWithObjects:TIFF_pasteboard_type, PDF_pasteboard_type, PICT_pasteboard_type, nil];
+  NSArray  *possible = [NSArray arrayWithObjects:PDF_pasteboard_type, TIFF_pasteboard_type, PICT_pasteboard_type, nil];
   NSString *found = nil;
   NSUInteger rank;
   for (NSUInteger i = 0; (!found) && i < [possible count]; i++) {
Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.