mirror of
https://github.com/mpv-player/mpv
synced 2024-12-19 05:15:12 +00:00
input: merge mouse wheel and axis keycodes
Mouse wheel bindings have always been a cause of user confusion.
Previously, on Wayland and macOS, precise touchpads would generate AXIS
keycodes and notched mouse wheels would generate mouse button keycodes.
On Windows, both types of device would generate AXIS keycodes and on
X11, both types of device would generate mouse button keycodes. This
made it pretty difficult for users to modify their mouse-wheel bindings,
since it differed between platforms and in some cases, between devices.
To make it more confusing, the keycodes used on Windows were changed in
18a45a42d5
without a deprecation period or adequate communication to
users.
This change aims to make mouse wheel binds less confusing. Both the
mouse button and AXIS keycodes are now deprecated aliases of the new
WHEEL keycodes. This will technically break input configs on Wayland and
macOS that assign different commands to precise and non-precise scroll
events, but this is probably uncommon (if anyone does it at all) and I
think it's a fair tradeoff for finally fixing mouse wheel-related
confusion on other platforms.
This commit is contained in:
parent
8fe4aa94ee
commit
7897f79217
@ -63,6 +63,9 @@ Interface changes
|
||||
the old numeric names (mouse_btn0) are deprecated
|
||||
- remove mouse_btn3_dbl and up, since they are only generated for buttons
|
||||
0-2 (these now print an error when sent from the 'mouse' command)
|
||||
- rename the axis bindings to wheel_up/down/etc. axis scrolling and mouse
|
||||
wheel scrolling are now conceptually the same thing
|
||||
the old axis_up/down names remain as deprecated aliases
|
||||
--- mpv 0.26.0 ---
|
||||
- remove remaining deprecated audio device options, like --alsa-device
|
||||
Some of them were removed in earlier releases.
|
||||
|
@ -31,18 +31,14 @@
|
||||
#MBTN_LEFT ignore # don't do anything
|
||||
#MBTN_LEFT_DBL cycle fullscreen # toggle fullscreen on/off
|
||||
#MBTN_RIGHT cycle pause # toggle pause on/off
|
||||
#WHEEL_UP seek 10
|
||||
#WHEEL_DOWN seek -10
|
||||
#WHEEL_LEFT add volume -2
|
||||
#WHEEL_RIGHT add volume 2
|
||||
|
||||
# Mouse wheels, touchpad or other input devices that have axes
|
||||
# if the input devices supports precise scrolling it will also scale the
|
||||
# numeric value accordingly
|
||||
#AXIS_UP seek 10
|
||||
#AXIS_DOWN seek -10
|
||||
#AXIS_LEFT seek 5
|
||||
#AXIS_RIGHT seek -5
|
||||
#WHEEL_UP seek 10
|
||||
#WHEEL_DOWN seek -10
|
||||
#WHEEL_LEFT add volume -2
|
||||
#WHEEL_RIGHT add volume 2
|
||||
|
||||
## Seek units are in seconds, but note that these are limited by keyframes
|
||||
#RIGHT seek 5
|
||||
|
@ -95,7 +95,7 @@ struct cmd_queue {
|
||||
struct mp_cmd *first;
|
||||
};
|
||||
|
||||
struct axis_state {
|
||||
struct wheel_state {
|
||||
double dead_zone_accum;
|
||||
double unit_accum;
|
||||
};
|
||||
@ -135,11 +135,11 @@ struct input_ctx {
|
||||
bool mouse_mangle, mouse_src_mangle;
|
||||
struct mp_rect mouse_src, mouse_dst;
|
||||
|
||||
// Axis state (MP_AXIS_*)
|
||||
struct axis_state axis_state_y; // MP_AXIS_UP/MP_AXIS_DOWN
|
||||
struct axis_state axis_state_x; // MP_AXIS_LEFT/MP_AXIS_RIGHT
|
||||
struct axis_state *axis_current; // Points to axis currently being scrolled
|
||||
double last_axis_time; // mp_time_sec() of the last axis event
|
||||
// Wheel state (MP_WHEEL_*)
|
||||
struct wheel_state wheel_state_y; // MP_WHEEL_UP/MP_WHEEL_DOWN
|
||||
struct wheel_state wheel_state_x; // MP_WHEEL_LEFT/MP_WHEEL_RIGHT
|
||||
struct wheel_state *wheel_current; // The direction currently being scrolled
|
||||
double last_wheel_time; // mp_time_sec() of the last wheel event
|
||||
|
||||
// List of command binding sections
|
||||
struct cmd_bind_section *cmd_bind_sections;
|
||||
@ -634,10 +634,10 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale,
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-processing for MP_AXIS_* events. If this returns false, the caller
|
||||
// Pre-processing for MP_WHEEL_* events. If this returns false, the caller
|
||||
// should discard the event.
|
||||
static bool process_axis(struct input_ctx *ictx, int code, double *scale,
|
||||
int *scale_units)
|
||||
static bool process_wheel(struct input_ctx *ictx, int code, double *scale,
|
||||
int *scale_units)
|
||||
{
|
||||
// Size of the deadzone in scroll units. The user must scroll at least this
|
||||
// much in any direction before their scroll is registered.
|
||||
@ -650,45 +650,45 @@ static bool process_axis(struct input_ctx *ictx, int code, double *scale,
|
||||
// sent when the user scrolls slowly.
|
||||
static const double UNIT_SCROLL_TIME = 0.5;
|
||||
|
||||
// Determine which axis is being scrolled
|
||||
// Determine which direction is being scrolled
|
||||
double dir;
|
||||
struct axis_state *state;
|
||||
struct wheel_state *state;
|
||||
switch (code) {
|
||||
case MP_AXIS_UP: dir = -1; state = &ictx->axis_state_y; break;
|
||||
case MP_AXIS_DOWN: dir = +1; state = &ictx->axis_state_y; break;
|
||||
case MP_AXIS_LEFT: dir = -1; state = &ictx->axis_state_x; break;
|
||||
case MP_AXIS_RIGHT: dir = +1; state = &ictx->axis_state_x; break;
|
||||
case MP_WHEEL_UP: dir = -1; state = &ictx->wheel_state_y; break;
|
||||
case MP_WHEEL_DOWN: dir = +1; state = &ictx->wheel_state_y; break;
|
||||
case MP_WHEEL_LEFT: dir = -1; state = &ictx->wheel_state_x; break;
|
||||
case MP_WHEEL_RIGHT: dir = +1; state = &ictx->wheel_state_x; break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reset accumulators if it's determined that the user finished scrolling
|
||||
double now = mp_time_sec();
|
||||
if (now > ictx->last_axis_time + DEADZONE_SCROLL_TIME) {
|
||||
ictx->axis_current = NULL;
|
||||
ictx->axis_state_y.dead_zone_accum = 0;
|
||||
ictx->axis_state_x.dead_zone_accum = 0;
|
||||
if (now > ictx->last_wheel_time + DEADZONE_SCROLL_TIME) {
|
||||
ictx->wheel_current = NULL;
|
||||
ictx->wheel_state_y.dead_zone_accum = 0;
|
||||
ictx->wheel_state_x.dead_zone_accum = 0;
|
||||
}
|
||||
if (now > ictx->last_axis_time + UNIT_SCROLL_TIME) {
|
||||
ictx->axis_state_y.unit_accum = 0;
|
||||
ictx->axis_state_x.unit_accum = 0;
|
||||
if (now > ictx->last_wheel_time + UNIT_SCROLL_TIME) {
|
||||
ictx->wheel_state_y.unit_accum = 0;
|
||||
ictx->wheel_state_x.unit_accum = 0;
|
||||
}
|
||||
ictx->last_axis_time = now;
|
||||
ictx->last_wheel_time = now;
|
||||
|
||||
// Process axis deadzone. A lot of touchpad drivers don't filter scroll
|
||||
// input, which makes it difficult for the user to send AXIS_UP/DOWN
|
||||
// without accidentally triggering AXIS_LEFT/RIGHT. We try to fix this by
|
||||
// implementing a deadzone. When the value of either axis breaks out of the
|
||||
// deadzone, events from the other axis will be ignored until the user
|
||||
// finishes scrolling.
|
||||
if (ictx->axis_current == NULL) {
|
||||
// Process wheel deadzone. A lot of touchpad drivers don't filter scroll
|
||||
// input, which makes it difficult for the user to send WHEEL_UP/DOWN
|
||||
// without accidentally triggering WHEEL_LEFT/RIGHT. We try to fix this by
|
||||
// implementing a deadzone. When the value of either direction breaks out
|
||||
// of the deadzone, events from the other direction will be ignored until
|
||||
// the user finishes scrolling.
|
||||
if (ictx->wheel_current == NULL) {
|
||||
state->dead_zone_accum += *scale * dir;
|
||||
if (state->dead_zone_accum * dir > DEADZONE_DIST) {
|
||||
ictx->axis_current = state;
|
||||
ictx->wheel_current = state;
|
||||
*scale = state->dead_zone_accum * dir;
|
||||
}
|
||||
}
|
||||
if (ictx->axis_current != state)
|
||||
if (ictx->wheel_current != state)
|
||||
return false;
|
||||
|
||||
// Determine scale_units. This is incremented every time the accumulated
|
||||
@ -724,7 +724,7 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale,
|
||||
if (!force_mouse && opts->doubleclick_time && MP_KEY_IS_MOUSE_BTN_DBL(unmod))
|
||||
return;
|
||||
int units = 1;
|
||||
if (MP_KEY_IS_AXIS(unmod) && !process_axis(ictx, unmod, &scale, &units))
|
||||
if (MP_KEY_IS_WHEEL(unmod) && !process_wheel(ictx, unmod, &scale, &units))
|
||||
return;
|
||||
interpret_key(ictx, code, scale, units);
|
||||
if (code & MP_KEY_STATE_DOWN) {
|
||||
@ -733,7 +733,7 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale,
|
||||
now - ictx->last_doubleclick_time < opts->doubleclick_time / 1000.0)
|
||||
{
|
||||
if (code >= MP_MBTN_LEFT && code <= MP_MBTN_RIGHT) {
|
||||
interpret_key(ictx, code - MP_MOUSE_BASE + MP_MOUSE_DBL_BASE,
|
||||
interpret_key(ictx, code - MP_MBTN_BASE + MP_MBTN_DBL_BASE,
|
||||
1, 1);
|
||||
}
|
||||
}
|
||||
@ -766,7 +766,7 @@ void mp_input_put_key_utf8(struct input_ctx *ictx, int mods, struct bstr t)
|
||||
}
|
||||
}
|
||||
|
||||
void mp_input_put_axis(struct input_ctx *ictx, int direction, double value)
|
||||
void mp_input_put_wheel(struct input_ctx *ictx, int direction, double value)
|
||||
{
|
||||
if (value == 0.0)
|
||||
return;
|
||||
|
@ -143,7 +143,7 @@ void mp_input_put_key_utf8(struct input_ctx *ictx, int mods, struct bstr t);
|
||||
|
||||
// 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);
|
||||
void mp_input_put_wheel(struct input_ctx *ictx, int direction, double value);
|
||||
|
||||
// Update mouse position (in window coordinates).
|
||||
void mp_input_set_mouse_pos(struct input_ctx *ictx, int x, int y);
|
||||
|
@ -117,11 +117,6 @@ static const struct key_name key_names[] = {
|
||||
{ MP_AR_VDOWN, "AR_VDOWN" },
|
||||
{ MP_AR_VDOWN_HOLD, "AR_VDOWN_HOLD" },
|
||||
|
||||
{ MP_AXIS_UP, "AXIS_UP" },
|
||||
{ MP_AXIS_DOWN, "AXIS_DOWN" },
|
||||
{ MP_AXIS_LEFT, "AXIS_LEFT" },
|
||||
{ MP_AXIS_RIGHT, "AXIS_RIGHT" },
|
||||
|
||||
{ MP_KEY_POWER, "POWER" },
|
||||
{ MP_KEY_MENU, "MENU" },
|
||||
{ MP_KEY_PLAY, "PLAY" },
|
||||
@ -176,6 +171,10 @@ static const struct key_name key_names[] = {
|
||||
{ MP_MBTN_LEFT_DBL, "MOUSE_BTN0_DBL" },
|
||||
{ MP_MBTN_MID_DBL, "MOUSE_BTN1_DBL" },
|
||||
{ MP_MBTN_RIGHT_DBL, "MOUSE_BTN2_DBL" },
|
||||
{ MP_WHEEL_UP, "AXIS_UP" },
|
||||
{ MP_WHEEL_DOWN, "AXIS_DOWN" },
|
||||
{ MP_WHEEL_LEFT, "AXIS_LEFT" },
|
||||
{ MP_WHEEL_RIGHT, "AXIS_RIGHT" },
|
||||
|
||||
{ MP_KEY_CLOSE_WIN, "CLOSE_WIN" },
|
||||
{ MP_KEY_MOUSE_MOVE, "MOUSE_MOVE" },
|
||||
|
@ -98,40 +98,42 @@
|
||||
#define MP_KEY_KPENTER (MP_KEY_KEYPAD+13)
|
||||
|
||||
// Mouse events from VOs
|
||||
#define MP_MOUSE_BASE ((MP_KEY_BASE+0xA0)|MP_NO_REPEAT_KEY|MP_KEY_EMIT_ON_UP)
|
||||
#define MP_MBTN_LEFT (MP_MOUSE_BASE+0)
|
||||
#define MP_MBTN_MID (MP_MOUSE_BASE+1)
|
||||
#define MP_MBTN_RIGHT (MP_MOUSE_BASE+2)
|
||||
#define MP_WHEEL_UP (MP_MOUSE_BASE+3)
|
||||
#define MP_WHEEL_DOWN (MP_MOUSE_BASE+4)
|
||||
#define MP_WHEEL_LEFT (MP_MOUSE_BASE+5)
|
||||
#define MP_WHEEL_RIGHT (MP_MOUSE_BASE+6)
|
||||
#define MP_MBTN_BACK (MP_MOUSE_BASE+7)
|
||||
#define MP_MBTN_FORWARD (MP_MOUSE_BASE+8)
|
||||
#define MP_MBTN9 (MP_MOUSE_BASE+9)
|
||||
#define MP_MBTN10 (MP_MOUSE_BASE+10)
|
||||
#define MP_MBTN11 (MP_MOUSE_BASE+11)
|
||||
#define MP_MBTN12 (MP_MOUSE_BASE+12)
|
||||
#define MP_MBTN13 (MP_MOUSE_BASE+13)
|
||||
#define MP_MBTN14 (MP_MOUSE_BASE+14)
|
||||
#define MP_MBTN15 (MP_MOUSE_BASE+15)
|
||||
#define MP_MBTN16 (MP_MOUSE_BASE+16)
|
||||
#define MP_MBTN17 (MP_MOUSE_BASE+17)
|
||||
#define MP_MBTN18 (MP_MOUSE_BASE+18)
|
||||
#define MP_MBTN19 (MP_MOUSE_BASE+19)
|
||||
#define MP_MOUSE_END (MP_MOUSE_BASE+20)
|
||||
#define MP_MBTN_BASE ((MP_KEY_BASE+0xA0)|MP_NO_REPEAT_KEY|MP_KEY_EMIT_ON_UP)
|
||||
#define MP_MBTN_LEFT (MP_MBTN_BASE+0)
|
||||
#define MP_MBTN_MID (MP_MBTN_BASE+1)
|
||||
#define MP_MBTN_RIGHT (MP_MBTN_BASE+2)
|
||||
#define MP_WHEEL_UP (MP_MBTN_BASE+3)
|
||||
#define MP_WHEEL_DOWN (MP_MBTN_BASE+4)
|
||||
#define MP_WHEEL_LEFT (MP_MBTN_BASE+5)
|
||||
#define MP_WHEEL_RIGHT (MP_MBTN_BASE+6)
|
||||
#define MP_MBTN_BACK (MP_MBTN_BASE+7)
|
||||
#define MP_MBTN_FORWARD (MP_MBTN_BASE+8)
|
||||
#define MP_MBTN9 (MP_MBTN_BASE+9)
|
||||
#define MP_MBTN10 (MP_MBTN_BASE+10)
|
||||
#define MP_MBTN11 (MP_MBTN_BASE+11)
|
||||
#define MP_MBTN12 (MP_MBTN_BASE+12)
|
||||
#define MP_MBTN13 (MP_MBTN_BASE+13)
|
||||
#define MP_MBTN14 (MP_MBTN_BASE+14)
|
||||
#define MP_MBTN15 (MP_MBTN_BASE+15)
|
||||
#define MP_MBTN16 (MP_MBTN_BASE+16)
|
||||
#define MP_MBTN17 (MP_MBTN_BASE+17)
|
||||
#define MP_MBTN18 (MP_MBTN_BASE+18)
|
||||
#define MP_MBTN19 (MP_MBTN_BASE+19)
|
||||
#define MP_MBTN_END (MP_MBTN_BASE+20)
|
||||
|
||||
#define MP_KEY_IS_MOUSE_BTN_SINGLE(code) \
|
||||
((code) >= MP_MOUSE_BASE && (code) < MP_MOUSE_END)
|
||||
((code) >= MP_MBTN_BASE && (code) < MP_MBTN_END)
|
||||
#define MP_KEY_IS_WHEEL(code) \
|
||||
((code) >= MP_WHEEL_UP && (code) < MP_WHEEL_RIGHT)
|
||||
|
||||
#define MP_MOUSE_DBL_BASE ((MP_KEY_BASE+0xC0)|MP_NO_REPEAT_KEY)
|
||||
#define MP_MBTN_LEFT_DBL (MP_MOUSE_DBL_BASE+0)
|
||||
#define MP_MBTN_MID_DBL (MP_MOUSE_DBL_BASE+1)
|
||||
#define MP_MBTN_RIGHT_DBL (MP_MOUSE_DBL_BASE+2)
|
||||
#define MP_MOUSE_DBL_END (MP_MOUSE_DBL_BASE+20)
|
||||
#define MP_MBTN_DBL_BASE ((MP_KEY_BASE+0xC0)|MP_NO_REPEAT_KEY)
|
||||
#define MP_MBTN_LEFT_DBL (MP_MBTN_DBL_BASE+0)
|
||||
#define MP_MBTN_MID_DBL (MP_MBTN_DBL_BASE+1)
|
||||
#define MP_MBTN_RIGHT_DBL (MP_MBTN_DBL_BASE+2)
|
||||
#define MP_MBTN_DBL_END (MP_MBTN_DBL_BASE+20)
|
||||
|
||||
#define MP_KEY_IS_MOUSE_BTN_DBL(code) \
|
||||
((code) >= MP_MOUSE_DBL_BASE && (code) < MP_MOUSE_DBL_END)
|
||||
((code) >= MP_MBTN_DBL_BASE && (code) < MP_MBTN_DBL_END)
|
||||
|
||||
// Apple Remote input module
|
||||
#define MP_AR_BASE (MP_KEY_BASE+0xE0)
|
||||
@ -150,17 +152,6 @@
|
||||
#define MP_AR_VDOWN (MP_AR_BASE + 12)
|
||||
#define MP_AR_VDOWN_HOLD (MP_AR_BASE + 13)
|
||||
|
||||
// Mouse wheels or touchpad input
|
||||
#define MP_AXIS_BASE (MP_KEY_BASE+0x100)
|
||||
#define MP_AXIS_UP (MP_AXIS_BASE+0)
|
||||
#define MP_AXIS_DOWN (MP_AXIS_BASE+1)
|
||||
#define MP_AXIS_LEFT (MP_AXIS_BASE+2)
|
||||
#define MP_AXIS_RIGHT (MP_AXIS_BASE+3)
|
||||
#define MP_AXIS_END (MP_AXIS_BASE+4)
|
||||
|
||||
#define MP_KEY_IS_AXIS(code) \
|
||||
((code) >= MP_AXIS_BASE && (code) < MP_AXIS_END)
|
||||
|
||||
// Reserved area. Can be used for keys that have no explicit names assigned,
|
||||
// but should be mappable by the user anyway.
|
||||
#define MP_KEY_UNKNOWN_RESERVED_START (MP_KEY_BASE+0x10000)
|
||||
@ -183,12 +174,10 @@
|
||||
|
||||
// Whether to dispatch the key binding by current mouse position.
|
||||
#define MP_KEY_DEPENDS_ON_MOUSE_POS(code) \
|
||||
(MP_KEY_IS_MOUSE_CLICK(code) || MP_KEY_IS_AXIS(code) || \
|
||||
(code) == MP_KEY_MOUSE_MOVE)
|
||||
(MP_KEY_IS_MOUSE_CLICK(code) || (code) == MP_KEY_MOUSE_MOVE)
|
||||
|
||||
#define MP_KEY_IS_MOUSE(code) \
|
||||
(MP_KEY_IS_MOUSE_CLICK(code) || MP_KEY_IS_AXIS(code) || \
|
||||
MP_KEY_IS_MOUSE_MOVE(code))
|
||||
(MP_KEY_IS_MOUSE_CLICK(code) || MP_KEY_IS_MOUSE_MOVE(code))
|
||||
|
||||
// No input source should generate this.
|
||||
#define MP_KEY_UNMAPPED (MP_KEY_INTERN+4)
|
||||
|
@ -5601,12 +5601,12 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
|
||||
return -1;
|
||||
}
|
||||
const bool dbc = cmd->args[3].v.i;
|
||||
if (dbc && button > (MP_MBTN_RIGHT - MP_MOUSE_BASE)) {
|
||||
if (dbc && button > (MP_MBTN_RIGHT - MP_MBTN_BASE)) {
|
||||
MP_ERR(mpctx, "%d is not a valid mouse button for double-clicks.\n",
|
||||
button);
|
||||
return -1;
|
||||
}
|
||||
button += dbc ? MP_MOUSE_DBL_BASE : MP_MOUSE_BASE;
|
||||
button += dbc ? MP_MBTN_DBL_BASE : MP_MBTN_BASE;
|
||||
mp_input_set_mouse_pos_artificial(mpctx->input, x, y);
|
||||
mp_input_put_key_artificial(mpctx->input, button);
|
||||
break;
|
||||
|
@ -2304,8 +2304,6 @@ mp.set_key_bindings({
|
||||
function(e) process_event("mbtn_right", "down") end},
|
||||
{"wheel_up", function(e) process_event("wheel_up", "press") end},
|
||||
{"wheel_down", function(e) process_event("wheel_down", "press") end},
|
||||
{"axis_up", function(e) process_event("wheel_up", "press") end},
|
||||
{"axis_down", function(e) process_event("wheel_down", "press") end},
|
||||
{"mbtn_left_dbl", "ignore"},
|
||||
{"shift+mbtn_left_dbl", "ignore"},
|
||||
{"mbtn_right_dbl", "ignore"},
|
||||
|
@ -239,13 +239,13 @@
|
||||
|
||||
if (fabs([event deltaY]) >= fabs([event deltaX])) {
|
||||
delta = [event deltaY] * 0.1;
|
||||
cmd = delta > 0 ? MP_AXIS_UP : MP_AXIS_DOWN;
|
||||
cmd = delta > 0 ? MP_WHEEL_UP : MP_WHEEL_DOWN;
|
||||
} else {
|
||||
delta = [event deltaX] * 0.1;
|
||||
cmd = delta > 0 ? MP_AXIS_RIGHT : MP_AXIS_LEFT;
|
||||
cmd = delta > 0 ? MP_WHEEL_RIGHT : MP_WHEEL_LEFT;
|
||||
}
|
||||
|
||||
[self.adapter putAxis:cmd delta:fabs(delta)];
|
||||
[self.adapter putWheel:cmd delta:fabs(delta)];
|
||||
}
|
||||
|
||||
- (void)scrollWheel:(NSEvent *)event
|
||||
|
@ -22,7 +22,7 @@
|
||||
- (void)setNeedsResize;
|
||||
- (void)signalMouseMovement:(NSPoint)point;
|
||||
- (void)putKey:(int)mpkey withModifiers:(int)modifiers;
|
||||
- (void)putAxis:(int)mpkey delta:(float)delta;
|
||||
- (void)putWheel:(int)mpkey delta:(float)delta;
|
||||
- (void)putCommand:(char*)cmd;
|
||||
- (void)handleFilesArray:(NSArray *)files;
|
||||
- (void)didChangeWindowedScreenProfile:(NSNotification *)notification;
|
||||
|
@ -994,9 +994,9 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
|
||||
cocoa_put_key_with_modifiers(mpkey, modifiers);
|
||||
}
|
||||
|
||||
- (void)putAxis:(int)mpkey delta:(float)delta;
|
||||
- (void)putWheel:(int)mpkey delta:(float)delta;
|
||||
{
|
||||
mp_input_put_axis(self.vout->input_ctx, mpkey, delta);
|
||||
mp_input_put_wheel(self.vout->input_ctx, mpkey, delta);
|
||||
}
|
||||
|
||||
- (void)putCommand:(char*)cmd
|
||||
|
@ -179,11 +179,11 @@ static void check_events(struct vo *vo)
|
||||
break;
|
||||
case CACA_EVENT_MOUSE_PRESS:
|
||||
mp_input_put_key(vo->input_ctx,
|
||||
(MP_MOUSE_BASE + cev.data.mouse.button - 1) | MP_KEY_STATE_DOWN);
|
||||
(MP_MBTN_BASE + cev.data.mouse.button - 1) | MP_KEY_STATE_DOWN);
|
||||
break;
|
||||
case CACA_EVENT_MOUSE_RELEASE:
|
||||
mp_input_put_key(vo->input_ctx,
|
||||
(MP_MOUSE_BASE + cev.data.mouse.button - 1) | MP_KEY_STATE_UP);
|
||||
(MP_MBTN_BASE + cev.data.mouse.button - 1) | MP_KEY_STATE_UP);
|
||||
break;
|
||||
case CACA_EVENT_KEY_PRESS:
|
||||
{
|
||||
|
@ -608,11 +608,11 @@ static void wait_events(struct vo *vo, int64_t until_time_us)
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
mp_input_put_key(vo->input_ctx,
|
||||
(MP_MOUSE_BASE + ev.button.button - 1) | MP_KEY_STATE_DOWN);
|
||||
(MP_MBTN_BASE + ev.button.button - 1) | MP_KEY_STATE_DOWN);
|
||||
break;
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
mp_input_put_key(vo->input_ctx,
|
||||
(MP_MOUSE_BASE + ev.button.button - 1) | MP_KEY_STATE_UP);
|
||||
(MP_MBTN_BASE + ev.button.button - 1) | MP_KEY_STATE_UP);
|
||||
break;
|
||||
case SDL_MOUSEWHEEL:
|
||||
break;
|
||||
|
@ -441,10 +441,10 @@ static void handle_mouse_wheel(struct vo_w32_state *w32, bool horiz, int val)
|
||||
{
|
||||
int code;
|
||||
if (horiz)
|
||||
code = val > 0 ? MP_AXIS_RIGHT : MP_AXIS_LEFT;
|
||||
code = val > 0 ? MP_WHEEL_RIGHT : MP_WHEEL_LEFT;
|
||||
else
|
||||
code = val > 0 ? MP_AXIS_UP : MP_AXIS_DOWN;
|
||||
mp_input_put_axis(w32->input_ctx, code | mod_state(w32), abs(val) / 120.);
|
||||
code = val > 0 ? MP_WHEEL_UP : MP_WHEEL_DOWN;
|
||||
mp_input_put_wheel(w32->input_ctx, code | mod_state(w32), abs(val) / 120.);
|
||||
}
|
||||
|
||||
static void signal_events(struct vo_w32_state *w32, int events)
|
||||
|
@ -470,18 +470,18 @@ static void pointer_handle_axis(void *data,
|
||||
// scale it down to 1.00 for multipliying it with the commands
|
||||
if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) {
|
||||
if (value > 0)
|
||||
mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_DOWN,
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_DOWN,
|
||||
wl_fixed_to_double(value)*0.1);
|
||||
if (value < 0)
|
||||
mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_UP,
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_UP,
|
||||
wl_fixed_to_double(value)*-0.1);
|
||||
}
|
||||
else if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
|
||||
if (value > 0)
|
||||
mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_RIGHT,
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_RIGHT,
|
||||
wl_fixed_to_double(value)*0.1);
|
||||
if (value < 0)
|
||||
mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_LEFT,
|
||||
mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_LEFT,
|
||||
wl_fixed_to_double(value)*-0.1);
|
||||
}
|
||||
}
|
||||
|
@ -1136,7 +1136,7 @@ void vo_x11_check_events(struct vo *vo)
|
||||
if (Event.xbutton.button == 1)
|
||||
x11->win_drag_button1_down = true;
|
||||
mp_input_put_key(x11->input_ctx,
|
||||
(MP_MOUSE_BASE + Event.xbutton.button - 1) |
|
||||
(MP_MBTN_BASE + Event.xbutton.button - 1) |
|
||||
get_mods(Event.xbutton.state) | MP_KEY_STATE_DOWN);
|
||||
long msg[4] = {XEMBED_REQUEST_FOCUS};
|
||||
vo_x11_xembed_send_message(x11, msg);
|
||||
@ -1145,7 +1145,7 @@ void vo_x11_check_events(struct vo *vo)
|
||||
if (Event.xbutton.button == 1)
|
||||
x11->win_drag_button1_down = false;
|
||||
mp_input_put_key(x11->input_ctx,
|
||||
(MP_MOUSE_BASE + Event.xbutton.button - 1) |
|
||||
(MP_MBTN_BASE + Event.xbutton.button - 1) |
|
||||
get_mods(Event.xbutton.state) | MP_KEY_STATE_UP);
|
||||
break;
|
||||
case MapNotify:
|
||||
|
Loading…
Reference in New Issue
Block a user