comparison src/video/ataricommon/SDL_xbiosevents.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
43 static Uint16 atari_prevmouseb; /* buttons */ 43 static Uint16 atari_prevmouseb; /* buttons */
44 44
45 /* Functions */ 45 /* Functions */
46 46
47 void 47 void
48 SDL_AtariXbios_InstallVectors (int vectors_mask) 48 SDL_AtariXbios_InstallVectors(int vectors_mask)
49 { 49 {
50 void *oldpile; 50 void *oldpile;
51 51
52 /* Clear variables */ 52 /* Clear variables */
53 SDL_AtariXbios_mouseb = 53 SDL_AtariXbios_mouseb =
59 SDL_AtariXbios_enabled = 0; 59 SDL_AtariXbios_enabled = 0;
60 return; 60 return;
61 } 61 }
62 62
63 /* Read IKBD vectors base */ 63 /* Read IKBD vectors base */
64 kbdvecs = Kbdvbase (); 64 kbdvecs = Kbdvbase();
65 65
66 /* Go to supervisor mode */ 66 /* Go to supervisor mode */
67 oldpile = (void *) Super (0); 67 oldpile = (void *) Super(0);
68 68
69 /* Install our vectors */ 69 /* Install our vectors */
70 SDL_AtariXbios_Install (kbdvecs, 70 SDL_AtariXbios_Install(kbdvecs,
71 (vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? 71 (vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ?
72 SDL_AtariXbios_MouseVector : NULL, 72 SDL_AtariXbios_MouseVector : NULL,
73 (vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ? 73 (vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ?
74 SDL_AtariXbios_JoystickVector : NULL); 74 SDL_AtariXbios_JoystickVector : NULL);
75 75
76 /* Back to user mode */ 76 /* Back to user mode */
77 Super (oldpile); 77 Super(oldpile);
78 78
79 SDL_AtariXbios_enabled = 1; 79 SDL_AtariXbios_enabled = 1;
80 } 80 }
81 81
82 void 82 void
83 SDL_AtariXbios_RestoreVectors (void) 83 SDL_AtariXbios_RestoreVectors(void)
84 { 84 {
85 void *oldpile; 85 void *oldpile;
86 86
87 if (SDL_AtariXbios_enabled == 0) { 87 if (SDL_AtariXbios_enabled == 0) {
88 return; 88 return;
89 } 89 }
90 90
91 /* Read IKBD vectors base */ 91 /* Read IKBD vectors base */
92 kbdvecs = Kbdvbase (); 92 kbdvecs = Kbdvbase();
93 93
94 /* Go to supervisor mode */ 94 /* Go to supervisor mode */
95 oldpile = (void *) Super (NULL); 95 oldpile = (void *) Super(NULL);
96 96
97 /* Reinstall system vector */ 97 /* Reinstall system vector */
98 SDL_AtariXbios_Restore (kbdvecs); 98 SDL_AtariXbios_Restore(kbdvecs);
99 99
100 /* Back to user mode */ 100 /* Back to user mode */
101 Super (oldpile); 101 Super(oldpile);
102 } 102 }
103 103
104 static int 104 static int
105 atari_GetButton (int button) 105 atari_GetButton(int button)
106 { 106 {
107 switch (button) { 107 switch (button) {
108 case 0: 108 case 0:
109 return SDL_BUTTON_RIGHT; 109 return SDL_BUTTON_RIGHT;
110 break; 110 break;
114 break; 114 break;
115 } 115 }
116 } 116 }
117 117
118 void 118 void
119 SDL_AtariXbios_PostMouseEvents (_THIS, SDL_bool buttonEvents) 119 SDL_AtariXbios_PostMouseEvents(_THIS, SDL_bool buttonEvents)
120 { 120 {
121 if (SDL_AtariXbios_enabled == 0) { 121 if (SDL_AtariXbios_enabled == 0) {
122 return; 122 return;
123 } 123 }
124 124
125 /* Mouse motion ? */ 125 /* Mouse motion ? */
126 if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) { 126 if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) {
127 SDL_PrivateMouseMotion (0, 1, SDL_AtariXbios_mousex, 127 SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex,
128 SDL_AtariXbios_mousey); 128 SDL_AtariXbios_mousey);
129 SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0; 129 SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
130 } 130 }
131 131
132 /* Mouse button ? */ 132 /* Mouse button ? */
133 if (buttonEvents && (SDL_AtariXbios_mouseb != atari_prevmouseb)) { 133 if (buttonEvents && (SDL_AtariXbios_mouseb != atari_prevmouseb)) {
138 138
139 curbutton = SDL_AtariXbios_mouseb & (1 << i); 139 curbutton = SDL_AtariXbios_mouseb & (1 << i);
140 prevbutton = atari_prevmouseb & (1 << i); 140 prevbutton = atari_prevmouseb & (1 << i);
141 141
142 if (curbutton && !prevbutton) { 142 if (curbutton && !prevbutton) {
143 SDL_PrivateMouseButton (SDL_PRESSED, 143 SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
144 atari_GetButton (i), 0, 0);
145 } 144 }
146 if (!curbutton && prevbutton) { 145 if (!curbutton && prevbutton) {
147 SDL_PrivateMouseButton (SDL_RELEASED, 146 SDL_PrivateMouseButton(SDL_RELEASED,
148 atari_GetButton (i), 0, 0); 147 atari_GetButton(i), 0, 0);
149 } 148 }
150 } 149 }
151 atari_prevmouseb = SDL_AtariXbios_mouseb; 150 atari_prevmouseb = SDL_AtariXbios_mouseb;
152 } 151 }
153 } 152 }