Commit Graph

1002 Commits

Author SHA1 Message Date
der richter 6846338cf2 mac/touchbar: use EventHelper for event handling
also remove remaining old event handling.
2024-03-24 23:03:48 +01:00
der richter f9618ea487 mac/touchbar: move touch bar into AppHub 2024-03-24 23:03:48 +01:00
der richter 3e6c931d90 mac/remote: use EventHelper for event handling 2024-03-24 23:03:48 +01:00
der richter 4107d29c90 mac/touchbar: fix devision by 0 2024-03-24 23:03:48 +01:00
der richter 6d767537d4 mac/remote: fix devision by 0 2024-03-24 23:03:48 +01:00
der richter 5ab3060961 cocoa-cb: use EventHelper for event handling 2024-03-24 23:03:48 +01:00
der richter 2a4bf7ca22 cocoa-cb: use a separate mpv_handle for cocoa-cb to simplify shutdown 2024-03-24 23:03:48 +01:00
der richter 7e07e1a087 mac/apphub: migrate remaining events functionality to new AppHub
add new app_bridge objc file for bridging between mpv core and app
functionality. replace old EventsResponder singleton with AppHub.

another step to clean up all App functionality and have one central
place for it.
2024-03-24 23:03:48 +01:00
der richter deb9d30e90 mac/event: add helper to subscribe to mpv events and property changes
preparation to remove duplicate code from all classes that implement
their own observer loops.
2024-03-24 23:03:48 +01:00
der richter 9cee44147a mac/libmpv: remove unused functions 2024-03-21 18:33:15 +01:00
der richter 9e03ab5e1e mac/option: remove now unused computed option variables 2024-03-21 18:33:15 +01:00
der richter 204e3f0df6 mac/option: rename option structs to properly represent their content
also optimise option cache setup.
2024-03-21 18:33:15 +01:00
der richter f72dfd48d0 mac/libmpv: remove mac option handling in favour of option handler
since the option handler is not optional anymore and available on init
in cocoa-cb we don't need to duplicate this functionality in libmpv
anymore.
2024-03-21 18:33:15 +01:00
der richter b480daad88 mac/option: make option helper none optional
gets rid of some unwrapping boilerplate and nil coalescing operators.
2024-03-21 18:33:15 +01:00
der richter 6defd49aa1 mac/option: make option helper vo struct independent 2024-03-21 18:33:15 +01:00
der richter 90c534a821 mac/option: optimise option pointer access 2024-03-21 18:33:15 +01:00
der richter 2d9be04c00 mac/option: remove unused and obsolete variables 2024-03-21 18:33:15 +01:00
der richter dc5059d027 mac/option: move option functionality from mpv helper to option helper
delete now empty mpv helper
2024-03-21 18:33:15 +01:00
der richter 283d0877c4 mac/type: move c<>swift type bridging into a dedicated type helper 2024-03-21 18:33:15 +01:00
nanahi aff376e066 win32: increase hires timer resolution
timeBeginPeriod() only allows setting minimum timer resolution
to 1 ms. However, modern x86 platforms support a minimum timer
resolution of 0.5 ms. Use NtSetTimerResolution() instead for
the increased resolution, which can be set with MPV_HRT_RES.

Additionally, change the units of mp_start_hires_timers(),
mp_end_hires_timer(), MPV_HRT_RES, and MPV_HRT_MAX to nanoseconds,
in accordance with other functions used in timer.h.
2024-03-19 20:23:25 +01:00
Kacper Michajłow bfd016d101 win32: avoid multi byte string to wide conversion if not needed 2024-03-19 19:58:09 +01:00
Kacper Michajłow fc55f355fc win32: add puts/fputs wrappers 2024-03-19 19:58:09 +01:00
Kacper Michajłow 3372e17d51 win32: optimize mp_vfprintf a little
- remove redundant strlen/wcslen
- reuse allocated temporary buffers

The difference is not big, but it satisfies me to remove those
redundancies.
2024-03-19 19:58:09 +01:00
Kacper Michajłow 8ee25db71f win32: cache GetConsoleMode state for stdout/stderr
GetConsoleMode() can be quite slow and in mpv the mode never changes, so
we can just check it once.

