From 6c364655aade125f055fabf7677d01204e28d6d1 Mon Sep 17 00:00:00 2001 From: Janos Kovacs Date: Sun, 17 Aug 2014 22:46:21 +0300 Subject: [PATCH] system-controller: onscreen support Change-Id: I5238521c1d664ec5f625b3d88231e9f7e28a7922 --- packaging.in/murphy.lua | 66 ++++++++++++++++++---- .../system-controller/plugin-system-controller.c | 15 ++++- 2 files changed, 66 insertions(+), 15 deletions(-) diff --git a/packaging.in/murphy.lua b/packaging.in/murphy.lua index 031d868..5c77f10 100644 --- a/packaging.in/murphy.lua +++ b/packaging.in/murphy.lua @@ -391,7 +391,7 @@ if with_system_controller then return true end, update = function(self) - send_night_mode_to_home_screen() + send_night_mode_to(homescreen) end } end @@ -553,7 +553,7 @@ sink.lua { end -- tell homescreen that driving mode was updated - send_driving_mode_to_home_screen() + send_driving_mode_to(homescreen) regulateApplications(ft(mdb.select.entertainment_applications), data) regulateApplications(ft(mdb.select.undefined_applications), data) @@ -1117,7 +1117,7 @@ wmgr = window_manager { end local arg = m:JSON({ surface = win.surface, - winname = win.name, + winname = win.name }) local command = 0 @@ -1192,7 +1192,7 @@ wmgr = window_manager { if verbose > 0 then print("### <== sending " .. command_name(msg.command) .. - " window message to '" .. win.name .. "'") + " window message to '" .. homescreen .. "'") if verbose > 1 then print(msg) end @@ -1224,6 +1224,35 @@ wmgr = window_manager { special_screen_sets[win.surface] = true end end + + if onscreen and win.appid == onscreen then + local resmsg = m:JSON({ + command = 0x40006, -- window_id_res + appid = win.appid, + pid = win.pid, + res = m:JSON({ + window = m:JSON({ + ECU = "", + display = "", + layer = "", + layout = "", + area = "", + dispatchApp = "", + role = win.name, + resourceId = win.surface + }) + }) + }) + if verbose > 0 then + print("### <== sending " .. + command_name(resmsg.command) .. + " message to '" .. onscreen .. "'") + if verbose > 1 then + print(resmsg) + end + end + sc:send_message(onscreen, resmsg); + end elseif oper == 2 then -- destroy resclnt:resource_set_destroy("screen", win.surface) special_screen_sets[win.surface] = nil @@ -1509,11 +1538,15 @@ if sc then print('Setting homescreen='..appid) homescreen = appid if command and command == 1 then - send_driving_mode_to_home_screen() - send_night_mode_to_home_screen() + send_driving_mode_to(homescreen) + send_night_mode_to(homescreen) end elseif appid == "org.tizen.ico.onscreen" then onscreen = appid + if command and command == 1 then + send_driving_mode_to(onscreen) + send_night_mode_to(onscreen) + end end if not connected and appid == "org.tizen.ico.homescreen" then @@ -2042,10 +2075,19 @@ if sc then end end end + + sc.notify_handler = function (self, cid, msg) + if verbose > 0 then + print('### notify handler: ' .. command_name(msg.command)) + if verbose > 1 then + print(msg) + end + end + end end -function send_driving_mode_to_home_screen() - if homescreen == "" then +function send_driving_mode_to(client) + if client == "" then return end @@ -2066,11 +2108,11 @@ function send_driving_mode_to_home_screen() end end - sc:send_message(homescreen, reply) + sc:send_message(client, reply) end -function send_night_mode_to_home_screen() - if homescreen == "" then +function send_night_mode_to(client) + if client == "" then return end @@ -2091,7 +2133,7 @@ function send_night_mode_to_home_screen() end end - sc:send_message(homescreen, reply) + sc:send_message(client, reply) end -- we should have 'audio_playback' defined by now diff --git a/src/plugins/system-controller/plugin-system-controller.c b/src/plugins/system-controller/plugin-system-controller.c index 3012ccb..be85ca7 100644 --- a/src/plugins/system-controller/plugin-system-controller.c +++ b/src/plugins/system-controller/plugin-system-controller.c @@ -89,6 +89,7 @@ typedef struct { mrp_funcbridge_t *user; mrp_funcbridge_t *resource; mrp_funcbridge_t *inputdev; + mrp_funcbridge_t *notify; } handler; } sysctl_t; @@ -119,6 +120,7 @@ typedef enum { SYSCTL_IDX_USER, SYSCTL_IDX_RESOURCE, SYSCTL_IDX_INPUTDEV, + SYSCTL_IDX_NOTIFY } sysctl_lua_index_t; @@ -331,7 +333,8 @@ static int send_message(client_t *c, mrp_json_t *msg) s = mrp_json_object_to_string(msg); - mrp_debug("sending system controller message to client #%d:", c->id); + mrp_debug("sending system controller message to client #%d (%s):", + c->id, c->app ? c->app : ""); mrp_debug(" %s", s); return mrp_transport_sendcustom(c->t, msg); @@ -414,7 +417,8 @@ static void recv_evt(mrp_transport_t *t, void *data, void *user_data) [2] = sc->handler.input, [3] = sc->handler.user, [4] = sc->handler.resource, - [5] = sc->handler.inputdev + [5] = sc->handler.inputdev, + [6] = sc->handler.notify, }, *h; mrp_funcbridge_value_t args[4]; mrp_funcbridge_value_t ret; @@ -466,7 +470,7 @@ static void recv_evt(mrp_transport_t *t, void *data, void *user_data) else { type = (cmd & 0xffff0000) >> 16; - if (0 <= type && type <= 5) + if (0 <= type && type <= 6) h = handlers[type]; else h = NULL; @@ -580,6 +584,7 @@ static int name_to_index(const char *name) MAP("user_handler" , USER); MAP("resource_handler", RESOURCE); MAP("inputdev_handler", INPUTDEV); + MAP("notify_handler" , NOTIFY); return 0; #undef MAP } @@ -614,6 +619,9 @@ static int sysctl_lua_getfield(lua_State *L) case SYSCTL_IDX_INPUTDEV: mrp_funcbridge_push(L, scl->sc->handler.inputdev); break; + case SYSCTL_IDX_NOTIFY: + mrp_funcbridge_push(L, scl->sc->handler.notify); + break; default: lua_pushnil(L); } @@ -637,6 +645,7 @@ static int sysctl_lua_setfield(lua_State *L) case SYSCTL_IDX_USER: hptr = &scl->sc->handler.user; break; case SYSCTL_IDX_RESOURCE: hptr = &scl->sc->handler.resource; break; case SYSCTL_IDX_INPUTDEV: hptr = &scl->sc->handler.inputdev; break; + case SYSCTL_IDX_NOTIFY: hptr = &scl->sc->handler.notify; break; default: luaL_error(L, "unknown system-controller handler '%s'", name); } -- 2.7.4