annotate test/testmmousetablet.c @ 2931:e705adf6f3dc

Date: Mon, 29 Dec 2008 23:29:52 +0100 From: Couriersud Subject: SDL1.3: Some X11 diffs The attached diff fixes the following issues in the X11 backend: a) When calling resize, actually a move was performed. This has been corrected. b) DisplayHeight and DisplayWidth do not return up-to-date information after a modeswitch using the xrandr code, which I enabled in x11_modes.c Height and width are now queried from the root window and all occurrences of DisplayHeight and DisplayWidth changed.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 30 Dec 2008 17:09:42 +0000
parents ae653575d4af
children 975fd903466b
rev   line source
2734
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
1 #include <stdio.h>
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
2 #include "SDL.h"
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
3
2736
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
4 SDL_Surface *screen;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
5 int quit = 0;
2734
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
6
2736
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
7 int
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
8 main()
2734
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
9 {
2736
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
10 SDL_Event event;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
11 int mice;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
12 int i;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
13 printf("Initing...\n");
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
14 if (SDL_Init(0) != 0) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
15 return 1;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
16 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
17 if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
18 return 1;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
19 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
20 screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
21 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
22 mice = SDL_GetNumMice();
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
23 printf("%d pointing devices found\n", mice);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
24 for (i = 0; i < mice; ++i) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
25 printf("device index: %d name:%s\n", i, SDL_GetMouseName(i));
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
26 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
27 while (quit != 1) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
28 if (SDL_PollEvent(&event) == 0) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
29 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
30 switch (event.type) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
31 case SDL_MOUSEMOTION:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
32 printf
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
33 ("Device id: %d x: %d y: %d relx: %d rely: %d pressure: %d\n \
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
34 pressure_max: %d pressure_min: %d current cursor:%d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
35 event.motion.which, event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel,
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
36 event.motion.pressure, event.motion.pressure_max, event.motion.pressure_min,
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
37 event.motion.cursor);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
38 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
39 case SDL_PROXIMITYIN:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
40 printf("proximity in id: %d x: %d y: %d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
41 (int) event.proximity.which, event.proximity.x,
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
42 event.proximity.y);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
43 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
44 case SDL_PROXIMITYOUT:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
45 printf("proximity out id: %d x: %d y: %d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
46 (int) event.proximity.which, event.proximity.x,
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
47 event.proximity.y);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
48 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
49 case SDL_MOUSEBUTTONDOWN:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
50 printf("mouse button down id: %d button:%d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
51 event.button.which, event.button.button);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
52 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
53 case SDL_MOUSEBUTTONUP:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
54 printf("mouse button up id: %d button: %d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
55 event.button.which, event.button.button);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
56 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
57 case SDL_QUIT:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
58 printf("Quitting\n");
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
59 SDL_QuitSubSystem(SDL_INIT_VIDEO);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
60 SDL_Quit();
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
61 quit = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
62 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
63 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
64 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
65 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
66 return 0;
2734
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
67 }