[Adium-devl] [Adium-CVS] 14842 : trunk/Plugins/Contact List/AIBorderlessListWindowController.m trunk/Plugins/Contact List/AIListController.m trunk/Plugins/Contact List/AIListWindowController.m

Evan Schoenberg evan.s at dreskin.net
Mon Jan 9 06:04:55 UTC 2006


Does that keep the borderless list on the screen through a resize  
that would place it off when vertical and horizontal autosizing are  
both disabled?

-Evan

On Jan 9, 2006, at 12:41 AM, catfish_man at users.sourceforge.net wrote:

> Author: catfish_man
> Date: 2006-01-09 00:41:51 -0500 (Mon, 09 Jan 2006)
> New Revision: 14842
>
> Modified:
>    trunk/Plugins/Contact List/AIBorderlessListWindowController.m
>    trunk/Plugins/Contact List/AIListController.m
>    trunk/Plugins/Contact List/AIListWindowController.m
> Log:
> This should improve the behavior of the contact list during screen  
> resolution changes. It is not perfect yet; for example it still  
> disables contact list hiding for unknown reasons
>
> Modified: trunk/Plugins/Contact List/ 
> AIBorderlessListWindowController.m
> ===================================================================
> --- trunk/Plugins/Contact List/AIBorderlessListWindowController.m	 
> 2006-01-09 05:26:58 UTC (rev 14841)
> +++ trunk/Plugins/Contact List/AIBorderlessListWindowController.m	 
> 2006-01-09 05:41:51 UTC (rev 14842)
> @@ -19,22 +19,6 @@
>
>  @implementation AIBorderlessListWindowController
>
> -//Init
> -- (id)initWithWindowNibName:(NSString *)inNibName
> -{	
> -    if ((self = [super initWithWindowNibName:inNibName])) {
> -		/* Unlike with a normal window, the system doesn't assist us in  
> keeping the borderless contact list on a visible screen,
> -		 * so we'll observe screen changes and ensure that the contact  
> list stays on a valid screen
> -		 */
> -		[[NSNotificationCenter defaultCenter] addObserver:self
> -												 selector:@selector(centerWindowOnMainScreenIfNeeded:)
> -													 name:NSApplicationDidChangeScreenParametersNotification
> -												   object:nil];
> -	}
> -
> -	return self;
> -}
> -
>  //Borderless nib
>  + (NSString *)nibName
>  {
> @@ -52,20 +36,13 @@
>  	[super dealloc];
>  }
>
> -//If our window is no longer on a screen, move it to the main  
> screen and center
> -- (void)centerWindowOnMainScreenIfNeeded:(NSNotification *) 
> notification
> -{
> -	if (![[self window] screen]) {
> -		[[self window] setFrameOrigin:[[NSScreen mainScreen]  
> frame].origin];
> -		[[self window] center];
> -	}
> -}
> -
> +#warning this seems like it would mess up people with more than  
> one screen
>  //Ensure we're on the main screen on load
>  - (void)windowDidLoad
>  {
>  	[super windowDidLoad];
> -	[self centerWindowOnMainScreenIfNeeded:nil];
> -}
> +	NSWindow * window = [self window];
> +	if (![window screen]) {
> +		[window constrainFrameRect:[window frame] toScreen:[NSScreen  
> mainScreen]];}
>
>  @end
>
> Modified: trunk/Plugins/Contact List/AIListController.m
> ===================================================================
> --- trunk/Plugins/Contact List/AIListController.m	2006-01-09  
> 05:26:58 UTC (rev 14841)
> +++ trunk/Plugins/Contact List/AIListController.m	2006-01-09  
> 05:41:51 UTC (rev 14842)
> @@ -199,13 +199,12 @@
>  	windowFrame = [theWindow frame];
>  	newWindowFrame = windowFrame;
>  	viewFrame = [scrollView_contactList frame];
> -    if (currentScreen != nil) {
> -        screenFrame = [currentScreen frame];
> -        visibleScreenFrame = [currentScreen visibleFrame];
> -    } else {
> -        visibleScreenFrame = screenFrame = NSZeroRect;
> -    }
>  	
> +	if(!currentScreen) currentScreen = [NSScreen mainScreen];
> +	
> +	screenFrame = [currentScreen frame];
> +	visibleScreenFrame = [currentScreen visibleFrame];
> +	
>  	//Width
>  	if (useDesiredWidth) {
>  		if (forcedWindowWidth != -1) {
> @@ -238,40 +237,34 @@
>  	}
>  	
>  	
> -    //Compute boundingFrame for window
> -    if (currentScreen == nil) {
> -        //No bound
> -        boundingFrame = NSMakeRect(FLT_MAX*-0.5f, FLT_MAX*-0.5f,  
> FLT_MAX, FLT_MAX);
> +    //Compute boundingFrame for window
> +	/*
> +	 * If the window is against the left or right edges of the screen  
> AND the user did not dock to the visibleFrame last,
> +	 * we use the full screenFrame as our bound.
> +	 * The edge check is used since most users' docks will not extend  
> to the edges of the screen.
> +	 * Alternately, if the user docked to the total frame last, we  
> can safely use the full screen even if we aren't
> +	 * on the edge.
> +	 */
> +	BOOL windowOnEdge = ((newWindowFrame.origin.x <  
> screenFrame.origin.x + EDGE_CATCH_X) ||
> +						 ((newWindowFrame.origin.x + newWindowFrame.size.width) >  
> (screenFrame.origin.x + screenFrame.size.width - EDGE_CATCH_X)));
>
> -    } else {
> -        /*
> -         * If the window is against the left or right edges of the  
> screen AND the user did not dock to the visibleFrame last,
> -		 * we use the full screenFrame as our bound.
> -         * The edge check is used since most users' docks will not  
> extend to the edges of the screen.
> -         * Alternately, if the user docked to the total frame  
> last, we can safely use the full screen even if we aren't
> -		 * on the edge.
> -         */
> -        BOOL windowOnEdge = ((newWindowFrame.origin.x <  
> screenFrame.origin.x + EDGE_CATCH_X) ||
> -                             ((newWindowFrame.origin.x +  
> newWindowFrame.size.width) > (screenFrame.origin.x +  
> screenFrame.size.width - EDGE_CATCH_X)));
> +	if ((windowOnEdge && (dockToBottomOfScreen !=  
> AIDockToBottom_VisibleFrame)) ||
> +	   (dockToBottomOfScreen == AIDockToBottom_TotalFrame)) {
> +		NSArray *screens;
>
> -        if ((windowOnEdge && (dockToBottomOfScreen !=  
> AIDockToBottom_VisibleFrame)) ||
> -           (dockToBottomOfScreen == AIDockToBottom_TotalFrame)) {
> -            NSArray *screens;
> +		boundingFrame = screenFrame;
>
> -            boundingFrame = screenFrame;
> +		//We still should not violate the menuBar, so account for it  
> here if we are on the menuBar screen.
> +		if ((screens = [NSScreen screens]) &&
> +			([screens count]) &&
> +			(currentScreen == [screens objectAtIndex:0])) {
> +			boundingFrame.size.height -= MENU_BAR_HEIGHT;
> +		}
>
> -            //We still should not violate the menuBar, so account  
> for it here if we are on the menuBar screen.
> -            if ((screens = [NSScreen screens]) &&
> -                ([screens count]) &&
> -                (currentScreen == [screens objectAtIndex:0])) {
> -                boundingFrame.size.height -= MENU_BAR_HEIGHT;
> -            }
> +	} else {
> +		boundingFrame = visibleScreenFrame;
> +	}
>
> -        } else {
> -            boundingFrame = visibleScreenFrame;
> -        }
> -    }
> -
>  	//Height
>  	if (useDesiredHeight) {
>  		//Subtract the current size of the view from our frame
> @@ -286,7 +279,7 @@
>  			newWindowFrame.size.height = boundingFrame.size.height;
>  			newWindowFrame.origin.y = boundingFrame.origin.y;
>  		} else {
> -			//A Non-full height window is anchrored to the appropriate  
> screen edge
> +			//A non-full height window is anchored to the appropriate  
> screen edge
>  			if (dockToBottomOfScreen == AIDockToBottom_No) {
>  				//If the user did not dock to the bottom in any way last, the  
> origin should move up
>  				newWindowFrame.origin.y = (windowFrame.origin.y +  
> windowFrame.size.height) - newWindowFrame.size.height;
>
> Modified: trunk/Plugins/Contact List/AIListWindowController.m
> ===================================================================
> --- trunk/Plugins/Contact List/AIListWindowController.m	2006-01-09  
> 05:26:58 UTC (rev 14841)
> +++ trunk/Plugins/Contact List/AIListWindowController.m	2006-01-09  
> 05:41:51 UTC (rev 14842)
> @@ -415,6 +415,7 @@
>
>  - (void)screenParametersChanged:(NSNotification *)notification
>  {
> +	[self slideWindowOnScreen];
>  	[contactListController contactListDesiredSizeChanged];
>  }
>
> @@ -515,8 +516,7 @@
>  - (BOOL)shouldSlideWindowOffScreen
>  {
>  	BOOL shouldSlide = NO;
> -
> -    if (preventHiding) {
> +	    if (preventHiding) {
>          shouldSlide = NO;
>      }
>      else if (windowSlidOffScreenEdgeMask != 0) {
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through  
> log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD  
> SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Adium-cvs mailing list
> Adium-cvs at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/adium-cvs
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20060109/8cf36a96/attachment.sig>


More information about the devel mailing list