2008-12-13 19:28:00 +01:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-22 10:09:46 +01:00
|
|
|
#ifndef MPLAYER_INPUT_H
|
|
|
|
#define MPLAYER_INPUT_H
|
2008-01-01 22:35:58 +01:00
|
|
|
|
2012-03-21 01:23:35 +01:00
|
|
|
#include <stdbool.h>
|
2013-12-17 02:39:45 +01:00
|
|
|
#include "bstr/bstr.h"
|
2012-03-21 01:23:35 +01:00
|
|
|
|
2013-12-26 17:10:35 +01:00
|
|
|
#include "cmd_list.h"
|
|
|
|
#include "cmd_parse.h"
|
2002-03-19 14:29:28 +01:00
|
|
|
|
|
|
|
// Error codes for the drivers
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2003-12-24 23:00:51 +01:00
|
|
|
// An error occurred but we can continue
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_INPUT_ERROR -1
|
2003-12-24 23:00:51 +01:00
|
|
|
// A fatal error occurred, this driver should be removed
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_INPUT_DEAD -2
|
2003-09-14 19:52:59 +02:00
|
|
|
// No input was available
|
2002-01-30 13:46:03 +01:00
|
|
|
#define MP_INPUT_NOTHING -3
|
2005-06-27 10:16:23 +02:00
|
|
|
//! Input will be available if you try again
|
|
|
|
#define MP_INPUT_RETRY -4
|
2011-05-01 14:57:39 +02:00
|
|
|
// Key FIFO was full - release events may be lost, zero button-down status
|
|
|
|
#define MP_INPUT_RELEASE_ALL -5
|
|
|
|
|
2013-12-15 23:35:36 +01:00
|
|
|
enum mp_cmd_flags {
|
2012-09-25 03:24:38 +02:00
|
|
|
MP_ON_OSD_NO = 0, // prefer not using OSD
|
|
|
|
MP_ON_OSD_AUTO = 1, // use default behavior of the specific command
|
|
|
|
MP_ON_OSD_BAR = 2, // force a bar, if applicable
|
|
|
|
MP_ON_OSD_MSG = 4, // force a message, if applicable
|
2013-12-15 23:35:36 +01:00
|
|
|
MP_EXPAND_PROPERTIES = 8, // expand strings as properties
|
|
|
|
MP_PAUSING = 16, // pause after running command
|
|
|
|
MP_PAUSING_TOGGLE = 32, // toggle pause after running command
|
|
|
|
|
|
|
|
MP_ON_OSD_FLAGS = MP_ON_OSD_NO | MP_ON_OSD_AUTO |
|
|
|
|
MP_ON_OSD_BAR | MP_ON_OSD_MSG,
|
|
|
|
MP_PAUSING_FLAGS = MP_PAUSING | MP_PAUSING_TOGGLE,
|
2012-09-09 02:08:08 +02:00
|
|
|
};
|
|
|
|
|
2012-08-24 13:29:28 +02:00
|
|
|
enum mp_input_section_flags {
|
input: handle mouse movement differently
Before this commit, mouse movement events emitted a special command
("set_mouse_pos"), which was specially handled in command.c. This was
once special-cased to the dvdnav and menu code, and did nothing after
libmenu and dvdnav were removed.
Change it so that mouse movement triggers a pseudo-key ("MOUSE_MOVE"),
which then can be bound to an arbitrary command. The mouse position is
now managed in input.c. A command which actually needs the mouse
position can use either mp_input_get_mouse_pos() or mp_get_osd_mouse_pos()
to query it. The former returns raw window-space coordinates, while the
latter returns coordinates transformed to OSD- space. (Both are the same
for most VOs, except vo_xv and vo_x11, which can't render OSD in
window-space. These require extra code for mapping mouse position.)
As of this commit, there is still nothing that uses mouse movement, so
MOUSE_MOVE is mapped to "ignore" to silence warnings when moving the
mouse (much like MOUSE_BTN0).
Extend the concept of input sections. Allow multiple sections to be
active at once, and organize them as stack. Bindings from the top of
the stack are preferred to lower ones.
Each section has a mouse input section associated, inside which mouse
events are associated with the bindings. If the mouse pointer is
outside of a section's mouse area, mouse events will be dispatched to
an input section lower on the stack of active sections. This is intended
for scripting, which is to be added later. Two scripts could occupy
different areas of the screen without conflicting with each other. (If
it turns out that this mechanism is useless, we'll just remove it
again.)
2013-04-26 02:13:30 +02:00
|
|
|
// If a key binding is not defined in the current section, do not search the
|
|
|
|
// other sections for it (like the default section). Instead, an unbound
|
|
|
|
// key warning will be printed.
|
|
|
|
MP_INPUT_EXCLUSIVE = 1,
|
2014-02-19 15:40:04 +01:00
|
|
|
// Prefer it to other sections.
|
|
|
|
MP_INPUT_ON_TOP = 2,
|
2013-08-31 21:59:37 +02:00
|
|
|
// Let mp_input_test_dragging() return true, even if inside the mouse area.
|
2014-02-19 15:40:04 +01:00
|
|
|
MP_INPUT_ALLOW_VO_DRAGGING = 4,
|
input: don't deliver mouse events if mouse area is not set
This caused the OSC to be always visible at startup on X11:
- EnterNotify event send a mouse event to input.c
- OSC has not completely initialized yet, and no mouse area is set
- mouse event is dispatched to "showhide" OSC section
- OSC becomes visible, regardless of mouse position
Fix this by treating the mouse area as empty if it's not set, instead of
infinite as it was before this commit. This means an input section must
set a mouse area to receive mouse events at all. We also have to change
the default section to receive mouse events with the new behavior.
Also, if MOUSE_MOVE is unmapped (or mapped to something that doesn't
parse), and produces no command, the mouse position wouldn't be updated
(because the mouse position is bound to input commands), so we have to
generate a dummy command in this case.
(This matters only for the OSC, On Screen Controller, which isn't merged
yet, so these changes shouldn't have much effect right now.)
2013-09-05 23:58:51 +02:00
|
|
|
// Don't force mouse pointer visible, even if inside the mouse area.
|
2014-02-19 15:40:04 +01:00
|
|
|
MP_INPUT_ALLOW_HIDE_CURSOR = 8,
|
2012-08-24 13:29:28 +02:00
|
|
|
};
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2008-04-30 06:15:52 +02:00
|
|
|
struct input_ctx;
|
2013-12-20 18:01:04 +01:00
|
|
|
struct mp_log;
|
2008-04-30 06:15:52 +02:00
|
|
|
|
2011-07-16 17:17:48 +02:00
|
|
|
struct mp_cmd_arg {
|
2013-11-28 19:04:16 +01:00
|
|
|
const struct m_option *type;
|
2011-07-16 17:17:48 +02:00
|
|
|
union {
|
|
|
|
int i;
|
|
|
|
float f;
|
2013-02-24 21:16:23 +01:00
|
|
|
double d;
|
2011-07-16 17:17:48 +02:00
|
|
|
char *s;
|
2014-02-22 07:28:05 +01:00
|
|
|
char **str_list;
|
2013-07-08 19:27:45 +02:00
|
|
|
void *p;
|
2011-07-16 17:17:48 +02:00
|
|
|
} v;
|
|
|
|
};
|
2002-01-30 13:46:03 +01:00
|
|
|
|
|
|
|
typedef struct mp_cmd {
|
2011-07-16 16:47:02 +02:00
|
|
|
int id;
|
|
|
|
char *name;
|
2011-07-16 17:17:48 +02:00
|
|
|
struct mp_cmd_arg args[MP_CMD_MAX_ARGS];
|
2012-03-21 01:23:35 +01:00
|
|
|
int nargs;
|
2013-12-15 23:35:36 +01:00
|
|
|
int flags; // mp_cmd_flags bitfield
|
2012-10-13 21:10:20 +02:00
|
|
|
bstr original;
|
2013-06-19 18:19:45 +02:00
|
|
|
char *input_section;
|
input: handle mouse movement differently
Before this commit, mouse movement events emitted a special command
("set_mouse_pos"), which was specially handled in command.c. This was
once special-cased to the dvdnav and menu code, and did nothing after
libmenu and dvdnav were removed.
Change it so that mouse movement triggers a pseudo-key ("MOUSE_MOVE"),
which then can be bound to an arbitrary command. The mouse position is
now managed in input.c. A command which actually needs the mouse
position can use either mp_input_get_mouse_pos() or mp_get_osd_mouse_pos()
to query it. The former returns raw window-space coordinates, while the
latter returns coordinates transformed to OSD- space. (Both are the same
for most VOs, except vo_xv and vo_x11, which can't render OSD in
window-space. These require extra code for mapping mouse position.)
As of this commit, there is still nothing that uses mouse movement, so
MOUSE_MOVE is mapped to "ignore" to silence warnings when moving the
mouse (much like MOUSE_BTN0).
Extend the concept of input sections. Allow multiple sections to be
active at once, and organize them as stack. Bindings from the top of
the stack are preferred to lower ones.
Each section has a mouse input section associated, inside which mouse
events are associated with the bindings. If the mouse pointer is
outside of a section's mouse area, mouse events will be dispatched to
an input section lower on the stack of active sections. This is intended
for scripting, which is to be added later. Two scripts could occupy
different areas of the screen without conflicting with each other. (If
it turns out that this mechanism is useless, we'll just remove it
again.)
2013-04-26 02:13:30 +02:00
|
|
|
bool key_up_follows;
|
2013-10-28 00:33:52 +01:00
|
|
|
bool repeated;
|
input: handle mouse movement differently
Before this commit, mouse movement events emitted a special command
("set_mouse_pos"), which was specially handled in command.c. This was
once special-cased to the dvdnav and menu code, and did nothing after
libmenu and dvdnav were removed.
Change it so that mouse movement triggers a pseudo-key ("MOUSE_MOVE"),
which then can be bound to an arbitrary command. The mouse position is
now managed in input.c. A command which actually needs the mouse
position can use either mp_input_get_mouse_pos() or mp_get_osd_mouse_pos()
to query it. The former returns raw window-space coordinates, while the
latter returns coordinates transformed to OSD- space. (Both are the same
for most VOs, except vo_xv and vo_x11, which can't render OSD in
window-space. These require extra code for mapping mouse position.)
As of this commit, there is still nothing that uses mouse movement, so
MOUSE_MOVE is mapped to "ignore" to silence warnings when moving the
mouse (much like MOUSE_BTN0).
Extend the concept of input sections. Allow multiple sections to be
active at once, and organize them as stack. Bindings from the top of
the stack are preferred to lower ones.
Each section has a mouse input section associated, inside which mouse
events are associated with the bindings. If the mouse pointer is
outside of a section's mouse area, mouse events will be dispatched to
an input section lower on the stack of active sections. This is intended
for scripting, which is to be added later. Two scripts could occupy
different areas of the screen without conflicting with each other. (If
it turns out that this mechanism is useless, we'll just remove it
again.)
2013-04-26 02:13:30 +02:00
|
|
|
bool mouse_move;
|
|
|
|
int mouse_x, mouse_y;
|
2011-07-17 03:47:50 +02:00
|
|
|
struct mp_cmd *queue_next;
|
2013-11-06 00:05:12 +01:00
|
|
|
double scale; // for scaling numeric arguments
|
2013-11-28 19:04:16 +01:00
|
|
|
const struct mp_cmd_def *def;
|
2002-01-30 13:46:03 +01:00
|
|
|
} mp_cmd_t;
|
|
|
|
|
2011-07-16 16:47:02 +02:00
|
|
|
/* Add a new command input source.
|
2013-12-21 19:33:45 +01:00
|
|
|
* "fd" is a file descriptor (use -1 if you don't use any fd)
|
2011-07-16 16:47:02 +02:00
|
|
|
* "select" tells whether to use select() on the fd to determine when to
|
|
|
|
* try reading.
|
2013-12-21 19:33:45 +01:00
|
|
|
* "read_cmd_func" is optional. It must return either text data or one of the
|
|
|
|
* MP_INPUT error codes above. For return values >= 0, it behaves like UNIX
|
|
|
|
* read() and returns the number of bytes copied to the dest buffer.
|
|
|
|
* "read_key_func" is optional. It returns either key codes (ASCII, keycodes.h),
|
|
|
|
* or MP_INPUT error codes.
|
2011-07-16 17:17:48 +02:00
|
|
|
* "close_func" will be called when closing. Can be NULL. Its return value
|
|
|
|
* is ignored (it's only there to allow using standard close() as the func).
|
2013-12-21 19:33:45 +01:00
|
|
|
* "ctx" is for free use, and is passed to the callbacks.
|
2011-07-16 16:47:02 +02:00
|
|
|
*/
|
2013-12-21 19:33:45 +01:00
|
|
|
int mp_input_add_fd(struct input_ctx *ictx, int fd, int select,
|
|
|
|
int read_cmd_func(void *ctx, int fd, char *dest, int size),
|
|
|
|
int read_key_func(void *ctx, int fd),
|
|
|
|
int close_func(void *ctx, int fd), void *ctx);
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2013-12-21 19:33:45 +01:00
|
|
|
/* Can be passed as read_func for above function in order to read() from the FD.
|
2011-07-16 16:47:02 +02:00
|
|
|
*/
|
2013-12-21 19:33:45 +01:00
|
|
|
int input_default_read_cmd(void *ctx, int fd, char *buf, int l);
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2013-07-02 14:00:24 +02:00
|
|
|
// Process keyboard input. code is a key code from keycodes.h, possibly
|
|
|
|
// with modifiers applied. MP_INPUT_RELEASE_ALL is also a valid value.
|
|
|
|
void mp_input_put_key(struct input_ctx *ictx, int code);
|
|
|
|
|
|
|
|
// Like mp_input_put_key(), but process all UTF-8 characters in the given
|
|
|
|
// string as key events.
|
|
|
|
void mp_input_put_key_utf8(struct input_ctx *ictx, int mods, struct bstr t);
|
2011-07-17 03:47:50 +02:00
|
|
|
|
2013-07-25 18:08:57 +02:00
|
|
|
// Process scrolling input. Support for precise scrolling. Scales the given
|
|
|
|
// scroll amount add multiplies it with the command (seeking, sub-delay, etc)
|
|
|
|
void mp_input_put_axis(struct input_ctx *ictx, int direction, double value);
|
|
|
|
|
input: handle mouse movement differently
Before this commit, mouse movement events emitted a special command
("set_mouse_pos"), which was specially handled in command.c. This was
once special-cased to the dvdnav and menu code, and did nothing after
libmenu and dvdnav were removed.
Change it so that mouse movement triggers a pseudo-key ("MOUSE_MOVE"),
which then can be bound to an arbitrary command. The mouse position is
now managed in input.c. A command which actually needs the mouse
position can use either mp_input_get_mouse_pos() or mp_get_osd_mouse_pos()
to query it. The former returns raw window-space coordinates, while the
latter returns coordinates transformed to OSD- space. (Both are the same
for most VOs, except vo_xv and vo_x11, which can't render OSD in
window-space. These require extra code for mapping mouse position.)
As of this commit, there is still nothing that uses mouse movement, so
MOUSE_MOVE is mapped to "ignore" to silence warnings when moving the
mouse (much like MOUSE_BTN0).
Extend the concept of input sections. Allow multiple sections to be
active at once, and organize them as stack. Bindings from the top of
the stack are preferred to lower ones.
Each section has a mouse input section associated, inside which mouse
events are associated with the bindings. If the mouse pointer is
outside of a section's mouse area, mouse events will be dispatched to
an input section lower on the stack of active sections. This is intended
for scripting, which is to be added later. Two scripts could occupy
different areas of the screen without conflicting with each other. (If
it turns out that this mechanism is useless, we'll just remove it
again.)
2013-04-26 02:13:30 +02:00
|
|
|
// Update mouse position (in window coordinates).
|
|
|
|
void mp_input_set_mouse_pos(struct input_ctx *ictx, int x, int y);
|
|
|
|
|
|
|
|
void mp_input_get_mouse_pos(struct input_ctx *ictx, int *x, int *y);
|
|
|
|
|
2003-09-14 19:52:59 +02:00
|
|
|
// As for the cmd one you usually don't need this function.
|
2008-04-30 10:06:55 +02:00
|
|
|
void mp_input_rm_key_fd(struct input_ctx *ictx, int fd);
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2011-07-16 16:47:02 +02:00
|
|
|
// Add a command to the command queue.
|
|
|
|
int mp_input_queue_cmd(struct input_ctx *ictx, struct mp_cmd *cmd);
|
2002-02-23 22:13:35 +01:00
|
|
|
|
2011-07-16 16:47:02 +02:00
|
|
|
/* Return next available command, or sleep up to "time" ms if none is
|
|
|
|
* available. If "peek_only" is true return a reference to the command
|
|
|
|
* but leave it queued.
|
|
|
|
*/
|
|
|
|
struct mp_cmd *mp_input_get_cmd(struct input_ctx *ictx, int time,
|
|
|
|
int peek_only);
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2012-10-13 21:09:42 +02:00
|
|
|
// Parse text and return corresponding struct mp_cmd.
|
|
|
|
// The location parameter is for error messages.
|
2013-09-27 15:30:59 +02:00
|
|
|
struct mp_cmd *mp_input_parse_cmd(struct input_ctx *ictx, bstr str,
|
|
|
|
const char *location);
|
2002-11-15 00:41:44 +01:00
|
|
|
|
input: handle mouse movement differently
Before this commit, mouse movement events emitted a special command
("set_mouse_pos"), which was specially handled in command.c. This was
once special-cased to the dvdnav and menu code, and did nothing after
libmenu and dvdnav were removed.
Change it so that mouse movement triggers a pseudo-key ("MOUSE_MOVE"),
which then can be bound to an arbitrary command. The mouse position is
now managed in input.c. A command which actually needs the mouse
position can use either mp_input_get_mouse_pos() or mp_get_osd_mouse_pos()
to query it. The former returns raw window-space coordinates, while the
latter returns coordinates transformed to OSD- space. (Both are the same
for most VOs, except vo_xv and vo_x11, which can't render OSD in
window-space. These require extra code for mapping mouse position.)
As of this commit, there is still nothing that uses mouse movement, so
MOUSE_MOVE is mapped to "ignore" to silence warnings when moving the
mouse (much like MOUSE_BTN0).
Extend the concept of input sections. Allow multiple sections to be
active at once, and organize them as stack. Bindings from the top of
the stack are preferred to lower ones.
Each section has a mouse input section associated, inside which mouse
events are associated with the bindings. If the mouse pointer is
outside of a section's mouse area, mouse events will be dispatched to
an input section lower on the stack of active sections. This is intended
for scripting, which is to be added later. Two scripts could occupy
different areas of the screen without conflicting with each other. (If
it turns out that this mechanism is useless, we'll just remove it
again.)
2013-04-26 02:13:30 +02:00
|
|
|
// Set current input section. The section is appended on top of the list of
|
|
|
|
// active sections, so its bindings are considered first. If the section was
|
|
|
|
// already active, it's moved to the top as well.
|
|
|
|
// name==NULL will behave as if name=="default"
|
2012-08-24 13:29:28 +02:00
|
|
|
// flags is a bitfield of enum mp_input_section_flags values
|
input: handle mouse movement differently
Before this commit, mouse movement events emitted a special command
("set_mouse_pos"), which was specially handled in command.c. This was
once special-cased to the dvdnav and menu code, and did nothing after
libmenu and dvdnav were removed.
Change it so that mouse movement triggers a pseudo-key ("MOUSE_MOVE"),
which then can be bound to an arbitrary command. The mouse position is
now managed in input.c. A command which actually needs the mouse
position can use either mp_input_get_mouse_pos() or mp_get_osd_mouse_pos()
to query it. The former returns raw window-space coordinates, while the
latter returns coordinates transformed to OSD- space. (Both are the same
for most VOs, except vo_xv and vo_x11, which can't render OSD in
window-space. These require extra code for mapping mouse position.)
As of this commit, there is still nothing that uses mouse movement, so
MOUSE_MOVE is mapped to "ignore" to silence warnings when moving the
mouse (much like MOUSE_BTN0).
Extend the concept of input sections. Allow multiple sections to be
active at once, and organize them as stack. Bindings from the top of
the stack are preferred to lower ones.
Each section has a mouse input section associated, inside which mouse
events are associated with the bindings. If the mouse pointer is
outside of a section's mouse area, mouse events will be dispatched to
an input section lower on the stack of active sections. This is intended
for scripting, which is to be added later. Two scripts could occupy
different areas of the screen without conflicting with each other. (If
it turns out that this mechanism is useless, we'll just remove it
again.)
2013-04-26 02:13:30 +02:00
|
|
|
void mp_input_enable_section(struct input_ctx *ictx, char *name, int flags);
|
|
|
|
|
|
|
|
// Undo mp_input_enable_section().
|
|
|
|
// name==NULL will behave as if name=="default"
|
|
|
|
void mp_input_disable_section(struct input_ctx *ictx, char *name);
|
|
|
|
|
|
|
|
// Like mp_input_set_section(ictx, ..., 0) for all sections.
|
|
|
|
void mp_input_disable_all_sections(struct input_ctx *ictx);
|
|
|
|
|
|
|
|
// Set the contents of an input section.
|
|
|
|
// name: name of the section, for mp_input_set_section() etc.
|
|
|
|
// location: location string (like filename) for error reporting
|
|
|
|
// contents: list of keybindings, like input.conf
|
|
|
|
// a value of NULL deletes the section
|
|
|
|
// builtin: create as builtin section; this means if the user defines bindings
|
|
|
|
// using "{name}", they won't be ignored or overwritten - instead,
|
|
|
|
// they are preferred to the bindings defined with this call
|
|
|
|
// If the section already exists, its bindings are removed and replaced.
|
|
|
|
void mp_input_define_section(struct input_ctx *ictx, char *name, char *location,
|
|
|
|
char *contents, bool builtin);
|
|
|
|
|
|
|
|
// Define where on the screen the named input section should receive.
|
|
|
|
// Setting a rectangle of size 0 unsets the mouse area.
|
|
|
|
// A rectangle with negative size disables mouse input for this section.
|
|
|
|
void mp_input_set_section_mouse_area(struct input_ctx *ictx, char *name,
|
|
|
|
int x0, int y0, int x1, int y1);
|
2007-06-07 20:06:53 +02:00
|
|
|
|
2013-05-16 23:17:46 +02:00
|
|
|
// Used to detect mouse movement.
|
2013-05-25 18:31:06 +02:00
|
|
|
unsigned int mp_input_get_mouse_event_counter(struct input_ctx *ictx);
|
2013-05-16 23:17:46 +02:00
|
|
|
|
input: handle mouse movement differently
Before this commit, mouse movement events emitted a special command
("set_mouse_pos"), which was specially handled in command.c. This was
once special-cased to the dvdnav and menu code, and did nothing after
libmenu and dvdnav were removed.
Change it so that mouse movement triggers a pseudo-key ("MOUSE_MOVE"),
which then can be bound to an arbitrary command. The mouse position is
now managed in input.c. A command which actually needs the mouse
position can use either mp_input_get_mouse_pos() or mp_get_osd_mouse_pos()
to query it. The former returns raw window-space coordinates, while the
latter returns coordinates transformed to OSD- space. (Both are the same
for most VOs, except vo_xv and vo_x11, which can't render OSD in
window-space. These require extra code for mapping mouse position.)
As of this commit, there is still nothing that uses mouse movement, so
MOUSE_MOVE is mapped to "ignore" to silence warnings when moving the
mouse (much like MOUSE_BTN0).
Extend the concept of input sections. Allow multiple sections to be
active at once, and organize them as stack. Bindings from the top of
the stack are preferred to lower ones.
Each section has a mouse input section associated, inside which mouse
events are associated with the bindings. If the mouse pointer is
outside of a section's mouse area, mouse events will be dispatched to
an input section lower on the stack of active sections. This is intended
for scripting, which is to be added later. Two scripts could occupy
different areas of the screen without conflicting with each other. (If
it turns out that this mechanism is useless, we'll just remove it
again.)
2013-04-26 02:13:30 +02:00
|
|
|
// Test whether there is any input section which wants to receive events.
|
|
|
|
// Note that the mouse event is always delivered, even if this returns false.
|
|
|
|
bool mp_input_test_mouse_active(struct input_ctx *ictx, int x, int y);
|
|
|
|
|
|
|
|
// Whether input.c wants mouse drag events at this mouse position. If this
|
|
|
|
// returns false, some VOs will initiate window dragging.
|
|
|
|
bool mp_input_test_dragging(struct input_ctx *ictx, int x, int y);
|
|
|
|
|
2011-07-16 16:47:02 +02:00
|
|
|
// Initialize the input system
|
2013-09-10 08:29:45 +02:00
|
|
|
struct mpv_global;
|
|
|
|
struct input_ctx *mp_input_init(struct mpv_global *global);
|
2002-01-30 13:46:03 +01:00
|
|
|
|
2013-07-27 21:26:00 +02:00
|
|
|
void mp_input_uninit(struct input_ctx *ictx);
|
2008-08-12 13:22:26 +02:00
|
|
|
|
2012-03-25 21:58:48 +02:00
|
|
|
// Wake up sleeping input loop from another thread.
|
|
|
|
void mp_input_wakeup(struct input_ctx *ictx);
|
|
|
|
|
2012-11-09 01:06:43 +01:00
|
|
|
// Interruptible usleep: (used by demux)
|
2011-07-16 16:47:02 +02:00
|
|
|
int mp_input_check_interrupt(struct input_ctx *ictx, int time);
|
2002-10-23 16:46:20 +02:00
|
|
|
|
2013-12-01 06:23:39 +01:00
|
|
|
// If this returns true, use Right Alt key as Alt Gr to produce special
|
|
|
|
// characters. If false, count Right Alt as the modifier Alt key.
|
|
|
|
bool mp_input_use_alt_gr(struct input_ctx *ictx);
|
|
|
|
|
2014-01-04 19:42:01 +01:00
|
|
|
// Like mp_input_parse_cmd_strv, but also run the command.
|
|
|
|
void mp_input_run_cmd(struct input_ctx *ictx, int def_flags, const char **cmd,
|
2014-01-04 16:59:22 +01:00
|
|
|
const char *location);
|
|
|
|
|
2008-01-08 22:40:44 +01:00
|
|
|
extern int async_quit_request;
|
|
|
|
|
2008-02-22 10:09:46 +01:00
|
|
|
#endif /* MPLAYER_INPUT_H */
|