Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11window.c @ 4465:3e69e077cb95
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Plus, this lets me start implementing cursor support.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 09 May 2010 20:47:22 -0700 |
parents | f7b03b6838cb |
children | f78a602ac135 |
comparison
equal
deleted
inserted
replaced
4464:fa77a6429698 | 4465:3e69e077cb95 |
---|---|
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 #include "SDL_config.h" | 22 #include "SDL_config.h" |
23 | 23 |
24 #include "../SDL_sysvideo.h" | 24 #include "../SDL_sysvideo.h" |
25 #include "../SDL_pixels_c.h" | |
25 #include "../../events/SDL_keyboard_c.h" | 26 #include "../../events/SDL_keyboard_c.h" |
26 #include "../../events/SDL_mouse_c.h" | 27 #include "../../events/SDL_mouse_c.h" |
27 | 28 |
28 #include "SDL_x11video.h" | 29 #include "SDL_x11video.h" |
29 #include "SDL_x11mouse.h" | 30 #include "SDL_x11mouse.h" |
32 | 33 |
33 #ifdef SDL_VIDEO_DRIVER_PANDORA | 34 #ifdef SDL_VIDEO_DRIVER_PANDORA |
34 #include "SDL_x11opengles.h" | 35 #include "SDL_x11opengles.h" |
35 #endif | 36 #endif |
36 | 37 |
38 #include "SDL_timer.h" | |
37 #include "SDL_syswm.h" | 39 #include "SDL_syswm.h" |
38 | 40 |
39 #define _NET_WM_STATE_REMOVE 0l | 41 #define _NET_WM_STATE_REMOVE 0l |
40 #define _NET_WM_STATE_ADD 1l | 42 #define _NET_WM_STATE_ADD 1l |
41 #define _NET_WM_STATE_TOGGLE 2l | 43 #define _NET_WM_STATE_TOGGLE 2l |
65 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | 67 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
66 SDL_WindowData *data; | 68 SDL_WindowData *data; |
67 int numwindows = videodata->numwindows; | 69 int numwindows = videodata->numwindows; |
68 int windowlistlength = videodata->windowlistlength; | 70 int windowlistlength = videodata->windowlistlength; |
69 SDL_WindowData **windowlist = videodata->windowlist; | 71 SDL_WindowData **windowlist = videodata->windowlist; |
70 int index; | |
71 | 72 |
72 /* Allocate the window data */ | 73 /* Allocate the window data */ |
73 data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); | 74 data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); |
74 if (!data) { | 75 if (!data) { |
75 SDL_OutOfMemory(); | 76 SDL_OutOfMemory(); |
273 xattr.border_pixel = 0; | 274 xattr.border_pixel = 0; |
274 | 275 |
275 if (visual->class == PseudoColor) { | 276 if (visual->class == PseudoColor) { |
276 printf("asking for PseudoColor\n"); | 277 printf("asking for PseudoColor\n"); |
277 | 278 |
278 Status status; | 279 /* Status status; */ |
279 XStandardColormap cmap; | |
280 XColor *colorcells; | 280 XColor *colorcells; |
281 Colormap colormap; | 281 Colormap colormap; |
282 Sint32 pix; | 282 Sint32 pix; |
283 Sint32 ncolors; | 283 Sint32 ncolors; |
284 Sint32 nbits; | 284 Sint32 nbits; |
385 | 385 |
386 SDL_free(colorcells); | 386 SDL_free(colorcells); |
387 } | 387 } |
388 } else if (visual->class == DirectColor) { | 388 } else if (visual->class == DirectColor) { |
389 Status status; | 389 Status status; |
390 XStandardColormap cmap; | |
391 XColor *colorcells; | 390 XColor *colorcells; |
392 Colormap colormap; | 391 Colormap colormap; |
393 int i; | 392 int i; |
394 int ncolors; | 393 int ncolors; |
395 int rmax, gmax, bmax; | 394 int rmax, gmax, bmax; |
396 int rmask, gmask, bmask; | 395 int rmask, gmask, bmask; |
397 int rshift, gshift, bshift; | 396 int rshift, gshift, bshift; |
398 | 397 |
399 /* Is the colormap we need already registered in SDL? */ | 398 /* Is the colormap we need already registered in SDL? */ |
400 if (colormap = | 399 if ((colormap = |
401 X11_LookupColormap(data->display, | 400 X11_LookupColormap(data->display, |
402 displaydata->screen, visual->visualid)) { | 401 displaydata->screen, visual->visualid))) { |
403 xattr.colormap = colormap; | 402 xattr.colormap = colormap; |
404 /* printf("found existing colormap\n"); */ | 403 /* printf("found existing colormap\n"); */ |
405 } else { | 404 } else { |
406 /* The colormap is not known to SDL so we will create it */ | 405 /* The colormap is not known to SDL so we will create it */ |
407 colormap = XCreateColormap(data->display, | 406 colormap = XCreateColormap(data->display, |
645 } | 644 } |
646 | 645 |
647 /* Tell KDE to keep fullscreen windows on top */ | 646 /* Tell KDE to keep fullscreen windows on top */ |
648 if (window->flags & SDL_WINDOW_FULLSCREEN) { | 647 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
649 XEvent ev; | 648 XEvent ev; |
650 long mask; | |
651 | 649 |
652 SDL_zero(ev); | 650 SDL_zero(ev); |
653 ev.xclient.type = ClientMessage; | 651 ev.xclient.type = ClientMessage; |
654 ev.xclient.window = RootWindow(data->display, displaydata->screen); | 652 ev.xclient.window = RootWindow(data->display, displaydata->screen); |
655 ev.xclient.message_type = | 653 ev.xclient.message_type = |
708 PropertyChangeMask | StructureNotifyMask | | 706 PropertyChangeMask | StructureNotifyMask | |
709 KeymapStateMask)); | 707 KeymapStateMask)); |
710 } | 708 } |
711 #endif | 709 #endif |
712 | 710 |
713 #if SDL_VIDEO_DRIVER_X11_XINPUT | |
714 /* we're informing the display what extension events we want to receive from it */ | |
715 { | |
716 int i, j, n = 0; | |
717 XEventClass xevents[256]; | |
718 | |
719 for (i = 0; i < SDL_GetNumMice(); ++i) { | |
720 SDL_Mouse *mouse; | |
721 X11_MouseData *data; | |
722 | |
723 mouse = SDL_GetMouse(i); | |
724 data = (X11_MouseData *) mouse->driverdata; | |
725 if (!data) { | |
726 continue; | |
727 } | |
728 | |
729 for (j = 0; j < data->num_xevents; ++j) { | |
730 xevents[n++] = data->xevents[j]; | |
731 } | |
732 } | |
733 if (n > 0) { | |
734 XSelectExtensionEvent(data->display, w, xevents, n); | |
735 } | |
736 } | |
737 #endif | |
738 | |
739 return 0; | 711 return 0; |
740 } | 712 } |
741 | 713 |
742 int | 714 int |
743 X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) | 715 X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) |
867 | 839 |
868 void | 840 void |
869 X11_SetWindowPosition(_THIS, SDL_Window * window) | 841 X11_SetWindowPosition(_THIS, SDL_Window * window) |
870 { | 842 { |
871 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; | 843 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; |
872 SDL_DisplayData *displaydata = | |
873 (SDL_DisplayData *) window->display->driverdata; | |
874 Display *display = data->videodata->display; | 844 Display *display = data->videodata->display; |
875 int x, y; | 845 int x, y; |
876 | 846 |
877 if ((window->flags & SDL_WINDOW_FULLSCREEN) | 847 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
878 || window->x == SDL_WINDOWPOS_CENTERED) { | 848 || window->x == SDL_WINDOWPOS_CENTERED) { |