summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
Commit message (Collapse)AuthorAgeFilesLines
* wayland_common: organize and correctly map mouse buttonsRostislav Pehlivanov2017-03-171-4/+8
| | | | | | | The function tried to do something clever but ignored the fact that the middle button followed the left button rather than the right. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* Fix mistakes in spelling and grammarDario Russo2016-12-211-3/+3
|
* wayland: destroy input before closing the display connection.Emmanuel Gil Peyrot2016-11-271-1/+1
| | | | | | Fixes a segfault introduced in libwayland e8ad23266f36521215dcd7cfcc524e0ef67d66dd, where a poison value has been introduced to catch this kind of use-after-free bug.
* vo: change messy handling of fullscreen and other flagswm42016-08-301-2/+2
| | | | | | | | | | | | | | Before this commit, all VOs had to toggle the option flag themselves, now command.c does it. I can't really comprehend why it required every VO to do this manually. Maybe it was for rejecting the property/option change if the VO didn't support a specific capability. But then it could have checked the VOCTRL result. In any case, I don't care, and successfully changing the property without doing anything (With some VOs) is fine too. Many things work this way now, and it's simpler overall. This change will be useful for cleaning up VO option handling.
* wayland: reject resize events with either dimension being 0Rostislav Pehlivanov2016-08-291-0/+2
| | | | Newer versions of mutter/gnome now ask mpv to resize to 0 by 0 pixels.
* x11, wayland: always round up wait timeswm42016-08-261-1/+1
| | | | | If wait_us is >0 and <500, the wait time gets rounded down 0, effectively turning this into busy waiting. Round it up instead.
* wayland_common: check for NULL current_output on fs switchingRostislav Pehlivanov2016-08-011-2/+3
| | | | | | | Prevents segfaults when a fullscreen switch is issued before fully initializing the VO. Doesn't change anything since the schedule_resize is only there to resize in case the image size switches, which happens long after init.
* wayland_common: provide the real scaled window resolutionRostislav Pehlivanov2016-08-011-3/+5
| | | | | | It makes more sense to completely abstract this scaling inside the backend so that internally the player only works with real actual drawn pixels.
* wayland_common: fix fullscreen image switching bugRostislav Pehlivanov2016-07-301-3/+4
| | | | | | | | | | | The problem was that when in fullscreen, switching between images did not issue a resize event, causing none of the images to be rendered correctly. This fixes the problem by issuing a resize event with the screen width and height. This commit also moves the zeroing of the events field to when it gets retrieved by mpv rather than randomly after a resize in the vo/backend code.
* wayland_common: prevent black bars on most non-native aspect ratiosRostislav Pehlivanov2016-07-301-0/+3
| | | | | | | | | ssurface_handle_configure()'s width and height are just hints given by the compositor, the application's free to not respect those strictly and to compensate for e.g. aspect ratio. This prevents crazy scenarios in which pictures with portrait aspect ratios have a huge black area to make them 16:9 or whatever the compositor feels like.
* wayland_common: clip window size to the display output sizeRostislav Pehlivanov2016-07-301-5/+7
| | | | | | | | With X11 it was usually left up to the window manager to prevent huge windows from being out of range, but no Wayland compositor will do this right now. Hugely improves usability when using mpv as an image viewer.
* wayland_common: flush wakeup_pipe on a wakeupRostislav Pehlivanov2016-07-301-8/+10
| | | | | | Missed during the recent changes. Also simplify error checking code and check for POLLNVAL as well (the display fd was never actually checked to be valid).
* wayland_common: remove untested/unusable wayland dnd codeRostislav Pehlivanov2016-07-301-183/+1
| | | | | Not worth keeping 200 lines of untestable as of today code which might be broken, if it hasn't been already.
* x11, wayland: do not accidentally close FD 0wm42016-07-211-2/+5
| | | | | | | | | | Both backends have code to close each FD of their wakeup_pipe array. This array is default-initialized with 0, which means if the backends exit before the wakeup pipe is created (e.g. when probing), they would close FD 0. Initialize the FDs with -1. Then we call close(-1) in these situations, which is perfectly allowed and has no bad consequences.
* wayland_common: make function declaration consistentRostislav Pehlivanov2016-07-211-23/+21
| | | | Half the code had a space before the arguments and half didn't.
* wayland: port to the new wakeup/wait_events frameworkRostislav Pehlivanov2016-07-211-61/+33
| | | | | | | | | | | | This fits natively into the vo/backend and allows to simplify the polling code. One new change is the fact that surface_handle_enter flags VO_EVENT_WIN_STATE and VO_EVENT_RESIZE instead of only VO_EVENT_WIN_STATE. Before this, the code hackily relied on the timeout and the loop in the wait_frame function to track and set the scaling factor. Instead, this triggers mpv to run a schedule_resize and adjust the new VO output dimensions immediately. This is also more accurate since surface_handle_enter() gets called when a surface is created, moved and resized, which is exactly what the rest of the player might be interested in.
* vo_wayland: fix high CPU usage due to busy pollingRostislav Pehlivanov2016-07-191-3/+3
| | | | | | There's no need to call wl_display_flush() since all the client-side buffered data has already been flushed prior to polling the fd. Instead only check for POLLIN and the usual ERR+HUP.
* wayland: mark existing dnd entry print as debug rather than an errorRostislav Pehlivanov2016-05-311-1/+1
| | | | | | | | It gets printed on every alt+tab or desktop switch under mutter and weston, and offers no useful information since it's handled by destroying the previous entry. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* wayland: correctly report display refresh rateRostislav Pehlivanov2016-05-311-4/+6
| | | | | | | | | | | | This commit will cause the wayland backend and vo to correctly report the display frame rate. This didn't work as VOCTRL_GET_DISPLAY_FPS was received way too early, before the window was created (and thus current_output set). The VO will now signal VO_EVENT_WIN_STATE after window initialization and upon a resize. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* wayland: implement HIDPI supportRostislav Pehlivanov2016-05-301-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | The wayland protocol exposes scaling done by the compositor to compensate for small window sizes on small high DPI displays. If the program ignores the scaling done, what'll happen is the compositor is going to ask the program to be scaled down by N times the window size and then it'll upscale the program's surface by N times. The scaling algorithm seems to be bilinear so the scaling is quite obvious. This commit sets up callbacks to listen for the scaling factor of each output and, on rescale events, notifies the compositor that the surface's scale is what the compositor asked for and changes the player's surface to the appropriate size, causing no scaling to be done by the compositor. Compositors not supporting this interface will ignore the callbacks and do nothing, keeping program behaviour the same. For compositors supporting and using this interface (mutter), this will fix the rendering to be pixel precise as it should be. Both the opengl wayland backend and the wayland vo have been fixed to support this. Verified to not break either on weston and mutter. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* wayland: use the advertised size in fullscreenEmmanuel Gil Peyrot2016-05-081-7/+0
| | | | | | | | | | | | | | | When we receive the wl_shell_surface::configure event, it makes sense to respect the aspect ratio of the video in windowed mode, but in fullscreen it forces compositing and wastes resources (until atomic modesetting is available everywhere and we can stop having desynchronised planes). Weston mitigates a resolution mismatch by creating black surfaces and compositing them around the fullscreen surface, placed at the middle, while GNOME puts it at the top-left and leaves the rest of the desktop composited below, both of them producing a subpar experience. Fixes #3021, #2657.
* Revert "wayland: set fs mode on every configure"Emmanuel Gil Peyrot2016-03-191-6/+5
| | | | | | | | | Prevents an infinite loop of configure event and set_fullscreen request on Weston and other compositors respecting the protocol. Fixes #2817 This reverts commit eb6b2b6e50e6e3d3db41190ad818d8b966750734.
* wayland: set fs mode on every configureAlexander Preisinger2016-02-071-5/+6
| | | | | Check and set the fullscreen mode on every surface configure event. This prevents gnome from resizing mpvs fullscreen window to a smaller size.
* Relicense some non-MPlayer source files to LGPL 2.1 or laterwm42016-01-191-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This covers source files which were added in mplayer2 and mpv times only, and where all code is covered by LGPL relicensing agreements. There are probably more files to which this applies, but I'm being conservative here. A file named ao_sdl.c exists in MPlayer too, but the mpv one is a complete rewrite, and was added some time after the original ao_sdl.c was removed. The same applies to vo_sdl.c, for which the SDL2 API is radically different in addition (MPlayer supports SDL 1.2 only). common.c contains only code written by me. But common.h is a strange case: although it originally was named mp_common.h and exists in MPlayer too, by now it contains only definitions written by uau and me. The exceptions are the CONTROL_ defines - thus not changing the license of common.h yet. codec_tags.c contained once large tables generated from MPlayer's codecs.conf, but all of these tables were removed. From demux_playlist.c I'm removing a code fragment from someone who was not asked; this probably could be done later (see commit 15dccc37). misc.c is a bit complicated to reason about (it was split off mplayer.c and thus contains random functions out of this file), but actually all functions have been added post-MPlayer. Except get_relative_time(), which was written by uau, but looks similar to 3 different versions of something similar in each of the Unix/win32/OSX timer source files. I'm not sure what that means in regards to copyright, so I've just moved it into another still-GPL source file for now. screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but they're all gone.
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-111-1/+1
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* wayland: fix typo in error messageAlessandro Ghedini2015-12-271-1/+1
|
* Revert "vo_wayland: define opaque region"Ricardo Vieira2015-10-201-9/+0
| | | | | | This reverts commit c10fb4ce9fcd3dbbf69741eb8499c4cfabbf5412. This is already done in vo_wayland.c:resize,324 doing it here makes the window bigger before the video resizes showing a black area while dragging the border.
* vo_opengl: wayland: switch to new internal APIwm42015-10-011-6/+4
|
* input: add append argument to file drop eventKevin Mitchell2015-08-301-1/+1
| | | | | | This puts in place the machinery to merely append dropped file to the playlist instead of replacing the existing playlist. In this commit, all front-ends set this to false preserving the existing behaviour.
* vo_wayland: Wait for frame callbacksJari Vetoniemi2015-08-211-5/+60
| | | | | | | Privdes small api for vo_wayland where one can request frame callback and then wait for it. This will make vo_wayland play video smoothly.
* vo_wayland: define opaque regionJari Vetoniemi2015-03-231-0/+9
| | | | | This allows compositor to optimize rendering, as it will know mpv is not transparent.
* vo_wayland: share frame callbacks.Jari Vetoniemi2015-03-231-0/+30
| | | | | | | | Define frame callback logic in wayland_common.c As this should be used by opengl renderer as well. Preferably drawing should be skipped entierly when no frame callbacks are received. However, for now only swap buffers is skipped.
* buid: readd -Wparentheseswm42015-03-021-1/+1
| | | | | | | | | This warning wasn't overly helpful in the past, and warned against perfectly fine code. But at least with recent gcc versions, this is the warning that complains about assignments in if expressions (why???), so we want to enable it. Also change all the code this warning complains about for no reason.
* input: add MOUSE_ENTER keybinding.torque2015-02-181-0/+1
| | | | Signed-off-by: wm4 <wm4@nowhere>
* command: unify handling of fullscreen and other VO flagswm42015-01-161-0/+1
| | | | | | | | The "ontop" and "border" properties already used a common mp_property_vo_flag() function, and the corresponding VOCTRLs used the same conventions. "fullscreen" is pretty similar, but was handled slightly similar. Change how VOCTRL_FULLSCREEN behaves, and use the same helper function for "fullscreen" as the other flags.
* wayland: implement key modifierswm42015-01-121-18/+24
| | | | Includes shift, ctrl, alt, meta.
* wayland: don't compute absurd window sizewm42015-01-121-3/+6
| | | | | | | | | For some reason, schedule_resize() can be called with everything set to 0. The code couldn't handle wl->window.aspect set to 0, converting NaNs to integers. Just work this around. (I have no idea what I'm doing. This is probably a corner case caused by my broken-ish wayland setup.)
* vo_wayland: Add "multimedia" keyboard key bindings.Sergey Kvachonok2014-11-291-0/+14
| | | | | | | | libxkbcommon keysyms are the same as X11 keysyms (sans prefix), so I simply copied the missing subsection from x11_common.c. Signed-off-by: Sergey Kvachonok <ravenexp@gmail.com> Signed-off-by: wm4 <wm4@nowhere>
* wayland: use reported rete and delayAlexander Preisinger2014-09-191-2/+27
| | | | | If native-keyrepeat is true then we set the rate and delay reported by the compositor.
* wayland_common: fix changing videos when fullscreenAlexander Preisinger2014-09-101-14/+3
| | | | I broke it again.
* video: rename VOCTRL_GET_WINDOW_SIZEwm42014-09-051-2/+2
| | | | Make it clear that this accesses the un-fullscreened window size.
* wayland: print some useful outptu infoAlexander Preisinger2014-09-031-15/+19
| | | | | Prints output informations, useful for finding out if we detect the right mode and for debugging.
* wayland: only save current mode of outputsAlexander Preisinger2014-09-031-1/+2
| | | | Other ones are not needed.
* Move compat/ and bstr/ directory contents somewhere elsewm42014-08-291-1/+1
| | | | | | | | | bstr.c doesn't really deserve its own directory, and compat had just a few files, most of which may as well be in osdep. There isn't really any justification for these extra directories, so get rid of them. The compat/libav.h was empty - just delete it. We changed our approach to API compatibility, and will likely not need it anymore.
* wayland: replace deprecated xkbcommon functionsAlexander Preisinger2014-08-201-3/+3
| | | | Available and stable since forever (xkbcommon 0.2).
* wayland: dynamically report display fpsAlexander Preisinger2014-08-181-20/+58
| | | | | | | | Only reports the most recently entered output if the window is displayed on 2 or more outputs. Should be changed to the lowest fps of all outputs the window is visible. Until no one complains this will have to wait. Look for the VO framedropping for more information on this topic.
* wayland: pointer interface is created after themeAlexander Preisinger2014-08-131-13/+8
| | | | | | | | Just always load the theme. It gets freed properly and dosn't bother anyone. Fixes #1012. CC: @mpv-player/stable
* wayland: remove redundant lineAlexander Preisinger2014-08-061-1/+0
|
* wayland: changes for nested compositorsAlexander Preisinger2014-08-061-20/+50
| | | | | Adds necessary checks for nested compositors which only have limited interfaces. Might also be useful for other minimal compositors.
* vo: remove vo_mouse_movement() wrapperwm42014-07-271-2/+2
| | | | So that VO backends don't have to access the VO just for that.
* wayland: move subsurfaces to wayland voAlexander Preisinger2014-06-151-20/+3
| | | | | | | Subsurfaces are only used by the wayland vo. Thats why it makes sense to move all osd and subsurface specific parts to the vo_wayland.c Also destroy the subsurfaces and subcompositor properly.
* wayland: attach NULL surface on osd creationAlexander Preisinger2014-06-151-0/+3
| | | | | | | When using the EGL output the subsurfaces have no buffer attached and the size seems to be infinite. Fix this by attaching a NULL buffer. Fixes #846
* Add more constwm42014-06-111-2/+1
| | | | | | | While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need.
* wayland: remove stub for unimplemented functionwm42014-06-021-15/+0
|
* wayland: fix typoAlexander Preisinger2014-05-141-14/+14
| | | | So long in the code without me noticing. Embarassing!
* wayland: fix unchecked malloc usagewm42014-05-111-3/+9
| | | | | | | Found by cppcheck. Actually untested. (This is the file drag&drop code, I don't even know which wayland clients support this.)
* wayland: don't use VOCTRL_UPDATE_SCREENINFOwm42014-05-061-19/+22
| | | | Not very tested. Appears to work.
* Revert "wayland: print waylands display erros"Alexander Preisinger2014-04-261-39/+0
| | | | | | | | | | | | This reverts commit 6e34b0ec1f50612cb2767da3dbc27be0be63041d. There has always been an error message "proxy already has a listener" and I couldn't reproduce where it is comming from until now. The display interface already has a listener and we can't overwrite it. Now remove the code and avoid this error message. Conflicts: video/out/wayland_common.c
* Fix some libav* include statementswm42014-04-191-1/+0
| | | | | | | | | | | | | Fix all include statements of the form: #include "libav.../..." These come from MPlayer times, when FFmpeg was somehow part of the MPlayer build tree, and this form was needed to prefer the local files over system FFmpeg. In some cases, the include statement wasn't needed or could be replaced with mpv defined symbols.
* wayland: unset input regions for osdAlexander Preisinger2014-04-161-0/+4
| | | | | Set a zero sized input region for the osd surfaces in order to avoid getting input for the subsurfaces which might dissapear any time.
* wayland/shm: Use subsurfaces for OSDAlexander Preisinger2014-04-161-5/+25
|
* wayland: don't schedule resize if going fullscreenRicardo Vieira2014-04-131-1/+0
| | | | mpv was resizing to the same size before it went to fullscreen, we don't need to schedule a resize because the compositor will send a configure event with the new dimensions and thats when we should do it.
* video/out: simplify monitor aspect handlingwm42014-01-111-2/+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 latt