Commit Graph

18 Commits

Author SHA1 Message Date
der richter d1be8bb606 mac: fix traditional fullscreen on macOS 11
the fullscreen style mask is not supported on macOS 11 anymore outside
of the native fullscreen animation. this can lead to a none working fs
or in the worst case a crash.

to fix this we will simulate a fullscreen window with a borderless
window with the size of the whole screen, though only on macOS 11.

Fixes #8490
2021-02-27 13:12:46 +01:00
der richter c2868bdd39 mac: remove an unused variable 2021-02-27 13:12:46 +01:00
Evgeny Zinoviev f913570aad mac: support --on-all-workspaces option 2021-02-21 13:38:53 +01:00
der richter dae9ea3fa7 mac: fix dangling pointers
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.
2021-01-13 16:23:47 +01:00
der richter dde0189279 mac: fix type mismatch Int instead of Int32 2020-12-19 21:47:19 +01:00
der richter af26402948 mac: use visible frame rectangle for window geometry calculation
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
2020-12-19 21:37:55 +02:00
der richter 93d071dbd8 mac: fix a window positioning bug when exiting fullscreen
when exiting fullscreen we set the window frame to a aspect fit frame of
the fullscreen frame to prevent aspect ration problems when animating.
though that intermediate frame was set too early and before the system
knew we already exited the fullscreen. because of that the frame we set
could not be properly set and its origin was defaulted to the bottom
left corner for exactly one display refresh and only after that the
wanted frame was set. this led to a (dark) grey area on the right or
top depending on the aspect ratio difference of the screen and video.

to prevent this set the intermediate frame in the animation group to
make it sync with the system's fullscreen behaviour.

Fixes #8371
2020-12-19 15:44:59 +01:00
der richter 96bcf51c39 mac: support screen-name and fs-screen-name opts
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.
2020-12-06 17:36:43 +00:00
der richter d0a2661c5b mac: make focus property observable
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.
2020-11-07 21:38:35 +01:00
der richter 82eda2e5f8 mac: add support for the focused property 2020-09-25 16:48:24 +02:00
der richter 18a35f17e2 mac: add an option to prevent focusing of the window on open
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
2020-09-25 16:48:24 +02:00
der richter 03047a0169 mac: add an option to change the App activation policy
useful to hide the app icon in the Dock if necessary.
2020-09-20 15:28:50 +02:00
der richter e28724d90d mac: add ontop window level for desktop
this puts the window ontop of the desktop but behind the desktop icons.

Fixes #7791
2020-09-20 15:28:50 +02:00
der richter 6c83e91e11 mac: add icc profile and ambient light sensor support
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.
2020-08-22 14:22:49 +02:00
der richter 5fb0f36937 mac: use config cache und wakeup for mac option runtime changes
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.
2020-08-22 14:22:49 +02:00
der richter 9035a51b13 mac: make ontop level runtime changeable
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.
2020-08-22 14:22:49 +02:00
der richter fa982a7cbe mac: properly guard and unwrap an optional value
i don't know what i was thinking there, but force unwrapping is a very
bad idea.
2020-08-22 14:22:49 +02:00
der richter f79a591ae4 cocoa-cb: generalisation of backend independent parts
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.
2020-08-22 14:22:49 +02:00