Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11events.c @ 4556:cc06f306c053
Fixed X error when showing debug info about a deleted property
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 19 Jul 2010 23:29:45 -0700 |
parents | ce811c9247da |
children | 4d95152d9e39 |
comparison
equal
deleted
inserted
replaced
4555:9e73d17638d3 | 4556:cc06f306c053 |
---|---|
32 #include "../../events/SDL_mouse_c.h" | 32 #include "../../events/SDL_mouse_c.h" |
33 | 33 |
34 #include "SDL_timer.h" | 34 #include "SDL_timer.h" |
35 #include "SDL_syswm.h" | 35 #include "SDL_syswm.h" |
36 | 36 |
37 #define DEBUG_XEVENTS | 37 /*#define DEBUG_XEVENTS*/ |
38 | 38 |
39 static void | 39 static void |
40 X11_DispatchEvent(_THIS) | 40 X11_DispatchEvent(_THIS) |
41 { | 41 { |
42 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | 42 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
185 if (videodata->key_layout[keycode] == SDLK_UNKNOWN) { | 185 if (videodata->key_layout[keycode] == SDLK_UNKNOWN) { |
186 int min_keycode, max_keycode; | 186 int min_keycode, max_keycode; |
187 XDisplayKeycodes(display, &min_keycode, &max_keycode); | 187 XDisplayKeycodes(display, &min_keycode, &max_keycode); |
188 keysym = XKeycodeToKeysym(display, keycode, 0); | 188 keysym = XKeycodeToKeysym(display, keycode, 0); |
189 fprintf(stderr, | 189 fprintf(stderr, |
190 "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list <sdl@libsdl.org> X11 KeyCode %d (%d), X11 KeySym 0x%X (%s).\n", | 190 "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list <sdl@libsdl.org> X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", |
191 keycode, keycode - min_keycode, keysym, | 191 keycode, keycode - min_keycode, keysym, |
192 XKeysymToString(keysym)); | 192 XKeysymToString(keysym)); |
193 } | 193 } |
194 #endif | 194 #endif |
195 /* */ | 195 /* */ |
297 Atom real_type; | 297 Atom real_type; |
298 unsigned long items_read, items_left, i; | 298 unsigned long items_read, items_left, i; |
299 | 299 |
300 char *name = XGetAtomName(display, xevent.xproperty.atom); | 300 char *name = XGetAtomName(display, xevent.xproperty.atom); |
301 if (name) { | 301 if (name) { |
302 printf("PropertyNotify: %s\n", name); | 302 printf("PropertyNotify: %s %s\n", name, (xevent.xproperty.state == PropertyDelete) ? "deleted" : "changed"); |
303 XFree(name); | 303 XFree(name); |
304 } | 304 } |
305 | 305 |
306 status = XGetWindowProperty(display, data->xwindow, xevent.xproperty.atom, 0L, 8192L, False, AnyPropertyType, &real_type, &real_format, &items_read, &items_left, &propdata); | 306 status = XGetWindowProperty(display, data->xwindow, xevent.xproperty.atom, 0L, 8192L, False, AnyPropertyType, &real_type, &real_format, &items_read, &items_left, &propdata); |
307 if (status == Success) { | 307 if (status == Success && items_read > 0) { |
308 if (real_type == XA_INTEGER) { | 308 if (real_type == XA_INTEGER) { |
309 int *values = (int *)propdata; | 309 int *values = (int *)propdata; |
310 | 310 |
311 printf("{"); | 311 printf("{"); |
312 for (i = 0; i < items_read; i++) { | 312 for (i = 0; i < items_read; i++) { |