diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-03 20:00:49 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-03 20:00:49 +0300 |
commit | be5f30416b34f6928b629dda44a3f1f071d054cb (patch) | |
tree | ba014b7532ab3b9cb7f6e8686b152afcb097a689 | |
parent | e86a489327190cfe87c98067da53fe40d6778bd1 (diff) |
Todo item
Drag/drop now has a User preset for dragging threshold.
Noticed this was set to 3 pixels even, made it 5 as default.
Tablet owners can put it larger too :)
Note: the tweak-threshold (3d win) is 10 pixels now, I think
this needs another preset too, leave this for now.
Also: fixed crash in filewindow: drag .blend icon and drop it.
You can't test anything in Blender or you get a bug :)
5 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c548be947fa..0733652a75f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -646,13 +646,12 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event) return BLI_in_rcti(&rect, x, y); } -#define UI_DRAG_THRESHOLD 3 static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { /* prevent other WM gestures to start while we try to drag */ WM_gestures_remove(C); - if( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > UI_DRAG_THRESHOLD ) { + if( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold ) { wmDrag *drag; button_activate_state(C, but, BUTTON_STATE_EXIT); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index fa36eed5911..6500ce041ba 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1527,7 +1527,7 @@ void init_userdef_do_versions(void) U.dbl_click_time = 350; } if (U.anim_player_preset == 0) { - U.anim_player_preset =1 ; + U.anim_player_preset = 1 ; } if (U.scrcastfps == 0) { U.scrcastfps = 10; @@ -1536,6 +1536,8 @@ void init_userdef_do_versions(void) if (U.v2d_min_gridsize == 0) { U.v2d_min_gridsize= 35; } + if (U.dragthreshold == 0 ) + U.dragthreshold= 5; /* funny name, but it is GE stuff, moves userdef stuff to engine */ // XXX space_set_commmandline_options(); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index f9ba1c2a471..cdb52c83b0a 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -350,7 +350,7 @@ typedef struct UserDef { short tw_hotspot, tw_flag, tw_handlesize, tw_size; short textimeout,texcollectrate; short wmdrawmethod; /* removed wmpad */ - short pad2; + short dragthreshold; int memcachelimit; int prefetchframes; short frameserverport; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index a7b7d91a2b6..bead4f39858 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2676,6 +2676,12 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_CONTINUOUS_MOUSE); RNA_def_property_ui_text(prop, "Continuous Grab", "Allow moving the mouse outside the view on some manipulations (transform, ui control drag)"); + /* tweak tablet & mouse preset */ + prop= RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "dragthreshold"); + RNA_def_property_range(prop, 3, 40); + RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens"); + prop= RNA_def_property(srna, "ndof_pan_speed", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ndof_pan"); RNA_def_property_range(prop, 0, 200); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 84c78669c64..7ad52f8fcb1 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1478,7 +1478,10 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) //wm_operator_invoke(C, drop->ot, event, drop->ptr, NULL, FALSE); action |= WM_HANDLER_BREAK; - /* prevent hanging on file read */ + /* XXX fileread case */ + if(CTX_wm_window(C)==NULL) + return action; + BLI_freelistN(event->customdata); event->customdata= NULL; event->custom= 0; @@ -1501,7 +1504,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) } } - /* fileread case */ + /* XXX fileread case */ if(CTX_wm_window(C)==NULL) return action; } |