Mercurial > mplayer.hg
changeset 34339:f05c75392897
Enable gui slave commands.
Allow sending the GUI skin messages which enables operating the GUI
with a remote control.
Only messages defined in current skin window will be executed, i.e.
only messages that could result from mouse clicks as well.
author | ib |
---|---|
date | Sun, 11 Dec 2011 14:43:16 +0000 |
parents | 4a507d3a039a |
children | ce8b1d7d54fe |
files | Changelog DOCS/tech/slave.txt command.c gui/app.c gui/app.h gui/interface.c gui/interface.h gui/win32/interface.c input/input.c input/input.h mplayer.c |
diffstat | 11 files changed, 59 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Changelog Sat Dec 10 20:55:31 2011 +0000 +++ b/Changelog Sun Dec 11 14:43:16 2011 +0000 @@ -20,6 +20,9 @@ * experimental af_cmdline slave command to change e.g. audio equalizer options at runtime. * vo x11: don't hide or show cursor any more if attached to an existing window (-wid) + GUI: + * all skin messages available as slave commands (gui <message>) + Ports: * Wine (see DOCS/tech/crosscompile.txt)
--- a/DOCS/tech/slave.txt Sat Dec 10 20:55:31 2011 +0000 +++ b/DOCS/tech/slave.txt Sun Dec 11 14:43:16 2011 +0000 @@ -181,6 +181,10 @@ get_video_resolution Print out the video resolution of the current file. +gui <message> + Send GUI skin message <message>. (See the skin documentation on GUI + messages for details.) + screenshot <value> Take a screenshot. Requires the screenshot filter to be loaded. 0 Take a single screenshot.
--- a/command.c Sat Dec 10 20:55:31 2011 +0000 +++ b/command.c Sun Dec 11 14:43:16 2011 +0000 @@ -3511,6 +3511,11 @@ break; default: +#ifdef CONFIG_GUI + if (use_gui && cmd->id == MP_CMD_GUI) + gui(GUI_RUN_MESSAGE, cmd->args[0].v.s); + else +#endif mp_msg(MSGT_CPLAYER, MSGL_V, "Received unknown cmd %s\n", cmd->name); }
--- a/gui/app.c Sat Dec 10 20:55:31 2011 +0000 +++ b/gui/app.c Sun Dec 11 14:43:16 2011 +0000 @@ -148,6 +148,33 @@ } /** + * @brief Find the item belonging to an event. + * + * @param event event + * + * @return pointer to the item (ok) or NULL (not found) + */ +wItem *appFindItem(int event) +{ + wItem *item; + int i, n; + + if (guiApp.subWindow.isFullScreen && guiApp.playbarIsPresent) { + item = guiApp.playbarItems; + n = guiApp.IndexOfPlaybarItems; + } else { + item = guiApp.mainItems; + n = guiApp.IndexOfMainItems; + } + + for (i = 0; i <= n; i++) + if (item[i].message == event) + return item; + + return NULL; +} + +/** * @brief Modify the state (i.e. set a new value) to the item belonging to an event. * * @param event event
--- a/gui/app.h Sat Dec 10 20:55:31 2011 +0000 +++ b/gui/app.h Sun Dec 11 14:43:16 2011 +0000 @@ -175,6 +175,7 @@ extern guiItems guiApp; +wItem *appFindItem(int event); int appFindMessage(const char *name); void appFreeStruct(void); void btnModify(int event, float state);
--- a/gui/interface.c Sat Dec 10 20:55:31 2011 +0000 +++ b/gui/interface.c Sun Dec 11 14:43:16 2011 +0000 @@ -323,7 +323,7 @@ dvd_priv_t *dvd; #endif plItem *next; - int state; + int msg, state; if (guiInfo.mpcontext) mixer = mpctx_get_mixer(guiInfo.mpcontext); @@ -382,6 +382,13 @@ break; + case GUI_RUN_MESSAGE: + mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_MESSAGE: %s\n", (const char *)data); + msg = appFindMessage((const char *)data); + if (appFindItem(msg)) + uiEventHandling(msg, 0); + break; + case GUI_PREPARE: wsVisibleMouse(&guiApp.subWindow, wsHideMouseCursor);
--- a/gui/interface.h Sat Dec 10 20:55:31 2011 +0000 +++ b/gui/interface.h Sun Dec 11 14:43:16 2011 +0000 @@ -45,6 +45,7 @@ GUI_PREPARE, GUI_REDRAW, GUI_RUN_COMMAND, + GUI_RUN_MESSAGE, GUI_SETUP_VIDEO_WINDOW, GUI_SET_AFILTER, GUI_SET_AUDIO,
--- a/gui/win32/interface.c Sat Dec 10 20:55:31 2011 +0000 +++ b/gui/win32/interface.c Sun Dec 11 14:43:16 2011 +0000 @@ -657,6 +657,8 @@ } break; } + case GUI_RUN_MESSAGE: + break; case GUI_HANDLE_EVENTS: break; case GUI_SET_MIXER:
--- a/input/input.c Sat Dec 10 20:55:31 2011 +0000 +++ b/input/input.c Sun Dec 11 14:43:16 2011 +0000 @@ -208,6 +208,8 @@ { MP_CMD_AF_CLR, "af_clr", 0, { {-1,{0}} } }, { MP_CMD_AF_CMDLINE, "af_cmdline", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, + { MP_CMD_GUI, "gui", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, + { 0, NULL, 0, {} } };
--- a/input/input.h Sat Dec 10 20:55:31 2011 +0000 +++ b/input/input.h Sun Dec 11 14:43:16 2011 +0000 @@ -162,6 +162,9 @@ MP_CMD_AF_CLR, MP_CMD_AF_CMDLINE, + /// GUI command + MP_CMD_GUI, + } mp_command_type; // The arg types
--- a/mplayer.c Sat Dec 10 20:55:31 2011 +0000 +++ b/mplayer.c Sun Dec 11 14:43:16 2011 +0000 @@ -3058,6 +3058,9 @@ gui(GUI_HANDLE_EVENTS, 0); gui(GUI_REDRAW, 0); if ((cmd = mp_input_get_cmd(0, 0, 0)) != NULL) { + if (cmd->id == MP_CMD_GUI) + gui(GUI_RUN_MESSAGE, cmd->args[0].v.s); + else gui(GUI_RUN_COMMAND, (void *)cmd->id); mp_cmd_free(cmd); }