comparison src/video/x11/SDL_x11events.c @ 3195:08747e24a50f

Mouse events now report the correct window id and window enter/leave events are now reported.
author Bob Pendleton <bob@pendleton.com>
date Thu, 11 Jun 2009 20:08:33 +0000
parents 102b7880543a
children 08c5964f2a34
comparison
equal deleted inserted replaced
3194:c18c03927a77 3195:08747e24a50f
81 switch (xevent.type) { 81 switch (xevent.type) {
82 82
83 /* Gaining mouse coverage? */ 83 /* Gaining mouse coverage? */
84 case EnterNotify:{ 84 case EnterNotify:{
85 #ifdef DEBUG_XEVENTS 85 #ifdef DEBUG_XEVENTS
86 printf("EnterNotify! (%d,%d)\n", xevent.xcrossing.x, 86 printf("EnterNotify! (%d,%d,%d)\n",
87 xevent.xcrossing.y); 87 xevent.xcrossing.x,
88 xevent.xcrossing.y,
89 xevent.xcrossing.mode);
88 if (xevent.xcrossing.mode == NotifyGrab) 90 if (xevent.xcrossing.mode == NotifyGrab)
89 printf("Mode: NotifyGrab\n"); 91 printf("Mode: NotifyGrab\n");
90 if (xevent.xcrossing.mode == NotifyUngrab) 92 if (xevent.xcrossing.mode == NotifyUngrab)
91 printf("Mode: NotifyUngrab\n"); 93 printf("Mode: NotifyUngrab\n");
92 #endif 94 #endif
93 if ((xevent.xcrossing.mode != NotifyGrab) && 95 if ((xevent.xcrossing.mode != NotifyGrab) &&
94 (xevent.xcrossing.mode != NotifyUngrab)) { 96 (xevent.xcrossing.mode != NotifyUngrab)) {
97 #if 1
95 /* FIXME: Should we reset data for all mice? */ 98 /* FIXME: Should we reset data for all mice? */
96 #if 0 99 for (i = 0; i < SDL_GetNumMice(); ++i) {
97 SDL_SetMouseFocus(0, data->windowID); 100 SDL_Mouse *mouse = SDL_GetMouse(i);
98 SDL_SendMouseMotion(0, 0, move->x, move->y, 0); 101 SDL_SetMouseFocus(mouse->id, data->windowID);
102 }
99 #endif 103 #endif
100 } 104 }
101 } 105 }
102 break; 106 break;
103 107
104 /* Losing mouse coverage? */ 108 /* Losing mouse coverage? */
105 case LeaveNotify:{ 109 case LeaveNotify:{
106 #ifdef DEBUG_XEVENTS 110 #ifdef DEBUG_XEVENTS
107 printf("LeaveNotify! (%d,%d)\n", xevent.xcrossing.x, 111 printf("LeaveNotify! (%d,%d,%d)\n",
108 xevent.xcrossing.y); 112 xevent.xcrossing.x,
113 xevent.xcrossing.y,
114 xevent.xcrossing.mode);
109 if (xevent.xcrossing.mode == NotifyGrab) 115 if (xevent.xcrossing.mode == NotifyGrab)
110 printf("Mode: NotifyGrab\n"); 116 printf("Mode: NotifyGrab\n");
111 if (xevent.xcrossing.mode == NotifyUngrab) 117 if (xevent.xcrossing.mode == NotifyUngrab)
112 printf("Mode: NotifyUngrab\n"); 118 printf("Mode: NotifyUngrab\n");
113 #endif 119 #endif
114 if ((xevent.xcrossing.mode != NotifyGrab) && 120 if ((xevent.xcrossing.mode != NotifyGrab) &&
115 (xevent.xcrossing.mode != NotifyUngrab) && 121 (xevent.xcrossing.mode != NotifyUngrab) &&
116 (xevent.xcrossing.detail != NotifyInferior)) { 122 (xevent.xcrossing.detail != NotifyInferior)) {
123 #if 1
117 /* FIXME: Should we reset data for all mice? */ 124 /* FIXME: Should we reset data for all mice? */
118 #if 0 125 for (i = 0; i < SDL_GetNumMice(); ++i) {
119 SDL_SetMouseFocus(0, 0); 126 SDL_Mouse *mouse = SDL_GetMouse(i);
127 SDL_SetMouseFocus(mouse->id, 0);
128 }
120 #endif 129 #endif
121 } 130 }
122 } 131 }
123 break; 132 break;
124 133