Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11events.c @ 3764:2970fcfbdd54 gsoc2008_manymouse
Relative mode for tablets. Info on wiki.
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Thu, 03 Jul 2008 22:03:58 +0000 |
parents | 81ea7d9a6624 |
children | 9087a84cba51 |
rev | line source |
---|---|
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
2046
da8332c8f480
Replaced strncmp for SDL_VIDEODRIVER test with strcasecmp
Sam Lantinga <slouken@libsdl.org>
parents:
1951
diff
changeset
|
24 #include <sys/types.h> |
da8332c8f480
Replaced strncmp for SDL_VIDEODRIVER test with strcasecmp
Sam Lantinga <slouken@libsdl.org>
parents:
1951
diff
changeset
|
25 #include <sys/time.h> |
da8332c8f480
Replaced strncmp for SDL_VIDEODRIVER test with strcasecmp
Sam Lantinga <slouken@libsdl.org>
parents:
1951
diff
changeset
|
26 #include <unistd.h> |
da8332c8f480
Replaced strncmp for SDL_VIDEODRIVER test with strcasecmp
Sam Lantinga <slouken@libsdl.org>
parents:
1951
diff
changeset
|
27 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 #include "SDL_syswm.h" |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include "SDL_x11video.h" |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 #include "../../events/SDL_events_c.h" |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
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:
2328
diff
changeset
|
32 //XEventClass *SDL_XEvents; |
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:
2328
diff
changeset
|
33 //int SDL_numOfEvents; |
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:
2328
diff
changeset
|
34 |
3761 | 35 extern int motion; |
36 extern int button_pressed; | |
37 extern int button_released; | |
3763
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
38 extern int proximity_in; |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
39 extern int proximity_out; |
3764
2970fcfbdd54
Relative mode for tablets. Info on wiki.
Szymon Wilczek <kazeuser@gmail.com>
parents:
3763
diff
changeset
|
40 extern int x_max,y_max; |
3763
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
41 |
3761 | 42 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 static void |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 X11_DispatchEvent(_THIS) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 SDL_WindowData *data; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 XEvent xevent; |
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:
2328
diff
changeset
|
49 int i,z; |
3761 | 50 //extern int motion; |
51 //extern int button_pressed; | |
52 //extern int button_released; | |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 SDL_zero(xevent); /* valgrind fix. --ryan. */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 XNextEvent(videodata->display, &xevent); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 |
2325
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
57 /* filter events catchs XIM events and sends them to the correct |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
58 handler */ |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
59 if (XFilterEvent(&xevent, None) == True) { |
2327
7b53a8401195
In testdyngl.c the event type was being anded (&) with SDL_KEYDOWN and if the result was none zero the program was quiting. This is very weird because it was
Bob Pendleton <bob@pendleton.com>
parents:
2326
diff
changeset
|
60 #if 0 |
2328
91e601d9df8b
re: bug#563. checking in some commented out trace code and a fix so that the in testalpha.c the background only flashes when alpha == 255. The problem that is being
Bob Pendleton <bob@pendleton.com>
parents:
2327
diff
changeset
|
61 printf("Filtered event type = %d display = %d window = %d\n", |
91e601d9df8b
re: bug#563. checking in some commented out trace code and a fix so that the in testalpha.c the background only flashes when alpha == 255. The problem that is being
Bob Pendleton <bob@pendleton.com>
parents:
2327
diff
changeset
|
62 xevent.type, xevent.xany.display, xevent.xany.window); |
2325
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
63 #endif |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
64 return; |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
65 } |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
66 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 /* Send a SDL_SYSWMEVENT if the application wants them */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 if (SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 SDL_SysWMmsg wmmsg; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 SDL_VERSION(&wmmsg.version); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 wmmsg.subsystem = SDL_SYSWM_X11; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 wmmsg.event.xevent = xevent; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 SDL_SendSysWMEvent(&wmmsg); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 data = NULL; |
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
|
78 if (videodata && videodata->windowlist) { |
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2323
diff
changeset
|
79 for (i = 0; i < videodata->numwindows; ++i) { |
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2323
diff
changeset
|
80 if ((videodata->windowlist[i] != NULL) && |
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2323
diff
changeset
|
81 (videodata->windowlist[i]->window == xevent.xany.window)) { |
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2323
diff
changeset
|
82 data = videodata->windowlist[i]; |
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2323
diff
changeset
|
83 break; |
3202e4826c57
more valgrind errors fixed. Plus I ran make indent which changed a few files.
Bob Pendleton <bob@pendleton.com>
parents:
2323
diff
changeset
|
84 } |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 if (!data) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 return; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 } |
2327
7b53a8401195
In testdyngl.c the event type was being anded (&) with SDL_KEYDOWN and if the result was none zero the program was quiting. This is very weird because it was
Bob Pendleton <bob@pendleton.com>
parents:
2326
diff
changeset
|
90 #if 0 |
2328
91e601d9df8b
re: bug#563. checking in some commented out trace code and a fix so that the in testalpha.c the background only flashes when alpha == 255. The problem that is being
Bob Pendleton <bob@pendleton.com>
parents:
2327
diff
changeset
|
91 printf("type = %d display = %d window = %d\n", |
91e601d9df8b
re: bug#563. checking in some commented out trace code and a fix so that the in testalpha.c the background only flashes when alpha == 255. The problem that is being
Bob Pendleton <bob@pendleton.com>
parents:
2327
diff
changeset
|
92 xevent.type, xevent.xany.display, xevent.xany.window); |
2327
7b53a8401195
In testdyngl.c the event type was being anded (&) with SDL_KEYDOWN and if the result was none zero the program was quiting. This is very weird because it was
Bob Pendleton <bob@pendleton.com>
parents:
2326
diff
changeset
|
93 #endif |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 switch (xevent.type) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 /* Gaining mouse coverage? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 case EnterNotify:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 printf("EnterNotify! (%d,%d)\n", xevent.xcrossing.x, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 xevent.xcrossing.y); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 if (xevent.xcrossing.mode == NotifyGrab) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 printf("Mode: NotifyGrab\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 if (xevent.xcrossing.mode == NotifyUngrab) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 printf("Mode: NotifyUngrab\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 if ((xevent.xcrossing.mode != NotifyGrab) && |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 (xevent.xcrossing.mode != NotifyUngrab)) { |
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:
2328
diff
changeset
|
108 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&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:
2328
diff
changeset
|
109 SDL_SetMouseFocus(move->deviceid, data->windowID); |
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:
2328
diff
changeset
|
110 SDL_SendMouseMotion(move->deviceid, 0, move->x, |
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:
2328
diff
changeset
|
111 move->y,move->axis_data[2]); |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 /* Losing mouse coverage? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 case LeaveNotify:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 printf("LeaveNotify! (%d,%d)\n", xevent.xcrossing.x, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 xevent.xcrossing.y); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 if (xevent.xcrossing.mode == NotifyGrab) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 printf("Mode: NotifyGrab\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 if (xevent.xcrossing.mode == NotifyUngrab) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 printf("Mode: NotifyUngrab\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 if ((xevent.xcrossing.mode != NotifyGrab) && |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 (xevent.xcrossing.mode != NotifyUngrab) && |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 (xevent.xcrossing.detail != NotifyInferior)) { |
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:
2328
diff
changeset
|
129 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; |
3764
2970fcfbdd54
Relative mode for tablets. Info on wiki.
Szymon Wilczek <kazeuser@gmail.com>
parents:
3763
diff
changeset
|
130 //SDL_SendMouseMotion(move->deviceid, 0, |
2970fcfbdd54
Relative mode for tablets. Info on wiki.
Szymon Wilczek <kazeuser@gmail.com>
parents:
3763
diff
changeset
|
131 // move->x, move->y,move->axis_data[2]); |
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:
2328
diff
changeset
|
132 SDL_SetMouseFocus(move->deviceid, 0); |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 /* Gaining input focus? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 case FocusIn:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 printf("FocusIn!\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 SDL_SetKeyboardFocus(videodata->keyboard, data->windowID); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 #ifdef X_HAVE_UTF8_STRING |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 if (data->ic) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 XSetICFocus(data->ic); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 /* Losing input focus? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 case FocusOut:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 printf("FocusOut!\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 SDL_SetKeyboardFocus(videodata->keyboard, 0); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 #ifdef X_HAVE_UTF8_STRING |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 if (data->ic) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 XUnsetICFocus(data->ic); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 /* Generated upon EnterWindow and FocusIn */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 case KeymapNotify:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 printf("KeymapNotify!\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 /* FIXME: |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 X11_SetKeyboardState(SDL_Display, xevent.xkeymap.key_vector); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 |
2305
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
176 /* Has the keyboard layout changed? */ |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
177 case MappingNotify:{ |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
178 #ifdef DEBUG_XEVENTS |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
179 printf("MappingNotify!\n"); |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
180 #endif |
2306 | 181 X11_UpdateKeymap(_this); |
2305
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
182 } |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
183 break; |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
184 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 /* Key press? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 case KeyPress:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 KeyCode keycode = xevent.xkey.keycode; |
2300
c97ad1abe05b
Minimal implementation of textinput events for x11. It only works for latin-1.
Bob Pendleton <bob@pendleton.com>
parents:
2299
diff
changeset
|
188 KeySym keysym = NoSymbol; |
2306 | 189 char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; |
2325
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
190 Status status = 0; |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 #endif |
2299
a7cbc25071b6
Enabled key board auto repeat in X11_InitKeyboard.c. Had to add a couple of new Xlib symbols.
Bob Pendleton <bob@pendleton.com>
parents:
2295
diff
changeset
|
195 SDL_SendKeyboardKey(videodata->keyboard, SDL_PRESSED, |
2305
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
196 videodata->key_layout[keycode]); |
2325
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
197 #if 0 |
2305
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
198 if (videodata->key_layout[keycode] == SDLK_UNKNOWN) { |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
199 int min_keycode, max_keycode; |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
200 XDisplayKeycodes(videodata->display, &min_keycode, |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
201 &max_keycode); |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
202 keysym = XKeycodeToKeysym(videodata->display, keycode, 0); |
2299
a7cbc25071b6
Enabled key board auto repeat in X11_InitKeyboard.c. Had to add a couple of new Xlib symbols.
Bob Pendleton <bob@pendleton.com>
parents:
2295
diff
changeset
|
203 fprintf(stderr, |
2305
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
204 "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", |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
205 keycode, keycode - min_keycode, keysym, |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
206 XKeysymToString(keysym)); |
2299
a7cbc25071b6
Enabled key board auto repeat in X11_InitKeyboard.c. Had to add a couple of new Xlib symbols.
Bob Pendleton <bob@pendleton.com>
parents:
2295
diff
changeset
|
207 } |
2295
dbc6d1893869
Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents:
2046
diff
changeset
|
208 #endif |
2325
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
209 /* */ |
2305
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
210 SDL_zero(text); |
2325
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
211 #ifdef X_HAVE_UTF8_STRING |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
212 if (data->ic) { |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
213 Xutf8LookupString(data->ic, &xevent.xkey, text, sizeof(text), |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
214 &keysym, status); |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
215 } |
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
216 #else |
2306 | 217 XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL); |
2325
c7bcf84ba1b9
Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text
Bob Pendleton <bob@pendleton.com>
parents:
2324
diff
changeset
|
218 #endif |
2305
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
219 if (*text) { |
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
220 printf("Sending text event %s\n", text); |
2300
c97ad1abe05b
Minimal implementation of textinput events for x11. It only works for latin-1.
Bob Pendleton <bob@pendleton.com>
parents:
2299
diff
changeset
|
221 SDL_SendKeyboardText(videodata->keyboard, text); |
c97ad1abe05b
Minimal implementation of textinput events for x11. It only works for latin-1.
Bob Pendleton <bob@pendleton.com>
parents:
2299
diff
changeset
|
222 } |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 /* Key release? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 case KeyRelease:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 KeyCode keycode = xevent.xkey.keycode; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 printf("KeyRelease (X11 keycode = 0x%X)\n", xevent.xkey.keycode); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 #endif |
2295
dbc6d1893869
Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents:
2046
diff
changeset
|
233 SDL_SendKeyboardKey(videodata->keyboard, SDL_RELEASED, |
2305
fbe8ff44c519
First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents:
2300
diff
changeset
|
234 videodata->key_layout[keycode]); |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 /* Have we been iconified? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 case UnmapNotify:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 printf("UnmapNotify!\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, 0); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MINIMIZED, 0, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 0); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 /* Have we been restored? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 case MapNotify:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 printf("MapNotify!\n"); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, 0, 0); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESTORED, 0, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 0); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 /* Have we been resized or moved? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 case ConfigureNotify:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 printf("ConfigureNotify! (resize: %dx%d)\n", |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 xevent.xconfigure.width, xevent.xconfigure.height); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MOVED, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 xevent.xconfigure.x, xevent.xconfigure.y); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESIZED, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 xevent.xconfigure.width, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 xevent.xconfigure.height); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 /* Have we been requested to quit (or another client message?) */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 case ClientMessage:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 if ((xevent.xclient.format == 32) && |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_CLOSE, 0, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 0); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 /* Do we need to refresh ourselves? */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 case Expose:{ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 #ifdef DEBUG_XEVENTS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 printf("Expose (count = %d)\n", xevent.xexpose.count); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 #endif |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED, 0, |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 0); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 default:{ |
3761 | 296 if(xevent.type==motion)//MotionNotify |
297 { | |
298 #ifdef DEBUG_MOTION | |
299 printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); | |
300 #endif | |
3764
2970fcfbdd54
Relative mode for tablets. Info on wiki.
Szymon Wilczek <kazeuser@gmail.com>
parents:
3763
diff
changeset
|
301 XWindowAttributes attrib; |
2970fcfbdd54
Relative mode for tablets. Info on wiki.
Szymon Wilczek <kazeuser@gmail.com>
parents:
3763
diff
changeset
|
302 XGetWindowAttributes(videodata->display, ((XAnyEvent*)&xevent)->window, &attrib); |
2970fcfbdd54
Relative mode for tablets. Info on wiki.
Szymon Wilczek <kazeuser@gmail.com>
parents:
3763
diff
changeset
|
303 /*x_max=attrib.width; |
2970fcfbdd54
Relative mode for tablets. Info on wiki.
Szymon Wilczek <kazeuser@gmail.com>
parents:
3763
diff
changeset
|
304 y_max=attrib.height;*/ |
2970fcfbdd54
Relative mode for tablets. Info on wiki.
Szymon Wilczek <kazeuser@gmail.com>
parents:
3763
diff
changeset
|
305 SDL_UpdateCoordinates(attrib.width, attrib.height); |
3761 | 306 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; |
307 SDL_SendMouseMotion(move->deviceid, 0, move->x, | |
308 move->y,move->axis_data[2]); | |
309 } | |
310 /* | |
311 | |
312 Mouse button press? */ | |
313 else if(xevent.type==button_pressed)//ButtonPress | |
314 { | |
315 XDeviceButtonPressedEvent* pressed=(XDeviceButtonPressedEvent*)&xevent; | |
316 SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED, | |
317 pressed->button); | |
318 } | |
319 | |
320 /* Mouse button release? */ | |
321 else if(xevent.type==button_released)//ButtonRelease | |
322 { | |
323 XDeviceButtonReleasedEvent* released=(XDeviceButtonReleasedEvent*)&xevent; | |
324 SDL_SendMouseButton(released->deviceid, SDL_RELEASED, | |
325 released->button); | |
326 } | |
3763
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
327 else if(xevent.type==proximity_in) |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
328 { |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
329 XProximityNotifyEvent* proximity = (XProximityNotifyEvent*)&xevent; |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
330 SDL_SendProximity(proximity->deviceid, proximity->x, proximity->y,SDL_PROXIMITYIN); |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
331 } |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
332 else if(xevent.type==proximity_out) |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
333 { |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
334 XProximityNotifyEvent* proximity = (XProximityNotifyEvent*)&xevent; |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
335 SDL_SendProximity(proximity->deviceid, proximity->x, proximity->y,SDL_PROXIMITYOUT); |
81ea7d9a6624
Proximity events and evil-temporary makefile repair
Szymon Wilczek <kazeuser@gmail.com>
parents:
3761
diff
changeset
|
336 } |
3761 | 337 else |
338 { | |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 #ifdef DEBUG_XEVENTS |
3761 | 340 printf("Unhandled event %d\n", xevent.type); |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 #endif |
3761 | 342 } |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 break; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 |
3761 | 348 |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 /* Ack! XPending() actually performs a blocking read if no events available */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 int |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 X11_Pending(Display * display) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 /* Flush the display connection and look to see if events are queued */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 XFlush(display); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 if (XEventsQueued(display, QueuedAlready)) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 return (1); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 /* More drastic measures are required -- see if X is ready to talk */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 static struct timeval zero_time; /* static == 0 */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 int x11_fd; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 fd_set fdset; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 x11_fd = ConnectionNumber(display); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 FD_ZERO(&fdset); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 FD_SET(x11_fd, &fdset); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 if (select(x11_fd + 1, &fdset, NULL, NULL, &zero_time) == 1) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 return (XPending(display)); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 /* Oh well, nothing is ready .. */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 return (0); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 void |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 X11_PumpEvents(_THIS) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 /* Keep processing pending events */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 while (X11_Pending(data->display)) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 X11_DispatchEvent(_this); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 void |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 X11_SaveScreenSaver(Display * display, int *saved_timeout, BOOL * dpms) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 int timeout, interval, prefer_blank, allow_exp; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 *saved_timeout = timeout; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 #if SDL_VIDEO_DRIVER_X11_DPMS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 if (SDL_X11_HAVE_DPMS) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 int dummy; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 if (DPMSQueryExtension(display, &dummy, &dummy)) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 CARD16 state; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 DPMSInfo(display, &state, dpms); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 #else |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 *dpms = 0; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 void |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 X11_DisableScreenSaver(Display * display) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 int timeout, interval, prefer_blank, allow_exp; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 timeout = 0; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 #if SDL_VIDEO_DRIVER_X11_DPMS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 if (SDL_X11_HAVE_DPMS) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 int dummy; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 if (DPMSQueryExtension(display, &dummy, &dummy)) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 DPMSDisable(display); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 void |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 X11_RestoreScreenSaver(Display * display, int saved_timeout, BOOL dpms) |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 int timeout, interval, prefer_blank, allow_exp; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 timeout = saved_timeout; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 #if SDL_VIDEO_DRIVER_X11_DPMS |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 if (SDL_X11_HAVE_DPMS) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 int dummy; |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 if (DPMSQueryExtension(display, &dummy, &dummy)) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 if (dpms) { |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 DPMSEnable(display); |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 } |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 |
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 /* vi: set ts=4 sw=4 expandtab: */ |