FB17250415 was also filed, please help me.
Reproduce Version: Macos 15.3.2 and above. Reproduce Steps:
- Download and run the following desktop watermark app(attachment);
2.After the watermark app running a watermark window is showing at the left top corner.
3. Open App Store and try to install any app, after the confirm installation dialog appears, move the App Store window to desktop watermark area, the confirm installation button will disapper.
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
NSLog(@"App started");
//TODO1:Get current screens and get screen's NSRect
NSScreen *screen;
NSRect frame = NSMakeRect(0, 0, 1000, 1000);
NSWindow* window = [[NSWindow alloc] initWithContentRect:frame
styleMask: NSWindowStyleMaskTitled //0x80
backing:NSBackingStoreBuffered
defer:NO];
// ant-setttings
[window setAcceptsMouseMovedEvents:NO];
//[window setFloatingPanel:true]; ==> only valid for NSPanel
//0x111 = 1 << 0 | 1 << 4 | 1 << 8
[window setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces
| NSWindowCollectionBehaviorStationary
| NSWindowCollectionBehaviorFullScreenAuxiliary ];
[window setMovableByWindowBackground:YES];
[window setExcludedFromWindowsMenu:YES];
// [window setAlphaValue:0x3FF0000000000000];
[window setOpaque:NO];
[window setHasShadow:NO];
[window setHidesOnDeactivate:NO];
[window setLevel:NSScreenSaverWindowLevel];
[window setIgnoresMouseEvents:YES];
[window setReleasedWhenClosed:NO];
[window setStyleMask:NSWindowStyleMaskBorderless];
// get screen rect and set to NSWindow
[window setFrame:frame display:YES animate:NO];
[window setMovable:NO];
//Step1. Create a NSImage object with user-infomation embedded; ==> get this done
NSSize size;
size.width = 100;
size.height = 300;
NSImage* watermark_image = [NSImage imageWithSize:size flipped:NO drawingHandler:^(NSRect dstRect) {
NSGraphicsContext* current_ctx = [NSGraphicsContext currentContext];
[current_ctx saveGraphicsState];
//current_ctx = [NSGraphicsContext currentContext];
CGContextRef context = [current_ctx CGContext];
//Rotates the user coordinate system in a context.
CGFloat tilt_angle = 20*M_PI/180;
CGContextRotateCTM(context, tilt_angle);
NSString* data = @"12345";
NSPoint point;
point.x = 20;
point.y = 0;
NSFont *font = [NSFont fontWithName:@"Arial" size:20.f];
NSDictionary *attributes = [NSDictionary dictionaryWithObjects:
@[font, [NSColor redColor]]
forKeys:
@[NSFontAttributeName, NSForegroundColorAttributeName]];
[data drawAtPoint:point withAttributes:attributes];
[current_ctx restoreGraphicsState];
return YES;
}];
//Step2. Create a UIColor object based on the NSImage object created above;
NSColor* backgroud_color = [NSColor colorWithPatternImage:watermark_image];
//Step3. Set the new UIColor object as NSWindow background;
[window setBackgroundColor:backgroud_color];
// TODO:Double check again;
[window makeKeyAndOrderFront:NSApp];
CFRunLoopRun();
NSLog(@"App ended");
}
//sleep(10*1000);
return 0;
}