Rev 9787 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9787 | Rev 9961 | ||
---|---|---|---|
Line 135... | Line 135... | ||
135 | ksys_pos_t mouse_pos; |
135 | ksys_pos_t mouse_pos; |
136 | ksys_pos_t center_pos; |
136 | ksys_pos_t center_pos; |
137 | SDL_keysym key; |
137 | SDL_keysym key; |
138 | static int ext_code = 0; |
138 | static int ext_code = 0; |
139 | static uint8_t old_mode = 0; |
139 | static uint8_t old_mode = 0; |
140 | // static uint32_t old_mouse_but = 0; |
- | |
141 | static uint32_t mouse_but = 0; |
- | |
Line 142... | Line 140... | ||
142 | 140 | ||
143 | while (1) { |
141 | while (1) { |
144 | kos_event = _ksys_check_event(); |
142 | kos_event = _ksys_check_event(); |
145 | switch (kos_event) { |
143 | switch (kos_event) { |
Line 187... | Line 185... | ||
187 | break; |
185 | break; |
188 | case KSYS_EVENT_BUTTON: |
186 | case KSYS_EVENT_BUTTON: |
189 | if (_ksys_get_button() == 1) exit(0); |
187 | if (_ksys_get_button() == 1) exit(0); |
190 | break; |
188 | break; |
191 | case KSYS_EVENT_MOUSE: { |
189 | case KSYS_EVENT_MOUSE: { |
- | 190 | static uint32_t old_mouse_but = 0; |
|
- | 191 | ||
192 | mouse_pos = _ksys_get_mouse_pos(KSYS_MOUSE_WINDOW_POS); |
192 | mouse_pos = _ksys_get_mouse_pos(KSYS_MOUSE_WINDOW_POS); |
193 | if (mouse_pos.x >= 0 && mouse_pos.x < this->hidden->win_size_x && |
193 | if (mouse_pos.x >= 0 && mouse_pos.x < this->hidden->win_size_x && |
194 | mouse_pos.y >= 0 && mouse_pos.y < this->hidden->win_size_y || |
194 | mouse_pos.y >= 0 && mouse_pos.y < this->hidden->win_size_y || |
195 | this->input_grab != SDL_GRAB_OFF) { |
195 | this->input_grab != SDL_GRAB_OFF) { |
Line 203... | Line 203... | ||
203 | } |
203 | } |
204 | } else { |
204 | } else { |
205 | SDL_PrivateMouseMotion(0, 0, mouse_pos.x, mouse_pos.y); |
205 | SDL_PrivateMouseMotion(0, 0, mouse_pos.x, mouse_pos.y); |
206 | } |
206 | } |
Line 207... | Line 207... | ||
207 | 207 | ||
- | 208 | uint32_t mouse_but = _ksys_get_mouse_buttons(); |
|
208 | mouse_but = _ksys_get_mouse_buttons(); |
209 | if ((mouse_but ^ old_mouse_but) & KSYS_MOUSE_LBUTTON_PRESSED) { |
209 | if (mouse_but & KSYS_MOUSE_LBUTTON_PRESSED) { |
210 | if(mouse_but & KSYS_MOUSE_LBUTTON_PRESSED) { |
210 | SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT, 0, 0); |
- | |
211 | return; |
211 | SDL_PrivateMouseButton(SDL_PRESSED,SDL_BUTTON_LEFT,0,0); |
212 | } else { |
212 | } else { |
213 | SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT, 0, 0); |
213 | SDL_PrivateMouseButton(SDL_RELEASED,SDL_BUTTON_LEFT,0,0); |
- | 214 | } |
|
- | 215 | } |
|
- | 216 | ||
214 | } |
217 | if ((mouse_but ^ old_mouse_but) & KSYS_MOUSE_RBUTTON_PRESSED) { |
215 | if (mouse_but & KSYS_MOUSE_RBUTTON_PRESSED) { |
218 | if(mouse_but & KSYS_MOUSE_RBUTTON_PRESSED) { |
216 | SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_RIGHT, 0, 0); |
- | |
217 | return; |
219 | SDL_PrivateMouseButton(SDL_PRESSED,SDL_BUTTON_RIGHT,0,0); |
218 | } else { |
220 | } else { |
219 | SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_RIGHT, 0, 0); |
221 | SDL_PrivateMouseButton(SDL_RELEASED,SDL_BUTTON_RIGHT,0,0); |
- | 222 | } |
|
- | 223 | } |
|
- | 224 | ||
220 | } |
225 | if ((mouse_but ^ old_mouse_but) & KSYS_MOUSE_MBUTTON_PRESSED) { |
221 | if (mouse_but & KSYS_MOUSE_MBUTTON_PRESSED) { |
226 | if(mouse_but & KSYS_MOUSE_MBUTTON_PRESSED) { |
222 | SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_MIDDLE, 0, 0); |
- | |
223 | return; |
227 | SDL_PrivateMouseButton(SDL_PRESSED,SDL_BUTTON_MIDDLE,0,0); |
224 | } else { |
228 | } else { |
225 | SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_MIDDLE, 0, 0); |
229 | SDL_PrivateMouseButton(SDL_RELEASED,SDL_BUTTON_MIDDLE,0,0); |
226 | } |
230 | } |
- | 231 | } |
|
- | 232 | ||
- | 233 | old_mouse_but = mouse_but; |
|
227 | } |
234 | } |
228 | } |
235 | } |
229 | } |
236 | } |
230 | } |
237 | } |
231 | }>> |
238 | }>> |