Commit Graph

241 Commits

Author SHA1 Message Date
Alexander Preisinger aa5f8ba542 Revert "wayland: don't create our own log context"
This reverts commit beab54506e.

Conflicts:
	video/out/wayland_common.c
2013-09-12 16:29:13 +02:00
Alexander Preisinger 6de1cb2d59 wayland/common: improved error messages
The previous error message were not very usefull.
Also include a hint where to look for solutions.
2013-09-10 17:53:43 +02:00
Alexander Preisinger 683e58066e wayland: update license headers 2013-09-09 18:37:33 +02:00
Alexander Preisinger 56644b8abc wayland: fix memory leaks 2013-08-26 20:34:06 +02:00
Alexander Preisinger beab54506e wayland: don't create our own log context
This was more problematic than useful ([vo/wayland/wayland])
2013-08-26 16:39:05 +02:00
Alexander Preisinger 9af505a796 wayland: remove shm listener for the backend
The obtained information from the shm listener isn't used by anything and is
also wrong now in wayland git master branch because of new shm formats which
need a different way of saving the supported formats.
2013-08-25 22:46:26 +02:00
Alexander Preisinger 8fd274ea3b wayland/egl: rework resizing (again)
Moves a good chunk of the resizing code to wayland_common.c. This makes it
possible to share it with future video drivers.

It doesn't resizit it immediatly, it calcutlates the new position and size and
then shedules a resizing event. This removes the ugly callback and void pointer
from the wayland data structure.
2013-08-25 22:46:26 +02:00
Alexander Preisinger 7cec294d08 wayland: separate shm and cursor context
The display, window, keyboard and cursor structures are now cleanly and
logically separated. Also could prevent a future bug where no shm format is set
when the cursor image is loaded (Never happened until now).
2013-08-19 14:12:39 +02:00
Alexander Preisinger f364a1e3df wayland: add support for precise scrolling
The default value for a standard mouse is 10.0. Because we don't want to
multiply the value in the input config file we scale it down to 1.0.

Hopefully this should work for more precise mousewheels or touchpad, but
I don't have access to such hardware.
2013-08-07 22:15:39 +02:00
Stefano Pigozzi 406241005e core: move contents to mpvcore (2/2)
Followup commit. Fixes all the files references.
2013-08-06 22:52:31 +02:00
Alexander Preisinger 6443a9b16c wayland: switch to the new mp_msg api 2013-07-31 21:52:16 +02:00
wm4 1df2ad7e03 Remove subopt-helper
Finally not used by anything anymore. Farewell.
2013-07-22 22:42:55 +02:00
Alexander Preisinger 3dc063a330 wayland: use a unified struct for the state
This commit removes the pointer to the single different structures for input
and window and puts them as anonymous structures inside the wayland_state
structure.

This has the disadvantage of passing the substructure to the listeners, but the
advantage is that we don't have to allocate them and check for NULL pointers.
This makes it more reliable and easier to follow.
2013-07-18 17:52:56 +02:00
Alexander Preisinger c5b76714a0 wayland: don't resize in gl_wayland.c
The vo_wayland_fullscreen handles resizing for the video, because the video
could still be in fullscreen mode and resizing it in gl_wayland could make it
grow or shrink.
2013-07-18 14:17:30 +02:00
wm4 c4b08a9a11 video: remove fullscreen flags chaos
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>
2013-07-18 14:07:21 +02:00
Alexander Preisinger 6230e0b896 wayland: early aspect calculation in vo_config
Calculate the aspect ratio in vo_config, when we get the window size and in the
inside the resize function we calculate the aspect ratio of the output in order
to determine if we have to change the height or the width of the video.

If the ratio of the output is bigger than the ratio of the video then we have
to set the width accordingly and if the ratio is smaller we change the size.
But only if no resize edges are passed, because this indicates that we want to
change the windows state instead of just a simple resize and the video should
not grow bigger than the requested size.
2013-07-16 19:13:29 +02:00
Alexander Preisinger dc142991f1 wayland: use default fullscreen method
I misunderstood how the different methods work and if we set the size
accordingly to the wayland configure event then METHOD_DEFAULT is what we want.
2013-07-16 16:53:42 +02:00
Alexander Preisinger 1789449a0a wayland: remove mp_fifo header 2013-07-03 22:43:05 +02:00
Alexander Preisinger 56b9dcaabb wayland: fix typo 2013-07-03 19:00:33 +02:00
Alexander Preisinger 8ea39d548b wayland: remove mp_fifo 2013-07-02 18:56:50 +02:00
Alexander Preisinger 37c5867703 wayland: implement MOUSE_LEAVE 2013-07-02 17:31:43 +02:00
wm4 c4766dc3c6 input: require VOs to send key up events, redo input key lookup
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".)
2013-07-02 12:19:16 +02:00
Alexander Preisinger 3866106be5 wayland: use VOCTRL_UPDATE_WINDOW_TTILE 2013-06-16 09:34:31 +02:00
Alexander Preisinger 405182af46 wayland: use VOCTRL_SET_CURSOR_VISIBILITY 2013-05-26 16:44:19 +02:00
Alexander Preisinger bb9b6501fd wayland: introduce vo_wayland_config
This removes the need for exposing vo_wayland_fullscreen and other functions
also this will be usefull for other vos in the future.
2013-05-26 16:44:19 +02:00
wm4 bf10a4fdfa video/out: introduce vo_control for gl_common based VOs
Instead of having separate callbacks for each backend-handled feature
(like MPGLContext.fullscreen, MPGLContext.border, etc.), pass the
VOCTRL responsible for this directly to the backend. This allows
removing a bunch of callbacks, that currently must be set even for
optional/lesser features (like VOCTRL_BORDER).

