summaryrefslogtreecommitdiff
path: root/src/lib/elput/elput_logind.c
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-05-09 11:35:48 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-05-09 11:35:48 -0400
commitf9149c1699515c060d004225c6a2c5653cebe322 (patch)
treed334079803dda24320ac438e07ee4859a3cb37e3 /src/lib/elput/elput_logind.c
parenta96266c42272bd6b8d3a27d7fdd7575199772c85 (diff)
elput: Add API function to switch to a given vt
This patch adds a new API function to Elput that can be used to switch to a given VT. This allows drm2 or enlightenment to switch to a given virtual terminal in response to keybindings. @feature Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/elput/elput_logind.c')
-rw-r--r--src/lib/elput/elput_logind.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/lib/elput/elput_logind.c b/src/lib/elput/elput_logind.c
index 123861a5ff..394fca5465 100644
--- a/src/lib/elput/elput_logind.c
+++ b/src/lib/elput/elput_logind.c
@@ -574,12 +574,62 @@ _logind_close(Elput_Manager *em, int fd)
574 _logind_device_release(em, major(st.st_rdev), minor(st.st_rdev)); 574 _logind_device_release(em, major(st.st_rdev), minor(st.st_rdev));
575} 575}
576 576
577static Eina_Bool
578_logind_vt_set(Elput_Manager *em, int vt)
579{
580 Eldbus_Object *obj;
581 Eldbus_Proxy *proxy;
582 Eldbus_Message *msg;
583 char self[PATH_MAX];
584
585 snprintf(self, sizeof(self), "/org/freedesktop/login1/seat/self");
586
587 obj = eldbus_object_get(em->dbus.conn, "org.freedesktop.login1", self);
588 if (!obj)
589 {
590 ERR("Could not get dbus object");
591 goto obj_err;
592 }
593
594 proxy = eldbus_proxy_get(obj, "org.freedesktop.login1.Seat");
595 if (!proxy)
596 {
597 ERR("Could not get dbus proxy");
598 goto proxy_err;
599 }
600
601 msg = eldbus_proxy_method_call_new(proxy, "SwitchTo");
602 if (!msg)
603 {
604 ERR("Could not create method call for proxy");
605 goto msg_err;
606 }
607
608 eldbus_message_arguments_append(msg, "u", &vt);
609
610 eldbus_proxy_send(proxy, msg, NULL, NULL, -1);
611
612 eldbus_message_unref(msg);
613 eldbus_proxy_unref(proxy);
614 eldbus_object_unref(obj);
615
616 return EINA_TRUE;
617
618msg_err:
619 eldbus_proxy_unref(proxy);
620proxy_err:
621 eldbus_object_unref(obj);
622obj_err:
623 return EINA_FALSE;
624}
625
577Elput_Interface _logind_interface = 626Elput_Interface _logind_interface =
578{ 627{
579 _logind_connect, 628 _logind_connect,
580 _logind_disconnect, 629 _logind_disconnect,
581 _logind_open, 630 _logind_open,
582 _logind_close, 631 _logind_close,
632 _logind_vt_set,
583}; 633};
584 634
585#endif 635#endif