summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Zima <xhire@tuxportal.cz>2009-07-16 13:07:51 +0200
committerMichal Zima <xhire@tuxportal.cz>2009-07-16 13:07:51 +0200
commit37880070ae525a0b5b23c711bf3f612ea15cd537 (patch)
tree576866c973a96219526336176844207724cec677 /src
parentd0c088655af27e2e66b164c061e48a5f5bd28f05 (diff)
Fixed code style
Diffstat (limited to 'src')
-rw-r--r--src/client/interface.c6
-rw-r--r--src/client/mouse_buffer.c23
-rw-r--r--src/client/mouse_buffer.h4
-rw-r--r--src/widget/widget_button.c12
-rw-r--r--src/widget/widget_catchkey.c8
-rw-r--r--src/widget/widget_check.c3
-rw-r--r--src/widget/widget_choicegroup.c8
-rw-r--r--src/widget/widget_select.c3
-rw-r--r--src/widget/widget_statusbar.c4
-rw-r--r--src/widget/widget_textfield.c5
10 files changed, 47 insertions, 29 deletions
diff --git a/src/client/interface.c b/src/client/interface.c
index 9907862..01fe241 100644
--- a/src/client/interface.c
+++ b/src/client/interface.c
@@ -278,9 +278,9 @@ int eventAction()
while (SDL_WaitEvent(&event)) {
switch (event.type) {
- case SDL_MOUSEBUTTONDOWN:
- mouse_buffer_event(&event.button);
- break;
+ case SDL_MOUSEBUTTONDOWN:
+ mouse_buffer_event(&event.button);
+ break;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
diff --git a/src/client/mouse_buffer.c b/src/client/mouse_buffer.c
index 9888c44..207951d 100644
--- a/src/client/mouse_buffer.c
+++ b/src/client/mouse_buffer.c
@@ -10,14 +10,13 @@
static list_t *list_event;
-typedef struct mouse_event_struct
-{
+typedef struct mouse_event_struct {
Uint8 button;
int x;
int y;
} mouse_event_t;
-static mouse_event_t* mouse_event_new(int x, int y, Uint8 button)
+static mouse_event_t *mouse_event_new(int x, int y, Uint8 button)
{
mouse_event_t *mouse_event;
@@ -47,18 +46,18 @@ int mouse_buffer_event(SDL_MouseButtonEvent *button)
assert(button != NULL);
assert(list_event != NULL);
- switch(button->button) {
+ switch (button->button) {
case SDL_BUTTON_LEFT:
case SDL_BUTTON_RIGHT:
- //printf("mouse button - pos(%d,%d)\n", button->x, button->y);
+ /*printf("mouse button - pos(%d,%d)\n", button->x, button->y);*/
list_add(list_event, mouse_event_new(button->x, button->y, button->button));
return 1;
- break;
+ break;
default:
- break;
+ break;
}
return 0;
@@ -89,10 +88,11 @@ bool_t mouse_buffer_is_on_area(int x, int y, int w, int h, unsigned int flag)
return TRUE;
}
} else {
- for (i = 0; i<list_event->count; i++) {
- mouse_event = (mouse_event_t *)list_event->list[i];
+ for (i = 0; i < list_event->count; i++) {
+ mouse_event = (mouse_event_t *) list_event->list[i];
- if ((mouse_event->x >= x && mouse_event->y >= y && mouse_event->x < x+w && mouse_event->y < y+h) ||
+ if ((mouse_event->x >= x && mouse_event->y >= y &&
+ mouse_event->x < x + w && mouse_event->y < y + h) ||
(flag & MOUSE_BUF_AREA_NONE)) {
if (flag & MOUSE_BUF_CLICK_LEFT) {
if (mouse_event->button == SDL_BUTTON_LEFT) {
@@ -111,7 +111,8 @@ bool_t mouse_buffer_is_on_area(int x, int y, int w, int h, unsigned int flag)
}
if (flag & MOUSE_BUF_CLICK) {
- if (mouse_event->button == SDL_BUTTON_LEFT || mouse_event->button == SDL_BUTTON_RIGHT) {
+ if (mouse_event->button == SDL_BUTTON_LEFT ||
+ mouse_event->button == SDL_BUTTON_RIGHT) {
return TRUE;
} else {
return FALSE;
diff --git a/src/client/mouse_buffer.h b/src/client/mouse_buffer.h
index 75fe549..7cc6588 100644
--- a/src/client/mouse_buffer.h
+++ b/src/client/mouse_buffer.h
@@ -15,6 +15,4 @@ extern int mouse_buffer_clean();
extern bool_t mouse_buffer_is_on_area(int x, int y, int w, int h, unsigned int flag);
extern int mouse_buffer_quit();
-#endif
-
-
+#endif /* MOUSE_EVENT_H */
diff --git a/src/widget/widget_button.c b/src/widget/widget_button.c
index 7e2d091..f30b03d 100644
--- a/src/widget/widget_button.c
+++ b/src/widget/widget_button.c
@@ -45,10 +45,13 @@ void button_draw(widget_t *widget)
g_button1 = image_add("button1.png", IMAGE_ALPHA, "button1", IMAGE_GROUP_BASE);
}
- if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_BUTTON_WIDTH, WIDGET_BUTTON_HEIGHT, MOUSE_BUF_MOTION)) {
- image_draw(g_button1, widget->x, widget->y, 0, 0, g_button0->w, g_button0->h);
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_BUTTON_WIDTH,
+ WIDGET_BUTTON_HEIGHT, MOUSE_BUF_MOTION)) {
+ image_draw(g_button1, widget->x, widget->y, 0, 0,
+ g_button0->w, g_button0->h);
} else {
- image_draw(g_button0, widget->x, widget->y, 0, 0, g_button0->w, g_button0->h);
+ image_draw(g_button0, widget->x, widget->y, 0, 0,
+ g_button0->w, g_button0->h);
}
/*font_draw(p->text, p->x+WIDGET_BUTTON_WIDTH/2-p->w/2, p->y+p->h/2, COLOR_WHITE);*/
@@ -72,7 +75,8 @@ void button_event(widget_t *widget)
return;
}
- if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_BUTTON_WIDTH, WIDGET_BUTTON_HEIGHT, MOUSE_BUF_CLICK)) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_BUTTON_WIDTH,
+ WIDGET_BUTTON_HEIGHT, MOUSE_BUF_CLICK)) {
my_time = WIDGET_BUTTON_TIME;
DEBUG_MSG(_("[Debug] Caught some button event\n"));
diff --git a/src/widget/widget_catchkey.c b/src/widget/widget_catchkey.c
index b6290a6..b785c92 100644
--- a/src/widget/widget_catchkey.c
+++ b/src/widget/widget_catchkey.c
@@ -18,7 +18,8 @@ widget_t *catch_key_new(int key, int x, int y, void *event)
new->fce_event = event;
new->active = FALSE;
- return widget_new(WIDGET_TYPE_CATCHKEY, x, y, WIDGET_CATCHKEY_WIDTH, WIDGET_CATCHKEY_HEIGHT, new);
+ return widget_new(WIDGET_TYPE_CATCHKEY, x, y, WIDGET_CATCHKEY_WIDTH,
+ WIDGET_CATCHKEY_HEIGHT, new);
}
int catch_key_get(widget_t *widget)
@@ -103,7 +104,10 @@ void catch_key_event(widget_t *widget)
p = (widget_catchkey_t *) widget->private_data;
if (mouse_buffer_is_on_area(0, 0, 0, 0, MOUSE_BUF_AREA_NONE|MOUSE_BUF_CLICK)) {
- if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_CATCHKEY_WIDTH, WIDGET_CATCHKEY_HEIGHT, MOUSE_BUF_CLICK)) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y,
+ WIDGET_CATCHKEY_WIDTH,
+ WIDGET_CATCHKEY_HEIGHT,
+ MOUSE_BUF_CLICK)) {
p->active = TRUE;
} else {
p->active = FALSE;
diff --git a/src/widget/widget_check.c b/src/widget/widget_check.c
index 4aa6a29..f39c6ad 100644
--- a/src/widget/widget_check.c
+++ b/src/widget/widget_check.c
@@ -62,7 +62,8 @@ void check_event(widget_t *widget)
return;
}
- if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_CHECK_WIDTH, WIDGET_CHECK_HEIGHT, MOUSE_BUF_CLICK)) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_CHECK_WIDTH,
+ WIDGET_CHECK_HEIGHT, MOUSE_BUF_CLICK)) {
if (p->status == TRUE) {
p->status = FALSE;
p->time = WIDGET_CHECK_TIME_SWITCH_STATUS;
diff --git a/src/widget/widget_choicegroup.c b/src/widget/widget_choicegroup.c
index d325d1b..2c3338f 100644
--- a/src/widget/widget_choicegroup.c
+++ b/src/widget/widget_choicegroup.c
@@ -20,7 +20,8 @@ widget_t *choice_group_new(int x, int y, bool_t status, list_t *list, void (*fce
new->fce_event = fce_event;
new->list = list;
- widget = widget_new(WIDGET_TYPE_CHOICE, x, y, WIDGET_CHOICEGROUP_WIDTH, WIDGET_CHOICEGROUP_HEIGHT, new);
+ widget = widget_new(WIDGET_TYPE_CHOICE, x, y, WIDGET_CHOICEGROUP_WIDTH,
+ WIDGET_CHOICEGROUP_HEIGHT, new);
list_add(new->list, widget);
@@ -116,7 +117,10 @@ void choice_group_event(widget_t *widget)
return;
}
- if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_CHOICEGROUP_WIDTH, WIDGET_CHOICEGROUP_HEIGHT, MOUSE_BUF_CLICK)) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y,
+ WIDGET_CHOICEGROUP_WIDTH,
+ WIDGET_CHOICEGROUP_HEIGHT,
+ MOUSE_BUF_CLICK)) {
choice_group_set_active(widget);
}
}
diff --git a/src/widget/widget_select.c b/src/widget/widget_select.c
index a453ec4..13ce483 100644
--- a/src/widget/widget_select.c
+++ b/src/widget/widget_select.c
@@ -105,7 +105,8 @@ void select_draw(widget_t *widget)
}
}
*/
- if (mouse_buffer_is_on_area(widget->x, widget->y+i * 20, w, h, MOUSE_BUF_MOTION)) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y + i * 20,
+ w, h, MOUSE_BUF_MOTION)) {
font_draw(line, widget->x, widget->y + i * 20, COLOR_YELLOW);
} else {
if (p->select == i) {
diff --git a/src/widget/widget_statusbar.c b/src/widget/widget_statusbar.c
index 0a9c9b3..c2b48a4 100644
--- a/src/widget/widget_statusbar.c
+++ b/src/widget/widget_statusbar.c
@@ -122,7 +122,9 @@ void statusbar_event(widget_t *widget)
item = (item_t *) p->listElement->list[i];
- if (mouse_buffer_is_on_area(item->widget->x, item->widget->y, item->widget->w, item->widget->h, MOUSE_BUF_MOTION)) {
+ if (mouse_buffer_is_on_area(item->widget->x, item->widget->y,
+ item->widget->w, item->widget->h,
+ MOUSE_BUF_MOTION)) {
p->selectElement = i;
}
}
diff --git a/src/widget/widget_textfield.c b/src/widget/widget_textfield.c
index 1711ad9..fdf4e1d 100644
--- a/src/widget/widget_textfield.c
+++ b/src/widget/widget_textfield.c
@@ -308,7 +308,10 @@ void text_field_event(widget_t *widget)
p = (widget_textfield_t *) widget->private_data;
if (mouse_buffer_is_on_area(0, 0, 0, 0, MOUSE_BUF_AREA_NONE|MOUSE_BUF_CLICK)) {
- if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_TEXTFIELD_WIDTH, WIDGET_TEXTFIELD_HEIGHT, MOUSE_BUF_MOTION)) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y,
+ WIDGET_TEXTFIELD_WIDTH,
+ WIDGET_TEXTFIELD_HEIGHT,
+ MOUSE_BUF_MOTION)) {
p->active = TRUE;
interface_enable_keyboard_buffer();
keyboard_buffer_clear();