aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/wayland_common.c
Commit message (Collapse)AuthorAge
* wayland_common: organize and correctly map mouse buttonsGravatar Rostislav Pehlivanov2017-03-17
| | | | | | | 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 grammarGravatar Dario Russo2016-12-21
|
* wayland: destroy input before closing the display connection.Gravatar Emmanuel Gil Peyrot2016-11-27
| | | | | | 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 flagsGravatar wm42016-08-30
| | | | | | | | | | | | | | 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 0Gravatar Rostislav Pehlivanov2016-08-29
| | | | Newer versions of mutter/gnome now ask mpv to resize to 0 by 0 pixels.
* x11, wayland: always round up wait timesGravatar wm42016-08-26
| | | | | 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 switchingGravatar Rostislav Pehlivanov2016-08-01
| | | | | | | 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 resolutionGravatar Rostislav Pehlivanov2016-08-01
| | | | | | 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 bugGravatar Rostislav Pehlivanov2016-07-30
| | | | | | | | | | | 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 ratiosGravatar Rostislav Pehlivanov2016-07-30
| | | | | | | | | 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 sizeGravatar Rostislav Pehlivanov2016-07-30
| | | | | | | | 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 wakeupGravatar Rostislav Pehlivanov2016-07-30
| | | | | | 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 codeGravatar Rostislav Pehlivanov2016-07-30
| | | | | 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 0Gravatar wm42016-07-21
| | | | | | | | | | 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 consistentGravatar Rostislav Pehlivanov2016-07-21
| | | | Half the code had a space before the arguments and half didn't.
* wayland: port to the new wakeup/wait_events frameworkGravatar Rostislav Pehlivanov2016-07-21
| | | | | | | | | | | | 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 pollingGravatar Rostislav Pehlivanov2016-07-19
| | | | | | 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 errorGravatar Rostislav Pehlivanov2016-05-31
| | | | | | | | 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 rateGravatar Rostislav Pehlivanov2016-05-31
| | | | | | | | | | | | 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 supportGravatar Rostislav Pehlivanov2016-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | 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 fullscreenGravatar Emmanuel Gil Peyrot2016-05-08
| | | | | | | | | | | | | | | 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"Gravatar Emmanuel Gil Peyrot2016-03-19
| | | | | | | | | 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 configureGravatar Alexander Preisinger2016-02-07
| | | | | 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 laterGravatar wm42016-01-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.hGravatar Dmitrij D. Czarkoff2016-01-11
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* wayland: fix typo in error messageGravatar Alessandro Ghedini2015-12-27
|
* Revert "vo_wayland: define opaque region"Gravatar Ricardo Vieira2015-10-20
| | | | | | 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 APIGravatar wm42015-10-01
|
* input: add append argument to file drop eventGravatar Kevin Mitchell2015-08-30
| | | | | | 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 callbacksGravatar Jari Vetoniemi2015-08-21
| | | | | | | 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 regionGravatar Jari Vetoniemi2015-03-23
| | | | | This allows compositor to optimize rendering, as it will know mpv is not transparent.
* vo_wayland: share frame callbacks.Gravatar Jari Vetoniemi2015-03-23
| | | | | | | | 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 -WparenthesesGravatar wm42015-03-02
| | | | | | | | | 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.Gravatar torque2015-02-18
| | | | Signed-off-by: wm4 <wm4@nowhere>
* command: unify handling of fullscreen and other VO flagsGravatar wm42015-01-16
| | | | | | | | 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 modifiersGravatar wm42015-01-12
| | | | Includes shift, ctrl, alt, meta.
* wayland: don't compute absurd window sizeGravatar wm42015-01-12
| | | | | | | | | 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.Gravatar Sergey Kvachonok2014-11-29
| | | | | | | | 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 delayGravatar Alexander Preisinger2014-09-19
| | | | | If native-keyrepeat is true then we set the rate and delay reported by the compositor.
* wayland_common: fix changing videos when fullscreenGravatar Alexander Preisinger2014-09-10
| | | | I broke it again.
* video: rename VOCTRL_GET_WINDOW_SIZEGravatar wm42014-09-05
| | | | Make it clear that this accesses the un-fullscreened window size.
* wayland: print some useful outptu infoGravatar Alexander Preisinger2014-09-03
| | | | | Prints output informations, useful for finding out if we detect the right mode and for debugging.
* wayland: only save current mode of outputsGravatar Alexander Preisinger2014-09-03
| | | | Other ones are not needed.
* Move compat/ and bstr/ directory contents somewhere elseGravatar wm42014-08-29
| | | | | | | | | 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 functionsGravatar Alexander Preisinger2014-08-20
| | | | Available and stable since forever (xkbcommon 0.2).
* wayland: dynamically report display fpsGravatar Alexander Preisinger2014-08-18
| | | | | | | | 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 themeGravatar Alexander Preisinger2014-08-13
| | | | | | | | Just always load the theme. It gets freed properly and dosn't bother anyone. Fixes #1012. CC: @mpv-player/stable
* wayland: remove redundant lineGravatar Alexander Preisinger2014-08-06
|
* wayland: changes for nested compositorsGravatar Alexander Preisinger2014-08-06
| | | | | Adds necessary checks for nested compositors which only have limited interfaces. Might also be useful for other minimal compositors.
* vo: remove vo_mouse_movement() wrapperGravatar wm42014-07-27
| | | | So that VO backends don't have to access the VO just for that.