void XsMoveOutline::_motionHandler (XEvent *event) { int curX, curY; // Get current mouse position curX = event->xbutton.x_root; curY = event->xbutton.y_root; // Compute the new window position _x += (curX - _rootX); _y += (curY - _rootY); // Move the window _drawOutline (False); // Save the new root position _rootX = curX; _rootY = curY; }
Boolean XsOutline::go (Boolean drawInitial) { XtAppContext appContext = XtWidgetToApplicationContext (_w); XEvent event; int done = 0; // Grab the pointer if (_grabPointer ( ) == False) return (False); // Draw the initial box (if requested) if (drawInitial) _drawOutline (False); // Process the events locally while (!done) { XtAppNextEvent (appContext, &event); switch (event.type) { case ButtonRelease: { // Clear the outline and break _drawOutline (True); done = 1; break; } case MotionNotify: { XEvent next; // Process only the last motion event while (XPending (XtDisplay (_w)) > 0) { XPeekEvent (XtDisplay (_w), &next); if (next.type != MotionNotify) break; XtAppNextEvent (appContext, &event); } // Send this event _motionHandler (&event); break; } default: { XtDispatchEvent (&event); break; } } } // Ungrab the pointer _ungrabPointer ( ); return (True); }
Boolean XsOutline::go (Boolean drawInitial) { XtAppContext appContext = XtWidgetToApplicationContext (_w); XEvent event; int done = 0; // Grab the pointer if (_grabPointer ( ) == False) return (False); // Draw the initial box (if requested) if (drawInitial) _drawOutline (False); // Process the events locally #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ while (!done) { XtAppNextEvent (appContext, &event); switch (event.type) { case ButtonRelease: { // Clear the outline and break _drawOutline (True); done = 1; break; } case MotionNotify: { XEvent next; // Process only the last motion event #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ while (XPending (XtDisplay (_w)) > 0) { XPeekEvent (XtDisplay (_w), &next); if (next.type != MotionNotify) break; XtAppNextEvent (appContext, &event); } // Send this event _motionHandler (&event); break; } default: { XtDispatchEvent (&event); break; } } } // Ungrab the pointer _ungrabPointer ( ); return (True); }