From fc236ac493a8a63ef0640d00f19f8f90c4c9f1a2 Mon Sep 17 00:00:00 2001
From: alexm
+ A boolean value, NO
by default. When set to YES,
+ GNUstep uses the windowmaker icon background
+ for app icons and mini-windows.
+
+ Note that this only works when using back-art, and the + XWindowBuffer-shape-hack default must be set to YES. +
+diff --git a/Source/NSApplication.m b/Source/NSApplication.m index feadbb647..2d8f3a4ea 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -66,6 +66,7 @@ #include "AppKit/NSWorkspace.h" #include "AppKit/NSNibLoading.h" #include "AppKit/NSPageLayout.h" +#include "AppKit/PSOperators.h" #include "GNUstepGUI/GSDisplayServer.h" #include "GNUstepGUI/GSServicesManager.h" @@ -342,16 +343,26 @@ NSApplication *NSApp = nil; // Class variables static NSCell* dragCell = nil; static NSCell* tileCell = nil; +static BOOL useWindowmakerIconBackground = NO; + (void) initialize { NSImage *defImage = [NSImage imageNamed: @"GNUstep"]; - NSImage *tileImage = [NSImage imageNamed: @"common_Tile"]; + NSImage *tileImage; dragCell = [[NSCell alloc] initImageCell: defImage]; [dragCell setBordered: NO]; - tileCell = [[NSCell alloc] initImageCell: tileImage]; - [tileCell setBordered: NO]; + if ([[NSUserDefaults standardUserDefaults] + boolForKey: @"GSUseWindowmakerIconBackground"]) + { + useWindowmakerIconBackground = YES; + } + else + { + tileImage = [NSImage imageNamed: @"common_Tile"]; + tileCell = [[NSCell alloc] initImageCell: tileImage]; + [tileCell setBordered: NO]; + } } - (BOOL) acceptsFirstMouse: (NSEvent*)theEvent @@ -379,7 +390,19 @@ static NSCell* tileCell = nil; - (void) drawRect: (NSRect)rect { - [tileCell drawWithFrame: NSMakeRect(0,0,64,64) inView: self]; + if (useWindowmakerIconBackground) + { + PScompositerect(_bounds.origin.x, + _bounds.origin.y, + _bounds.size.width, + _bounds.size.height, + NSCompositeClear); + } + else + { + [tileCell drawWithFrame: NSMakeRect(0,0,64,64) inView: self]; + } + [dragCell drawWithFrame: NSMakeRect(8,8,48,48) inView: self]; if ([NSApp isHidden]) { diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 5573ef652..4734875b1 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -341,15 +341,24 @@ has blocked and waited for events. @end static NSCell *tileCell = nil; +static BOOL useWindowmakerIconBackground = NO; @implementation NSMiniWindowView + (void) initialize { - NSImage *tileImage = [NSImage imageNamed: @"common_MiniWindowTile"]; - - tileCell = [[NSCell alloc] initImageCell: tileImage]; - [tileCell setBordered: NO]; + NSImage *tileImage; + if ([[NSUserDefaults standardUserDefaults] + boolForKey: @"GSUseWindowmakerIconBackground"]) + { + useWindowmakerIconBackground = YES; + } + else + { + tileImage = [NSImage imageNamed: @"common_Tile"]; + tileCell = [[NSCell alloc] initImageCell: tileImage]; + [tileCell setBordered: NO]; + } } - (BOOL) acceptsFirstMouse: (NSEvent*)theEvent @@ -365,8 +374,19 @@ static NSCell *tileCell = nil; } - (void) drawRect: (NSRect)rect -{ - [tileCell drawWithFrame: NSMakeRect(0,0,64,64) inView: self]; +{ + if (useWindowmakerIconBackground) + { + PScompositerect(_bounds.origin.x, + _bounds.origin.y, + _bounds.size.width, + _bounds.size.height, + NSCompositeClear); + } + else + { + [tileCell drawWithFrame: NSMakeRect(0,0,64,64) inView: self]; + } [imageCell drawWithFrame: NSMakeRect(8,4,48,48) inView: self]; [titleCell drawWithFrame: NSMakeRect(1,52,62,11) inView: self]; } @@ -453,7 +473,8 @@ static NSCell *tileCell = nil; [titleCell setEditable: NO]; [titleCell setBordered: NO]; [titleCell setAlignment: NSCenterTextAlignment]; - [titleCell setDrawsBackground: NO]; + [titleCell setDrawsBackground: YES]; + [titleCell setBackgroundColor: [NSColor blackColor]]; [titleCell setTextColor: [NSColor whiteColor]]; [titleCell setFont: [NSFont systemFontOfSize: 8]]; }