Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of a Win32 message pump in Linux?

Tags:

c++

linux

In Windows, to pump for system messages (for a game, for example) one would roughly do this:

MSG msg;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
   TranslateMessage(&msg);
   DispatchMessage(&msg);
}

I've never done development on Linux (I'm on Mint v17 at the moment) before, so I'm not sure what the equivalent (if any) would be. I did some self-research on this but didn't find much help, most likely because I am unaware of the proper linux terminology for such concepts.

like image 552
void.pointer Avatar asked Jan 23 '15 21:01

void.pointer


1 Answers

There is nothing intrinsic (i.e. built into the OS) like that. If you have e.g. X11, you have a similar message loop, where you receive and dispatch messages. Normally, you wouldn't see that message loop though, just as under MS Windows people rarely program on the bare win32 API. Use a so-called windowing toolkit like WxWidgets, Qt, GTK etc.

BTW: You could use an implementation of the win32 API on Linux, too, it's called WINE.

like image 198
Ulrich Eckhardt Avatar answered Oct 11 '22 16:10

Ulrich Eckhardt