summaryrefslogtreecommitdiffstats
path: root/video/out/mac/common.swift
Commit message (Collapse)AuthorAgeFilesLines
* mac: code cleanup and consistency changes, fix linting issuesder richter5 days1-27/+24
|
* mac/helper: make wakeup callback declaration consistentder richter5 days1-1/+1
|
* mac: make display-names unique to allow specific selectionder richter9 days1-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | the Screen property localizedName returns a none unique dynamic name that doesn't allow a specific selection of a Screen on every OS boot. the name consists of the vendor name and model name (eg DELL U2723QE). if the same model display is connected to the system several times, macOS starts to add numbers to the localizedName (eg DELL U2723QE (1)), that may not be associated to the same Screen on every OS boot or connecting the display. it also changes the name of the first connected display by adding that numeration. this makes it impossible specify the proper screen with the screen-name option every time. to circumvent this we remove the enumeration from the name and instead add the serial number to the display-names property. this makes the actual Screen unique and none dynamic. furthermore the selection of a screen by name will check for equality for the old localizedName, simple name without enumeration, serial number and the combined name with serial number. this makes it possible to select the screen by either of those names and identifiers, and keeps backwards compatibility with the old behaviour. Examples: localized name (System Settings name): DELL U2723QE, DELL U2723QE (1) simple name: DELL U2723QE serial number: 123456789 combined name: DELL U2723QE (123456789)
* mac/common: reuse hidpi window scale frame calculation helperder richter2024-04-041-4/+2
|
* mac: cleanup swift bridge header imports and unify themder richter2024-03-291-2/+2
|
* mac/log: rename log functions and cleanup classder richter2024-03-291-18/+18
|
* mac: use LogHelper directly instead of mp_logder richter2024-03-291-3/+3
|
* mac/apphub: move app icon into AppHubder richter2024-03-291-4/+2
| | | | | split up AppHub header in obj-c and c parts and make it a bidirectional bridging.
* mac: optimise and shorten some codeder richter2024-03-211-8/+4
|
* mac/option: rename option structs to properly represent their contentder richter2024-03-211-41/+41
| | | | also optimise option cache setup.
* mac/option: make option helper none optionalder richter2024-03-211-46/+18
| | | | gets rid of some unwrapping boilerplate and nil coalescing operators.
* mac/option: make option helper vo struct independentder richter2024-03-211-2/+3
|
* mac/option: move option functionality from mpv helper to option helperder richter2024-03-211-59/+59
| | | | delete now empty mpv helper
* mac/type: move c<>swift type bridging into a dedicated type helperder richter2024-03-211-20/+20
|
* mac/helper: move input ctx related functionality into new input helperder richter2024-03-141-0/+1
| | | | also make functions thread safe.
* options: remove --focus-on-open and add --focus-onder richter2024-03-101-3/+3
| | | | | | | | | replaces the old focus-on-open option with a more generic focus-on options that can be extended. adjust the only platform that uses that option. Fixes #8337
* mac/vulkan: directly retrieve current render size without cachingder richter2024-03-061-1/+1
| | | | | | the render size cached in ctx->vo->dwidth/dheight can be outdated in some circumstances at the time the context needs resizing. instead use the current render size.
* mac/vulkan: set NSView as layer delegate like recommended by MoltenVKder richter2024-02-291-0/+1
|
* mac: set layer content scale on initder richter2024-02-271-0/+2
| | | | | | | | usually the content scale updates automatically, though on init it is possible the wrong scale is used for the initial rendering leading to a wrongly sized surface. properly set the initial content scale of the layer.
* mac: add support for --input-cursor-passthrough optionder richter2023-12-251-0/+4
|
* mac: update geometry/autofit opts on runtimeder richter2023-12-231-0/+8
|
* mac: add support for window-id propertyder richter2023-12-151-0/+7
| | | | returns the NSWindow
* mac: fix initial window size and position when already maximizedder richter2023-12-021-1/+2
| | | | | | | | | | | | in the case the window was already set to a maximized size via geometry or related options (100%x100%) the maximize function would try to maximize the window again. this reset the position and slightly increased the size further. to prevent this only maximize on init if we really want to maximize. in the reverse case make a noop call by passing the current zoom state. Fixes #11193
* mac: fix a race condition when updating the window titleder richter2023-11-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | | the title is updated on the main thread (mandatory with cocoa) asynchronously, because otherwise it would either deadlock when done synchronously, lead to undefined behaviour or just crashes. the problem here is that the c string was only copied to an NSString within that asynchronous call, which potentially would access the pointer when it is accessed, modified or freed by another thread. it is only safe to access this pointer as long as the control callback wasn't returned yet. to fix this we move the copying and creation of the String from the c string pointer outside of the asynchronous call where the conversion of an untyped pointer to a typed pointer is done too. since the resulting String is a copy it's safe to be used in the asynchronous call. also reverting ee6ad40, since the problem was most likely an SDK problem or the very same problem as mentioned here. i retested the crash case again und can't reproduce it anymore. using a swift String again instead of an NSSstring. Fixes #12935
* mac: change display name retrieval to localizedName NSScreen propertyder richter2023-11-101-2/+2
| | | | | | | | | | | | | | | the old displayName property via the IODisplay API is not working anymore on ARM based macs and was broken in at least one other case. instead we use the new localizedName property introduced in 10.15 of the NSScreen. we don't need any backwards compatibility since 10.15 is the oldest version we support now. configs and scripts that use the options and properties fs-screen-name, screen-name or display-names need to be adjusted since the names could differ from the previous implementation via the IODisplay API. Fixes #9697
* mac: remove runtime checks and compatibility for macOS older than 10.15der richter2023-11-091-17/+2
| | | | | we stopped supporting macOS older than 10.15 and hence can remove all the unnecessary runtime checks and compatibility layers.
* options: transition options from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-211-1/+1
| | | | | | c78482045444c488bb7948305d583a55d17cd236 introduced a bool option type as a replacement for the flag type, but didn't actually transition and remove the flag type because it would have been too much mundane work.
* mac: avoid unnecessary unsafe conversions; fixes crash in debug buildsrcombs2022-09-141-12/+12
| | | | | | | | | | | | | | | Previously, running a debug build of mpv would crash with this output when preinit() at vo_libmpv.c:732 calls control(vo, VOCTRL_PREINIT, NULL): Swift/Optional.swift:247: Fatal error: unsafelyUnwrapped of nil optional This comes from this line of code: var data = UnsafeMutableRawPointer.init(bitPattern: 0).unsafelyUnwrapped Unsafely unwrapping a UnsafeMutableRawPointer.init has always been UB, but the Swift runtime began asserting on it in debug builds a couple macOS versions ago.
* various: fix typosCœur2022-04-251-4/+4
|
* mac: add support for display-width/display-height propertyder richter2021-05-061-13/+20
| | | | | also merge back a helper function that was introduced in commit d3b7732 and for the purpose to be used with the new display res voctrl event.
* mac: fix window geometry calculation on secondary screensder richter2021-04-241-19/+26
| | | | | | | | | | | | | | | this is a regression of af26402, where we changed the geometry calculation to use the visible frame and consider its origin. though the origin is not screen relative but relative to the main screen. the rest of the code expects a screen relative rectangle. because of that windows would be placed out of the screen bounds when not on the main screen. recalculate to origin to be screen relative and use those values for the rest of the calculations. to make the code a bit more comprehensible be a bit more explicit about what is done where with temporary variables and comments. also move the mp_rect calculation that moves the origin and flips the y position to a separate function, so we can reuse it later.
* mac: support --on-all-workspaces optionEvgeny Zinoviev2021-02-211-0/+5
|
* mac: fix dangling pointersder richter2021-01-131-28/+17
| | | | | | initialising UnsafeMutableRawPointer the way we did won't free those pointers and we get dangling pointers. explicitly define a scope those pointers are alive and auto freed.
* mac: fix type mismatch Int instead of Int32der richter2020-12-191-1/+1
|
* mac: use visible frame rectangle for window geometry calculationder richter2020-12-191-12/+18
| | | | | | | | | | | | | currently we use the whole screen rectangle to calculate the window geometry. this doesn't take the menu bar or the Dock into account. by default use the visible screen rectangle instead. this is also a change in behaviour, since the window can't be placed outside of this rectangle anymore. also add an option to change to the old behaviour, because it can still be useful in certain cases, like placing the window directly underneath the menu bar when used a desktop background. Fixes #8272
* mac: support screen-name and fs-screen-name optsder richter2020-12-061-5/+22
| | | | | | | the screen-name and fs-screen-name option allow for specifying screens based on their name. this is the name of the NSScreen and also reported by the VOCTRL_GET_DISPLAY_NAMES event. the old screen and fs-screen options by id, respectively, are preferred over these new ones.
* mac: make focus property observableder richter2020-11-071-0/+32
| | | | | | i missed the VO_EVENT_FOCUS event and the possibility to observe this property and didn't include it in my initial focus commit for that matter.
* mac: add support for the focused propertyder richter2020-09-251-0/+4
|
* mac: add an option to prevent focusing of the window on opender richter2020-09-251-2/+12
| | | | | | | | | on macOS 10.15 setting the activation policy behaves quite weirdly. the call changes the current active App to a nameless process, which probably also the reason that prevents the not focusing to work. a workaround for that, is to refocus the previous active app. Fixes #7725
* mac: add an option to change the App activation policyder richter2020-09-201-1/+18
| | | | useful to hide the app icon in the Dock if necessary.
* mac: add icc profile and ambient light sensor supportder richter2020-08-221-6/+30
| | | | | | this is preparation for new backends. currently this is done via the libmpv API but for future new new VOs not based on libmpv we need these VOCTRL events.
* mac: use config cache und wakeup for mac option runtime changesder richter2020-08-221-1/+40
| | | | | | | | remove the libmpv observer for the macOS specific options and use a config cache + change callback for runtime changes. this is also a preparation for new backends and generalises even more, since libmpv functions can't and shouldn't be used in usual vo backends. for feature parity the config cache is used.
* mac: make ontop level runtime changeableder richter2020-08-221-1/+2
| | | | | | this was requested on an old issue, but the comment has since been deleted. i though it was useful enough to add it. it's also just a one line change.
* mac: properly guard and unwrap an optional valueder richter2020-08-221-8/+12
| | | | | i don't know what i was thinking there, but force unwrapping is a very bad idea.
* cocoa-cb: generalisation of backend independent partsder richter2020-08-221-0/+544
move all backend independent code parts in their own folder and files, to simplify adding new backends. the goal is to only extend one class and add the backend dependent parts there. usually only the (un)init, config and related parts need to be implemented per backend. furthermore all needed windowing and related events are propagated and can be overwritten. the other backend dependent part is usually the surface for rendering, for example the opengl oder metal layer. in the best case a new backend can be added with only a few hundred lines.