Fixes performance when writing lots of logs to terminal.
2024-03-19 19:58:09 +01:00
Kacper Michajłow 7bdd673a72 win32: don't touch buffering options 2024-03-19 19:56:25 +01:00
Kacper Michajłow fe29152d06 win32-console-wrapper: fix printf specifiers
%s is evaluated as wchar_t only in "Windows classic" semantic. It is not
C standard compliant.

%ls is compatible with both and means the same wchar_t format.

This commit fixes error output from mpv.com.

See: https://devblogs.microsoft.com/oldnewthing/?p=102823
2024-03-19 19:56:25 +01:00
Kacper Michajłow c3843d79de win32: don't pass std handles if they are attached to console
This is default behavior to attach to existing console, passing custom
handles is useful if we want to replace them, but in case they are
already attached to console we want to attach to console directly.

In theory, it should work out of the box because "console-like" handles
should be managed by Windows internally, which works for INPUT and
OUTPUT, but in certain cases, not for ERROR. This allows using VT
features in those cases for stderr too.
2024-03-19 19:56:25 +01:00
nanahi aa08e304c4 Revert "osdep/io: ignore 'x' mode for mp_fopen"
This flag is a GNU extension in C99, but was standardrized in C11,
so mpv should be able to use it. fopen is wrapped on win32 so
non-compliant MSVCRT.dll isn't a concern.
Since the upcoming commit uses this feature it can be brought back.

This reverts commit c36e051470.
2024-03-19 19:30:27 +01:00
nanahi d2bbd7a531 win32: implement shell link target resolving
Adds a function to resolve the target of a shell link (Windows shortcut)
for use by other parts of mpv.
2024-03-19 11:34:00 +01:00
nanahi 465f405703 osdep/main-fn-win: fix implicit conversion warning 2024-03-19 08:58:18 +01:00
nanahi fbea9607be osdep/threads: fix warning: initializer element is not constant 2024-03-19 08:58:18 +01:00
der richter bf1c8acdac mac/touchbar: simplify item and view creation 2024-03-18 20:29:27 +01:00
der richter 9f68214a06 mac/touchbar: optimise time item update 2024-03-18 20:29:27 +01:00
der richter d7cc5cdec1 mac/touchbar: optimise constraint calculation 2024-03-18 20:29:27 +01:00
der richter ef82ef0bb5 mac/touchbar: use DateComponentsFormatter for time formatting 2024-03-18 20:29:27 +01:00
der richter be49f4fe20 mac/touchbar: simplify update items logic 2024-03-18 20:29:27 +01:00
der richter 647bf5d0ba mac/touchbar: take playback speed into account for rate limiting 2024-03-18 20:29:27 +01:00
der richter c8088d801a mac/touchbar: rewrite touch bar in swift 2024-03-18 20:29:27 +01:00
sfan5 ead9f892b3 various: use static assertions where appropriate 2024-03-17 20:04:04 +01:00
der richter 2a36ed9abd mac/input: optimise scroll wheel event handling 2024-03-16 15:29:27 +01:00
der richter a4eddf742d mac/input: move scroll wheel event handling into input helper 2024-03-16 15:29:27 +01:00
der richter 9a4c673dd7 mac/input: optimise mouse movement enabled check 2024-03-16 15:29:27 +01:00
der richter 53722a4082 mac/input: fix switched mouse forward and back button 2024-03-16 15:29:27 +01:00
der richter db4eac140d mac/input: move mouse event handling into input helper 2024-03-16 15:29:27 +01:00
der richter 474e213f52 mac/input: add missing special keys 2024-03-14 23:33:15 +01:00
der richter 556cb7d6a4 mac/input: add simplified mp_keymap init 2024-03-14 23:33:15 +01:00
der richter 4d8ea338de mac/input: remove wrongly mapped modifier keys 2024-03-14 23:33:15 +01:00
der richter 3ef3bbf93d mac/event: move key event handling to input helper and optimise it 2024-03-14 23:33:15 +01:00
der richter 5482eecb8a mac/input: define AltGr mask as static NSEvent.ModifierFlags variable
this makes it possible to properly test for those modifiers in a proper
swift like way.
2024-03-14 23:33:15 +01:00
der richter 18fb71498b mac/events: remove redundant functions and optimise input helper usage
some redundant functions that jump through hoops.
2024-03-14 23:33:15 +01:00