Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simplify button click code a bit

  • Loading branch information...
commit aec293fb8c3b01740c64c3bbe6cf773cf7f36ad5 1 parent 550a609
Sébastien Bourdeauducq authored June 15, 2011

Showing 1 changed file with 27 additions and 30 deletions. Show diff stats Hide diff stats

  1. 57  lib/button.c
57  lib/button.c
@@ -225,36 +225,33 @@ static void but_handle_event(BUTTON *b, EVENT *e, WIDGET *from)
225 225
 {
226 226
 	char *click_msg, *clack_msg, *commit_msg = NULL;
227 227
 	switch (e->type) {
228  
-
229  
-	case EVENT_PRESS:
230  
-
231  
-		/* check for mouse button event */
232  
-		if ((e->code  != MTK_BTN_LEFT) && (e->code != MTK_KEY_SPACE)) break;
233  
-
234  
-		if (b->bd->click) b->bd->click(b);
235  
-
236  
-		click_msg  = b->gen->get_bind_msg(b, "click");
237  
-		clack_msg  = b->gen->get_bind_msg(b, "clack");
238  
-		commit_msg = b->gen->get_bind_msg(b, "commit");
239  
-
240  
-		if (click_msg || clack_msg || commit_msg)
241  
-			userstate->touch(b, NULL, but_untouch_callback);
242  
-
243  
-		if (click_msg)
244  
-			msg->send_action_event(b->gen->get_app_id(b), "click", click_msg);
245  
-
246  
-		if (commit_msg && !config_clackcommit)
247  
-			msg->send_action_event(b->gen->get_app_id(b), "commit", commit_msg);
248  
-
249  
-		if (click_msg || clack_msg || commit_msg || b->bd->click) return;
250  
-		break;
251  
-
252  
-	case EVENT_RELEASE:
253  
-		/* check for mouse button event */
254  
-		if (e->code  == MTK_BTN_LEFT) {
255  
-			if (b->bd->release) b->bd->release(b);
256  
-		}
257  
-		break;
  228
+		case EVENT_PRESS:
  229
+			/* check for mouse button event */
  230
+			if (e->code == MTK_BTN_LEFT) {
  231
+				if (b->bd->click) b->bd->click(b);
  232
+
  233
+				click_msg  = b->gen->get_bind_msg(b, "click");
  234
+				clack_msg  = b->gen->get_bind_msg(b, "clack");
  235
+				commit_msg = b->gen->get_bind_msg(b, "commit");
  236
+
  237
+				if (click_msg || clack_msg || commit_msg)
  238
+					userstate->touch(b, NULL, but_untouch_callback);
  239
+
  240
+				if (click_msg)
  241
+					msg->send_action_event(b->gen->get_app_id(b), "click", click_msg);
  242
+
  243
+				if (commit_msg && !config_clackcommit)
  244
+					msg->send_action_event(b->gen->get_app_id(b), "commit", commit_msg);
  245
+
  246
+				if (click_msg || clack_msg || commit_msg || b->bd->click) return;
  247
+			}
  248
+			break;
  249
+		case EVENT_RELEASE:
  250
+			/* check for mouse button event */
  251
+			if (e->code == MTK_BTN_LEFT) {
  252
+				if (b->bd->release) b->bd->release(b);
  253
+			}
  254
+			break;
258 255
 	}
259 256
 
260 257
 	if (b->bd->click) return;

0 notes on commit aec293f

Please sign in to comment.
Something went wrong with that request. Please try again.