summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/osx/salframeview.h3
-rw-r--r--vcl/osx/salframe.cxx14
-rw-r--r--vcl/osx/salframeview.mm34
3 files changed, 37 insertions, 14 deletions
diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h
index dec2f03a42f3..287ccaedbc06 100644
--- a/vcl/inc/osx/salframeview.h
+++ b/vcl/inc/osx/salframeview.h
@@ -111,6 +111,7 @@ enum class SalEvent;
BOOL mbInCommitMarkedText;
NSAttributedString* mpLastMarkedText;
BOOL mbTextInputWantsNonRepeatKeyDown;
+ NSTrackingArea* mpLastTrackingArea;
}
+(void)unsetMouseFrame: (AquaSalFrame*)pFrame;
-(id)initWithSalFrame: (AquaSalFrame*)pFrame;
@@ -146,6 +147,8 @@ enum class SalEvent;
-(BOOL)handleKeyDownException:(NSEvent*)pEvent;
-(void)clearLastEvent;
-(void)clearLastMarkedText;
+-(void)clearLastTrackingArea;
+-(void)updateTrackingAreas;
/*
text action methods
*/
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 940337b770a1..81aae45457a7 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -244,20 +244,6 @@ void AquaSalFrame::initWindowAndView()
[mpNSWindow setRestorable:NO];
- // tdf#155092 use tracking areas instead of tracking rectangles
- // Apparently, the older, tracking rectangles selectors cause
- // unexpected window resizing upon the first mouse down after the
- // window has been manually resized so switch to the newer,
- // tracking areas selectors. Also, the NSTrackingInVisibleRect
- // option allows us to create one single tracking area that
- // resizes itself automatically over the lifetime of the view.
- // Note: for some unknown reason, both NSTrackingMouseMoved and
- // NSTrackingAssumeInside are necessary options for this fix
- // to work.
- NSTrackingArea *pTrackingArea = [[NSTrackingArea alloc] initWithRect: [mpNSView bounds] options: ( NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingAssumeInside | NSTrackingInVisibleRect ) owner: mpNSView userInfo: nil];
- [mpNSView addTrackingArea: pTrackingArea];
- [pTrackingArea release];
-
maSysData.mpNSView = mpNSView;
UpdateFrameGeometry();
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index fa59f1018a39..950cec3271eb 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -773,6 +773,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize)
mbInCommitMarkedText = NO;
mpLastMarkedText = nil;
mbTextInputWantsNonRepeatKeyDown = NO;
+ mpLastTrackingArea = nil;
}
return self;
@@ -782,6 +783,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize)
{
[self clearLastEvent];
[self clearLastMarkedText];
+ [self clearLastTrackingArea];
[self revokeWrapper];
[super dealloc];
@@ -2128,6 +2130,38 @@ static void updateWinDataInLiveResize(bool bInLiveResize)
mbTextInputWantsNonRepeatKeyDown = NO;
}
+-(void)clearLastTrackingArea
+{
+ if (mpLastTrackingArea)
+ {
+ [self removeTrackingArea: mpLastTrackingArea];
+ [mpLastTrackingArea release];
+ mpLastTrackingArea = nil;
+ }
+}
+
+-(void)updateTrackingAreas
+{
+ [super updateTrackingAreas];
+
+ // tdf#155092 use tracking areas instead of tracking rectangles
+ // Apparently, the older, tracking rectangles selectors cause
+ // unexpected window resizing upon the first mouse down after the
+ // window has been manually resized so switch to the newer,
+ // tracking areas selectors. Also, the NSTrackingInVisibleRect
+ // option allows us to create one single tracking area that
+ // resizes itself automatically over the lifetime of the view.
+ // Note: for some unknown reason, both NSTrackingMouseMoved and
+ // NSTrackingAssumeInside are necessary options for this fix
+ // to work.
+ // Note: for some unknown reason, [mpLastTrackingArea rect]
+ // returns an empty NSRect (at least on macOS Sequoia) so always
+ // remove the old tracking area and add a new one.
+ [self clearLastTrackingArea];
+ mpLastTrackingArea = [[NSTrackingArea alloc] initWithRect: [self bounds] options: ( NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingAssumeInside | NSTrackingInVisibleRect ) owner: self userInfo: nil];
+ [self addTrackingArea: mpLastTrackingArea];
+}
+
- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
{
// FIXME - These should probably be used?
04e198754'>cleanup osl/diagnose.h includesJochen Nitschke 2017-05-06coverity#1405891..1405898: MISSING_COMMAJulien Nabet 2017-05-04tdf#107566 adjust constraints for Add-In function YIELDMAT.Winfried Donkers 2017-05-02untranslated strings are just stringsCaolán McNamara 2017-04-28split these out into a standalone headerCaolán McNamara 2017-04-27can move these nonlocalized strings into sourceCaolán McNamara 2017-04-20loplugin:unusedmethodsNoel Grandin 2017-04-04scaddins: silence -Werror=maybe-uninitializedMiklos Vajna 2017-03-25Fix typosAndrea Gelmini 2017-03-23loplugins:redundantcast teach it about c-style typedef castsNoel Grandin