summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-11-23 21:44:36 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-11-24 09:02:31 +0000
commit4bd8ffd27f17ec4915790a260087ef1890169911 (patch)
tree063b8ac7c5909252934fffe00dd90367f94ab7b7 /vcl
parent37b5f1ed3139b8569bfec0fcb5077f6b66b79acd (diff)
Replace return boolean from DoYield with pleasant enumeration.
Change-Id: I1b1f885b4d7916a18dfb2457a8e9af9a5b4ae6e4 Reviewed-on: https://gerrit.libreoffice.org/20138 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/headless/svpinst.cxx5
-rw-r--r--vcl/inc/headless/svpinst.hxx2
-rw-r--r--vcl/inc/osx/salinst.h2
-rw-r--r--vcl/inc/salinst.hxx4
-rw-r--r--vcl/inc/unx/gtk/gtkdata.hxx2
-rw-r--r--vcl/inc/unx/gtk/gtkinst.hxx2
-rw-r--r--vcl/inc/unx/saldisp.hxx2
-rw-r--r--vcl/inc/unx/salinst.h2
-rw-r--r--vcl/inc/win/salinst.h2
-rw-r--r--vcl/osx/salinst.cxx6
-rw-r--r--vcl/source/app/scheduler.cxx4
-rw-r--r--vcl/source/app/timer.cxx3
-rw-r--r--vcl/unx/generic/app/saldata.cxx10
-rw-r--r--vcl/unx/generic/app/salinst.cxx2
-rw-r--r--vcl/unx/gtk/gtkdata.cxx7
-rw-r--r--vcl/unx/gtk/gtkinst.cxx2
-rw-r--r--vcl/win/source/app/salinst.cxx14
17 files changed, 39 insertions, 32 deletions
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index ec7039a315e0..0d765c19fa5c 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -261,7 +261,7 @@ SalBitmap* SvpSalInstance::CreateSalBitmap()
#endif
}
-bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
@@ -329,7 +329,8 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong
DoReleaseYield(nTimeoutMS);
}
- return bEvent;
+ return bEvent ? SalYieldResult::EVENT :
+ SalYieldResult::TIMEOUT;
}
void SvpSalInstance::DoReleaseYield( int nTimeoutMS )
diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx
index 779a65f122d5..2d2716eb1d4f 100644
--- a/vcl/inc/headless/svpinst.hxx
+++ b/vcl/inc/headless/svpinst.hxx
@@ -155,7 +155,7 @@ public:
// wait next event and dispatch
// must returned by UserEvent (SalFrame::PostEvent)
// and timer
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
// may return NULL to disable session management
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index 151da029b58c..5c652414e82e 100644
--- a/vcl/inc/osx/salinst.h
+++ b/vcl/inc/osx/salinst.h
@@ -107,7 +107,7 @@ public:
virtual sal_uLong ReleaseYieldMutex() override;
virtual void AcquireYieldMutex( sal_uLong nCount ) override;
virtual bool CheckYieldMutex() override;
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents,
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents,
sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pVCLMenu ) override;
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 6ed84b909230..b20448f3e7bf 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -60,6 +60,8 @@ class Menu;
enum class VclInputFlags;
enum class SalFrameStyleFlags;
+enum SalYieldResult { EVENT, TIMEOUT };
+
class VCL_PLUGIN_PUBLIC SalInstance
{
private:
@@ -132,7 +134,7 @@ public:
* If @bHandleAllCurrentEvents - dispatch multiple posted
* user events. Returns true if events needed processing.
*/
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) = 0;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) = 0;
virtual bool AnyInput( VclInputFlags nType ) = 0;
// menus
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index aa513ceddb4f..082aa62d8130 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -115,7 +115,7 @@ public:
static gboolean userEventFn( gpointer data );
void PostUserEvent();
- bool Yield( bool bWait, bool bHandleAllCurrentEvents );
+ SalYieldResult Yield( bool bWait, bool bHandleAllCurrentEvents );
inline GdkDisplay *GetGdkDisplay();
virtual void ErrorTrapPush() override;
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 3dd8f0d6da37..002b6549ec17 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -80,7 +80,7 @@ public:
const SystemGraphicsData* ) override;
virtual SalBitmap* CreateSalBitmap() override;
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual GenPspGraphics *CreatePrintGraphics() override;
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index e6c2a0fcef72..58ac8d07afe4 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -153,7 +153,7 @@ public:
virtual ~SalXLib();
virtual void Init();
- virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents );
+ virtual SalYieldResult Yield( bool bWait, bool bHandleAllCurrentEvents );
virtual void Wakeup();
virtual void PostUserEvent();
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index 5ccb9a1a7a89..54119d46f8a2 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -71,7 +71,7 @@ public:
virtual SalBitmap* CreateSalBitmap() override;
virtual SalSession* CreateSalSession() override;
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) override;
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index c50aaa57dd3c..b6408ea4f322 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -72,7 +72,7 @@ public:
virtual void AcquireYieldMutex( sal_uIntPtr nCount ) override;
virtual bool CheckYieldMutex() override;
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual SalMenu* CreateMenu( bool bMenuBar, Menu* ) override;
virtual void DestroyMenu( SalMenu* ) override;
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index f2afec8c71d6..8cdce3ffc4f5 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -559,7 +559,7 @@ class ReleasePoolHolder
~ReleasePoolHolder() { [mpPool release]; }
};
-bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
@@ -600,7 +600,7 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLon
osl_setCondition( maWaitingYieldCond );
// return if only one event is asked for
if( ! bHandleAllCurrentEvents )
- return true;
+ return SalYieldResult::EVENT;
}
}
@@ -711,7 +711,7 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLon
}
}
- return bHadEvent;
+ return bHadEvent ? SalYieldResult::EVENT : SalYieldResult::TIMEOUT;
}
bool AquaSalInstance::AnyInput( VclInputFlags nType )
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 6092f1dbe4c7..138fbcdcb3fa 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -41,7 +41,7 @@ void ImplSchedulerData::Invoke()
mbInScheduler = false;
}
-ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimer )
+ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimerOnly )
{
ImplSVData* pSVData = ImplGetSVData();
ImplSchedulerData *pMostUrgent = nullptr;
@@ -49,7 +49,7 @@ ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimer )
for ( ImplSchedulerData *pSchedulerData = pSVData->mpFirstSchedulerData; pSchedulerData; pSchedulerData = pSchedulerData->mpNext )
{
if ( !pSchedulerData->mpScheduler || pSchedulerData->mbDelete || pSchedulerData->mnUpdateStack >= pSVData->mnUpdateStack
- || !pSchedulerData->mpScheduler->ReadyForSchedule( bTimer ) || !pSchedulerData->mpScheduler->IsActive())
+ || !pSchedulerData->mpScheduler->ReadyForSchedule( bTimerOnly ) || !pSchedulerData->mpScheduler->IsActive())
continue;
if (!pMostUrgent)
pMostUrgent = pSchedulerData;
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx
index b048504beeb5..de7c52b8a1d1 100644
--- a/vcl/source/app/timer.cxx
+++ b/vcl/source/app/timer.cxx
@@ -30,9 +30,8 @@ void Timer::SetDeletionFlags()
}
}
-bool Timer::ReadyForSchedule( bool bTimer ) const
+bool Timer::ReadyForSchedule( bool /* bTimerOnly */ ) const
{
- (void)bTimer;
return (mpSchedulerData->mnUpdateTime + mnTimeout) <= tools::Time::GetSystemTicks();
}
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index ceee7fc82c67..3f9d184a5566 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -606,7 +606,8 @@ bool SalXLib::CheckTimeout( bool bExecuteTimers )
return bRet;
}
-bool SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
+SalYieldResult
+SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
blockIdleTimeout = !bWait;
// check for timeouts here if you want to make screenshots
@@ -629,7 +630,7 @@ bool SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( ! bHandleAllCurrentEvents )
{
blockIdleTimeout = false;
- return true;
+ return SalYieldResult::EVENT;
}
}
}
@@ -706,7 +707,7 @@ bool SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if (nFound == 0)
{
blockIdleTimeout = false;
- return false;
+ return SalYieldResult::TIMEOUT;
}
for ( int nFD = 0; nFD < nFDs_; nFD++ )
@@ -736,7 +737,8 @@ bool SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
}
blockIdleTimeout = false;
- return bHandledEvent;
+ return bHandledEvent ? SalYieldResult::EVENT
+ : SalYieldResult::TIMEOUT;
}
void SalXLib::Wakeup()
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index 457fc52c5f50..af3f95cf09a2 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -151,7 +151,7 @@ bool X11SalInstance::AnyInput(VclInputFlags nType)
return bRet;
}
-bool X11SalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult X11SalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx
index 02ad2b81468c..d25b03652a6d 100644
--- a/vcl/unx/gtk/gtkdata.cxx
+++ b/vcl/unx/gtk/gtkdata.cxx
@@ -579,7 +579,7 @@ void GtkData::Dispose()
}
/// Allows events to be processed, returns true if we processed an event.
-bool GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
+SalYieldResult GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
blockIdleTimeout = !bWait;
@@ -598,7 +598,7 @@ bool GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
else if( ! bWait )
{
blockIdleTimeout = false;
- return false; // someone else is waiting already, return
+ return SalYieldResult::TIMEOUT; // someone else is waiting already, return
}
if( bDispatchThread )
@@ -633,7 +633,8 @@ bool GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
}
blockIdleTimeout = false;
- return bWasEvent;
+ return bWasEvent ? SalYieldResult::EVENT
+ : SalYieldResult::TIMEOUT;
}
void GtkData::Init()
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index ec13855308bc..f7da84f3c9ba 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -396,7 +396,7 @@ void GtkInstance::RemoveTimer (SalTimer *pTimer)
m_aTimers.erase( it );
}
-bool GtkInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult GtkInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index fcb5a1581405..5cf6c3dd58ba 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -621,7 +621,8 @@ static void ImplSalDispatchMessage( MSG* pMsg )
ImplSalPostDispatchMsg( pMsg, lResult );
}
-bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
+SalYieldResult
+ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
{
MSG aMsg;
bool bWasMsg = false, bOneEvent = false;
@@ -648,12 +649,13 @@ bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
ImplSalDispatchMessage( &aMsg );
}
}
- return bWasMsg;
+ return bWasMsg ? SalYieldResult::EVENT :
+ SalYieldResult::TIMEOUT;
}
-bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
- bool bDidWork = false;
+ SalYieldResult eDidWork = SalYieldResult::TIMEOUT;
// NOTE: if nReleased != 0 this will be called without SolarMutex
// so don't do anything dangerous before releasing it here
SalYieldMutex* pYieldMutex = mpSalYieldMutex;
@@ -694,7 +696,7 @@ bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong
}
else
{
- bDidWork = ImplSalYield( bWait, bHandleAllCurrentEvents );
+ eDidWork = ImplSalYield( bWait, bHandleAllCurrentEvents );
n = nCount;
while ( n )
@@ -703,7 +705,7 @@ bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong
n--;
}
}
- return bDidWork;
+ return eDidWork;
}
LRESULT CALLBACK SalComWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )