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/aqua/source/window | |
parent | a5509a421f2f3d43aad1ba5d32e6c7bf1c015b3b (diff) |
xlastovi: #i91990#: fixed the issue
Diffstat (limited to 'vcl/aqua/source/window')
-rw-r--r-- | vcl/aqua/source/window/salframe.cxx | 74 |
1 files changed, 72 insertions, 2 deletions
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(); |