Xevent mouse

This is just a reference if someone is going to do an Xwindows mouse. It needs to be enabled in attr.event.mask and then MotionNotify and other signals can be used.

In the window initialization.

attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask;

In the event handler.

XEvent event;XNextEvent(passVarsA->dpy2, &event);switch (event.type) { case MotionNotify: printf("Mouse X %d Y %d\n",event.xmotion.x, event.xmotion.y);break;

And some more code for the handling of buttons.

// mouse movement case MotionNotify: x = event.xmotion.x; y = event.xmotion.y; break; case ButtonRelease: case ButtonPress: { switch (event.xbutton.button) { // mouse button presses case 1: // LeftMB case 2: // MiddleMB case 3: // RightMB } break; }
case 4: //This is the forward roll case 5: //This is the backward roll

These are the names that are used to identify the specific events.


Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen