Skip to content

Commit

Permalink
Cherry-pick 858a9b80e18a and c3c3cdaf37f9
Browse files Browse the repository at this point in the history
  • Loading branch information
jgranick committed Sep 14, 2015
1 parent 0bf79a9 commit f314cd7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/joystick/darwin/SDL_sysjoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
curdevice = curdevice->pNext;
}
curdevice->pNext = device;
++device_index; /* bump by one since we counted by pNext. */
}

/* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceAdded()? */
Expand Down
20 changes: 16 additions & 4 deletions src/video/cocoa/SDL_cocoawindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -1288,11 +1288,23 @@ - (void)resetCursorRects
{
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
NSWindow *nswindow = windata->nswindow;
NSSize size;
NSRect rect;
Uint32 moveHack;

/* Cocoa will resize the window from the bottom-left rather than the
* top-left when -[nswindow setContentSize:] is used, so we must set the
* entire frame based on the new size, in order to preserve the position.
*/
rect.origin.x = window->x;
rect.origin.y = window->y;
rect.size.width = window->w;
rect.size.height = window->h;
ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect);

size.width = window->w;
size.height = window->h;
[nswindow setContentSize:size];
moveHack = s_moveHack;
s_moveHack = 0;
[nswindow setFrame:[nswindow frameRectForContentRect:rect] display:YES];
s_moveHack = moveHack;

ScheduleContextUpdates(windata);
}}
Expand Down

0 comments on commit f314cd7

Please sign in to comment.