summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-05-09 11:01:30 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-05-09 11:01:30 -0400
commit3de066469ae76c22e50e9f78b03f1841d81cd7cc (patch)
treede812f28a53f7cadaff7797fd1923d94d9e30b79 /src/lib
parent9ed2f42c08c5adffbd4c13043923a1d5683d0bf1 (diff)
elput: Support sending of session activate/deactivate event
This patch adds support for notifying when a session gets activated or deactivated. This will be used in drm2 to notify compositor when to pause/restart rendering during a vt switch @feature Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elput/Elput.h8
-rw-r--r--src/lib/elput/elput.c3
-rw-r--r--src/lib/elput/elput_logind.c37
3 files changed, 39 insertions, 9 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index f3fe16b127..95adfce052 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -91,11 +91,19 @@ typedef struct _Elput_Event_Device_Change
91 Elput_Device_Change_Type type; 91 Elput_Device_Change_Type type;
92} Elput_Event_Device_Change; 92} Elput_Event_Device_Change;
93 93
94/* structure to represent session active changes */
95typedef struct _Elput_Event_Session_Active
96{
97 const char *session;
98 Eina_Bool active : 1;
99} Elput_Event_Session_Active;
100
94EAPI extern int ELPUT_EVENT_SEAT_CAPS; 101EAPI extern int ELPUT_EVENT_SEAT_CAPS;
95EAPI extern int ELPUT_EVENT_SEAT_FRAME; 102EAPI extern int ELPUT_EVENT_SEAT_FRAME;
96EAPI extern int ELPUT_EVENT_KEYMAP_SEND; 103EAPI extern int ELPUT_EVENT_KEYMAP_SEND;
97EAPI extern int ELPUT_EVENT_MODIFIERS_SEND; 104EAPI extern int ELPUT_EVENT_MODIFIERS_SEND;
98EAPI extern int ELPUT_EVENT_DEVICE_CHANGE; 105EAPI extern int ELPUT_EVENT_DEVICE_CHANGE;
106EAPI extern int ELPUT_EVENT_SESSION_ACTIVE;
99 107
100/** 108/**
101 * @file 109 * @file
diff --git a/src/lib/elput/elput.c b/src/lib/elput/elput.c
index 2e54b3ec28..95d7a1e6c4 100644
--- a/src/lib/elput/elput.c
+++ b/src/lib/elput/elput.c
@@ -11,6 +11,7 @@ EAPI int ELPUT_EVENT_SEAT_FRAME = -1;
11EAPI int ELPUT_EVENT_KEYMAP_SEND = -1; 11EAPI int ELPUT_EVENT_KEYMAP_SEND = -1;
12EAPI int ELPUT_EVENT_MODIFIERS_SEND = -1; 12EAPI int ELPUT_EVENT_MODIFIERS_SEND = -1;
13EAPI int ELPUT_EVENT_DEVICE_CHANGE = -1; 13EAPI int ELPUT_EVENT_DEVICE_CHANGE = -1;
14EAPI int ELPUT_EVENT_SESSION_ACTIVE = -1;
14 15
15EAPI int 16EAPI int
16elput_init(void) 17elput_init(void)
@@ -34,6 +35,7 @@ elput_init(void)
34 ELPUT_EVENT_KEYMAP_SEND = ecore_event_type_new(); 35 ELPUT_EVENT_KEYMAP_SEND = ecore_event_type_new();
35 ELPUT_EVENT_MODIFIERS_SEND = ecore_event_type_new(); 36 ELPUT_EVENT_MODIFIERS_SEND = ecore_event_type_new();
36 ELPUT_EVENT_DEVICE_CHANGE = ecore_event_type_new(); 37 ELPUT_EVENT_DEVICE_CHANGE = ecore_event_type_new();
38 ELPUT_EVENT_SESSION_ACTIVE = ecore_event_type_new();
37 39
38 return _elput_init_count; 40 return _elput_init_count;
39 41
@@ -60,6 +62,7 @@ elput_shutdown(void)
60 ELPUT_EVENT_KEYMAP_SEND = -1; 62 ELPUT_EVENT_KEYMAP_SEND = -1;
61 ELPUT_EVENT_MODIFIERS_SEND = -1; 63 ELPUT_EVENT_MODIFIERS_SEND = -1;
62 ELPUT_EVENT_DEVICE_CHANGE = -1; 64 ELPUT_EVENT_DEVICE_CHANGE = -1;
65 ELPUT_EVENT_SESSION_ACTIVE = -1;
63 66
64 eina_log_domain_unregister(_elput_log_dom); 67 eina_log_domain_unregister(_elput_log_dom);
65 _elput_log_dom = -1; 68 _elput_log_dom = -1;
diff --git a/src/lib/elput/elput_logind.c b/src/lib/elput/elput_logind.c
index 0f32b2539a..aedcd790d8 100644
--- a/src/lib/elput/elput_logind.c
+++ b/src/lib/elput/elput_logind.c
@@ -3,6 +3,31 @@
3#ifdef HAVE_SYSTEMD 3#ifdef HAVE_SYSTEMD
4 4
5static void 5static void
6_logind_session_active_cb_free(void *data EINA_UNUSED, void *event)
7{
8 Elput_Event_Session_Active *ev;
9
10 ev = event;
11 eina_stringshare_del(ev->session);
12 free(ev);
13}
14
15static void
16_logind_session_active_send(Elput_Manager *em, Eina_Bool active)
17{
18 Elput_Event_Session_Active *ev;
19
20 ev = calloc(1, sizeof(Elput_Event_Session_Active));
21 if (!ev) return;
22
23 ev->session = eina_stringshare_add(em->sid);
24 ev->active = active;
25
26 ecore_event_add(ELPUT_EVENT_SESSION_ACTIVE, ev,
27 _logind_session_active_cb_free, NULL);
28}
29
30static void
6_logind_device_pause_complete(Elput_Manager *em, uint32_t major, uint32_t minor) 31_logind_device_pause_complete(Elput_Manager *em, uint32_t major, uint32_t minor)
7{ 32{
8 Eldbus_Proxy *proxy; 33 Eldbus_Proxy *proxy;
@@ -79,9 +104,7 @@ _cb_device_paused(void *data, const Eldbus_Message *msg)
79 _logind_device_pause_complete(em, maj, min); 104 _logind_device_pause_complete(em, maj, min);
80 105
81 if ((em->sync) && (maj == 226)) // DRM_MAJOR 106 if ((em->sync) && (maj == 226)) // DRM_MAJOR
82 { 107 _logind_session_active_send(em, EINA_FALSE);
83 /* TODO: _ecore_drm2_launcher_activate_send(em, EINA_FALSE); */
84 }
85 } 108 }
86} 109}
87 110
@@ -103,9 +126,7 @@ _cb_device_resumed(void *data, const Eldbus_Message *msg)
103 if (eldbus_message_arguments_get(msg, "u", &maj)) 126 if (eldbus_message_arguments_get(msg, "u", &maj))
104 { 127 {
105 if ((em->sync) && (maj == 226)) // DRM_MAJOR 128 if ((em->sync) && (maj == 226)) // DRM_MAJOR
106 { 129 _logind_session_active_send(em, EINA_TRUE);
107 /* TODO: _ecore_drm2_launcher_activate_send(em, EINA_TRUE); */
108 }
109 } 130 }
110} 131}
111 132
@@ -125,9 +146,7 @@ _cb_property_changed(void *data, Eldbus_Proxy *proxy EINA_UNUSED, void *event)
125 { 146 {
126 eina_value_get(ev->value, &active); 147 eina_value_get(ev->value, &active);
127 if ((!em->sync) || (!active)) 148 if ((!em->sync) || (!active))
128 { 149 _logind_session_active_send(em, active);
129 /* TODO: _ecore_drm2_launcher_activate_send(em, active); */
130 }
131 } 150 }
132} 151}
133 152