1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
Index: src/mred/mredx.cxx
===================================================================
--- src/mred/mredx.cxx (.../v360) (revision 5838)
+++ src/mred/mredx.cxx (.../v360p1) (revision 5838)
@@ -151,7 +151,43 @@
static unsigned long lastUngrabTime;
static unsigned long lastUnhideTime;
+static int need_unhide = 0;
+class Check_Ungrab_Record {
+public:
+ Window window;
+ int x, y, x_root, y_root;
+ Check_Ungrab_Record *next;
+};
+
+static int cur_registered = 0;
+static Check_Ungrab_Record *first_cur = NULL, *last_cur = NULL;
+
+static void CheckUngrab(Display *dpy, Check_Ungrab_Record *cur)
+{
+ Window root;
+ int x, y;
+ unsigned w, h, b, d;
+
+ XGetGeometry(dpy, cur->window,
+ &root, &x, &y, &w, &h,
+ &b, &d);
+ if ((cur->x < 0) || (cur->y < 0)
+ || ((unsigned int)cur->x > w) || ((unsigned int)cur->y > h)) {
+ /* Looks bad, but is it a click in a MrEd window
+ that we could care about? */
+
+ wxWindow *w;
+ w = wxLocationToWindow(cur->x_root, cur->y_root);
+
+ if (w) {
+ /* Looks like we need to ungrab */
+ XUngrabPointer(dpy, 0);
+ XUngrabKeyboard(dpy, 0);
+ }
+ }
+}
+
static Bool CheckPred(Display *display, XEvent *e, char *args)
{
Window window;
@@ -163,7 +199,7 @@
case MotionNotify:
if (e->xbutton.time > lastUnhideTime) {
lastUnhideTime = e->xbutton.time;
- wxUnhideAllCursors();
+ need_unhide = 1;
}
break;
default:
@@ -197,28 +233,22 @@
/* lastUngrabTime keeps us from checking the same events
over and over again. */
if (e->xbutton.time > lastUngrabTime) {
- Window root;
- int x, y;
- unsigned w, h, b, d;
-
- XGetGeometry(XtDisplay(widget), e->xbutton.window,
- &root, &x, &y, &w, &h,
- &b, &d);
- if ((e->xbutton.x < 0) || (e->xbutton.y < 0)
- || ((unsigned int)e->xbutton.x > w) || ((unsigned int)e->xbutton.y > h)) {
- /* Looks bad, but is it a click in a MrEd window
- that we could care about? */
-
- wxWindow *w;
- w = wxLocationToWindow(e->xbutton.x_root, e->xbutton.y_root);
-
- if (w) {
- /* Looks like we need to ungrab */
- XUngrabPointer(XtDisplay(widget), 0);
- XUngrabKeyboard(XtDisplay(widget), 0);
- }
+ Check_Ungrab_Record *cur;
+ if (!cur_registered) {
+ wxREGGLOB(first_cur);
+ wxREGGLOB(last_cur);
}
-
+ cur = new WXGC_PTRS Check_Ungrab_Record;
+ cur->window = e->xbutton.window;
+ cur->x = e->xbutton.x;
+ cur->y = e->xbutton.y;
+ cur->x_root = e->xbutton.x_root;
+ cur->y_root = e->xbutton.y_root;
+ if (last_cur)
+ last_cur->next = cur;
+ else
+ first_cur = cur;
+ last_cur = cur;
lastUngrabTime = e->xbutton.time;
}
}
@@ -339,6 +369,7 @@
XEvent *event, MrEdContext **which)
{
Display *d;
+ int got;
if (which)
*which = NULL;
@@ -351,7 +382,20 @@
else
d = XtDisplay(orig_top_level);
- if (XCheckIfEvent(d, event, CheckPred, (char *)which)) {
+ got = XCheckIfEvent(d, event, CheckPred, (char *)which);
+
+ if (need_unhide) {
+ need_unhide = 0;
+ wxUnhideAllCursors();
+ }
+
+ while (first_cur) {
+ CheckUngrab(d, first_cur);
+ first_cur = first_cur->next;
+ }
+ last_cur = NULL;
+
+ if (got) {
just_check = 0;
return 1;
} else if (short_circuit) {
Index: collects/version/patchlevel.ss
===================================================================
--- collects/version/patchlevel.ss (.../v360) (revision 5838)
+++ collects/version/patchlevel.ss (.../v360p1) (revision 5838)
@@ -1,5 +1,5 @@
;; this file contains the current patch level of DrScheme
;; it is usually `0' in the repository, and changed only when a patch is made.
(module patchlevel mzscheme
- (define patchlevel 0)
+ (define patchlevel 1)
(provide patchlevel))
|