當創建在XLIBX11鼠標移動事件
- 一個窗口什麼是我提供給
SetWindowAttributes.event_mask
成員的面具? - 我有什麼要傳遞給的
XCreateWindow()
- 11日paramater什麼事件,我在主消息循環尋找(這裏我用
XNextEvent(lDisplay, &xEvent);
? - 因爲X的表現比微軟的Win32 API的不同,如何我確定鼠標是否在我的窗口或我的「應用程序」窗口,而不是在桌面上?
我已經找了一個類似的帖子,如果已經有一個,請指出我在正確的方向
更新
對於那些誰想要簡單的答案,部分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有很好的文檔記錄。你有沒有嘗試搜索互聯網?例如[XLib編程手冊:事件掩膜](http://tronche.com/gui/x/xlib/events/mask.html) – 2012-02-20 07:14:41