comparison src/video/picogui/SDL_pgevents.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
29 #include "../../events/SDL_events_c.h" 29 #include "../../events/SDL_events_c.h"
30 #include "SDL_pgvideo.h" 30 #include "SDL_pgvideo.h"
31 #include "SDL_pgevents_c.h" 31 #include "SDL_pgevents_c.h"
32 32
33 int 33 int
34 PG_HandleClose (struct pgEvent *evt) 34 PG_HandleClose(struct pgEvent *evt)
35 { 35 {
36 SDL_PrivateQuit (); 36 SDL_PrivateQuit();
37 return 1; /* Intercept the event's normal quit handling */ 37 return 1; /* Intercept the event's normal quit handling */
38 } 38 }
39 39
40 int 40 int
41 PG_HandleResize (struct pgEvent *evt) 41 PG_HandleResize(struct pgEvent *evt)
42 { 42 {
43 SDL_PrivateResize (evt->e.size.w, evt->e.size.h); 43 SDL_PrivateResize(evt->e.size.w, evt->e.size.h);
44 return 0; 44 return 0;
45 } 45 }
46 46
47 int 47 int
48 PG_HandleKey (struct pgEvent *evt) 48 PG_HandleKey(struct pgEvent *evt)
49 { 49 {
50 SDL_keysym sym; 50 SDL_keysym sym;
51 SDL_memset (&sym, 0, sizeof (sym)); 51 SDL_memset(&sym, 0, sizeof(sym));
52 sym.sym = evt->e.kbd.key; 52 sym.sym = evt->e.kbd.key;
53 sym.mod = evt->e.kbd.mods; 53 sym.mod = evt->e.kbd.mods;
54 SDL_PrivateKeyboard (evt->type == PG_WE_KBD_KEYDOWN, &sym); 54 SDL_PrivateKeyboard(evt->type == PG_WE_KBD_KEYDOWN, &sym);
55 return 0; 55 return 0;
56 } 56 }
57 57
58 int 58 int
59 PG_HandleChar (struct pgEvent *evt) 59 PG_HandleChar(struct pgEvent *evt)
60 { 60 {
61 SDL_keysym sym; 61 SDL_keysym sym;
62 SDL_memset (&sym, 0, sizeof (sym)); 62 SDL_memset(&sym, 0, sizeof(sym));
63 sym.unicode = evt->e.kbd.key; 63 sym.unicode = evt->e.kbd.key;
64 sym.mod = evt->e.kbd.mods; 64 sym.mod = evt->e.kbd.mods;
65 SDL_PrivateKeyboard (evt->type == PG_WE_KBD_KEYDOWN, &sym); 65 SDL_PrivateKeyboard(evt->type == PG_WE_KBD_KEYDOWN, &sym);
66 return 0; 66 return 0;
67 } 67 }
68 68
69 int 69 int
70 PG_HandleMouseButton (struct pgEvent *evt) 70 PG_HandleMouseButton(struct pgEvent *evt)
71 { 71 {
72 /* We need to focus the canvas when it's clicked */ 72 /* We need to focus the canvas when it's clicked */
73 if (evt->extra) { 73 if (evt->extra) {
74 SDL_VideoDevice *this = (SDL_VideoDevice *) evt->extra; 74 SDL_VideoDevice *this = (SDL_VideoDevice *) evt->extra;
75 pgFocus (this->hidden->wCanvas); 75 pgFocus(this->hidden->wCanvas);
76 } 76 }
77 SDL_PrivateMouseButton (evt->type == PG_WE_PNTR_DOWN, evt->e.pntr.chbtn, 77 SDL_PrivateMouseButton(evt->type == PG_WE_PNTR_DOWN, evt->e.pntr.chbtn,
78 evt->e.pntr.x, evt->e.pntr.y); 78 evt->e.pntr.x, evt->e.pntr.y);
79 return 0; 79 return 0;
80 } 80 }
81 81
82 int 82 int
83 PG_HandleMouseMotion (struct pgEvent *evt) 83 PG_HandleMouseMotion(struct pgEvent *evt)
84 { 84 {
85 SDL_PrivateMouseMotion (evt->e.pntr.btn, 0, evt->e.pntr.x, evt->e.pntr.y); 85 SDL_PrivateMouseMotion(evt->e.pntr.btn, 0, evt->e.pntr.x, evt->e.pntr.y);
86 return 0; 86 return 0;
87 } 87 }
88 88
89 void 89 void
90 PG_PumpEvents (_THIS) 90 PG_PumpEvents(_THIS)
91 { 91 {
92 /* Process all pending events */ 92 /* Process all pending events */
93 pgEventPoll (); 93 pgEventPoll();
94 } 94 }
95 95
96 void 96 void
97 PG_InitOSKeymap (_THIS) 97 PG_InitOSKeymap(_THIS)
98 { 98 {
99 /* We need no keymap */ 99 /* We need no keymap */
100 } 100 }
101 101
102 void 102 void
103 PG_InitEvents (_THIS) 103 PG_InitEvents(_THIS)
104 { 104 {
105 /* Turn on all the mouse and keyboard triggers for our canvas, normally less important 105 /* Turn on all the mouse and keyboard triggers for our canvas, normally less important
106 * events like mouse movement are ignored to save bandwidth. */ 106 * events like mouse movement are ignored to save bandwidth. */
107 pgSetWidget (this->hidden->wCanvas, PG_WP_TRIGGERMASK, 107 pgSetWidget(this->hidden->wCanvas, PG_WP_TRIGGERMASK,
108 pgGetWidget (this->hidden->wCanvas, PG_WP_TRIGGERMASK) | 108 pgGetWidget(this->hidden->wCanvas, PG_WP_TRIGGERMASK) |
109 PG_TRIGGER_UP | PG_TRIGGER_DOWN | PG_TRIGGER_MOVE | 109 PG_TRIGGER_UP | PG_TRIGGER_DOWN | PG_TRIGGER_MOVE |
110 PG_TRIGGER_KEYUP | PG_TRIGGER_KEYDOWN | PG_TRIGGER_CHAR, 0); 110 PG_TRIGGER_KEYUP | PG_TRIGGER_KEYDOWN | PG_TRIGGER_CHAR, 0);
111 111
112 /* Start our canvas out focused, so we get keyboard input */ 112 /* Start our canvas out focused, so we get keyboard input */
113 pgFocus (this->hidden->wCanvas); 113 pgFocus(this->hidden->wCanvas);
114 114
115 /* Set up bindings for all the above event handlers */ 115 /* Set up bindings for all the above event handlers */
116 pgBind (this->hidden->wApp, PG_WE_CLOSE, &PG_HandleClose, NULL); 116 pgBind(this->hidden->wApp, PG_WE_CLOSE, &PG_HandleClose, NULL);
117 pgBind (this->hidden->wCanvas, PG_WE_BUILD, &PG_HandleResize, NULL); 117 pgBind(this->hidden->wCanvas, PG_WE_BUILD, &PG_HandleResize, NULL);
118 pgBind (this->hidden->wCanvas, PG_WE_KBD_CHAR, &PG_HandleChar, NULL); 118 pgBind(this->hidden->wCanvas, PG_WE_KBD_CHAR, &PG_HandleChar, NULL);
119 pgBind (this->hidden->wCanvas, PG_WE_KBD_KEYUP, &PG_HandleKey, NULL); 119 pgBind(this->hidden->wCanvas, PG_WE_KBD_KEYUP, &PG_HandleKey, NULL);
120 pgBind (this->hidden->wCanvas, PG_WE_KBD_KEYDOWN, &PG_HandleKey, NULL); 120 pgBind(this->hidden->wCanvas, PG_WE_KBD_KEYDOWN, &PG_HandleKey, NULL);
121 pgBind (this->hidden->wCanvas, PG_WE_PNTR_MOVE, &PG_HandleMouseMotion, 121 pgBind(this->hidden->wCanvas, PG_WE_PNTR_MOVE, &PG_HandleMouseMotion,
122 NULL); 122 NULL);
123 pgBind (this->hidden->wCanvas, PG_WE_PNTR_UP, &PG_HandleMouseButton, 123 pgBind(this->hidden->wCanvas, PG_WE_PNTR_UP, &PG_HandleMouseButton, NULL);
124 NULL); 124 pgBind(this->hidden->wCanvas, PG_WE_PNTR_DOWN, &PG_HandleMouseButton,
125 pgBind (this->hidden->wCanvas, PG_WE_PNTR_DOWN, &PG_HandleMouseButton, 125 this);
126 this);
127 } 126 }
128 127
129 /* end of SDL_pgevents.c ... */ 128 /* end of SDL_pgevents.c ... */
130 /* vi: set ts=4 sw=4 expandtab: */ 129 /* vi: set ts=4 sw=4 expandtab: */