summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-10-13 15:17:38 +0100
committerNoel Power <noel.power@novell.com>2010-10-13 15:17:38 +0100
commit1f4a6a21cb5445d3ed0c7d544906d5c98e31447a (patch)
tree7d8ab04dc4750c8dec9e9194d496b89a46670ddc /vcl
parent44b6cad4026d7c48325a43c970d05493c4113e1b (diff)
parent8e3b6ac3249200da87d1bd4b7ef0c7e51b706dd6 (diff)
Merge branch 'master' of ssh://noelp@git.freedesktop.org/git/libreoffice/libs-gui
Diffstat (limited to 'vcl')
-rwxr-xr-xvcl/aqua/inc/salframeview.h4
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm65
-rw-r--r--vcl/source/gdi/metaact.cxx2
-rwxr-xr-x[-rw-r--r--]vcl/source/gdi/outdev2.cxx11
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx19
5 files changed, 66 insertions, 35 deletions
diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h
index 0174c1a68832..d812523c472d 100755
--- a/vcl/aqua/inc/salframeview.h
+++ b/vcl/aqua/inc/salframeview.h
@@ -77,6 +77,10 @@
id mpMouseEventListener;
id mDraggingDestinationHandler;
NSEvent* mpLastSuperEvent;
+
+ // #i102807# used by magnify event handler
+ NSTimeInterval mfLastMagnifyTime;
+ float mfMagnifyDeltaSum;
}
+(void)unsetMouseFrame: (AquaSalFrame*)pFrame;
-(id)initWithSalFrame: (AquaSalFrame*)pFrame;
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index 25dadf0e592b..2f9959ab43f4 100755
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -378,6 +378,7 @@ static AquaSalFrame* getMouseContainerFrame()
mpLastSuperEvent = nil;
}
+ mfLastMagnifyTime = 0.0;
return self;
}
@@ -637,21 +638,40 @@ private:
// TODO: ?? -(float)magnification;
if( AquaSalFrame::isAlive( mpFrame ) )
- {
- mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
+ {
+ const NSTimeInterval fMagnifyTime = [pEvent timestamp];
+ mpFrame->mnLastEventTime = static_cast<ULONG>( fMagnifyTime * 1000.0 );
mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
-
- float dZ = 0.0;
- for(;;)
+
+ // check if this is a new series of magnify events
+ static const NSTimeInterval fMaxDiffTime = 0.3;
+ const bool bNewSeries = (fMagnifyTime - mfLastMagnifyTime > fMaxDiffTime);
+
+ if( bNewSeries )
+ mfMagnifyDeltaSum = 0.0;
+ mfMagnifyDeltaSum += [pEvent deltaZ];
+
+ mfLastMagnifyTime = [pEvent timestamp];
+ // TODO: change to 0.1 when COMMAND_WHEEL_ZOOM handlers allow finer zooming control
+ static const float fMagnifyFactor = 0.25;
+ static const float fMinMagnifyStep = 15.0 / fMagnifyFactor;
+ if( fabs(mfMagnifyDeltaSum) <= fMinMagnifyStep )
+ return;
+
+ // adapt NSEvent-sensitivity to application expectations
+ // TODO: rather make COMMAND_WHEEL_ZOOM handlers smarter
+ const float fDeltaZ = mfMagnifyDeltaSum * fMagnifyFactor;
+ int nDeltaZ = FRound( fDeltaZ );
+ if( !nDeltaZ )
{
- dZ += [pEvent deltaZ];
- NSEvent* pNextEvent = [NSApp nextEventMatchingMask: NSScrollWheelMask
- untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES ];
- if( !pNextEvent )
- break;
- pEvent = pNextEvent;
+ // handle new series immediately
+ if( !bNewSeries )
+ return;
+ nDeltaZ = (fDeltaZ >= 0.0) ? +1 : -1;
}
-
+ // eventually give credit for delta sum
+ mfMagnifyDeltaSum -= nDeltaZ / fMagnifyFactor;
+
NSPoint aPt = [NSEvent mouseLocation];
mpFrame->CocoaToVCL( aPt );
@@ -667,18 +687,15 @@ private:
if( Application::GetSettings().GetLayoutRTL() )
aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX;
- if( dZ != 0.0 )
- {
- aEvent.mnDelta = static_cast<long>(floor(dZ));
- aEvent.mnNotchDelta = dZ < 0 ? -1 : 1;
- if( aEvent.mnDelta == 0 )
- aEvent.mnDelta = aEvent.mnNotchDelta;
- aEvent.mbHorz = FALSE;
- aEvent.mnScrollLines = dZ > 0 ? dZ/WHEEL_EVENT_FACTOR : -dZ/WHEEL_EVENT_FACTOR;
- if( aEvent.mnScrollLines == 0 )
- aEvent.mnScrollLines = 1;
- mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
- }
+ aEvent.mnDelta = nDeltaZ;
+ aEvent.mnNotchDelta = (nDeltaZ >= 0) ? +1 : -1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
+ aEvent.mbHorz = FALSE;
+ aEvent.mnScrollLines = nDeltaZ;
+ if( aEvent.mnScrollLines == 0 )
+ aEvent.mnScrollLines = 1;
+ mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
}
}
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 1102569d0844..c4e571cbdce2 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -3793,7 +3793,6 @@ MetaAction* MetaFloatTransparentAction::Clone()
void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove )
{
maPoint.Move( nHorzMove, nVertMove );
- maMtf.Move(nHorzMove, nVertMove);
}
// ------------------------------------------------------------------------
@@ -3804,7 +3803,6 @@ void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY )
ImplScaleRect( aRectangle, fScaleX, fScaleY );
maPoint = aRectangle.TopLeft();
maSize = aRectangle.GetSize();
- maMtf.Scale(fScaleX, fScaleY);
}
// ------------------------------------------------------------------------
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 29c22e8f7962..7aaa9d7d510a 100644..100755
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1986,7 +1986,15 @@ void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
const long nSrcWidth = aBmpRect.GetWidth(), nSrcHeight = aBmpRect.GetHeight();
const long nDstWidth = aDstRect.GetWidth(), nDstHeight = aDstRect.GetHeight();
const long nOutWidth = aOutSz.Width(), nOutHeight = aOutSz.Height();
- const long nOffX = aDstRect.Left() - aOutPt.X(), nOffY = aDstRect.Top() - aOutPt.Y();
+ // calculate offset in original bitmap
+ // in RTL case this is a little more complicated since the contents of the
+ // bitmap is not mirrored (it never is), however the paint region and bmp region
+ // are in mirrored coordinates, so the intersection of (aOutPt,aOutSz) with these
+ // is content wise somewhere else and needs to take mirroring into account
+ const long nOffX = IsRTLEnabled()
+ ? aOutSz.Width() - aDstRect.GetWidth() - (aDstRect.Left() - aOutPt.X())
+ : aDstRect.Left() - aOutPt.X(),
+ nOffY = aDstRect.Top() - aOutPt.Y();
long nX, nOutX, nY, nOutY;
long nMirrOffX = 0;
long nMirrOffY = 0;
@@ -2000,7 +2008,6 @@ void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
for( nX = 0L, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
{
pMapX[ nX ] = aBmpRect.Left() + nOutX * nSrcWidth / nOutWidth;
-
if( bHMirr )
pMapX[ nX ] = nMirrOffX - pMapX[ nX ];
}
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index e6ecdd3b4880..18447946ffc1 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -509,24 +509,29 @@ namespace
std::vector<lang_and_family>::const_iterator aEnd = families.end();
bool alreadyclosematch = false;
- for (std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter)
+ for( std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter )
{
const char *pLang = (const char*)aIter->first;
- if( rtl_str_compare(pLang,sFullMatch.getStr() ) == 0)
+ if( rtl_str_compare( pLang, sFullMatch.getStr() ) == 0)
{
- //perfect match
+ // both language and country match
candidate = aIter->second;
break;
}
- else if( (rtl_str_compare(pLang,sLangMatch.getStr()) == 0) && (!alreadyclosematch))
+ else if( alreadyclosematch )
{
- //fairly close
+ // override candidate only if there is a perfect match
+ continue;
+ }
+ else if( rtl_str_compare( pLang, sLangMatch.getStr()) == 0)
+ {
+ // just the language matches
candidate = aIter->second;
alreadyclosematch = true;
}
- else if( (rtl_str_compare(pLang,"en") == 0) && (!alreadyclosematch) )
+ else if( rtl_str_compare( pLang, "en") == 0)
{
- //english name
+ // fallback to the english family name
candidate = aIter->second;
}
}