summaryrefslogtreecommitdiffstats
path: root/src/ui_input.c
diff options
context:
space:
mode:
authorOlliver Schinagl <o.schinagl@ultimaker.com>2015-07-06 05:49:50 (GMT)
committerOlliver Schinagl <o.schinagl@ultimaker.com>2015-07-06 12:07:31 (GMT)
commit0ab6f4f9f4c2af88e4bbd10b0e11b1516577d319 (patch)
treebe0e67637b190e5c930f93a80a343f8e0d5c8b44 /src/ui_input.c
parentf217213dccab10e8af0953f48a7671855326c871 (diff)
downloadeulogium-master.zip
eulogium-master.tar.gz
eulogium-master.tar.bz2
archival commitHEADmaster
Diffstat (limited to 'src/ui_input.c')
-rw-r--r--src/ui_input.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ui_input.c b/src/ui_input.c
new file mode 100644
index 0000000..1de5e4e
--- /dev/null
+++ b/src/ui_input.c
@@ -0,0 +1,40 @@
+/*
+ * functions, callbacks and data types for user input
+ *
+ * Copyright (c) 2015 Ultimaker B.V.
+ * Author: Olliver Schinagl <o.schinagl@ultimaker.com>
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ */
+
+#include <Ecore.h>
+#include <Elementary.h>
+#include <Evas.h>
+
+#include "ui_input.h"
+
+int INPUT_MOUSE_WHEEL_UP = 0; /* For custom ecore_event handling */
+int INPUT_MOUSE_WHEEL_DOWN = 0; /* For custom ecore_event handling */
+
+/* Function to make the Z-axis of any wheel focus the next/previous focusable widget */
+void input_mouse_wheel_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Wheel *ev = event_info;
+ Ecore_Event *event = NULL;
+
+ if (ev->z > 0) {
+ elm_object_focus_next((Evas_Object *)data, ELM_FOCUS_NEXT);
+ event = ecore_event_add(INPUT_MOUSE_WHEEL_DOWN, NULL, NULL, NULL);
+ } else {
+ elm_object_focus_next((Evas_Object *)data, ELM_FOCUS_PREVIOUS);
+ event = ecore_event_add(INPUT_MOUSE_WHEEL_UP, NULL, NULL, NULL);
+ }
+ if (!event)
+ EINA_LOG_ERR("Wheel event failed to queue.");
+}
+
+void input_init()
+{
+ INPUT_MOUSE_WHEEL_UP = ecore_event_type_new();
+ INPUT_MOUSE_WHEEL_DOWN = ecore_event_type_new();
+}