diff options
author | pavel <pavel@BUILD.kancl.blue-point.cz> | 2010-12-10 13:05:43 +0100 |
---|---|---|
committer | pavel <pavel@BUILD.kancl.blue-point.cz> | 2010-12-10 13:05:43 +0100 |
commit | 706fbdd8ad421098a4acc7c82796c26491f780b4 (patch) | |
tree | 958e124ab8e107bb40bb414061f3a203c6061676 /vcl | |
parent | a5509a421f2f3d43aad1ba5d32e6c7bf1c015b3b (diff) |
xlastovi: #i91990#: fixed the issue
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/aqua/source/gdi/salvd.cxx | 15 | ||||
-rw-r--r-- | vcl/aqua/source/window/salframe.cxx | 74 | ||||
-rw-r--r-- | vcl/source/app/sound.cxx | 5 | ||||
-rwxr-xr-x | vcl/source/window/window.cxx | 6 |
4 files changed, 93 insertions, 7 deletions
diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx index eb09a44f5edd..1decdc34b720 100644 --- a/vcl/aqua/source/gdi/salvd.cxx +++ b/vcl/aqua/source/gdi/salvd.cxx @@ -33,6 +33,7 @@ #include "salgdi.h" #include "saldata.hxx" #include "salframe.h" +#include <vcl/svapp.hxx> #include "vcl/sysdata.hxx" @@ -197,13 +198,19 @@ BOOL AquaSalVirtualDevice::SetSize( long nDX, long nDY ) pSalFrame = *GetSalData()->maFrames.begin(); if( pSalFrame ) { - NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pSalFrame->getWindow()]; - if( pNSContext ) - xCGContext = reinterpret_cast<CGContextRef>([pNSContext graphicsPort]); + // #i91990# + NSWindow* pWindow = pSalFrame->getWindow(); + if ( pWindow ) + { + NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pWindow]; + if( pNSContext ) + xCGContext = reinterpret_cast<CGContextRef>([pNSContext graphicsPort]); + } } } - DBG_ASSERT( xCGContext, "no context" ); + if ( !Application::IsHeadlessModeEnabled() ) + DBG_ASSERT( xCGContext, "no context" ); const CGSize aNewSize = { nDX, nDY }; mxLayer = CGLayerCreateWithContext( xCGContext, aNewSize, NULL ); diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index 4530778c5775..a829855204cf 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -191,14 +191,24 @@ void AquaSalFrame::initWindowAndView() mnStyleMask |= NSTitledWindowMask; } + // #i91990# support GUI-less (daemon) execution + @try + { mpWindow = [[SalFrameWindow alloc] initWithSalFrame: this]; mpView = [[SalFrameView alloc] initWithSalFrame: this]; + } + @catch ( id exception ) + { + return; + } + if( (mnStyle & SAL_FRAME_STYLE_TOOLTIP) ) [mpWindow setIgnoresMouseEvents: YES]; else [mpWindow setAcceptsMouseMovedEvents: YES]; [mpWindow setHasShadow: YES]; - [mpWindow setDelegate: mpWindow]; + // compiler warning: class 'NSWindow' does not implement the 'NSWindowDelegate' protocol + // [mpWindow setDelegate: mpWindow]; NSRect aRect = { { 0,0 }, { maGeometry.nWidth, maGeometry.nHeight } }; mnTrackingRectTag = [mpView addTrackingRect: aRect owner: mpView userData: nil assumeInside: NO]; @@ -291,6 +301,9 @@ BOOL AquaSalFrame::PostEvent( void *pData ) // ----------------------------------------------------------------------- void AquaSalFrame::SetTitle(const XubString& rTitle) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -405,6 +418,9 @@ void AquaSalFrame::SendPaintEvent( const Rectangle* pRect ) void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -563,6 +579,8 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); + if ( mpWindow ) + { // set normal state NSRect aStateRect = [mpWindow frame]; aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask]; @@ -599,6 +617,7 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) if( [mpWindow isZoomed] ) [mpWindow zoom: NSApp]; } + } // get new geometry UpdateFrameGeometry(); @@ -619,7 +638,7 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) if( nEvent ) CallCallback( nEvent, NULL ); - if( mbShown ) + if( mbShown && mpWindow ) { // trigger filling our backbuffer SendPaintEvent(); @@ -633,6 +652,9 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) { + if ( !mpWindow ) + return FALSE; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -670,6 +692,9 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) void AquaSalFrame::SetScreenNumber(unsigned int nScreen) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -704,6 +729,9 @@ void AquaSalFrame::SetScreenNumber(unsigned int nScreen) void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -814,6 +842,9 @@ public: void AquaSalFrame::StartPresentation( BOOL bStart ) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -841,6 +872,9 @@ void AquaSalFrame::SetAlwaysOnTop( BOOL bOnTop ) void AquaSalFrame::ToTop(USHORT nFlags) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -900,6 +934,9 @@ NSCursor* AquaSalFrame::getCurrentCursor() const void AquaSalFrame::SetPointer( PointerStyle ePointerStyle ) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -1198,6 +1235,9 @@ void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY ) // doesn't make the anything cleaner for now void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -1312,6 +1352,9 @@ void AquaSalFrame::Beep( SoundType eSoundType ) void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHORT nFlags) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -1399,6 +1442,9 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR void AquaSalFrame::GetWorkArea( Rectangle& rRect ) { + if ( !mpWindow ) + return; + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -1537,11 +1583,15 @@ void AquaSalFrame::SetMenu( SalMenu* pSalMenu ) void AquaSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle ) { + if ( mpWindow ) + { // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); if( (mnExtStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) != (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) ) [mpWindow setDocumentEdited: (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) ? YES : NO]; + } + mnExtStyle = nStyle; } @@ -1572,6 +1622,11 @@ void AquaSalFrame::SetParent( SalFrame* pNewParent ) void AquaSalFrame::UpdateFrameGeometry() { + if ( !mpWindow ) + { + return; + } + // keep in mind that view and window coordinates are lower left // whereas vcl's are upper left @@ -1644,6 +1699,11 @@ void AquaSalFrame::CaptureMouse( BOOL bCapture ) void AquaSalFrame::ResetClipRegion() { + if ( !mpWindow ) + { + return; + } + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -1662,6 +1722,11 @@ void AquaSalFrame::ResetClipRegion() void AquaSalFrame::BeginSetClipRegion( ULONG nRects ) { + if ( !mpWindow ) + { + return; + } + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); @@ -1696,6 +1761,11 @@ void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight void AquaSalFrame::EndSetClipRegion() { + if ( !mpWindow ) + { + return; + } + // #i113170# may not be the main thread if called from UNO API SalData::ensureThreadAutoreleasePool(); diff --git a/vcl/source/app/sound.cxx b/vcl/source/app/sound.cxx index bac9d50dc5da..d180f2647135 100644 --- a/vcl/source/app/sound.cxx +++ b/vcl/source/app/sound.cxx @@ -38,6 +38,7 @@ #include <vcl/salframe.hxx> #include <tools/debug.hxx> #include <vcl/svdata.hxx> +#include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <vcl/salbtype.hxx> #include <vcl/sound.hxx> @@ -45,6 +46,10 @@ void Sound::Beep( SoundType eType, Window* pWindow ) { + // #i91990# + if ( Application::IsHeadlessModeEnabled() ) + return; + if( !pWindow ) { Window* pDefWindow = ImplGetDefaultWindow(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index f6bedc1bfa25..4afd0c95a3a2 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -8521,6 +8521,10 @@ Reference< XDragSource > Window::GetDragSource() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); + // #i91990# + if ( Application::IsHeadlessModeEnabled() ) + return Reference< XDragSource > (); + if( mpWindowImpl->mpFrameData ) { if( ! mpWindowImpl->mpFrameData->mxDragSource.is() ) @@ -8615,7 +8619,7 @@ Reference< XClipboard > Window::GetClipboard() { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); - if( mpWindowImpl->mpFrameData ) + if( mpWindowImpl->mpFrameData && ! Application::IsHeadlessModeEnabled() ) { if( ! mpWindowImpl->mpFrameData->mxClipboard.is() ) { |