MCPcopy Create free account
hub / github.com/SimHacker/micropolis / IntervalMouseProc

Function IntervalMouseProc

micropolis-activity/src/sim/w_inter.c:1375–1415  ·  view source on GitHub ↗
(clientData, eventPtr)

Source from the content-addressed store, hash-verified

1373 * This procedure is called back by Tk in response to
1374 * mouse events such as window entry, window exit, mouse
1375 * motion, and button presses.
1376 *
1377 * Results:
1378 * None.
1379 *
1380 * Side effects:
1381 * This procedure implements the "feel" of the interval by
1382 * issuing commands in response to button presses and mouse
1383 * motion.
1384 *
1385 *--------------------------------------------------------------
1386 */
1387
1388static void
1389IntervalMouseProc(clientData, eventPtr)
1390 ClientData clientData; /* Information about window. */
1391 register XEvent *eventPtr; /* Information about event. */
1392{
1393 register Interval *intervalPtr = (Interval *) clientData;
1394
1395 if (intervalPtr->state != tkNormalUid) {
1396 return;
1397 }
1398
1399 Tk_Preserve((ClientData) intervalPtr);
1400 if (eventPtr->type == EnterNotify) {
1401 intervalPtr->flags |= ACTIVE;
1402 EventuallyRedrawInterval(intervalPtr, REDRAW_SLIDER);
1403 } else if (eventPtr->type == LeaveNotify) {
1404 intervalPtr->flags &= ~ACTIVE;
1405 EventuallyRedrawInterval(intervalPtr, REDRAW_SLIDER);
1406 } else if ((eventPtr->type == MotionNotify)
1407 && (intervalPtr->flags & BUTTON_PRESSED)) {
1408 TrackInterval(intervalPtr, PixelToValue(intervalPtr,
1409 eventPtr->xmotion.x, eventPtr->xmotion.y));
1410 } else if ((eventPtr->type == ButtonPress)
1411/* && (eventPtr->xbutton.button == Button1) */
1412 && (eventPtr->xbutton.state == 0)) {
1413 intervalPtr->flags |= BUTTON_PRESSED;
1414 StartTrackInterval(intervalPtr, PixelToValue(intervalPtr,
1415 eventPtr->xbutton.x, eventPtr->xbutton.y));
1416/* NotifyInterval(intervalPtr); */
1417 EventuallyRedrawInterval(intervalPtr, REDRAW_SLIDER);
1418 } else if ((eventPtr->type == ButtonRelease)

Callers

nothing calls this directly

Calls 6

Tk_PreserveFunction · 0.85
EventuallyRedrawIntervalFunction · 0.85
TrackIntervalFunction · 0.85
StartTrackIntervalFunction · 0.85
Tk_ReleaseFunction · 0.85
PixelToValueFunction · 0.70

Tested by

no test coverage detected