v03i059: prompting program, Patch1
Mike Wexler
mikew at wyse.wyse.com
Tue Mar 21 08:50:29 AEST 1989
Submitted-by: brachman at cs.ubc.ca
Posting-number: Volume 3, Issue 59
Archive-name: xprompt/patch1
diff -cr xprompt.old/patchlevel.h xprompt/patchlevel.h
*** xprompt.old/patchlevel.h Mon Mar 20 14:39:36 1989
--- xprompt/patchlevel.h Mon Mar 20 14:41:34 1989
***************
*** 1 ****
! #define PATCHLEVEL 0
--- 1 ----
! #define PATCHLEVEL 1
diff -cr xprompt.old/xprompt.c xprompt/xprompt.c
*** xprompt.old/xprompt.c Mon Mar 20 14:39:36 1989
--- xprompt/xprompt.c Mon Mar 20 14:39:50 1989
***************
*** 3,11 ****
/*
* xprompt - prompt the user for one or more replies
*
! * Written for X11R3
! * 24-Jan-89 bjb
*
* Copyright (C) 1989 Barry Brachman and The University of British Columbia
*
* Permission is given to freely copy and distribute this software provided:
--- 3,13 ----
/*
* xprompt - prompt the user for one or more replies
*
! * 11-Mar-89 Fixed problem with XSetInputFocus being done before windows
! * were viewable.
*
+ * 24-Jan-89 Written for X11R3. Released for distribution.
+ *
* Copyright (C) 1989 Barry Brachman and The University of British Columbia
*
* Permission is given to freely copy and distribute this software provided:
***************
*** 39,45 ****
#include "trexp.h"
#ifndef lint
! static char *version = "xprompt v1.0 brachman at cs.ubc.ca 14-Feb-89";
#endif lint
static XrmOptionDescRec table[] = {
--- 41,47 ----
#include "trexp.h"
#ifndef lint
! static char *version = "xprompt v1.1 brachman at cs.ubc.ca 11-Mar-89";
#endif lint
static XrmOptionDescRec table[] = {
***************
*** 542,563 ****
/*
* Handle the grab and/or warp, if necessary
*/
! if (app_resources.grab) {
! XGrabKeyboard(XtDisplay(reply_w), XtWindow(reply_w), False,
! GrabModeAsync, GrabModeAsync, CurrentTime);
! XSetInputFocus(XtDisplay(reply_w), XtWindow(reply_w),
! RevertToPointerRoot, CurrentTime);
! }
!
! if (app_resources.warp) {
XWindowAttributes reply_w_attr;
- XEvent event;
- long em;
if (XGetWindowAttributes(XtDisplay(reply_w), XtWindow(reply_w),
&reply_w_attr) == 0)
! app_resources.warp = FALSE;
! else {
Window root_return, child_return;
int root_x_return, root_y_return;
int win_x_return, win_y_return;
--- 544,587 ----
/*
* Handle the grab and/or warp, if necessary
*/
! if (app_resources.grab || app_resources.warp) {
XWindowAttributes reply_w_attr;
if (XGetWindowAttributes(XtDisplay(reply_w), XtWindow(reply_w),
&reply_w_attr) == 0)
! app_resources.warp = app_resources.grab = FALSE;
! else if (!visible) {
! XEvent event;
! long em;
!
! /*
! * The following weirdness waits for the windows to become visible
! * before warping the cursor or setting the input focus.
! * This is necessary to avoid the cases where a window manager
! * repositions things *after* the warp has occurred and where the
! * focus window is not viewable at the time of the XSetInputFocus.
! * Suggestions on the Right Thing welcome.
! */
! em = VisibilityChangeMask;
! XSelectInput(XtDisplay(popup), XtWindow(popup), em);
! while (1) {
! bzero(&event, sizeof(event));
! XNextEvent(XtDisplay(popup), &event);
! if (event.type == VisibilityNotify)
! break;
! }
! em = reply_w_attr.all_event_masks;
! XSelectInput(XtDisplay(popup), XtWindow(popup), em);
! }
!
! if (app_resources.grab) {
! XGrabKeyboard(XtDisplay(reply_w), XtWindow(reply_w), False,
! GrabModeAsync, GrabModeAsync, CurrentTime);
! XSetInputFocus(XtDisplay(reply_w), XtWindow(reply_w),
! RevertToPointerRoot, CurrentTime);
! }
!
! if (app_resources.warp) {
Window root_return, child_return;
int root_x_return, root_y_return;
int win_x_return, win_y_return;
***************
*** 581,605 ****
reply_x = reply_w_attr.width - reply_w_attr.width / 10;
reply_y = reply_w_attr.height / 2;
- /*
- * The following weirdness waits for the windows to become visible
- * before warping the cursor.
- * This is necessary to avoid the case where a window manager
- * repositions things *after* the warp has occurred.
- * Suggestions on the Right Thing welcome.
- */
- if (!visible) {
- em = VisibilityChangeMask;
- XSelectInput(XtDisplay(popup), XtWindow(popup), em);
- while (1) {
- bzero(&event, sizeof(event));
- XNextEvent(XtDisplay(popup), &event);
- if (event.type == VisibilityNotify)
- break;
- }
- em = reply_w_attr.all_event_masks;
- XSelectInput(XtDisplay(popup), XtWindow(popup), em);
- }
XWarpPointer(XtDisplay(reply_w), None, XtWindow(reply_w),
0, 0, 0, 0, reply_x, reply_y);
}
--- 605,610 ----
--
Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330
Moderator of comp.sources.x
More information about the Comp.sources.x
mailing list