mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Improve window resizing on OS X (close #468)
This commit is contained in:
parent
718588ff1d
commit
c0f3587a7c
@ -55,7 +55,7 @@ BOOL isValidTextUnicode(NSEvent* event);
|
|||||||
/// Handle view resized event.
|
/// Handle view resized event.
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
-(void)frameDidChange:(NSNotification *)notification;
|
-(void)viewDidEndLiveResize;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Establish if the mouse is inside or outside the OpenGL view.
|
/// Establish if the mouse is inside or outside the OpenGL view.
|
||||||
@ -110,13 +110,6 @@ BOOL isValidTextUnicode(NSEvent* event);
|
|||||||
owner:self
|
owner:self
|
||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
[self addTrackingArea:m_trackingArea];
|
[self addTrackingArea:m_trackingArea];
|
||||||
|
|
||||||
// Register for resize event
|
|
||||||
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
|
|
||||||
[center addObserver:self
|
|
||||||
selector:@selector(frameDidChange:)
|
|
||||||
name:NSViewFrameDidChangeNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
// Create a hidden text view for parsing key down event properly
|
// Create a hidden text view for parsing key down event properly
|
||||||
m_silentResponder = [[SFSilentResponder alloc] init];
|
m_silentResponder = [[SFSilentResponder alloc] init];
|
||||||
@ -224,8 +217,19 @@ BOOL isValidTextUnicode(NSEvent* event);
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
-(void)frameDidChange:(NSNotification *)notification
|
-(void)viewDidEndLiveResize
|
||||||
{
|
{
|
||||||
|
// We use viewDidEndLiveResize to notify the user ONCE
|
||||||
|
// only, when the resizing is finished.
|
||||||
|
// In a perfect world we would like to notify the user
|
||||||
|
// in live that the window is being resized. However,
|
||||||
|
// it seems impossible to forward to the user
|
||||||
|
// NSViewFrameDidChangeNotification before the resizing
|
||||||
|
// is done. Several notifications are emitted but they
|
||||||
|
// are all delivered after when the work is done.
|
||||||
|
|
||||||
|
[super viewDidEndLiveResize];
|
||||||
|
|
||||||
// Update mouse internal state.
|
// Update mouse internal state.
|
||||||
[self updateMouseState];
|
[self updateMouseState];
|
||||||
|
|
||||||
@ -278,7 +282,6 @@ BOOL isValidTextUnicode(NSEvent* event);
|
|||||||
-(void)dealloc
|
-(void)dealloc
|
||||||
{
|
{
|
||||||
// Unregister
|
// Unregister
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
||||||
[self removeTrackingArea:m_trackingArea];
|
[self removeTrackingArea:m_trackingArea];
|
||||||
|
|
||||||
// Release attributes
|
// Release attributes
|
||||||
|
Loading…
Reference in New Issue
Block a user