home *** CD-ROM | disk | FTP | other *** search
- /*************************************** palettetool_confirm.c ********
- * by Hsuan Chang (hsc%vanderbilt@csnet-relay)
- * 7/1/87
- */
- #include <suntool/sunview.h>
- #include <suntool/canvas.h>
- #include <suntool/panel.h>
- #include <stdio.h>
-
- xtern Frame base_frame;
-
- /* confirm procedure */
- onfirm()
- {
- struct fullscreen *fsh;
- struct inputevent event;
- int fd,
- result;
-
- /* obtain handles to the whole tool and its environment */
- fd = (int)window_get(base_frame, WIN_FD);
- fsh = (struct fullscreen *)fullscreen_init(fd);
-
- /* replace the cursor with a confirm cursor */
- window_set(base_frame,
- WIN_CONSUME_PICK_EVENTS, WIN_NO_EVENTS, WIN_MOUSE_BUTTONS, 0,
- 0);
- /*
- * confirm loop, only mouse button press will terminate it.
- * the screen blinks if other events occur
- */
- while (TRUE) {
- if (input_readevent(fd, &event) == -1) {
- perror("Cursor_confirm input failed");
- abort();
- }
- switch (event.ie_code) {
- case MS_MIDDLE:
- case MS_RIGHT:
- result = FALSE;
- break;
- case MS_LEFT:
- result = TRUE;
- break;
- default:
- continue;
- }
- break;
- }
- /* get back to normal environment */
- fullscreen_destroy(fsh);
- return(result);
- }
-