[gtk+/wip/mir2] mir: properly converts mir nanoseconds timestamps to milliseconds
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/mir2] mir: properly converts mir nanoseconds timestamps to milliseconds
- Date: Tue, 2 Dec 2014 15:07:15 +0000 (UTC)
commit 73002dca915da3834c6ccf4af422f9fb443637de
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Dec 2 16:06:59 2014 +0100
mir: properly converts mir nanoseconds timestamps to milliseconds
gdk/mir/gdkmireventsource.c | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index a6042cc..a02adff 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -118,7 +118,7 @@ set_key_event_string (GdkEventKey *event)
}
static void
-generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint keyval, guint16 keycode,
gboolean is_modifier, guint64 time)
+generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint keyval, guint16 keycode,
gboolean is_modifier, guint32 event_time)
{
GdkEvent *event;
@@ -127,7 +127,7 @@ generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint key
event->key.keyval = keyval;
event->key.hardware_keycode = keycode + 8;
event->key.is_modifier = is_modifier;
- event->key.time = time;
+ event->key.time = event_time;
set_key_event_string (&event->key);
send_event (window, _gdk_mir_device_manager_get_keyboard (gdk_display_get_device_manager
(gdk_window_get_display (window))), event);
@@ -140,7 +140,7 @@ get_pointer (GdkWindow *window)
}
static void
-generate_button_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint button, guint
state, guint64 time)
+generate_button_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint button, guint
state, guint32 event_time)
{
GdkEvent *event;
@@ -149,13 +149,13 @@ generate_button_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble
event->button.y = y;
event->button.state = state;
event->button.button = button;
- event->button.time = time;
+ event->button.time = event_time;
send_event (window, get_pointer (window), event);
}
static void
-generate_scroll_event (GdkWindow *window, gdouble x, gdouble y, gdouble delta_x, gdouble delta_y, guint
state, guint64 time)
+generate_scroll_event (GdkWindow *window, gdouble x, gdouble y, gdouble delta_x, gdouble delta_y, guint
state, guint32 event_time)
{
GdkEvent *event;
@@ -166,13 +166,13 @@ generate_scroll_event (GdkWindow *window, gdouble x, gdouble y, gdouble delta_x,
event->scroll.direction = GDK_SCROLL_SMOOTH;
event->scroll.delta_x = -delta_x;
event->scroll.delta_y = -delta_y;
- event->scroll.time = time;
+ event->scroll.time = event_time;
send_event (window, get_pointer (window), event);
}
static void
-generate_motion_event (GdkWindow *window, gdouble x, gdouble y, guint state, guint64 time)
+generate_motion_event (GdkWindow *window, gdouble x, gdouble y, guint state, guint32 event_time)
{
GdkEvent *event;
@@ -181,13 +181,13 @@ generate_motion_event (GdkWindow *window, gdouble x, gdouble y, guint state, gui
event->motion.y = y;
event->motion.state = state;
event->motion.is_hint = FALSE;
- event->motion.time = time;
+ event->motion.time = event_time;
send_event (window, get_pointer (window), event);
}
static void
-generate_crossing_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint64 time)
+generate_crossing_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint32 event_time)
{
GdkEvent *event;
@@ -197,7 +197,7 @@ generate_crossing_event (GdkWindow *window, GdkEventType type, gdouble x, gdoubl
event->crossing.mode = GDK_CROSSING_NORMAL;
event->crossing.detail = GDK_NOTIFY_ANCESTOR;
event->crossing.focus = TRUE;
- event->crossing.time = time;
+ event->crossing.time = event_time;
send_event (window, get_pointer (window), event);
}
@@ -273,7 +273,7 @@ handle_key_event (GdkWindow *window, const MirKeyEvent *event)
event->key_code,
event->scan_code,
is_modifier,
- event->event_time / 1000);
+ event->event_time / 1000000);
break;
default:
//case mir_key_action_multiple:
@@ -290,7 +290,7 @@ handle_motion_event (GdkWindow *window, const MirMotionEvent *event)
gboolean cursor_inside;
MirMotionButton button_state;
guint modifier_state;
- guint64 time;
+ guint32 event_time;
GdkEventType event_type;
MirMotionButton changed_button_state;
@@ -301,14 +301,14 @@ handle_motion_event (GdkWindow *window, const MirMotionEvent *event)
y = event->pointer_coordinates[0].y;
}
modifier_state = get_modifier_state (event->modifiers, event->button_state);
- time = event->event_time / 1000;
+ event_time = event->event_time / 1000000;
/* The Mir events generate hover-exits even while inside the window so
counteract this by always generating an enter notify on all other events */
if (!cursor_inside && event->action != mir_motion_action_hover_exit)
{
cursor_inside = TRUE;
- generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, time);
+ generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time);
}
/* Update which window has focus */
@@ -320,23 +320,23 @@ handle_motion_event (GdkWindow *window, const MirMotionEvent *event)
event_type = event->action == mir_motion_action_down ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
changed_button_state = button_state ^ event->button_state;
if (changed_button_state == 0 || (changed_button_state & mir_motion_button_primary) != 0)
- generate_button_event (window, event_type, x, y, GDK_BUTTON_PRIMARY, modifier_state, time);
+ generate_button_event (window, event_type, x, y, GDK_BUTTON_PRIMARY, modifier_state, event_time);
if ((changed_button_state & mir_motion_button_secondary) != 0)
- generate_button_event (window, event_type, x, y, GDK_BUTTON_SECONDARY, modifier_state, time);
+ generate_button_event (window, event_type, x, y, GDK_BUTTON_SECONDARY, modifier_state, event_time);
if ((changed_button_state & mir_motion_button_tertiary) != 0)
- generate_button_event (window, event_type, x, y, GDK_BUTTON_MIDDLE, modifier_state, time);
+ generate_button_event (window, event_type, x, y, GDK_BUTTON_MIDDLE, modifier_state, event_time);
button_state = event->button_state;
break;
case mir_motion_action_scroll:
- generate_scroll_event (window, x, y, event->pointer_coordinates[0].hscroll,
event->pointer_coordinates[0].vscroll, modifier_state, time);
+ generate_scroll_event (window, x, y, event->pointer_coordinates[0].hscroll,
event->pointer_coordinates[0].vscroll, modifier_state, event_time);
break;
case mir_motion_action_move: // move with button
case mir_motion_action_hover_move: // move without button
- generate_motion_event (window, x, y, modifier_state, time);
+ generate_motion_event (window, x, y, modifier_state, event_time);
break;
case mir_motion_action_hover_exit:
cursor_inside = FALSE;
- generate_crossing_event (window, GDK_LEAVE_NOTIFY, x, y, time);
+ generate_crossing_event (window, GDK_LEAVE_NOTIFY, x, y, event_time);
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]