construct a bit mask specifying which scrolling operations are allowed */
| 617 | |
| 618 | /* construct a bit mask specifying which scrolling operations are allowed */ |
| 619 | static unsigned |
| 620 | menu_scrollmask(struct xwindow *wp) |
| 621 | { |
| 622 | float shown, top; |
| 623 | Arg args[2]; |
| 624 | Widget hbar = (Widget) 0, vbar = (Widget) 0; |
| 625 | unsigned scrlmask = 0U; |
| 626 | |
| 627 | /* set up args once, then use twice (provided that both scrollbars are |
| 628 | present); 'top' is left for horizontal scrollbar */ |
| 629 | (void) memset(args, 0, sizeof args); |
| 630 | XtSetArg(args[0], nhStr(XtNshown), &shown); |
| 631 | XtSetArg(args[1], nhStr(XtNtopOfThumb), &top); |
| 632 | |
| 633 | find_scrollbars(wp->w, wp->popup, &hbar, &vbar); |
| 634 | if (vbar) { |
| 635 | XtGetValues(vbar, args, TWO); |
| 636 | if (top > 0.0) |
| 637 | scrlmask |= 1U; /* not at top; can scroll up */ |
| 638 | if (top + shown < 1.0) |
| 639 | scrlmask |= 2U; /* more beyond bottom; can scroll down */ |
| 640 | } |
| 641 | if (hbar) { |
| 642 | XtGetValues(hbar, args, TWO); |
| 643 | if (top > 0.0) |
| 644 | scrlmask |= 4U; /* not at left edge; can scroll to left */ |
| 645 | if (top + shown < 1.0) |
| 646 | scrlmask |= 8U; /* more beyond right side; can scroll to right */ |
| 647 | } |
| 648 | return scrlmask; |
| 649 | } |
| 650 | |
| 651 | /* if a menu is scrolled vertically and/horizontally, return it to the top |
| 652 | and far left */ |
no test coverage detected