summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa_common.m
Commit message (Collapse)AuthorAgeFilesLines
* video: rename VOCTRL_GET_WINDOW_SIZEwm42014-09-051-2/+2
| | | | Make it clear that this accesses the un-fullscreened window size.
* cocoa: macosx_application needs cocoa-applicationFRAU KOUJIRO2014-08-061-2/+7
|
* cocoa: move handleFilesArray: to macosx_eventsFRAU KOUJIRO2014-08-061-2/+2
|
* vo: remove vo_mouse_movement() wrapperwm42014-07-271-1/+1
| | | | So that VO backends don't have to access the VO just for that.
* cocoa: don't send messages to uninitialized gl contextsStefano Pigozzi2014-07-191-1/+6
| | | | | | | This should fix some crashes where we sent makeCurrentContext to a context that was being freed from another thread. /cc @mpv-player/stable
* cocoa: fix regression preventing window resizeStefano Pigozzi2014-07-151-1/+3
| | | | | I introduced this bug in b5bbb49. Sorry! This could fix #943 and #930 even though I can't reproduce those specific bugs.
* cocoa: move CGL context creation to gl_cocoaStefano Pigozzi2014-07-081-111/+16
| | | | | | This approach is similar to what other vo_opengl backends do. It can also be used in the future to create another cocoa backend that renders offscreen with IOSurfaces or FBOs.
* cocoa: add fallback for automatic GPU switchingStefano Pigozzi2014-06-151-1/+14
| | | | | | Not all the hardware supports kCGLPFASupportsAutomaticGraphicsSwitching (apparently all Mid-2010 and before MacBooks do not work with it), so fallback to not asking for this attribute in the GL pixel format.
* cocoa: allow automatic gpu switchingStefano Pigozzi2014-06-151-0/+3
| | | | Fixes #820
* cocoa: switch to CGL APIs for GL context creationStefano Pigozzi2014-06-151-16/+23
| | | | | CGL APIs are lower level thus giving us better control and more options for the context creation.
* cocoa: don't use VOCTRL_UPDATE_SCREENINFOwm42014-05-061-18/+23
|
* options: rename video-related options/propertiesMartin Herkt2014-05-041-2/+2
| | | | | | | | | | | Renamed options: --aspect → --video-aspect --fstype → --x11-fstype --native-fs → --fs-missioncontrol --name → --x11-name Renamed properties: aspect → video-aspect
* cocoa: refactor sync scheduling to a functionStefano Pigozzi2014-04-281-14/+18
| | | | | | | | | This extracts the scheduling logic to a single function which is nicer to keep it consistent. Additionally make sure we don't schedule sync operations from a sync operation itself since that could cause deadlocks (even if it should not be happening with the current code).
* cocoa: move sync section assignments in vo_controlRyan Goulden2014-04-281-4/+4
|
* cocoa: cosmetics: use NSMakeSizeRyan Goulden2014-04-281-1/+1
|
* cocoa: fix native fullscreenRyan Goulden2014-04-281-5/+3
| | | | | | | | | | | | | | | | | | | | | | | This fixes a couple of issues with the Cocoa `--native-fs` mode, primarily: - A ghost titlebar at the top of the screen in full screen: This was caused by the window constraining code kicking in during fullscreen. Simply returning the unconstrained rect from the constraining method fixes the problem. - Incorrect behavior when using the titlebar buttons to enter/exit fullscreen, as opposed to the OSD button. This was caused by mpv's internal fullscreen state going out of sync with the NSWindow's one. This was the case because `toggleFullScreen:` completely bypassed the normal event flow that mpv expects. Signed-off-by: Ryan Goulden <percontation@gmail.com> Change style for mpv, simplify and refactor some of the constraining code. Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
* vo_opengl, cocoa: allow to autoselect a color profileStefano Pigozzi2014-03-311-0/+168
| | | | | | | | | | | | | This commit adds support for automatic selection of color profiles based on the display where mpv is initialized, and automatically changes the color profile when display is changed or the profile itself is changed from System Preferences. @UliZappe was responsible with the testing and implementation of a lot of this commit, including the original implementation of `cocoa_get_icc_profile_path` (See #594). Fixes #594
* vo: merge get rid of vo.aspdat fieldwm42014-01-221-3/+0
| | | | | | | | | | | | Rename vo_get_src_dst_rects() to mp_get_src_dst_rects() and make it independent from the VO (it takes a comical amount of parameters now to pass all required state). Add a convenience wrapper with the name vo_get_src_dst_rects() to vo.c. Replace all aspdat and vo usages with immediate parameters. Functionally, nothing should change, except that the window size is clamped to a minimum of size 1 much earlier, and some log messages change the prefix (don't bother with vo.vo_log stuff).
* cocoa: remove dead codeStefano Pigozzi2014-01-211-7/+0
| | | | This became dead code in commit 3f594c2e.
* video/out: simplify monitor aspect handlingwm42014-01-111-1/+0
| | | | | | | | For some reason, this made all VO backends both set the screen resolution in opts->screenwidth/height, and call aspect_save_screenres(). Remove the latter. Move the code to calculate the PAR-corrected window size from aspect.c to vo.c, and make it so that the monitor PAR is recalculated when it makes sense.
* cocoa: fix window placement on secondary screensStefano Pigozzi2014-01-111-3/+2
| | | | | | | | | | | | | | For a long time the cocoa backend set the xinerama_x/y and used dx/dy from the VO instance. This somewhat worked with some workarounds but wasn't really what was supposed to be happening. Moreover 27e4360, which touched this workaround introduced a regression. New code doesn't set the xinerama_x/y values so that dx/dy are offsets in the current screen (not a virtual screen composed of all the screens). The screen reference detected during VOCTRL_UPDATE_SCREENINFO is also passed down to the window initialization code. Fixes #472
* cocoa: refactor init window positioning codeStefano Pigozzi2014-01-101-2/+1
|
* cocoa: don't reset window size when the video size doesn't changeStefano Pigozzi2014-01-061-15/+14
| | | | Fixes #459
* cocoa: handle files drag and drop on the player video viewStefano Pigozzi2014-01-041-0/+6
|
* Revert "cocoa: unlock on uninit"Stefano Pigozzi2013-12-261-3/+1
| | | | | | Not sure why but this doesn't seem to be needed anymore. This reverts commit 6ead6aa005f1c78a117bde58e48f106cfd1e9806.
* cocoa: sanitize window title string and guard against NULLStefano Pigozzi2013-12-251-1/+6
| | | | | | | | | | | If the utf8 string used to create the NSString for title was invalid utf8, -stringWithUTF8String returned nil and triggered an assertion in Cocoa's framework code. Sanitize the utf8 string and if the sanitation wasn't enough just avoid crashing by not setting a title. Fixes #406
* Fix OSX build; remove all remaining mpvcore references11rcombs2013-12-171-3/+3
|
* cocoa: make borderless window resizableagiz2013-12-071-1/+1
| | | | Fixes #399
* cocoa: unlock on uninitStefano Pigozzi2013-11-261-1/+3
| | | | NSLock should be unlocked before dealloc is called on it.
* cocoa: use window-scale to support video scaling functionalityStefano Pigozzi2013-11-221-0/+7
| | | | | In the cocoa backend you can use cmd+0/1/2 to scale the window. This commit makes it use the new window-scale functionality.
* cocoa: implement window-scaleStefano Pigozzi2013-11-221-0/+20
|
* cocoa: set and clear gl context inside of sync sectionsStefano Pigozzi2013-10-201-6/+6
| | | | | | | The code did not set and unset the current context inside sync sections. I am not sure if this was an actual problem but this is better since the context is linked to a single thread. In my brief tests this seems to avoid garbage to show up in fullscreen.
* cocoa: make --ontop also cover dock+menubarStefano Pigozzi2013-10-121-1/+3
| | | | | This only shows any differences when mpv isn't frontmost and is in fullscreen. Cmd+Tab overlay is still at a higher level as to avoid complete usability fail.
* cocoa_common: add OS X 10.7 compatibility hacks includesStefano Pigozzi2013-10-051-0/+1
| | | | | I forgot these when I split the code. They will hopefully fix compilation on 10.7.
* cocoa_common: call gl_clear indirectlyStefano Pigozzi2013-09-281-2/+11
| | | | | | | glClear needs GL headers and we don't want those in `cocoa_common`. Create a callback in `gl_cocoa` and register it `cocoa_common`. Fixes #264
* cocoa_common: fix deadlockStefano Pigozzi2013-09-281-5/+7
| | | | | | | After rebasing my dev branch it turned out that the code deadlocked on recursive calls of `vo_control`. Make the locking code a little bit smarter by making always skip locking/unlocking if we are executing a chunck of code that is already synchronized with `dispatch_sync`.
* cocoa_common: split the code, refactoring and cleanupsStefano Pigozzi2013-09-281-503/+162
| | | | | | | | | Split the code to several files. The GUI elements now each have they own files and private state. The original code was a mess to respect the retarded mplayer convention of having everything in a single file. This commit also seems to fix the long running bug of artifacts showing randomly when going fullscreen using nVidia GPUs.
* cocoa_common: signal a mouse movement when changing window sizeStefano Pigozzi2013-09-181-0/+8
| | | | | | | | | This is mainly to avoid spurious cursor states due to the mouse moving inside or outside the window as a result of the window resize (with cmd-0/1/2). This avoids complex logic and triggers a mouse move so that the player recomputes the correct cursor state based on the autohide configuration of the user.
* cocoa_common: override core's cursor visibility stateStefano Pigozzi2013-09-181-3/+5
| | | | | | | This keeps the state in sync with the current state in cocoa_common. Infact the cocoa code in mpv can decide wether it really wants to hide the cursor based on the result of the `canHideCursor` method (this is so that the cursor is only hidden when hovering on the video window).
* cocoa_common: remove most of the special handling for cursor autohideStefano Pigozzi2013-09-101-17/+3
| | | | | | | | | | | | | | | This is mostly related to the fullscreen behaviour. cecbd8864 introduces an option to make mpv behave like a OSX user would expect. This commit changes the Cocoa parts of the code to be consistent with the behaviour on X11. Old behaviour is still available through the option mentioned in cecbd8864. There is still custom logic in the cocoa backend and it can probably be moved to core: * Don't perform autohide if the mouse is down * Don't perform autohide outside of the video window Fixes #218 (by accident)
* cocoa_common: remove unlocking from fullscreen functionStefano Pigozzi2013-09-021-12/+0
| | | | | This was added in the past to prevent a deadlock, but is not needed anymore.
* cocoa_common: avoid the opengl view to leak it's stateStefano Pigozzi2013-09-021-7/+13
| | | | | Just because everything is in a single file it doesn't excuse us to have high coupling between C and ObjC code.
* cocoa_common: enable click-through on the video viewStefano Pigozzi2013-09-011-0/+1
| | | | | | Generate a mouse down event on the first click so that one can interact with the OSC directly as opposed to wasting the first click in order to focus the window.
* cocoa_common: track mouse move events when not focusedStefano Pigozzi2013-09-011-1/+1
| | | | | This is really only important with the OSC and makes the tracking code behave more consistently with the X11 one.
* cocoa_common: autohide dock when autohiding menubarStefano Pigozzi2013-08-261-1/+5
| | | | A cocoa bug doesn't allow to do otherwise. Will open a radar later.
* cocoa_common: avoid locking calls when not neededStefano Pigozzi2013-08-231-2/+2
| | | | | | | | | | cocoa_common contains some locking calls to support video outputs that support live resizing (at this moment only vo=opengl). These should not be used unless the VO declares it is multithreaded by registering the resize_redraw callback used for live resizing. Fixes #200
* cocoa_common: fix window positioning with `--geometry`Stefano Pigozzi2013-08-221-10/+5
| | | | | | | | | | | Regression since ff3b98d11c. The window positioning code relied on the visibleFrame's height without taking into account the dock's presence. Also moved the constraining code to the proper method that overrides the original NSWindow behaviour. This avoids having to check for border since the constraining is performed by Cocoa only for titled windows. Fixes #190
* cocoa_common: add precise scrolling supportStefano Pigozzi2013-08-131-16/+11
| | | | | | This adds precise scrolling support. I ran some tests and it seems a little bit smoother and well.. precise. The defaults are rebindable using: AXIS_UP, AXIS_DOWN, AXIS_LEFT and AXIS_RIGHT.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-3/+3
| | | | Followup commit. Fixes all the files references.
* cocoa_common: use new log APIStefano Pigozzi2013-08-011-7/+11
|
* cocoa_common: simplify resize codeStefano Pigozzi2013-07-301-51/+16
| | | | | | | | | | This introduces some changes in resize behaviour. Most importantly the window frame is not constrained to it's screen's `visibleFrame`. Anyone who still wants that kind of behaviour when opening a video, can use `--autofit-larger`. Even though the size of the window is not constrained, it's position is, so that the titlebar will always be visible. When using `--no-border` even the position will not be constrained in any way.
* cocoa_common: fix regression in draggable state computationStefano Pigozzi2013-07-211-0/+1
| | | | Regression introduced in 8fb064de5. Prevented the OSC from working correctly.
* cocoa_common: fix styleStefano Pigozzi2013-07-211-2/+2
|
* cocoa_common: move tracking area setup to updateTrackingAreasStefano Pigozzi2013-07-211-14/+13
| | | | This makes the tracking area work when going in and out of fullscreen.
* cocoa_common: handle keyboard modifiers for mouse eventsStefano Pigozzi2013-07-211-47/+51
|
* cocoa_common: make the fullscreen transition only when necessaryStefano Pigozzi2013-07-201-5/+16
| | | | | This makes the cocoa backend follow more closely the new fullscreen semantics added in c4b08a9a.
* cocoa_common: use a tracking area to handle mouse eventsStefano Pigozzi2013-07-201-33/+52
| | | | | | | | | This change which also flipse the coordinate system of the view, greatly simplifies the mouse event handling code. There are still some uglities mostly related to the cursor visibility code. For instance the core doesn't show the cursor when it receives a mouse leave event.
* cocoa_common: fix typo in commentStefano Pigozzi2013-07-201-1/+1
| | | | Surely it's copy pasta's fault.
* cocoa_common: implement MP_MOUSE_LEAVE notificationsStefano Pigozzi2013-07-201-0/+2
| | | | | This is needed for the OSC. At the moment I'm sending a notification for any mouse movement outside of the video surface. This might be overkill.
* cocoa_common: implement conditional video draggingStefano Pigozzi2013-07-201-14/+30
| | | | | | This was more roundabout than expected, since it looks like the framework caches isMovabileByWindowBackground so in mpv's case it's needed to set it with setMovableByWindowBackground.
* video: remove fullscreen flags chaoswm42013-07-181-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a MPOpts fullscreen field, a mp_vo_opts.fs field, and VOFLAG_FULLSCREEN. Remove all these and introduce a mp_vo_opts.fullscreen flag instead. When VOs receive VOCTRL_FULLSCREEN, they are supposed to set the current fullscreen mode to the state in mp_vo_opts.fullscreen. They also should do this implicitly on config(). VOs which are capable of doing so can update the mp_vo_opts.fullscreen if the actual fullscreen mode changes (e.g. if the user uses the window manager controls). If fullscreen mode switching fails, they can also set mp_vo_opts.fullscreen to the actual state. Note that the X11 backend does almost none of this, and it has a private fs flag to store the fullscreen flag, instead of getting it from the WM. (Possibly because it has to deal with broken WMs.) The fullscreen option has to be checked on config() to deal with the -fs option, especially with something like: mpv --fs file1.mkv --{ --no-fs file2.mkv --} (It should start in fullscreen mode, but go to windowed mode when playing file2.mkv.) Wayland changes by: Alexander Preisinger <alexander.preisinger@gmail.com> Cocoa changes by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
* cocoa_common: change video size when changing screen DPIStefano Pigozzi2013-07-101-0/+8
| | | | | This improves the situation when moving a window from screens with different DPIs.
* core: remove mp_fifo leftoverswm42013-07-041-1/+0
|
* input: require VOs to send key up events, redo input key lookupwm42013-07-021-2/+2
| | | | | | | | | | | | | | Making key up events implicit was sort-of a nice idea, but it's too tricky and unreliable and makes the key lookup code (interpret_keys()) hard to reason about. See e.g. previous commit for subtle bugs and issues this caused. Make key-up events explicit instead. Add key up events to all VOs. Any time MP_KEY_STATE_DOWN is used, the matching key up event must use MP_KEY_STATE_UP. Rewrite the key lookup code. It should be simpler and more robust now. (Even though the LOC increases, because the new code is less "compact".)
* cocoa_common: uninit fs window properlyStefano Pigozzi2013-06-291-0/+3
| | | | | | | | In fullscreen `s->window` is the windowed window. So freeing that didn't get rid of the FS window and OpenGL view. Fixes #122 [ci skip]
* cocoa_common: schedule a redraw frame after a non live resizeStefano Pigozzi2013-06-251-3/+18
| | | | | | | | | | | A redraw forces recalculation of panscan and other stuff not accounted for in the resize_redraw codepath. This is actually a hack but works really well in my tests. Thanks @wm4 and @Cpuroast for the idea. Fixes #86 [ci skip]
* OSX: fix compilation with 10.7 SDKStefano Pigozz