在XLib中创建窗口时
我为 SetWindowAttributes.event_mask 会员提供的面具是什么?
我需要传递给 XCreateWindow() 的第11个参数
我在主消息循环中寻找的事件是什么(我在哪里使用 XNextEvent(lDisplay, &xEvent); ?
由于X的行为与Microsoft的Win32 API不同,如何确定鼠标是在我的窗口上还是在我的"Application"窗口而不是在桌面上?
我找了一个类似的帖子 . 如果那里已经有一个,请指出我正确的方向 .
Update
对于那些想要轻松回答第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;
}