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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-19 17:58:24 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-19 17:58:24 +0300
commit924122199b3f4e8c548397c9859c783514008ea2 (patch)
tree9f9a073cc8f6e2d7abf532593d4cba0e8828b4bb /source
parent7e8af5868e3eea49f544a0487a01cb2134b6cb4d (diff)
Bugfix: doubles are not supported correctly in SDNA, double click
introduced one in wmWindow.last_click_time. Moved this to the wmEvent struct, which now no is in DNA, was needed for RNA wrapping but not needed anymore.
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h39
-rw-r--r--source/blender/makesrna/intern/rna_wm.c4
-rw-r--r--source/blender/windowmanager/WM_types.h38
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c28
4 files changed, 57 insertions, 52 deletions
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 9e47a6f1d89..2f640d3dfd4 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -154,10 +154,7 @@ typedef struct wmWindow {
short cursor; /* current mouse cursor type */
short lastcursor; /* for temp waitcursor */
short addmousemove; /* internal: tag this for extra mousemove event, makes cursors/buttons active on UI switching */
-
- short last_type; /* last event information, used for click */
- short last_val;
- double last_click_time; /* for double click */
+ short pad2[2];
struct wmEvent *eventstate; /* storage for event system */
@@ -345,40 +342,6 @@ typedef struct wmOperator {
/* wmOperator flag */
#define OP_GRAB_POINTER 1
-/* ************** wmEvent ************************ */
-/* for read-only rna access, dont save this */
-
-/* each event should have full modifier state */
-/* event comes from eventmanager and from keymap */
-typedef struct wmEvent {
- struct wmEvent *next, *prev;
-
- short type; /* event code itself (short, is also in keymap) */
- short val; /* press, release, scrollvalue */
- short x, y; /* mouse pointer position, screen coord */
- short mval[2]; /* region mouse position, name convention pre 2.5 :) */
- short prevx, prevy; /* previous mouse pointer position */
- short unicode; /* future, ghost? */
- char ascii; /* from ghost */
- char pad;
-
- /* modifier states */
- short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
- short keymodifier; /* rawkey modifier */
-
- short pad1;
-
- /* keymap item, set by handler (weak?) */
- const char *keymap_idname;
-
- /* custom data */
- short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */
- short customdatafree;
- int pad2;
- void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
-
-} wmEvent;
-
typedef enum wmRadialControlMode {
WM_RADIALCONTROL_SIZE,
WM_RADIALCONTROL_STRENGTH,
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 3d4899a0a51..ca6d8959d00 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -701,6 +701,8 @@ static void rna_def_event(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
RNA_def_struct_sdna(srna, "wmEvent");
+ RNA_define_verify_sdna(0); // not in sdna
+
/* strings */
prop= RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -764,6 +766,8 @@ static void rna_def_event(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "OS Key", "True when the Cmd key is held.");
+
+ RNA_define_verify_sdna(1); // not in sdna
}
static void rna_def_window(BlenderRNA *brna)
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 2a742b29d1c..318945918e7 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -288,6 +288,44 @@ typedef struct wmGesture {
/* customdata for lasso is short array */
} wmGesture;
+/* ************** wmEvent ************************ */
+
+/* each event should have full modifier state */
+/* event comes from eventmanager and from keymap */
+typedef struct wmEvent {
+ struct wmEvent *next, *prev;
+
+ short type; /* event code itself (short, is also in keymap) */
+ short val; /* press, release, scrollvalue */
+ short x, y; /* mouse pointer position, screen coord */
+ short mval[2]; /* region mouse position, name convention pre 2.5 :) */
+ short unicode; /* future, ghost? */
+ char ascii; /* from ghost */
+ char pad;
+
+ /* previous state */
+ short prevtype;
+ short prevval;
+ short prevx, prevy;
+ double prevclicktime;
+
+ /* modifier states */
+ short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
+ short keymodifier; /* rawkey modifier */
+
+ short pad1;
+
+ /* keymap item, set by handler (weak?) */
+ const char *keymap_idname;
+
+ /* custom data */
+ short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */
+ short customdatafree;
+ int pad2;
+ void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
+
+} wmEvent;
+
/* ************** custom wmEvent data ************** */
typedef struct wmTabletData {
int Active; /* 0=EVT_TABLET_NONE, 1=EVT_TABLET_STYLUS, 2=EVT_TABLET_ERASER */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index ac4c2709688..435f3823fed 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1177,9 +1177,9 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
if (wm_action_not_handled(action) && event->val == KM_RELEASE) {
wmWindow *win = CTX_wm_window(C);
- if (win && win->last_type == event->type && win->last_val == KM_PRESS) {
+ if (win && win->eventstate->prevtype == event->type && win->eventstate->prevval == KM_PRESS) {
/* test for double click first */
- if ((PIL_check_seconds_timer() - win->last_click_time) * 1000 < U.dbl_click_time) {
+ if ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) {
event->val = KM_DBL_CLICK;
action |= wm_handlers_do(C, event, handlers);
}
@@ -1381,26 +1381,26 @@ void wm_event_do_handlers(bContext *C)
/* mousemove and timer events don't overwrite last type */
if (event->type != MOUSEMOVE && !ISTIMER(event->type)) {
if (wm_action_not_handled(action)) {
- if (win->last_type == event->type) {
+ if (win->eventstate->prevtype == 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();
+ if (win->eventstate->prevval == KM_PRESS && event->val == KM_RELEASE) {
+ win->eventstate->prevclicktime = PIL_check_seconds_timer();
}
} else {
/* reset click time if event type not the same */
- win->last_click_time = 0;
+ win->eventstate->prevclicktime = 0;
}
- win->last_val = event->val;
- win->last_type = event->type;
+ win->eventstate->prevval = event->val;
+ win->eventstate->prevtype = event->type;
} else if (event->val == KM_CLICK) { /* keep click for double click later */
- win->last_type = event->type;
- win->last_val = event->val;
- win->last_click_time = PIL_check_seconds_timer();
+ win->eventstate->prevtype = event->type;
+ win->eventstate->prevval = event->val;
+ win->eventstate->prevclicktime = PIL_check_seconds_timer();
} else { /* reset if not */
- win->last_type = -1;
- win->last_val = 0;
- win->last_click_time = 0;
+ win->eventstate->prevtype = -1;
+ win->eventstate->prevval = 0;
+ win->eventstate->prevclicktime = 0;
}
}