[Bf-blender-cvs] [bcc9a23] master: Various Sticky fixes (tm)

Julian Eisel noreply at git.blender.org
Mon Apr 6 23:10:49 CEST 2015


Commit: bcc9a235487e9607204475ce66140d4cef3d59bf
Author: Julian Eisel
Date:   Mon Apr 6 23:10:21 2015 +0200
Branches: master
https://developer.blender.org/rBbcc9a235487e9607204475ce66140d4cef3d59bf

Various Sticky fixes (tm)

* Revert 776bfa64a53191b and c3dad7953afccd4 (some X11 systems are doing
stupid things forcing me to do an extra check that completely breaks the
click type handling on other systems using the slightly changed
implementation from those commits - see T44278)
* Fix sample lines in Compositor+VSE

(And yes, this time I tested on both of my systems to make sure
everything is fine)

===================================================================

M	source/blender/editors/interface/interface_eyedropper.c
M	source/blender/editors/mesh/editmesh_extrude.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_node/node_view.c
M	source/blender/editors/space_sequencer/sequencer_view.c
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_window.c

===================================================================

diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index f5847a9..96f9b87 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -277,6 +277,10 @@ static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
 			eyedropper_cancel(C, op);
 			return OPERATOR_CANCELLED;
 		case LEFTMOUSE:
+			/* two release events are sent on KM_CLICK, so ignore second one */
+			if (event->click_type == KM_CLICK) {
+				break;
+			}
 			if (event->val == KM_RELEASE) {
 				if (eye->accum_tot == 0) {
 					eyedropper_color_sample(C, eye, event->x, event->y);
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index 5c7efcc..5cdd450 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -511,6 +511,10 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
 	bool done = false;
 	bool use_proj;
 
+	if (ELEM(event->click_type, KM_CLICK, KM_HOLD)) {
+		return OPERATOR_CANCELLED;
+	}
+
 	em_setup_viewcontext(C, &vc);
 
 	ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 6a5462b..aa62521 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2950,11 +2950,11 @@ static int image_sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
 	switch (event->type) {
 		case LEFTMOUSE:
 		case RIGHTMOUSE: // XXX hardcoded
-		if (event->val == KM_RELEASE) {
-			image_sample_exit(C, op);
-			return OPERATOR_CANCELLED;
-		}
-		break;
+			if (event->val == KM_RELEASE) {
+				image_sample_exit(C, op);
+				return OPERATOR_CANCELLED;
+			}
+			break;
 		case MOUSEMOVE:
 			image_sample_apply(C, op, event);
 			break;
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index 3491ecc..dda84eb 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -609,8 +609,11 @@ static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
 	switch (event->type) {
 		case LEFTMOUSE:
 		case RIGHTMOUSE: // XXX hardcoded
-			sample_exit(C, op);
-			return OPERATOR_CANCELLED;
+			if (event->val == KM_RELEASE) {
+				sample_exit(C, op);
+				return OPERATOR_CANCELLED;
+			}
+			break;
 		case MOUSEMOVE:
 			sample_apply(C, op, event);
 			break;
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 4eafd2f..37ac600 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -201,8 +201,10 @@ static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
 	switch (event->type) {
 		case LEFTMOUSE:
 		case RIGHTMOUSE: /* XXX hardcoded */
-			sample_exit(C, op);
-			return OPERATOR_CANCELLED;
+			if (event->val == KM_RELEASE) {
+				sample_exit(C, op);
+				return OPERATOR_CANCELLED;
+			}
 		case MOUSEMOVE:
 			sample_apply(C, op, event);
 			break;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 225e313..8c013eb 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2994,7 +2994,7 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
  * - #KM_PRESS && time since first #KM_PRESS > U.click_timeout --> send #KM_HOLD
  * - #KM_PRESS after a #KM_RELEASE && time since previous #KM_PRESS < U.dbl_click_time --> send #KM_DBL_CLICK
  *
- * \note: only #KM_DBL_CLICK and #KM_CLICK are handled here, #KM_HOLD in #wm_window_event_clicktype_init (wm_window.c)
+ * \note: only #KM_DBL_CLICK is handled here, rest in #wm_window_event_clicktype_init (wm_window.c)
  */
 static void wm_event_clicktype_init(wmWindow *win, wmEvent *event, wmEvent *event_state)
 {
@@ -3025,16 +3025,6 @@ static void wm_event_clicktype_init(wmWindow *win, wmEvent *event, wmEvent *even
 		}
 	}
 
-	/* click */
-	if ((PIL_check_seconds_timer() - event->click_time) * 1000 <= U.click_timeout) {
-		if (event->val == KM_RELEASE) {
-			click_type = KM_CLICK;
-			if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS)) {
-				printf("%s Send click event\n", __func__);
-			}
-		}
-	}
-
 	if (click_type != event->click_type) {
 		event_state->click_type = event->click_type = click_type;
 	}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 4b98f8b..61bddb1 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1107,9 +1107,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
 }
 
 /**
- * #KM_DBL_CLICK and #KM_CLICK are set in wm_event_clicktype_init (wm_event_system.c)
- * Normally, #KM_HOLD should be there too, but we need a time precision of a few
- * milliseconds for it, which we can't get from there
+ * #KM_DBL_CLICK is set in wm_event_clicktype_init (wm_event_system.c)
+ * Normally, this should be there too, but for #KM_CLICK/#KM_HOLD, we need a
+ * time precision of a few milliseconds, which we can't get from there
  */
 static void wm_window_event_clicktype_init(const bContext *C)
 {
@@ -1150,7 +1150,14 @@ static void wm_window_event_clicktype_init(const bContext *C)
 
 		/* the actual test */
 		if ((PIL_check_seconds_timer() - event->click_time) * 1000 <= U.click_timeout) {
-			/* sending of KM_CLICK is handled in wm_event_clicktype_init (wm_event_system.c) */
+			/* for any reason some X11 systems send two release events triggering two KM_CLICK
+			 * events - making the rules more strict by checking for prevval resolves this */
+			if (event->val == KM_RELEASE && event->prevval != KM_RELEASE) {
+				click_type = KM_CLICK;
+				if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS)) {
+					printf("%s Send click event\n", __func__);
+				}
+			}
 		}
 		else if (event->is_key_pressed) {
 			click_type = KM_HOLD;




More information about the Bf-blender-cvs mailing list