summaryrefslogtreecommitdiffstats
path: root/player/lua/osc.lua
Commit message (Collapse)AuthorAgeFilesLines
* osc: fix rare stack overflow when changing visibility modeAvi Halachmi (:avih)2017-09-231-1/+6
| | | | | | | | | | | | | Under some conditions, hide_osc() was calling render(), which then called hide_osc() again, and so forth, until the stack overflows. Tracking the exact conditions where this happens (and then managing them to prevent it) is an excercise in futility. Remove the osc directly - instead of going through the entire rendering procedure just to end up rendering nothing. Fixes #4900 .
* input: merge mouse wheel and axis keycodesJames Ross-Gowan2017-09-031-2/+0
| | | | | | | | | | | | | | | | | | | | | | 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 18a45a42d524 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.
* input: use mnemonic names for mouse buttonsJames Ross-Gowan2017-09-031-48/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpv's mouse button numbering is based on X11 button numbering, which allows for an arbitrary number of buttons and includes mouse wheel input as buttons 3-6. This button numbering was used throughout the codebase and exposed in input.conf, and it was difficult to remember which physical button each number actually referred to and which referred to the scroll wheel. In practice, PC mice only have between two and five buttons and one or two scroll wheel axes, which are more or less in the same location and have more or less the same function. This allows us to use names to refer to the buttons instead of numbers, which makes input.conf syntax a lot easier to remember. It also makes the syntax robust to changes in mpv's underlying numbering. The old MOUSE_BTNx names are still understood as deprecated aliases of the named buttons. This changes both the input.conf syntax and the MP_MOUSE_BTNx symbols in the codebase, since I think both would benefit from using names over numbers, especially since some platforms don't use X11 button numbering and handle different mouse buttons in different windowing system events. This also makes the names shorter, since otherwise they would be pretty long, and it removes the high-numbered MOUSE_BTNx_DBL names, since they weren't used. Names are the same as used in Qt: https://doc.qt.io/qt-5/qt.html#MouseButton-enum
* OSD message: "Drop files or URLs to play here."nodiscc2017-05-311-1/+1
| | | | Add "or URLs" to the default OSD message when mpv is launched without parameters. Since this works flawlessly with youtube-dl integration, the fact that you can drop URLs directly to the window should be advertised more.
* osc: also add processing for axis_up/down eventsRicardo Constantino2017-04-251-4/+6
| | | | | | Considered semantically equivalent with mouse_btn3/4. This is a preemptive fix for upcoming changes to AXIS_* events.
* osc: add user_opts.boxmaxchars for box layout title limitAvi Halachmi (:avih)2017-04-191-3/+6
| | | | | The default of 80 is conservative to allow relatively wide fonts, but with many common fonts a bigger number can be used without overflow.
* osc: add volume icons to osd font and use themRicardo Constantino2017-04-191-3/+4
| | | | | Glyphs taken and based on U+1F507 to U+1F50A from Symbola, which is available under public domain: http://users.teilar.gr/~g1951d/
* osc: move volume left of fullscreen buttonRicardo Constantino2017-04-191-16/+17
|
* osc: bottom/topbar: add fullscreen buttonRicardo Constantino2017-04-191-4/+13
|
* osc: add volume buttonRicardo Constantino2017-04-191-3/+41
| | | | | Click to toggle mute, mouse wheel to change volume. OSD is shown on volume change.
* osc: support handling mouse wheel eventsRicardo Constantino2017-04-191-4/+8
|
* osc: simplify checks in key handlerRicardo Constantino2017-04-191-30/+25
| | | | Use a helper function for these safety checks.
* osc: fix last potential race condition on key eventsRicardo Constantino2017-04-191-1/+2
|
* osc: use "loop-playlist" instead of "loop" propertywm42017-04-111-1/+1
|
* osc: escape ASS and strip newlines on titleRicardo Constantino2017-03-271-0/+2
|
* osc: make title configurable and use property expansion on itRicardo Constantino2017-03-271-6/+4
|
* Revert "osc: make the title toggleable between media-title and filename"Ricardo Constantino2017-03-271-11/+10
| | | | This reverts commit 6573b73462e336da0daca845ba4df02782afc2b6.
* osc: make the title toggleable between media-title and filenameRicardo Constantino2017-03-261-10/+11
| | | | Close #4221
* osc: fix PlayResX undefined warning when aspect is 0Ricardo Constantino2017-03-241-3/+6
|
* osc: bottom/topbar: don't clip title verticallyRicardo Constantino2017-03-241-2/+2
|
* osc: bottom/topbar: increase timecodes width a bitRicardo Constantino2017-03-241-4/+4
| | | | | | | Compensates for wider fonts like DejaVu Sans Mono. Further compensate for the minus sign in the right timecode by 10px. Closes #3952
* osc: refactor cache status displayRicardo Constantino2017-03-241-11/+18
| | | | This removes the twitch of the right-aligned cache status.
* osc: refactor osc message scalingRicardo Constantino2017-03-241-35/+20
| | | | | | | | | | Will still hide playlist items with long enough filenames and osd-font-size but not as soon. osc messages should now preserve their scaling with fullscreen toggling and cycling through audio-only files and files with video. Closes #4081, #4083, #4102
* osc: fix window dragging with showwindowed=noAkemi2017-02-271-0/+2
| | | | | | | initialise OSC with a zero mouse area so mp_input_test_dragging returns a proper value. Fixes #1819
* osc: allow playlist buttons when loopingRicardo Constantino2017-02-011-2/+3
| | | | Closes #4092
* osc: box: clip with ellipsis after too much stretchingRicardo Constantino2017-01-311-2/+9
|
* osc: bottom/topbar: clip title instead of stretchingRicardo Constantino2017-01-311-4/+6
|
* osc: fix crashes related to field eventresponder being nilRoland Hieber2017-01-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm still getting some crashes after issue #3210 was fixed in commit 5beb2306904b4437b5acf136b02aeaa073c351c7. It's hard to reproduce those crashes, they happen maybe once a month, so I guess it could be a race condition. But in any case, I don't see anything wrong in applying some defensive programming here. For reference, here is what was happening on 0.23.0-1 from Debian testing: Playing: ytdl://usL5CeP_row (+) Video --vid=1 (*) (h264) (+) Audio --aid=1 --alang=und (*) (aac) [osc] [osc] stack traceback: [osc] @osc.lua:2074: in function 'process_event' [osc] @osc.lua:2246: in function 'cb' [osc] mp.defaults:107: in function 'fn' [osc] mp.defaults:60: in function 'handler' [osc] mp.defaults:339: in function 'handler' [osc] mp.defaults:448: in function 'call_event_handlers' [osc] mp.defaults:485: in function 'dispatch_events' [osc] mp.defaults:441: in function <mp.defaults:440> [osc] [C]: in ? [osc] [C]: in ? [osc] Lua error: @osc.lua:2074: attempt to index field 'eventresponder' (a nil value) Note that the location is different from where issue #3210 happens. Signed-off-by: Roland Hieber <rohieb@rohieb.name>
* osc: bottombar/topbar: make chapter markers slightly biggerRicardo Constantino2016-12-251-17/+18
| | | | | | | 1px squares to 2px triangles and layout=box markers from 1px squares to 2x1px rectangles. While we're at it, wrap a few lines to 80col again.
* osc: replace length property with durationpavelxdd2016-12-041-1/+1
| | | | | | Length property is deprecated and no longer works. This fixes a bug when the total file duration wasn't visible if the option to display milliseconds was activated.
* osc: don't hide playlist buttons, just disableRicardo Constantino2016-12-021-5/+6
| | | | | | | | Having empty space before the title in layout=*bar looks worse than the floating buttons in layout=box. Also disable both playlist buttons selectively according to the current position.
* osc: topbar: use same styles as bottombarRicardo Constantino2016-12-021-13/+13
|
* osc: fix use of deprecated idle propertyRicardo Constantino2016-11-221-1/+1
| | | | Fixes regression since 7201fd7d
* osc: fix possible race condition in right timecodeRicardo Constantino2016-11-211-2/+1
|
* osc: add seekbarstyle=knobRicardo Constantino2016-11-091-4/+16
| | | | | | | | Most code from @leiserfg in #2365. Closes #2365 Cut guides to the center of the knob. This makes the knob knob look more like IRL knob sliders.
* osc: fix crashes when dragging seekbar across file changesRicardo Constantino2016-11-081-2/+3
| | | | Fixes #3210
* osc: slimbox: fix clipping with seekbarstyle=barRicardo Constantino2016-11-071-1/+3
| | | | Fixes #3737
* osc: add alpha animation to tooltipRicardo Constantino2016-10-311-1/+14
| | | | | Fixes lingering tooltip with full alpha if mouse leaves window with OSC still active.
* osc: top/bottombar: rescale layout to same size with scale=1Ricardo Constantino2016-10-291-49/+53
| | | | | Basically, there's two less values to revert to previous defaults and top/bottombar now look at scale=1 like they looked with scale=1.5.
* osc: top/bottombar: scale title if too large like boxRicardo Constantino2016-10-291-14/+24
|
* osc: compromise on default deadzonesizeRicardo Constantino2016-10-291-2/+2
| | | | | | This way people can still use the mouse to quickly check the elapsed time without moving it all the way to the bottom while still having half the screen to ignore mouse movement.
* osc: don't wrap the titleRicardo Constantino2016-10-291-1/+1
|
* osc: top/bottombar: also scale when min-width is reachedRicardo Constantino2016-10-291-12/+34
| | | | Same behavior as box/slimbox.
* osc: top/bottombar: dynamically size timecodes according to timemsRicardo Constantino2016-10-291-9/+14
|
* osc: fix missing chapter ticks with seekbarstyle=barRicardo Constantino2016-10-291-0/+1
|
* osc: fix crash with no chaptersRicardo Constantino2016-10-251-4/+4
| | | | Also, chapter position which wasn't changed to work with 1-based.
* osc: Fix and simplify limited_listMiroslav Koskar2016-10-251-28/+25
| | | | | | | | | | | * Fixes: when on the end of playlist only half of entries are displayed. * Simplifies the logic of limited_list so it's easy to follow. * limited_list's pos parameter is now 1 based which seem more natural. * Few changes to comply with code style thorough the file. * Small format change: "Playlist: (%d/%d):" -> "Playlist [%d/%d]:" "Chapters: (%d/%d):" -> "Chapters [%d/%d]:"
* osc: add script message handlers for chapter/track/playlistsRicardo Constantino2016-10-241-0/+13
| | | | | | | | | | These can be used in input.conf for pretty formatting of lists as with shift+clicking the OSC buttons. Ex: z script-message osc-playlist Z script-message osc-chapterlist x script-message osc-tracklist
* osc: fix crash after reaching a certain position in limited listsRicardo Constantino2016-10-201-1/+1
| | | | | Don't try to display more items than there are in the chapter/playlist. Fixes #3691
* osc: use the same characters as track list for playlist/chapterRicardo Constantino2016-10-171-10/+4
| | | | | | | | | Had only tested with luajit which supports the \xHH syntax added in Lua 5.2. The arrow is troublesome to use since the ideal way to use it, as the OSD code uses it, needs \alpha&H00<arrow>\r to work, which does not in OSC's way of showing messages.
* osc: fix chapter/playlist listing if emptyRicardo Constantino2016-10-151-1/+1
|
* osc: show playlist/chapter list on prev/next instead of osdRicardo Constantino2016-10-151-4/+16
|
* osc: fix listing of chapters and playlistRicardo Constantino2016-10-151-10/+87
| | | | | | | Fixes regression since 05c398f. Add helper functions for limiting potentially huge lists of playlists and chapters and use them.
* osc: fix display of chapters and playlist scalingRicardo Constantino2016-10-151-2/+11
| | | | Compensate \fs when using non-default scale(fullscreen|windowed).
* osc: add user-alterable margin for top/bottombarRicardo Constantino2016-10-151-5/+6
|
* osc: add right-click behavior to playlist and chapter buttonsRicardo Constantino2016-10-151-0/+8
|
* osc: change default layout to bottombarRicardo Constantino2016-10-151-6/+6
| | | | | | Change a few other defaults accordingly: - seekbarstyle=bar looks better with bottombar. - Bigger scalewindowed and scalefullscreen make bottom/topbar more readable.
* osc: move tooltip to inside seekbar for top/bottombarRicardo Constantino2016-10-071-25/+28
| | | | Tooltip border is user-alterable
* osc: change seekbar background's alpha scalingRicardo Constantino2016-10-071-2/+4
| | | | | | This avoids a full transparent seekbar with only boxalpha=115. No change with default values.
* osc: align text vertically in top/bottombarRicardo Constantino2016-10-071-32/+39
| | | | Close #2093
* osc: Fix scaling issues when toggling fullscreenRicardo Constantino2016-09-251-0/+1
| | | | Fixes #3429
* player: fix minor spelling mistake in osc.luaJames Cowgill2016-08-271-1/+1
| | | | | Lintain (https://lintian.debian.org/) complains about this particular spelling mistake.
* Use - as command-name separator everywhereTimotej Lazar2016-07-141-4/+4
| | | | | | | Old-style commands using _ as separator (e.g. show_progress) were still used in some places, including documentation and configuration files. This commit updates all such instances to the new style (show-progress) so that commands are easier to find in the manual.
* osc: fix mouse areaswm42016-03-081-1/+1
| | | | | | | | The scaling was the wrong way around, and the section name was missing. Regression since commit 5fa45fb5. Fixes #2916.
* osd, lua: remove weird OSD scalingwm42016-03-071-9/+30
| | | | | | | | | | | | | | | | | | | | | Do not scale OSD mouse input to the ASS OSD script resolution. The original idea of this mechanism was that the user doesn't have to care about the actual resolution of anything, and can just use the OSD resolution consistently. But this made things worse. Remove the implicit scaling, and always use the screen resolution. (Except with --vo=xv, where additional scaling is forced upon everything.) Drop get_osd_resolution(). There is no replacement. Rename get_screen_size() and get_screen_margins() to use "osd" instead of "screen". For anything but --vo=xv these are equivalent, but with --vo=xv the OSD resolution has additional implicit scaling. Add code to osc.lua which emulates the old behavior. Note that none of the changed functions were public API, so implicit breakage of scripts which used it is just going to happen.
* osc: add always-on mode and unify visibility mode (always/never/auto)Avi Halachmi (:avih)2016-02-271-6/+61
| | | | | | | | | | | | | Adds always-on mode by internally utilizing hidetimeout as negative and forbidding the user to set negative values. This removes script-message to enable/disable the osc, and instead introduces a combined 'visibility' control with the values never/auto/always. It's available via script_opts and script_message as 'osc-visibility'. As message, it also supports a 'cycle' value. The del key is bound to cycling the visibility modes.
* osc: fix runtime enable_osc(true/false)Avi Halachmi (:avih)2016-02-271-4/+11
| | | | | | | | | | | There were few issues: - When it's disabled and then enabled, it was displaying the osc briefly and then autohide right away. Don't do that. - When it's enabled and then disabled, it was not removing the osc from screen if called while the osc is visible (because tick() is responsible for the hide but it doesn't render() the empty osc when the osc is disabled). - Due to delayed/async unbinding of mouse events it was possible to show_osc() after it got disabled e.g. from mouse_move. Prevent this.
* osc: reinit on playlist changesKevin Mitchell2015-08-291-0/+1
| | | | | | This takes care of the corner case where the player is started with a single playlist entry so that the next/prev arrows are greyed out, but remain that way even after new elements are added to the playlist.
* osc: exit tick immediately if disabled.torque2015-08-281-0/+2
| | | | | | | | | | | Even after it has been disabled with the `disable-osc` message, the OSC continues to run the tick function. Completely preventing tick from being called is impractical since there are several different places that it's called in the code, so just make it immediately return if the OSC has been disabled. This prevents the OSC from continuing the clear the OSD on every tick, allowing other scripts to disable it so that they may draw to the OSD.
* osc: avoid annoying verbose mode log spamwm42015-08-101-6/+22
| | | | | | | | enable_key_bindings()/disable_key_bindings() now prints a log message on each call, thus we should avoid makign redundant calls. This could probably be solved more elegantly, but since this is all legacy/private API, don't bother.
* lua: implement input_enable_section/input_disable_section via commandswm4</