Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-12-10 20:41:03 +0300
committerMartin Poirier <theeth@yahoo.com>2009-12-10 20:41:03 +0300
commit0779f2c42599dd665730902cd669741070bdb46b (patch)
tree49549d0330c31504c17cd00d0c0e1b70ea19383e /source
parent0cc5d50d9183ca3915ae6d0fd423127d7fc43df4 (diff)
Double Click event value.
Timeout between both clicks is user configurable, should be taken from the OS when possible.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/resources.c3
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h4
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c5
-rw-r--r--source/blender/makesrna/intern/rna_wm.c10
-rw-r--r--source/blender/windowmanager/WM_types.h1
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c21
7 files changed, 44 insertions, 2 deletions
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 1df76f312b3..809b3387f28 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1280,6 +1280,9 @@ void init_userdef_do_versions(void)
if (U.frameserverport == 0) {
U.frameserverport = 8080;
}
+ if (U.dbl_click_time == 0) {
+ U.dbl_click_time = 350;
+ }
/* 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 6e610b1c32d..82e6cebe71e 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -288,7 +288,9 @@ typedef struct UserDef {
char sounddir[160];
/* yafray: temporary xml export directory */
char yfexportdir[160];
- short versions, pad;
+ short versions;
+
+ short dbl_click_time;
int gameflags;
int wheellinescroll;
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 678cc85ee0f..9d944ca0d4b 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -158,6 +158,7 @@ typedef struct wmWindow {
short last_type; /* last event information, used for click */
short last_val;
+ double last_click_time; /* for double click */
struct wmEvent *eventstate; /* storage for event system */
@@ -291,6 +292,7 @@ typedef struct wmKeyMap {
/* wmKeyMap.flag */
#define KEYMAP_MODAL 1 /* modal map, not using operatornames */
#define KEYMAP_USER 2 /* user created keymap */
+#define KEYMAP_EXPANDED 4
typedef struct wmKeyConfig {
struct wmKeyConfig *next, *prev;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 2424a72b6a3..f695936d47c 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2338,6 +2338,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_range(prop, 0, 200);
RNA_def_property_ui_text(prop, "NDof Rotation Speed", "The overall rotation speed of an NDOF device, as percent of standard.");
+ prop= RNA_def_property(srna, "double_click_time", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "dbl_click_time");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_text(prop, "Double Click Timeout", "The time (in ms) for a double click.");
+
prop= RNA_def_property(srna, "emulate_3_button_mouse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TWOBUTTONMOUSE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_userdef_emulate_set");
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index b0d8e372cb0..5cf9c245b05 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -43,6 +43,7 @@ EnumPropertyItem event_keymouse_value_items[] = {
{KM_PRESS, "PRESS", 0, "Press", ""},
{KM_RELEASE, "RELEASE", 0, "Release", ""},
{KM_CLICK, "CLICK", 0, "Click", ""},
+ {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem event_tweak_value_items[]= {
@@ -871,16 +872,19 @@ static void rna_def_keyconfig(BlenderRNA *brna)
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "idname");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Name", "Name of the key map.");
RNA_def_struct_name_property(srna, prop);
prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spaceid");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, space_type_items);
RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with.");
prop= RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "regionid");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, region_type_items);
RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with.");
@@ -894,8 +898,14 @@ static void rna_def_keyconfig(BlenderRNA *brna)
prop= RNA_def_property(srna, "modal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Modal Keymap", "Indicates that a keymap is used for translate modal events for an operator.");
+ prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_EXPANDED);
+ RNA_def_property_ui_text(prop, "Expanded", "Expanded in the user interface.");
+
+
RNA_api_keymap(srna);
/* KeyMapItem */
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index a884d7b6831..160f9cccf6c 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -83,6 +83,7 @@ enum {
#define KM_PRESS 1
#define KM_RELEASE 2
#define KM_CLICK 3
+#define KM_DBL_CLICK 4
/* ************** UI Handler ***************** */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index ce3acece776..9aad7da7a58 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -60,6 +60,8 @@
#include "UI_interface.h"
+#include "PIL_time.h"
+
#include "WM_api.h"
#include "WM_types.h"
#include "wm.h"
@@ -1163,6 +1165,12 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
event->val = KM_CLICK;
action |= wm_handlers_do(C, event, handlers);
+ /* if not handled and time is right, check double click */
+ if ((action & WM_HANDLER_BREAK) == 0 && (PIL_check_seconds_timer() - win->last_click_time) * 1000 < U.dbl_click_time) {
+ event->val = KM_DBL_CLICK;
+ action |= wm_handlers_do(C, event, handlers);
+ }
+
/* revert value if not handled */
if ((action & WM_HANDLER_BREAK) == 0) {
event->val = KM_RELEASE;
@@ -1354,11 +1362,22 @@ void wm_event_do_handlers(bContext *C)
/* mousemove event don't overwrite last type */
if (event->type != MOUSEMOVE) {
if (action == WM_HANDLER_CONTINUE || action == (WM_HANDLER_BREAK|WM_HANDLER_MODAL)) {
- win->last_type = event->type;
+ if (win->last_type == event->type) {
+ /* set click time on first click (press -> release) */
+ if (win->last_val == KM_PRESS && event->val == KM_RELEASE) {
+ win->last_click_time = PIL_check_seconds_timer();
+ }
+ } else {
+ /* reset click time if event type not the same */
+ win->last_click_time = 0;
+ }
+
win->last_val = event->val;
+ win->last_type = event->type;
} else {
win->last_type = -1;
win->last_val = 0;
+ win->last_click_time = 0;
}
}