When creating a Window in XLib
SetWindowAttributes.event_mask
member? XCreateWindow()
XNextEvent(lDisplay, &xEvent);
?I have looked for a similar post. If there is already one out there please point me in the right direction.
Update
For those who want the easy answer to parts 1-3:
1.
xAttributes.event_mask = ExposureMask | KeyPressMask | ButtonPress |
StructureNotifyMask | ButtonReleaseMask |
KeyReleaseMask | EnterWindowMask | LeaveWindowMask |
PointerMotionMask | Button1MotionMask | VisibilityChangeMask |
ColormapChangeMask;
2.
unsigned long valuemask = CWEventMask | CWBackPixel | CWBorderPixel | CWCursor;
switch (xEvent.type)
{
case MapNotify:
break;
case Expose:
// If this is not the last expose event break
if (xEvent.xexpose.count != 0)
break;
else
break;
case ConfigureNotify:
break;
case VisibilityNotify:
break;
case DestroyNotify:
break;
case ButtonPress:
case ButtonRelease:
case EnterNotify:
case MotionNotify:
case LeaveNotify:
if(_mouseHandler)
_mouseHandler->HandleInput(lDisplay, &xEvent);
break;
case KeyPress:
case KeyRelease:
if(_keyboardHandler)
_keyboardHandler->HandleInput(lDisplay, &xEvent);
break;
default:
if(_keyboardHandler)
_keyboardHandler->HandleInput(lDisplay, &xEvent);
break;
}
XLib is pretty well documented. For example XLib Programming Manual: Event Masks