-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from JacobDomagala/135-default-window-size-to…
…-monitor-size [#135]: Default the size of `Window` to size of `PrimaryMonitor`
- Loading branch information
Showing
22 changed files
with
276 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#pragma once | ||
|
||
#include <functional> | ||
#include <vector> | ||
|
||
namespace looper { | ||
|
||
class WorkQueue | ||
{ | ||
public: | ||
using WorkUnit = std::function< void() >; | ||
using Precondition = std::function< bool() >; | ||
using Workers = std::vector< std::pair< Precondition, WorkUnit > >; | ||
|
||
void | ||
PushWorkUnit(const Precondition& prec, const WorkUnit& work) | ||
{ | ||
queue_.push_back({prec, work}); | ||
} | ||
|
||
void | ||
RunWorkUnits() | ||
{ | ||
Workers tmpQueue; | ||
|
||
for (auto& unit : queue_) | ||
{ | ||
if (unit.first()) | ||
{ | ||
unit.second(); | ||
} | ||
else | ||
{ | ||
tmpQueue.push_back(unit); | ||
} | ||
} | ||
|
||
queue_.swap(tmpQueue); | ||
} | ||
|
||
private: | ||
Workers queue_; | ||
}; | ||
|
||
} // namespace looper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.