This patch allows for dragging the spinner buttons.

James
Index: e17/libs/ewl/src/ewl_spinner.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_spinner.c,v
retrieving revision 1.49
diff -r1.49 ewl_spinner.c
75a76
> 	s->isdragging = 0;
91a93,105
> 
> 	ewl_callback_append(s->button_increase, EWL_CALLBACK_MOUSE_DOWN,
> 			    ewl_spinner_mouse_down_cb, NULL);
> 	ewl_callback_append(s->button_increase, EWL_CALLBACK_MOUSE_UP,
> 			    ewl_spinner_mouse_up_cb, NULL);
> 
> 	ewl_callback_append(s->button_decrease, EWL_CALLBACK_MOUSE_DOWN,
> 			    ewl_spinner_mouse_down_cb, NULL);
> 	ewl_callback_append(s->button_decrease, EWL_CALLBACK_MOUSE_UP,
> 			    ewl_spinner_mouse_up_cb, NULL);
> 
> 
> 
446a461,524
> ewl_spinner_mouse_down_cb(Ewl_Widget * w, void *ev_data, void *user_data)
> {
> 	Ewl_Spinner    *s;
> 
> 	DENTER_FUNCTION(DLEVEL_STABLE);
> 	DCHECK_PARAM_PTR("w", w);
> 
> 	// Install the move handler
> 	ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
> 			    ewl_spinner_mouse_move_cb, NULL);
> 	s = EWL_SPINNER(w->parent);
> 
> 	DLEAVE_FUNCTION(DLEVEL_STABLE);
> }
> 
> void
> ewl_spinner_mouse_up_cb(Ewl_Widget * w, void *ev_data, void *user_data)
> {
> 	Ewl_Spinner    *s;
> 
> 	DENTER_FUNCTION(DLEVEL_STABLE);
> 	DCHECK_PARAM_PTR("w", w);
> 	// Remove the move handler
> 	ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE,
> 			    ewl_spinner_mouse_move_cb);
> 
> 	s = EWL_SPINNER(w->parent);
> 	s->isdragging = 0;
> 
> 
> 	DLEAVE_FUNCTION(DLEVEL_STABLE);
> }
> 
> 
> void
> ewl_spinner_mouse_move_cb(Ewl_Widget * w, void *ev_data, void *user_data)
> {
> 	Ewl_Spinner    *s;
> 	Ewl_Event_Mouse_Move *ev;
> 	int diff;
> 
> 	DENTER_FUNCTION(DLEVEL_STABLE);
> 	DCHECK_PARAM_PTR("w", w);
> 
> 	s = EWL_SPINNER(w->parent);
> 	ev = ev_data;
> 
> 	if ( s->isdragging == 0 )
> 	{
> 		s->isdragging = 1;
> 		s->y_drag = ev->y;
> 	}
> 	else
> 	{
> 		diff = s->y_drag - ev->y;
> 		ewl_spinner_calc_value(s, s->value + diff );
> 		s->y_drag = ev->y;
> 	}
> 
> 	DLEAVE_FUNCTION(DLEVEL_STABLE);
> }
> 
> 
> void
Index: e17/libs/ewl/src/ewl_spinner.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_spinner.h,v
retrieving revision 1.22
diff -r1.22 ewl_spinner.h
40a41,42
> 	int		isdragging; //*< Reset to start dragiing */
> 	int 		y_drag; /**< Initial Dragging Position Y */
74a77,82
> void ewl_spinner_mouse_down_cb(Ewl_Widget * w, void *ev_data, void *user_data);
> void ewl_spinner_mouse_up_cb(Ewl_Widget * w, void *ev_data, void *user_data);
> void ewl_spinner_mouse_move_cb(Ewl_Widget * w, void *ev_data, void *user_data);
> 
> 
> 

Reply via email to