diff options
author | Michael Meeks <michael.meeks@suse.com> | 2011-10-26 19:45:35 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-10-26 19:46:15 +0100 |
commit | 90067e8007227b7f1e555a878088d81c117fee56 (patch) | |
tree | f980909fe1c008db0aa57b277c44a7022f40fd10 /vcl/headless | |
parent | 306c79e24f29bfb01b64aad1b6054a454e2927e4 (diff) |
gtk3: cleanup some code inclusion, and share timeval operators
Diffstat (limited to 'vcl/headless')
-rw-r--r-- | vcl/headless/svpdata.cxx | 50 | ||||
-rw-r--r-- | vcl/headless/svpinst.cxx | 52 |
2 files changed, 52 insertions, 50 deletions
diff --git a/vcl/headless/svpdata.cxx b/vcl/headless/svpdata.cxx new file mode 100644 index 000000000000..32afd02197df --- /dev/null +++ b/vcl/headless/svpdata.cxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2011 Novell, Inc. + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#include <generic/gendata.hxx> +#include <headless/svpinst.hxx> + +class SvpSalData : public SalGenericData +{ +public: + SvpSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_SVP, pInstance ) {} + virtual void ErrorTrapPush() {} + virtual bool ErrorTrapPop( bool ) { return false; } +}; + +// plugin factory function +extern "C" +{ + SAL_DLLPUBLIC_EXPORT SalInstance* create_SalInstance() + { + SvpSalInstance* pInstance = new SvpSalInstance( new SalYieldMutex() ); + new SvpSalData( pInstance ); + return pInstance; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index ad58bc5bcb00..9de3f8259968 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -45,28 +45,8 @@ #include <svdata.hxx> #include <generic/gendata.hxx> #include <vcl/solarmutex.hxx> - -// FIXME: split off into a separate, standalone module to aid linking -#ifndef GTK3_INCLUDED -class SvpSalData : public SalGenericData -{ -public: - SvpSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_SVP, pInstance ) { } - virtual void ErrorTrapPush() {} - virtual bool ErrorTrapPop( bool ) { return false; } -}; - -// plugin factory function -extern "C" -{ - SAL_DLLPUBLIC_EXPORT SalInstance* create_SalInstance() - { - SvpSalInstance* pInstance = new SvpSalInstance( new SalYieldMutex() ); - new SvpSalData( pInstance ); - return pInstance; - } -} -#endif +// FIXME: remove when we re-work the svp mainloop +#include <unx/salunxtime.h> bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const { @@ -198,34 +178,6 @@ void SvpSalInstance::Wakeup() OSL_VERIFY(write (m_pTimeoutFDS[1], "", 1) == 1); } -// FIXME: share this with unx/generic [!] .... -#ifndef GTK3_INCLUDED -// -=-= timeval =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -inline int operator >= ( const timeval &t1, const timeval &t2 ) -{ - if( t1.tv_sec == t2.tv_sec ) - return t1.tv_usec >= t2.tv_usec; - return t1.tv_sec > t2.tv_sec; -} -inline timeval &operator += ( timeval &t1, sal_uLong t2 ) -{ - t1.tv_sec += t2 / 1000; - t1.tv_usec += t2 ? (t2 % 1000) * 1000 : 500; - if( t1.tv_usec > 1000000 ) - { - t1.tv_sec++; - t1.tv_usec -= 1000000; - } - return t1; -} -inline int operator > ( const timeval &t1, const timeval &t2 ) -{ - if( t1.tv_sec == t2.tv_sec ) - return t1.tv_usec > t2.tv_usec; - return t1.tv_sec > t2.tv_sec; -} -#endif - bool SvpSalInstance::CheckTimeout( bool bExecuteTimers ) { bool bRet = false; |