Adium

Opened 14 years ago

Closed 14 years ago

#2172 closed defect (fixed)

Improve contact list positioning when switching resolutions

Reported by: brian@infinitenexus.com Owned by: nobody
Milestone: Adium X 1.0 Component: Adium UI
Version: Severity: normal
Keywords: contact list auto-hiding Cc:
Patch Status:

Description (last modified by David Smith)

Currently, switching resolutions can result in the contact list becoming "detached" from the side that it's docked on, requiring the user to manually re-dock it. This is particularly annoying with list hiding.

Change History (7)

comment:1 Changed 14 years ago by Zachary West

Milestone: SVN issues

comment:2 Changed 14 years ago by Evan Schoenberg

Milestone: SVN issuesAdium X 1.0

comment:3 Changed 14 years ago by David Smith

Owner: changed from nobody to David Smith
Status: newassigned

This was mostly fixed over the past few days. Changing resolutions to a larger size will leave the list in the old position, but other than that it works. Once Evan merges his local changes to #28 in, I'll have a look at what the behavior should be for the remaining case.

comment:4 Changed 14 years ago by David Smith

Description: modified (diff)
Status: assignednew
Summary: Auto-hide contact list and fast user switchingImprove contact list positioning when switching resolutions

This is being evil to implement. I have some code that pretty much works, except that it doesn't deal well with the window being hidden. I'm having trouble figuring out what's wrong with it, so I'm unassigning this ticket for now.

- (void)screenParametersChanged:(NSNotification *)notification
{
	[self slideWindowOnScreen];

	NSWindow * window = [self window];
	
	NSScreen * windowScreen = [window screen];
	if(!windowScreen) windowScreen = [NSScreen mainScreen];
	
	NSRect newScreenFrame = [windowScreen frame];
	NSRect listFrame = [window frame];
	
	if(NSEqualRects(currentScreenFrame, newScreenFrame)) return;
	
	NSPoint scaleFactor = NSMakePoint(newScreenFrame.size.width / currentScreenFrame.size.width, newScreenFrame.size.height / currentScreenFrame.size.height);
	
	NSLog(@"window is: %@, window screen is: %@, scale factor is: %f, %f", window, windowScreen, scaleFactor.x, scaleFactor.y);
	
	float x1 = (NSMinX(listFrame) - NSMinX(currentScreenFrame)) * scaleFactor.x;
	float x2 = (NSMaxX(currentScreenFrame) - NSMaxX(listFrame)) * scaleFactor.x;
	float y1 = (NSMinY(listFrame) - NSMinY(currentScreenFrame)) * scaleFactor.y;
	float y2 = (NSMaxY(currentScreenFrame) - NSMaxY(listFrame)) * scaleFactor.y;
	
	NSPoint origin = NSZeroPoint;
	if (x1 <= x2)
		origin.x = x1;
	else
		origin.x = NSMaxX(newScreenFrame) - x2 - listFrame.size.width;
	
	if (y1 <= y2)
		origin.y = y1;
	else
		origin.y = NSMaxY(newScreenFrame) - y2 - listFrame.size.height;

	NSLog(@"newOrigin = %f, %f : oldOrigin = %f, %f", origin.x, origin.y, listFrame.origin.x, listFrame.origin.y);
	[window setFrameOrigin:origin];
		
	currentScreenFrame = newScreenFrame;
	
	[contactListController contactListDesiredSizeChanged];
}

comment:5 Changed 14 years ago by David Smith

Owner: changed from David Smith to nobody

blarg. Trac isn't letting me unassign stuff properly.

comment:6 Changed 14 years ago by David Smith

Keywords: fast user switching removed

comment:7 Changed 14 years ago by David Smith

Resolution: fixed
Status: newclosed

(In [15338]) Fixes #2172. Please test the tar out of this, as there may be edge cases I missed.

Note: See TracTickets for help on using tickets.