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

Function ScaleMouseProc

micropolis-activity/src/tk/tkscale.c:1296–1330  ·  view source on GitHub ↗
(clientData, eventPtr)

Source from the content-addressed store, hash-verified

1294 * This procedure is called back by Tk in response to
1295 * mouse events such as window entry, window exit, mouse
1296 * motion, and button presses.
1297 *
1298 * Results:
1299 * None.
1300 *
1301 * Side effects:
1302 * This procedure implements the "feel" of the scale by
1303 * issuing commands in response to button presses and mouse
1304 * motion.
1305 *
1306 *--------------------------------------------------------------
1307 */
1308
1309static void
1310ScaleMouseProc(clientData, eventPtr)
1311 ClientData clientData; /* Information about window. */
1312 register XEvent *eventPtr; /* Information about event. */
1313{
1314 register Scale *scalePtr = (Scale *) clientData;
1315
1316 if (scalePtr->state != tkNormalUid) {
1317 return;
1318 }
1319
1320 Tk_Preserve((ClientData) scalePtr);
1321 if (eventPtr->type == EnterNotify) {
1322 scalePtr->flags |= ACTIVE;
1323 EventuallyRedrawScale(scalePtr, REDRAW_SLIDER);
1324 } else if (eventPtr->type == LeaveNotify) {
1325 scalePtr->flags &= ~ACTIVE;
1326 EventuallyRedrawScale(scalePtr, REDRAW_SLIDER);
1327 } else if ((eventPtr->type == MotionNotify)
1328 && (scalePtr->flags & BUTTON_PRESSED)) {
1329 SetScaleValue(scalePtr, PixelToValue(scalePtr,
1330 eventPtr->xmotion.x, eventPtr->xmotion.y));
1331 } else if ((eventPtr->type == ButtonPress)
1332 && ((eventPtr->xbutton.state & ALL_BUTTONS) == 0)) {
1333 scalePtr->flags |= BUTTON_PRESSED;

Callers

nothing calls this directly

Calls 5

Tk_PreserveFunction · 0.85
EventuallyRedrawScaleFunction · 0.85
SetScaleValueFunction · 0.85
Tk_ReleaseFunction · 0.85
PixelToValueFunction · 0.70

Tested by

no test coverage detected