Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void UpdateSceneUnix()
- {
- while(XPending(win.display) > 0)
- {
- XNextEvent(win.display, &event);
- switch(event.type)
- {
- case KeyPress:
- ActivateKey(XLookupKeysym(&event.xkey, 0));
- break;
- case KeyRelease:
- DeactivateKey(XLookupKeysym(&event.xkey, 0));
- break;
- case ButtonPress:
- //mouse buttons in X are left (1) middle (2) right (3)
- if(event.xbutton.button == 1)
- ActivateMouseButton(true, false, event.xbutton.x, event.xbutton.y);
- else if(event.xbutton.button == 3)
- ActivateMouseButton(false, true, event.xbutton.x, event.xbutton.y);
- break;
- case ButtonRelease:
- if(event.xbutton.button == 1)
- DeactivateMouseButton(true, false, event.xbutton.x, event.xbutton.y);
- else if(event.xbutton.button == 3)
- DeactivateMouseButton(false, true, event.xbutton.x, event.xbutton.y);
- break;
- // The reporting in *nix for the mouse happens in several different spaces
- // In windows it happens globally. Therefore we have to adjust the mouse
- // to a global coordinate frame for the mouse movement to work
- case MotionNotify:
- MoveCursor(win.x + event.xmotion.x, win.y + event.xmotion.y);
- break;
- case ClientMessage:
- if (*XGetAtomName(win.display, event.xclient.message_type) == *"WM_PROTOCOLS")
- {
- quit_requested = true;
- }
- break;
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement