MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / pumpQueue

Method pumpQueue

src/ui/manager.cpp:1247–1357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1245}
1246
1247void Manager::pumpQueue()
1248{
1249#ifdef LIMIT_DISPATCH_TIME
1250 base::tick_t t = base::current_tick();
1251#endif
1252
1253 Messages::iterator it = msg_queue.begin();
1254 while (it != msg_queue.end()) {
1255#ifdef LIMIT_DISPATCH_TIME
1256 if (base::current_tick()-t > 250)
1257 break;
1258#endif
1259
1260 // The message to process
1261 Message* msg = *it;
1262
1263 // Go to next message
1264 if (msg->isUsed()) {
1265 ++it;
1266 continue;
1267 }
1268
1269 // This message is in use
1270 msg->markAsUsed();
1271 Message* first_msg = msg;
1272
1273 // Call Timer::tick() if this is a tick message.
1274 if (msg->type() == kTimerMessage) {
1275 ASSERT(static_cast<TimerMessage*>(msg)->timer() != NULL);
1276 static_cast<TimerMessage*>(msg)->timer()->tick();
1277 }
1278
1279 bool done = false;
1280
1281 for (auto listener : m_messageListeners)
1282 done = listener->sendMessage(msg);
1283
1284 for (auto widget : msg->recipients()) {
1285 if (!widget)
1286 continue;
1287 if (done)
1288 break;
1289
1290#ifdef REPORT_EVENTS
1291 {
1292 std::cout << "Event " << msg->type() << " (" << ui::to_string(msg->type()) << ") "
1293 << "for " << typeid(*widget).name();
1294 if (!widget->id().empty())
1295 std::cout << " (" << widget->id() << ")";
1296 std::cout << std::endl;
1297 }
1298#endif
1299
1300 // We need to configure the clip region for paint messages
1301 // before we call Widget::sendMessage().
1302 if (msg->type() == kPaintMessage) {
1303 if (widget->hasFlags(HIDDEN))
1304 continue;

Callers

nothing calls this directly

Calls 15

current_tickFunction · 0.85
to_stringFunction · 0.85
display_wFunction · 0.85
display_hFunction · 0.85
isUsedMethod · 0.80
markAsUsedMethod · 0.80
timerMethod · 0.80
tickMethod · 0.80
sendMessageMethod · 0.80
rectMethod · 0.80
flipMethod · 0.80
RegionClass · 0.70

Tested by

no test coverage detected