annotate src/video/x11/SDL_x11video.c @ 3763:81ea7d9a6624 gsoc2008_manymouse

Proximity events and evil-temporary makefile repair
author Szymon Wilczek <kazeuser@gmail.com>
date Wed, 02 Jul 2008 20:29:29 +0000
parents e0c95ad1ba87
children 2970fcfbdd54
rev   line source
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include "SDL_video.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #include "SDL_mouse.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include "../SDL_sysvideo.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "../SDL_pixels_c.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include "SDL_x11video.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 //#include "SDL_d3drender.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 //#include "SDL_gdirender.h"
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
33 XDevice **SDL_XDevices;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
34 int SDL_NumOfXDevices;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
35 XEventClass SDL_XEvents[256];
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
36 int SDL_NumOfXEvents;
3761
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
37 int motion, button_pressed, button_released;
3763
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
38 int proximity_in, proximity_out;
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
39
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 /* Initialization/Query functions */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 static int X11_VideoInit(_THIS);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 static void X11_VideoQuit(_THIS);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
44 /* Find out what class name we should use */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
45 static char *
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
46 get_classname()
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
47 {
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
48 char *spot;
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
49 #if defined(__LINUX__) || defined(__FREEBSD__)
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
50 char procfile[1024];
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
51 char linkfile[1024];
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
52 int linksize;
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
53 #endif
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
54
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
55 /* First allow environment variable override */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
56 spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS");
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
57 if (spot) {
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
58 return SDL_strdup(spot);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
59 }
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
60
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
61 /* Next look at the application's executable name */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
62 #if defined(__LINUX__) || defined(__FREEBSD__)
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
63 #if defined(__LINUX__)
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
64 SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
65 #elif defined(__FREEBSD__)
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
66 SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file",
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
67 getpid());
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
68 #else
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
69 #error Where can we find the executable name?
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
70 #endif
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
71 linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
72 if (linksize > 0) {
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
73 linkfile[linksize] = '\0';
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
74 spot = SDL_strrchr(linkfile, '/');
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
75 if (spot) {
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
76 return SDL_strdup(spot + 1);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
77 } else {
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
78 return SDL_strdup(linkfile);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
79 }
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
80 }
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
81 #endif /* __LINUX__ || __FREEBSD__ */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
82
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
83 /* Finally use the default we've used forever */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
84 return SDL_strdup("SDL_App");
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
85 }
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
86
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 /* X11 driver bootstrap functions */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 static int
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 X11_Available(void)
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 Display *display = NULL;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 if (SDL_X11_LoadSymbols()) {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 display = XOpenDisplay(NULL);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 if (display != NULL) {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 XCloseDisplay(display);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 SDL_X11_UnloadSymbols();
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 return (display != NULL);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 static void
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 X11_DeleteDevice(SDL_VideoDevice * device)
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 {
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
106 int i;
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 if (data->display) {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 XCloseDisplay(data->display);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 }
2324
3202e4826c57 more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents: 2323
diff changeset
111 SDL_free(data->windowlist);
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 SDL_free(device->driverdata);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 SDL_free(device);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 SDL_X11_UnloadSymbols();
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 static SDL_VideoDevice *
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 X11_CreateDevice(int devindex)
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 SDL_VideoDevice *device;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 SDL_VideoData *data;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 const char *display = NULL; /* Use the DISPLAY environment variable */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 if (!SDL_X11_LoadSymbols()) {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 return NULL;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 /* Initialize all variables that we clean on shutdown */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
2323
4ac07ae446d3 Fixed many valgrind errors. But, I broke testdyngl.
Bob Pendleton <bob@pendleton.com>
parents: 2305
diff changeset
131 if (!device) {
4ac07ae446d3 Fixed many valgrind errors. But, I broke testdyngl.
Bob Pendleton <bob@pendleton.com>
parents: 2305
diff changeset
132 SDL_OutOfMemory();
4ac07ae446d3 Fixed many valgrind errors. But, I broke testdyngl.
Bob Pendleton <bob@pendleton.com>
parents: 2305
diff changeset
133 return NULL;
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 }
2323
4ac07ae446d3 Fixed many valgrind errors. But, I broke testdyngl.
Bob Pendleton <bob@pendleton.com>
parents: 2305
diff changeset
135 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
4ac07ae446d3 Fixed many valgrind errors. But, I broke testdyngl.
Bob Pendleton <bob@pendleton.com>
parents: 2305
diff changeset
136 if (!data) {
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 SDL_OutOfMemory();
2323
4ac07ae446d3 Fixed many valgrind errors. But, I broke testdyngl.
Bob Pendleton <bob@pendleton.com>
parents: 2305
diff changeset
138 SDL_free(device);
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 return NULL;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 device->driverdata = data;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 /* FIXME: Do we need this?
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 local_X11 = 1;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 } else {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 local_X11 = 0;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 data->display = XOpenDisplay(display);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 #if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC)
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 /* On Tru64 if linking without -lX11, it fails and you get following message.
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 * Xlib: connection to ":0.0" refused by server
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 * Xlib: XDM authorization key matches an existing client!
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 *
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 * It succeeds if retrying 1 second later
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 * or if running xhost +localhost on shell.
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 if (data->display == NULL) {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 SDL_Delay(1000);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 data->display = XOpenDisplay(display);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 #endif
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 if (data->display == NULL) {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 SDL_free(device);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 SDL_SetError("Couldn't open X11 display");
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 return NULL;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 #ifdef X11_DEBUG
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 XSynchronize(data->display, True);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 #endif
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 /* Set the function pointers */
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 device->VideoInit = X11_VideoInit;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 device->VideoQuit = X11_VideoQuit;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 device->GetDisplayModes = X11_GetDisplayModes;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 device->SetDisplayMode = X11_SetDisplayMode;
2162
1d23870d8c49 Added stubs for x11 gamma functions and enabled them in SDL_x11video.c
Bob Pendleton <bob@pendleton.com>
parents: 1952
diff changeset
179 device->SetDisplayGammaRamp = X11_SetDisplayGammaRamp;
1d23870d8c49 Added stubs for x11 gamma functions and enabled them in SDL_x11video.c
Bob Pendleton <bob@pendleton.com>
parents: 1952
diff changeset
180 device->GetDisplayGammaRamp = X11_GetDisplayGammaRamp;
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
181 device->PumpEvents = X11_PumpEvents;
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 device->CreateWindow = X11_CreateWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 device->CreateWindowFrom = X11_CreateWindowFrom;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 device->SetWindowTitle = X11_SetWindowTitle;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 device->SetWindowPosition = X11_SetWindowPosition;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 device->SetWindowSize = X11_SetWindowSize;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 device->ShowWindow = X11_ShowWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 device->HideWindow = X11_HideWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 device->RaiseWindow = X11_RaiseWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 device->MaximizeWindow = X11_MaximizeWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 device->MinimizeWindow = X11_MinimizeWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 device->RestoreWindow = X11_RestoreWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 device->SetWindowGrab = X11_SetWindowGrab;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 device->DestroyWindow = X11_DestroyWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 device->GetWindowWMInfo = X11_GetWindowWMInfo;
1952
420716272158 Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents: 1951
diff changeset
197 #ifdef SDL_VIDEO_OPENGL_GLX
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 device->GL_LoadLibrary = X11_GL_LoadLibrary;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 device->GL_GetProcAddress = X11_GL_GetProcAddress;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 device->GL_CreateContext = X11_GL_CreateContext;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 device->GL_MakeCurrent = X11_GL_MakeCurrent;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 device->GL_SetSwapInterval = X11_GL_SetSwapInterval;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 device->GL_GetSwapInterval = X11_GL_GetSwapInterval;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 device->GL_SwapWindow = X11_GL_SwapWindow;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 device->GL_DeleteContext = X11_GL_DeleteContext;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 #endif
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 device->free = X11_DeleteDevice;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 return device;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 VideoBootStrap X11_bootstrap = {
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 "x11", "SDL X11 video driver",
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 X11_Available, X11_CreateDevice
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 };
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 int
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 X11_VideoInit(_THIS)
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 {
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
222 int i,index=0,c_not_needed;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
223 XEventClass xEvent;
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
224 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
225
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
226 /* Get the window class name, usually the name of the application */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
227 data->classname = get_classname();
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
228
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
229 /* Open a connection to the X input manager */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
230 #ifdef X_HAVE_UTF8_STRING
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
231 if (SDL_X11_HAVE_UTF8) {
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
232 data->im =
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
233 XOpenIM(data->display, NULL, data->classname, data->classname);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
234 }
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
235 #endif
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
236
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
237 /* Save DPMS and screensaver settings */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
238 X11_SaveScreenSaver(data->display, &data->screensaver_timeout,
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
239 &data->dpms_enabled);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
240 X11_DisableScreenSaver(data->display);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
241
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
242 /* Look up some useful Atoms */
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
243 data->WM_DELETE_WINDOW =
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
244 XInternAtom(data->display, "WM_DELETE_WINDOW", False);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
245
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 X11_InitModes(_this);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247
2295
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2162
diff changeset
248 if (X11_InitKeyboard(_this) != 0) {
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2162
diff changeset
249 return -1;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2162
diff changeset
250 }
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 X11_InitMouse(_this);
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
252 for(i=0;i<SDL_NumOfXDevices;++i)
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
253 {
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
254 DeviceKeyPress(SDL_XDevices[i],c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
255 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
256 DeviceKeyRelease(SDL_XDevices[i],c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
257 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
258
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
259 /* focus events */
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
260 DeviceFocusIn(SDL_XDevices[i],c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
261 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
262 DeviceFocusOut(SDL_XDevices[i],c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
263 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
264
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
265 /* button events */
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
266 DeviceButtonPress(SDL_XDevices[i],c_not_needed,xEvent);
3761
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
267 if (xEvent)
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
268 {
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
269 SDL_XEvents[index++] = xEvent;
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
270 button_pressed=c_not_needed;
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
271 }
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
272 DeviceButtonRelease(SDL_XDevices[i],c_not_needed,xEvent);
3761
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
273 if (xEvent)
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
274 {
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
275 SDL_XEvents[index++] = xEvent;
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
276 button_released=c_not_needed;
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
277 }
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
278
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
279 /* proximity events */
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
280 ProximityIn(SDL_XDevices[i],c_not_needed,xEvent);
3763
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
281 if (xEvent)
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
282 {
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
283 SDL_XEvents[index++] = xEvent;
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
284 proximity_in=c_not_needed;
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
285 }
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
286 ProximityOut(SDL_XDevices[i],c_not_needed,xEvent);
3763
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
287 if (xEvent)
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
288 {
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
289 SDL_XEvents[index++] = xEvent;
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
290 proximity_out=c_not_needed;
81ea7d9a6624 Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents: 3761
diff changeset
291 }
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
292 /* motion events */
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
293 DeviceMotionNotify(SDL_XDevices[i],c_not_needed,xEvent);
3761
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
294 if (xEvent)
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
295 {
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
296 SDL_XEvents[index++] = xEvent;
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
297 motion=c_not_needed;
e0c95ad1ba87 Major bug fixes
Szymon Wilczek <kazeuser@gmail.com>
parents: 3760
diff changeset
298 }
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
299
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
300 /* device state */
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
301 DeviceStateNotify(SDL_XDevices[i],c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
302 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
303 DeviceMappingNotify(SDL_XDevices[i],
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
304 c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
305 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
306 ChangeDeviceNotify(SDL_XDevices[i],c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
307 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
308
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
309 #if 0
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
310 /* this cuts the motion data down - not sure if this is useful */
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
311 DevicePointerMotionHint(SDL_XDevices[i],
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
312 c_not_neededINPUTEVENT_DEVICE_POINTER_MOTION_HINT],xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
313 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
314 #endif
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
315
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
316 /* button motion */
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
317 DeviceButtonMotion(SDL_XDevices[i],
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
318 c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
319 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
320 DeviceButton1Motion(SDL_XDevices[i],
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
321 c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
322 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
323 DeviceButton2Motion(SDL_XDevices[i],
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
324 c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
325 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
326 DeviceButton3Motion(SDL_XDevices[i],
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
327 c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
328 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
329 DeviceButton4Motion(SDL_XDevices[i],
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
330 c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
331 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
332 DeviceButton5Motion(SDL_XDevices[i],
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
333 c_not_needed,xEvent);
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
334 if (xEvent) SDL_XEvents[index++] = xEvent;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
335 }
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
336 SDL_NumOfXEvents=index;
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338 return 0;
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 void
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 X11_VideoQuit(_THIS)
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 {
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
344 int i;
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
345
1951
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
346 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
347
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
348 if (data->classname) {
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
349 SDL_free(data->classname);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
350 }
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
351 #ifdef X_HAVE_UTF8_STRING
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
352 if (data->im) {
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
353 XCloseIM(data->im);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
354 }
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
355 #endif
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
356 X11_RestoreScreenSaver(data->display, data->screensaver_timeout,
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
357 data->dpms_enabled);
7177581dc9fa Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents: 1950
diff changeset
358
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 X11_QuitModes(_this);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 X11_QuitKeyboard(_this);
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 X11_QuitMouse(_this);
3760
64f346a83ed3 http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
Szymon Wilczek <kazeuser@gmail.com>
parents: 2324
diff changeset
362 free(SDL_XDevices);
1950
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 }
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364
a344e42bce3b Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
365 /* vim: set ts=4 sw=4 expandtab: */