This requires changes to all VOs using gl_common, as well as all
backends that support gl_common.

Also introduce VOCTRL_CHECK_EVENTS. vo.check_events is now optional.
VO backends can use VOCTRL_CHECK_EVENTS instead to implementing
check_events. This has the advantage that the event handling code in
VOs doesn't have to be duplicated if vo_control() is used.
2013-05-26 16:44:18 +02:00
Alexander Preisinger 2c6c842719 wayland: reworked resizing
This fixes 2 bugs:
 * Resizing very fast breaks the aspect of the window and the width and height
   don't match with the video anymore
 * Pressing 'f' for fullscreen very fast can overwrite the backup variables for
   the previous width and height.

Also includes a better aspect calculation with fluid resizing.
2013-05-07 21:21:37 +02:00
Alexander Preisinger f8c13d6b66 wayland: fix wrong poll comment, check for errors
We only print an error message when POLLERR or POLLHUP occurrs, as the
something did go horribly wrong and the server will either deal with it or
crash.

Also add POLLOUT to the events.
2013-05-02 23:24:14 +02:00
Alexander Preisinger 68d4cc4536 wayland: avoid iterating over all outputs
If we use the output itself as user data we don't have to iterate over all
outputs when the handle_mode event comes.
2013-05-02 21:01:19 +02:00
Alexander Preisinger 57e0a84715 wayland: remove unused stuff 2013-05-02 21:01:19 +02:00
Alexander Preisinger c0b8c35e3b wayland: use new function xkb_keymap_from_buffer
Bump xkbcommon version and use the new xkb_keymap_from_buffer. This is more
secure, because the from_string expects a 0 terminated string, but this cannot
be guaranteed with mmap.
2013-05-02 21:01:19 +02:00
Alexander Preisinger 3899e594ea wayland: remove input modifier variable
This variable was never used anywhere.
2013-05-01 15:46:01 +02:00
Alexander Preisinger db0c3d79f8 wayland: use GetTimerMS for hiding mouse cursor
This commit remove a lot of linux specific code, like epoll. It also reduces
the complexity of the code. Instead of epoll we use poll which makes the
wayland backend more portable to other platforms.
2013-05-01 15:41:33 +02:00
Alexander Preisinger 048c68e5c2 wayland: use mpv internal key auto-repeat handling
This removes a good chunk of code trying to recreate key repeat.
Because the wayland protocol and xkbcommon don't have an interface for
auto-repeating pressed keys.
2013-05-01 13:41:07 +02:00
Alexander Preisinger 1fc58386d1 wayland: fully support cursor autohide options
I missed the special cases in the previous commits.
2013-03-23 12:58:34 +01:00
Alexander Preisinger ba43d98ac2 wayland: use the cursor_autohide_delay option
In the previous implemention the backend always assumed 1 second
instead of honoring the cursor_autohide_delay option
2013-03-11 18:31:09 +01:00
Alexander Preisinger f2debeca66 wayland: move window by grabing it
Because the are no server-side-decorations in the available wayland compositors
use grabbing the surface to move it.
2013-03-11 18:24:12 +01:00
Alexander Preisinger 1198c031e4 vo: Separate vo options from MPOpts
Separate the video output options from the big MPOpts structure and also only
pass the new mp_vo_opts structure to the vo backend.

Move video_driver_list into mp_vo_opts
2013-03-04 23:32:47 +01:00
Alexander Preisinger 7686cd7f04 vo: remove and cleanup globals
Removes almost every global variabel in vo.h and puts them in a special struct
in MPOpts for video output related options.

Also we completly remove the options/globals pts and refresh rate because
they were unused.
2013-03-04 17:40:21 +01:00
wm4 1b09f46338 x11_common: use private variables for window state
Store the window state (position and size) in vo_x11_state, instead of
in vo->dx/dy/dwidth/dheight. The VO variables are overwritten by vo.c on
every vo_config() call, which is extremely not helpful.

Now vo->dx/dy are mostly unused (except for passing the position forced
by the --geometry option), and vo->dwidth/dheight are set for the VO,
and otherwise read for resize detection only.

In the long term, the way vo_config() handles the --geometry option
should be changed, and vo->dx/dy should be removed.

Remove some useless stuff: VO_EVENT_MOVE and VO_EVENT_KEYPRESS were
generated, but unused. Wayland changes by Alexander Preisinger.
2013-03-03 14:19:57 +01:00
Alexander Preisinger bf9b9c3bd0 wayland: add wayland support
All wayland only specific routines are placed in wayland_common.
This makes it easier to write other video outputs.

The EGL specific parts, as well as opengl context creation, are in gl_common.

This backend works for:
    * opengl-old
    * opengl
    * opengl-hq

To use it just specify the opengl backend
    --vo=opengl:backend=wayland
or disable the x11 build.

Don't forget to set EGL_PLATFORM to wayland.

Co-Author: Scott Moreau
(Sorry I lost the old commit history due to the file structure changes)
2013-02-28 20:01:33 +01:00