[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-video-cvs
Subject: [Video-cvs] sitelib/platform/mac maceventgrabber.cpp, 1.1,
From: milko () helixcommunity ! org
Date: 2007-06-05 19:15:33
Message-ID: 200706051915.l55JFfth013696 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/video/sitelib/platform/mac
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv26770/platform/mac
Modified Files:
maceventgrabber.cpp macsite.cpp macsurf.cpp
Log Message:
Handled full-screen background repaint for Mac.
Index: macsite.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/mac/macsite.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- macsite.cpp 29 May 2007 17:54:46 -0000 1.28
+++ macsite.cpp 5 Jun 2007 19:15:30 -0000 1.29
@@ -434,19 +434,18 @@
*/
STDMETHODIMP_(HXxWindow*) CHXMacSite::GetWindow()
{
- if (zm_bFullScreenActive)
+ if (zm_bFullScreenActive &&
+ m_pHXxFullScreenWindow &&
+ m_pHXxFullScreenWindow->window)
{
- if (m_pHXxFullScreenWindow) return m_pHXxFullScreenWindow;
- if (m_pParentSite) return m_pParentSite->GetWindow();
+ return m_pHXxFullScreenWindow;
+ }
- HX_ASSERT(!"shouldn't get here");
+ if (m_pParentSite)
+ {
+ return m_pParentSite->GetWindow();
}
- return CHXBaseSite::GetWindow();
-
-
- if (zm_bFullScreenActive && m_pHXxFullScreenWindow) return \
m_pHXxFullScreenWindow;
-return m_pWindow;
return CHXBaseSite::GetWindow();
}
@@ -466,43 +465,9 @@
void
CHXMacSite::_AttachWindow()
{
- m_pHXxFullScreenWindow = new HXxWindow;
if (m_pTopLevelSite == this)
{
- Rect r = {0,0,0,0};
- ::CreateNewWindow(kFloatingWindowClass,
- kWindowStandardHandlerAttribute | kWindowNoTitleBarAttribute, &r,
- (WindowRef*) (&m_pHXxFullScreenWindow->window));
- // if we created the mac window we need to update the HXxWindow parameters
- // so we're not clipped out later
- if (m_bCreatedOSWindow)
- {
- HX_ASSERT(m_pWindow);
-
- WindowPtr w = (WindowPtr)m_pWindow->window;
-
- HX_ASSERT(w);
-
- m_pWindow->x = 0;
- m_pWindow->y = 0;
-
- Rect bounds;
- ::GetPortBounds(::GetWindowPort(w), &bounds);
-
- m_pWindow->width = bounds.right-bounds.left;
- m_pWindow->height = bounds.bottom-bounds.top;
-
- m_pWindow->clipRect.left = 0;
- m_pWindow->clipRect.top = 0;
- m_pWindow->clipRect.right = m_pWindow->width;
- m_pWindow->clipRect.bottom = m_pWindow->height;
- }
- }
- else
- {
- CHXMacSite* pMacParentSite = (CHXMacSite*)m_pParentSite; // XXXbobclark Ewwww! (Can \
we use RTTI ya think?)
- m_pHXxFullScreenWindow->window = pMacParentSite->m_pHXxFullScreenWindow->window;
}
}
@@ -590,6 +555,8 @@
}
// delete the scroll bars so it recreates them in the right spot
_DestroySliders();
+
+ _CheckFullScreenRepaint();
}
/************************************************************************
@@ -610,6 +577,8 @@
}
// delete the scroll bars so it recreates them in the right spot.
_DestroySliders();
+
+ _CheckFullScreenRepaint();
}
/************************************************************************
@@ -936,8 +905,8 @@
siteRectToDamage.top = 0;
siteRectToDamage.right = m_size.cx;
siteRectToDamage.bottom = m_size.cy;
- DamageRect(siteRectToDamage);
- InternalForceRedraw();
+ _RecursiveDamageRect(&siteRectToDamage, FALSE);
+ _ForceRedrawAll();
}
HXxWindow* pWindow = GetWindow();
@@ -1489,13 +1458,15 @@
HX_RESULT
CHXMacSite::_EnterFullScreen(HXxWindow* pWindow)
{
+ HX_RESULT retVal = HXR_OK;
+
if (zm_bFullScreenActive)
{
return HXR_UNEXPECTED;
}
zm_bFullScreenActive = TRUE;
- // We need to inicate we are in full screen at the bginning of the process
+ // We need to indicate we are in full screen at the bginning of the process
// rather than the end in order for recepient of any callabck fired in the
// full screen process (e.g. SizeChanged) to be able to discover them as
// part of full-screen mode via site query.
@@ -1551,6 +1522,29 @@
GDHandle mainGD = ::GetMainDevice();
Rect bounds = (**mainGD).gdRect;
+ if (!m_pHXxFullScreenWindow)
+ {
+ m_pHXxFullScreenWindow = new HXxWindow;
+
+ retVal = HXR_OUTOFMEMORY;
+
+ if (m_pHXxFullScreenWindow)
+ {
+ OSStatus macStatus;
+
+ Rect r = {0,0,0,0};
+ macStatus = ::CreateNewWindow(kFloatingWindowClass,
+ kWindowStandardHandlerAttribute | kWindowNoTitleBarAttribute, &r,
+ (WindowRef*) (&m_pHXxFullScreenWindow->window));
+
+ retVal = HXR_FAIL;
+ if (macStatus == noErr)
+ {
+ retVal = HXR_OK;
+ }
+ }
+ }
+
if (m_pHXxFullScreenWindow && m_pHXxFullScreenWindow->window)
{
WindowPtr w = (WindowPtr)m_pHXxFullScreenWindow->window;
@@ -1600,17 +1594,13 @@
m_pHXxFullScreenWindow->clipRect.right = newPosition.x + newSize.cx;
m_pHXxFullScreenWindow->clipRect.bottom = newPosition.y + newSize.cy;
-#if defined(_CARBON) || defined(_MAC_UNIX)
- ::SetPort( GetWindowPort( (WindowPtr)m_pHXxFullScreenWindow->window ) );
-#else
- ::SetPort((WindowPtr)m_pHXxFullScreenWindow->window);
-#endif
- RGBColor holdRGB;
- RGBColor theRGB = {0x0000, 0x0000, 0x0000};
- ::GetBackColor(&holdRGB);
- ::RGBBackColor(&theRGB);
- ::EraseRect(&bounds);
- ::RGBBackColor(&holdRGB);
+ ::SetPort(GetWindowPort((WindowPtr) m_pHXxFullScreenWindow->window));
+ SetOriginAndMaintainClipRgn(-m_pHXxFullScreenWindow->x, \
-m_pHXxFullScreenWindow->y); +
+ _RepaintFullScreenSurroundings(TRUE);
+
+ m_lastFSSize = newSize;
+ m_lastFSPosition = newPosition;
GetSize(m_RememberNonFullscreenSize);
GetPosition(m_RememberNonFullscreenPosition);
@@ -1622,8 +1612,6 @@
newPosition.x -= m_pHXxFullScreenWindow->x;
newPosition.y -= m_pHXxFullScreenWindow->y;
SetPosition(newPosition);
-
- SetOriginAndMaintainClipRgn(-m_pHXxFullScreenWindow->x, \
-m_pHXxFullScreenWindow->y); }
}
@@ -1649,29 +1637,11 @@
m_bInFullScreen = FALSE;
_DestroySliders();
- if (bOnDestruct)
- {
- if (m_pHXxFullScreenWindow && m_pHXxFullScreenWindow->window)
- {
- ::DisposeWindow((WindowRef) m_pHXxFullScreenWindow->window);
- }
- HX_DELETE(m_pHXxFullScreenWindow);
- }
- else
+ if (m_pHXxFullScreenWindow && m_pHXxFullScreenWindow->window)
{
- if (m_pHXxFullScreenWindow && m_pHXxFullScreenWindow->window)
- {
- WindowPtr w = (WindowPtr)m_pHXxFullScreenWindow->window;
- GrafPtr savePort;
- ::GetPort(&savePort);
- ::SetPort(::GetWindowPort(w));
- // we need to restore the origin for the next time we may
- // enter fullscreen mode. xxxbobclark
- SetOriginAndMaintainClipRgn(0,0);
- ::HideWindow(w);
- ::SetPort(savePort);
- }
+ ::DisposeWindow((WindowRef) m_pHXxFullScreenWindow->window);
}
+ HX_DELETE(m_pHXxFullScreenWindow);
::EndFullScreen(zm_pRememberFullScreenInformation, nil);
@@ -1723,6 +1693,121 @@
}
}
+HXBOOL CHXMacSite::_CheckFullScreenRepaint(void)
+{
+ if (m_bInFullScreen &&
+ (m_pTopLevelSite == this) &&
+ (!m_bDisableForceRedraw) &&
+ ((m_size.cx != m_lastFSSize.cx) ||
+ (m_size.cy != m_lastFSSize.cy) ||
+ (m_position.x != m_lastFSPosition.x) ||
+ (m_position.y != m_lastFSPosition.y)))
+ {
+ _RepaintFullScreenSurroundings(FALSE);
+
+ m_lastFSSize = m_size;
+ m_lastFSPosition = m_lastFSPosition;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+HX_RESULT
+CHXMacSite::_RepaintFullScreenSurroundings(HXBOOL bPaintOverSites)
+{
+ HX_RESULT retVal = HXR_UNEXPECTED;
+
+ if ((m_pTopLevelSite == this) &&
+ m_pHXxFullScreenWindow &&
+ m_pHXxFullScreenWindow->window &&
+ m_bInFullScreen)
+ {
+ RgnHandle macFSWindowRgn = ::NewRgn();
+ RgnHandle macTLSRgn = ::NewRgn();
+ RgnHandle macFSSurroundRgn = ::NewRgn();
+
+ retVal = HXR_OUTOFMEMORY;
+
+ if (macFSWindowRgn && macTLSRgn && macFSSurroundRgn)
+ {
+ GrafPtr fsPort;
+ GrafPtr savePort;
+ Rect savePortRect;
+ RGBColor saveRGB;
+ RGBColor repaintRGB = {0x0000, 0x0000, 0x0000};
+ // Pattern solidPattern = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+ retVal = HXR_OK;
+
+ if (bPaintOverSites)
+ {
+ ::SetRectRgn(macFSSurroundRgn,
+ 0,
+ 0,
+ (short) m_pHXxFullScreenWindow->width,
+ (short) m_pHXxFullScreenWindow->height);
+ }
+ else
+ {
+ ::SetRectRgn(macFSWindowRgn,
+ 0,
+ 0,
+ (short) m_pHXxFullScreenWindow->width,
+ (short) m_pHXxFullScreenWindow->height);
+
+ ::SetRectRgn(macTLSRgn,
+ (short) m_position.x,
+ (short) m_position.y,
+ (short) (m_position.x + m_size.cx),
+ (short) (m_position.y + m_size.cy));
+
+ ::DiffRgn(macFSWindowRgn, macTLSRgn, macFSSurroundRgn);
+ }
+
+
+ ::GetPort(&savePort);
+
+ fsPort = GetWindowPort((WindowPtr) m_pHXxFullScreenWindow->window);
+ ::SetPort(fsPort);
+
+ ::GetPortBounds(fsPort, &savePortRect);
+
+ SetOriginAndMaintainClipRgn(-m_pHXxFullScreenWindow->x, \
-m_pHXxFullScreenWindow->y); + // ::InvalWindowRect((WindowPtr) \
m_pHXxFullScreenWindow->window, &bounds); +
+ ::GetBackColor(&saveRGB);
+ ::RGBBackColor(&repaintRGB);
+ // ::BackPat(&solidPattern);
+ ::EraseRgn(macFSSurroundRgn);
+ // ::FillRect(&bounds, &solidPattern);
+ ::RGBBackColor(&saveRGB);
+
+ SetOriginAndMaintainClipRgn(savePortRect.left, savePortRect.top);
+
+ ::SetPort(savePort);
+ }
+
+ if (macFSWindowRgn)
+ {
+ ::DisposeRgn(macFSWindowRgn);
+ }
+
+ if (macTLSRgn)
+ {
+ ::DisposeRgn(macTLSRgn);
+ }
+
+ if (macFSSurroundRgn)
+ {
+ ::DisposeRgn(macFSSurroundRgn);
+ }
+ }
+
+ return retVal;
+}
+
/************************************************************************
* Method:
* CHXMacSite::_TestFullScreen
Index: maceventgrabber.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/mac/maceventgrabber.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- maceventgrabber.cpp 29 May 2007 17:54:46 -0000 1.1
+++ maceventgrabber.cpp 5 Jun 2007 19:15:30 -0000 1.2
@@ -135,8 +135,8 @@
{
kEventClassMouse, kEventMouseDown,
kEventClassMouse, kEventMouseUp,
- // kEventClassMouse, kEventMouseMoved,
- // kEventClassMouse, kEventMouseDragged,
+ kEventClassMouse, kEventMouseMoved,
+ kEventClassMouse, kEventMouseDragged,
kEventClassKeyboard, kEventRawKeyDown,
kEventClassKeyboard, kEventRawKeyUp,
kEventClassKeyboard, kEventRawKeyRepeat,
Index: macsurf.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/mac/macsurf.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- macsurf.cpp 17 May 2007 22:54:18 -0000 1.23
+++ macsurf.cpp 5 Jun 2007 19:15:30 -0000 1.24
@@ -309,9 +309,10 @@
HX_RESULT retVal = HXR_OK;
GrafPtr savePort = nil;
+ GrafPtr surfacePort = nil;
Point originalOrigin = {0,0};
-
+
HXxWindow* pWindow = m_pSite->m_pTopLevelSite->GetWindow();
if (IsMacInCooperativeThread())
{
@@ -336,13 +337,15 @@
if (w)
{
- GrafPtr processedPort = ::GetWindowPort(w);
+ origPort = ::GetWindowPort(w);
- ::SetPort(processedPort);
- ::GetPortBounds(processedPort, &portRect);
+ ::SetPort(origPort);
+ ::GetPortBounds(origPort, &portRect);
originalOrigin.h = portRect.left;
originalOrigin.v = portRect.top;
}
+
+ surfacePort = origPort;
}
if (zm_pOverlayBuf == nil)
@@ -357,6 +360,7 @@
static HXxSize sLastSrcSize = {0,0};
static HXxRect sLastClipRect = {0,0,0,0};
static Point sLastOrigin = {-1,-1};
+ static GrafPtr sLastPort = nil;
HX_ASSERT(m_pSite);
@@ -377,6 +381,7 @@
if (sLastSrcSize.cx != srcSize.cx || sLastSrcSize.cy != srcSize.cy) \
bOverlayRebuildingRequired = TRUE;
if (sLastOrigin.h != originalOrigin.h || sLastOrigin.v != originalOrigin.v) \
bOverlayRebuildingRequired = TRUE; if (zm_pOverlayBuf == nil) \
bOverlayRebuildingRequired = TRUE; + if (surfacePort != sLastPort) \
bOverlayRebuildingRequired = TRUE;
// xxxbobclark this catch up workaround is necessary because with some
// parameters of the overlay while the TLC is resizing, a glitch can
@@ -528,7 +533,7 @@
RgnHandle rectRgn = ::NewRgn();
if (rectRgn)
{
- RectRgn(rectRgn, &rgnBounds);
+ ::RectRgn(rectRgn, &rgnBounds);
::SectRgn(rectRgn, newMaskRgn, newMaskRgn);
::DisposeRgn(rectRgn);
}
@@ -584,6 +589,8 @@
sLastSrcSize = srcSize;
sLastClipRect = clipRect;
sLastOrigin = originalOrigin;
+ sLastPort = surfacePort;
+
if (!newMaskRgn && zm_OverlayMaskRgn)
{
// CleanUpOverlay is going to clear out
@@ -605,38 +612,12 @@
}
HX_ASSERT(zm_OverlayMaskRgn);
- Point deltaPoint = {0,0};
-
- HXxWindow* pWindow = m_pSite->m_pTopLevelSite->GetWindow();
- GrafPtr origPort = GetGrafPortFromHXWindow(pWindow);
- Rect portRect;
- ::SetPort(origPort);
- ::GetPortBounds(origPort, &portRect);
- Point oldOrigin;
- oldOrigin.h = portRect.left;
- oldOrigin.v = portRect.top;
-
- WindowPtr w = ::GetWindowFromPort(origPort);
-
- if (w)
- {
- GrafPtr processedPort = ::GetWindowPort(w);
-
- ::LocalToGlobal(&deltaPoint);
-
- ::SetPort(processedPort);
- ::GetPortBounds(processedPort, &portRect);
- oldOrigin.h = portRect.left;
- oldOrigin.v = portRect.top;
-
- ::GlobalToLocal(&deltaPoint);
- }
SetOriginAndMaintainClipRgn(0, 0);
-
+
ConstructOverlay(0, 0, s.cx, s.cy, srcSize.cx, srcSize.cy, zm_OverlayMaskRgn);
- SetOriginAndMaintainClipRgn(oldOrigin.h, oldOrigin.v);
+ SetOriginAndMaintainClipRgn(originalOrigin.h, originalOrigin.v);
}
}
if (newMaskRgn)
@@ -748,7 +729,7 @@
::GlobalToLocal(&deltaPoint);
}
-
+
SetOriginAndMaintainClipRgn(-(offset.x + deltaPoint.h), -(offset.y + \
deltaPoint.v));
short err = DecompressSequenceFrameWhen(
_______________________________________________
Video-cvs mailing list
Video-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/video-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic