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
der richter
055e9cd93e
mac/helper: move input ctx related functionality into new input helper
...
also make functions thread safe.
2024-03-14 23:33:15 +01:00
der richter
f3e5fea4f5
mac/events: move input ctx related functionality into new input helper
...
preparation for mac/events cleanup and single responsibility principle.
all functions are thread safe.
2024-03-14 23:33:15 +01:00
der richter
8a37f0f693
mac/menu: add explicit menu type instead of an inferred type
...
with the use of an explicit type we can removed inferred type checks
like separators/services menu by name or menus by sub configs.
2024-03-07 01:03:52 +01:00
der richter
16ea688115
mac/menu: make menu creation recursive to allow nested submenus
...
also makes menu creation cleaner and more obvious.
2024-03-07 01:03:52 +01:00
der richter
4eb58f6ea7
mac/menu: move conditional Bundle menu items into config
...
only add the "Show log File…" menu item config when invoked from the
bundle, instead of testing on menu item creation. this is similar to the
touch bar menu items now.
2024-03-07 01:03:52 +01:00
der richter
73e494a237
mac/menu: keep track of menu items with dynamic actions
...
keeping track of the dynamic menu items lets us directly access them by
key. we don't need to search in the config array for the right config
and menu item.
2024-03-07 01:03:52 +01:00
der richter
8d4329a710
mac/menu: merge file and url config properties
...
a file path is basically an URL. both are also handled as URL objects
in our code.
2024-03-07 01:03:52 +01:00
der richter
46a9e8c130
mac/menu: properly guard playlist array access
2024-03-07 01:03:52 +01:00
der richter
30eab4b933
mac/menu: attach menu config to menu item for direct access
...
add a config property to the menu items, so we don't need to search in
the config array for the right config.
2024-03-07 01:03:52 +01:00
der richter
95d08df7a7
mac/menu: replace app.command usage with event.command
2024-03-07 01:03:52 +01:00
der richter
37990597c7
mac/menu: fix touch bar menu item
...
the check broke when the runtime check was removed, eg the menu item was
never added to the menu. since we only add the menu item to the config
when touch bar support is available the check is completely unnecessary.
2024-03-07 01:03:52 +01:00
der richter
035906dad5
mac/menu: rename Preferences to Settings for consistency with macOS
2024-03-07 01:03:52 +01:00
der richter
ad0573ff8e
mac/menu: remove duplicate key assignment Undo/Zoom
...
this key is already assigned to Undo.
2024-03-07 01:03:52 +01:00
der richter
eadd85a6ac
mac/menu: optimise loading files function
...
don't save files in a temporary array and use an in place mapping.
2024-03-07 01:03:52 +01:00
der richter
cb807ff063
mac/menu: replace deprecated openFile() usage
2024-03-07 01:03:52 +01:00
der richter
996ec6feca
mac/menu: remove unnecessary alert config fields and alert
...
the config folder is created by mpv if it does not exist, so the last
alert is unnecessary.
also change config path priority.
2024-03-07 01:03:52 +01:00
der richter
fe35baa88e
mac/menu: rewrite menu bar in swift
2024-03-07 01:03:52 +01:00
der richter
bbbd6e272c
mac/app: remove unused function
2024-03-07 01:03:52 +01:00
der richter
86fa9b18a3
osdep/mac: make mac naming of files, folders and function consistent
...
rename all macOS namings (osx, macosx, macOS, macos, apple) to mac, to
make naming consistent.
2024-02-28 15:52:47 +01:00