summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
Commit message (Collapse)AuthorAgeFilesLines
* x11: use xdg-screensaver suspend/resumewm42017-08-151-34/+60
| | | | | | If it doesn't work this time, I'll remove all X11 screensaver code. Fixes #4763.
* x11: drop xscrnsaver usewm42017-08-081-16/+0
| | | | | | | | | | | It's an ancient X11 protocol extension that apparently nobody uses anymore (desktop environments in particular have replaced it with equally bad protocols that require tons of dependencies). Users keep complaining about it being a required dependency. The impact is likely minimal to none. Fixes #4706 and other annoying people.
* x11: add 128x128 sized icon supportXu Zhao2017-07-021-0/+5
|
* x11: load icon differentlywm42017-07-011-83/+40
| | | | | | | | Now it's sourced from the etc/ PNG files directly, instead of preprocessing them with imagemagick. Add some ad-hoc code to decode PNG files with libavcodec. At least we can drop the zlib code in exchange.
* Avoid calling close(-1)wm42017-06-291-2/+4
| | | | | | | | | | While this is perfectly OK on Unix, it causes annoying valgrind warnings, and might be otherwise confusing to others. On Windows, the runtime can actually abort the process if this is called. push.c part taken from a patch by Pedro Pombeiro.
* build: make various x11 protocol extension libs mandatorywm42017-04-211-51/+17
| | | | | | | Reduces the ifdeffery, which is good and will avoid silent breakages, or weird behavior if a lib is omitted. Also reorder the x11_common.c include statements.
* x11: pseudo HiDPI scalingwm42017-01-191-1/+18
| | | | | | | | | | | | | | | | Scale the window by the assumed DPI scaling factor, using 96 DPI as base. For example, a screen that reports 192 DPI is assumed to have a DPI scale factor 2. The window will then be created with twice the size. For robustness reasons, we accept only integer DPI scales between 1 and 9. We also error out if the X and Y scales are very different, as this most likely indicates a multiscreen system with botched size reporting. I'm not sure if reading the X server's DPI is such a good idea - maybe the Xrdb "Xft.dpi" value should be used instead. The current method follows what xdpyinfo does. This can be disabled with --hidpi-window-scale=no.
* vo_opengl: x11: move RGBA visual test to x11_common.cwm42016-12-301-0/+12
| | | | | | | | So that the EGL code can use it too. Also print the actual FB config ID, instead of nonsense. (I _think_ once in the past a certain GLX implementation just used numeric config IDs casted to EGLConfig - or at least that would explain this nonsense.)
* x11: fix external fullscreen updatewm42016-09-231-12/+4
| | | | | | | | | | | | On x11, you can change the fullscreen via the window manager and without mpv's involvement. In these cases, the internal fullscreen flag has to be updated. The hack used for this didn't really work properly. Change it accordingly. The important thing is that the shadow copy of the option is updated. This is still not really ideal. Fixes #3570.
* osdep: rename atomics.h to atomic.hwm42016-09-071-1/+0
| | | | | The standard header is stdatomic.h, so the extra "s" freaks me out every time I look at it.
* vo: use new option update mechanismwm42016-09-021-0/+13
| | | | | | | | | | | | | | | | This is still rather basic. run_reconfig() and run_control() update the options because it's needed for panscan (and other video scaling options), and fullscreen, border, ontop updates. In the old model, these options could be accessed only while both playback thread and VO threads were locked (i.e. during synchronous calls like vo_control()), so this should be sufficient in order not to miss any updates. In the future, a more fine-grained update mechanism could be added to handle these updates "exactly". x11_common.c contains an evil hack, as I see no reasonable way to handle this properly. The VO thread can't "lock" the main thread, so this is not simple.
* vo: change messy handling of fullscreen and other flagswm42016-08-301-4/+0
| | | | | | | | | | | | | | 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.
* 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.
* x11: work around mutter fullscreen issuewm42016-08-251-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | If the video has the same size as the screen, starting with --fs and then leaving fullscreen doesn't actually leave fullscreen. The reason is that mpv tries to restore the previous window size if necessary (otherwise, you'd end up with a Window of nearly the same size as the screen with some WMs). It will typically restore with the rectangle set exactly to the screen if no other position or size is forced. This triggers pre-EWMH fullscreen mode, which WMs detect using various heuristics. Apparently we triggered this with mutter (but strangely no other WMs). It's possible that pre-EWMH fullscreen mode actually requires removing decorations, and mutter either ignores this. But this is speculation and I haven't checked. Work this around by reducing the requested size by 1 pixel if it happens. This was observed with mutter 3.18.2. Fixes #2072.
* osdep/io: introduce mp_flush_wakeup_pipe()Rostislav Pehlivanov2016-07-301-4/+2
| | | | Makes a fairly common occurence with wakeup_pipes easier to handle.
* x11: do not accidentally discard event flagswm42016-07-251-5/+4
| | | | | | | | | It seems vo_x11_check_events() was supposed to return the currently flagged events and reset them. But there are many places where vo_x11_check_events() is called without checking its return value. This could lead to forgotten events. Change the code such that they can't get lost.
* x11, wayland: do not accidentally close FD 0wm42016-07-211-0/+1
| | | | | | | | | | 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.
* x11: stop using vo.event_fdwm42016-07-201-1/+34
| | | | Instead let it do its own event loop wakeup handling.
* x11: skip ICC update on every window movewm42016-07-181-11/+25
| | | | | | | Don't just cause vo_opengl to update the ICC profile every time the window is moved. Instead, explicitly check if the screen was changed. Mostly untested.
* x11: add missing FocusChangeMaskwm42016-07-081-1/+1
| | | | | So we actually get FocusOut events. Disables key repeat when losing focus while a key is down.
* x11_common: silence xdg-screensaverBen Boeckel2016-07-051-1/+1
| | | | | Some screen lockers have a habit of dumping output to the terminal when their output is reset. Ignore its output to keep the TTY output clean.
* x11: tell GNOME to use dark window decorationsMantas Mikulėnas2016-05-091-0/+1
|
* x11: slightly safer X11 error handler behaviorwm42016-05-081-1/+4
| | | | | | | | | | | The X11 error handler is global, and not per-display. If another Xlib user exists in the process, they can conflict. In theory, it might happen that e.g. another library sets an error handler (overwriting the mpv one), and some time after mpv closes its display, restores the error handler to mpv's one. To mitigate this, check if the error log instance is actually set, instead of possibly crashing. The change in vo_x11_uninit() is mostly cosmetic.
* x11: add --x11-bypass-compositor=alwayswm42016-05-061-0/+1
| | | | Also add missing documentation for fs-only, and correct the default.
* x11: extend --x11-bypass-compositor with fs-only optionwm42016-05-021-6/+22
| | | | | | | | | | The "fs-only" choice sets the _NET_WM_BYPASS_COMPOSITOR to 1 if the window is fullscreened, and 0 otherwise. (0 is specified to be the implicit default - i.e. no change is requested in windowed mode.) In particular, change the default to "fs-only". Fixes #2582.
* x11, input: move mime type drag&drop negotiation to common codewm42016-03-151-2/+52
| | | | | | | | | | | | | Drag&drop mechanisms typically support multiple types for the drop data. Move most of the logic which types are accepted and preferred to event.c, where the data is also interpreted. (Maybe sorting the types by assigning scores is over-engineered, since they're already sorted by preference, but it's actually not much more code.) Not very interesting/meaningful yet, but preparation for the next commit.
* x11: move vo->input_ctx accesses to x11->input_ctxwm42016-03-151-19/+20
| | | | | | Reduces VO access and makes the code more self-contained. (One day the windowing backend code should not access the VO anymore. We're just not quite there yet.)
* x11: stop waiting for MapNotify when WM_STATE changesTracerneo2016-01-311-1/+3
| | | | Signed-off-by: wm4 <wm4@nowhere>
* x11: get *current* XRandR screen configurationNils Schneider2016-01-201-1/+1
| | | | | | | | | | | | Only request the current screen configuration instead of polling for new screens, too. We're not interested in detecting any new screens as we're merely enumerating what is currently connected and configured. On some hardware (like mine) calling XRRGetScreenResources will stall X11 for about 10 to 20 seconds. This has annoyed me for a few months now and almost made me switch to VLC ;) Signed-off-by: wm4 <wm4@nowhere>
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-111-1/+1
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* x11: silence xdg-screensaver failure messagewm42016-01-031-2/+2
|
* vo: get rid of vo_get_window_title()wm42015-12-061-6/+7
| | | | | | | | | | | It always was a weird artifact - VOCTRLs are meant _not_ to require special handling in the code that passes them through (like in vo.c). Removing it is also interesting to further reduce the dependency of backends on struct vo. Just get rid of it. Removing it is somewhat inconvenient, because in many situations the UI window is created after the first VOCTRL_UPDATE_WINDOW_TITLE. This means these backends have to store it in a new field in their own context.
* x11: request bypassing compositorwm42015-11-181-0/+6
| | | | | | | Maybe this is a good idea. Also add an option to disable it again, for the sake of testing. Fixes #2502.
* x11: print Xlib errors in verbose mode if Xlib messages are silencedwm42015-11-071-9/+5
| | | | Follow up to commit b984ec52.
* vo_opengl: x11: silence error messages when using legacy GL contextwm42015-11-061-1/+11
| | | | | | | | glXCreateContextAttribsARB() by design can throw some X11 errors. We ignore these, but we generally still print error messages to the terminal. This was confusing/annoying users, so silence it. The stupid part is that the Xlib error handler is global, so we have to be slightly careful here.
* x11: separate window creation and configurationwm42015-09-301-25/+28
| | | | | | | | | | | | | | | | | | | This gets rid of an old hack, VOFLAG_HIDDEN. Although handling of it has been sane for a while, it used to cause much pain, and is still unintuitive and weird even today. The main reason for this hack is that OpenGL selects a X11 Visual for you, and you're supposed to use this Visual when creating the X window for the OpenGL context. Which means the X window can't be created early in the common X11 init code, but the OpenGL code needs to do something before that. API-wise you need separate functions for X11 init and X11 window creation. The VOFLAG_HIDDEN hack conflated window creation and the entrypoint for resizing on video resolution change into one function, vo_x11_config_vo_window(). This required all platform backends to handle this flag, even if they didn't need this mechanism. Wayland still uses this for minor reasons (alpha support?), so the wayland backend must be changed before the flag can be entirely removed.
* x11: drag and drop append with modifierKevin Mitchell2015-08-301-1/+7
| | | | | | | If the drag and drop action is anything other than XdndActionCopy, append the dropped files rather than replacing the existing playlist. With most file managers, this will mean at least pressing shift while dropping.
* 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.
* x11: move GCs and background clearing to vo_xvwm42015-07-011-40/+0
| | | | vo_xv.c is the only place where these things are used.
* x11: remove clear on mapwm42015-07-011-11/+0
| | | | | | | | Less code, and avoids a black flash on start. In theory it could happen that we map the window, and then don't have a frame to draw - but mapping the window is done in the exact moment we have a new frame to display.
* x11: remove trailing spaceswm42015-06-291-1/+1
|
* x11: Handle external fullscreen togglesEduardo Sánchez Muñoz2015-06-281-0/+43
| | | | | | | | | | | | | | | Some window managers let you change the fullscreen state of any window using a key combination. For example, on XFWM you can use Alt+F11 and on Compiz you can configure a key combination with the "Extra WM actions" plugin. With this change mpv will handle these fullscreen state changes. So, if you enter into fullscreen mode using the WM's shortcut and then you use mpv's fullscreen toggle, you will get back into window mode. Merges PR #2081. Signed-off-by: wm4 <wm4@nowhere>
* x11: make screensaver failure message slightly more friendlywm42015-06-201-2/+4
|
* x11: never forcefully terminate xdg-screensaver processwm42015-05-181-8/+5
| | | | | | It sometimes happens on exit, and it's probably a bad idea. If the process hangs on exit (possibly due to stupid hardcoded timeouts it's doing), mpv will also hang now, unfortunately.
* x11: attempt to make initial fullscreening more reliablewm42015-05-151-0/+3
| | | | | | | | | | | | | | It appears some WMs have a problem with out method of setting initial fullscreen mode. We assume that if the window's _NET_WM_STATE includes _NET_WM_STATE_FULLSCREEN before mapping the window, the WM will show it as fullscreen at mapped. EWMH doesn't say anything that this should work, although one could argue that it's implied. In any case, since it's not standard behavior without at least some doubt, it's probably a good idea to try the "old" method as well. Fortunately, it should be idempotent. See #1937, #1920.
* x11: query ICC profile based on center of windowNiklas Haas2015-04-291-1/+3
| | | | | | | | | | Right now, the default behavior is to pick the numerically lowest screen ID that overlaps the window in any way - but this means that mpv will decide to pick an ICC profile in a pretty arbitrary way even if the window only overlaps another screen by a single pixel. The new behavior is to query it based on the center of the window instead.
* x11: actually disable screensaverwm42015-04-151-12/+55
| | | | | | | | | | | | | | | | | | | We already use 2 screensaver APIs when attempting to disable the screensaver: XResetScreenSaver() (from xlib) and XScreenSaverSuspend (from the X11 Screen Saver extension). None of these actually work. On modern desktop Linux, we are expected to make dbus calls using some freedesktop-defined protocol (and possibly we'd have to fallback to a Gnome specific one). At least xscreensaver doesn't respect the "old" APIs either. Solve this by running the xdg-screensaver script. It's a terrible, ugly piece of shit (just read the script if you disagree), but at least it appears to work everywhere. It's also simpler than involving various dbus client libraries. I hope this can replace the --heartbeat-cmd option, and maybe we could remove our own DPMS/XSS code too.
* Update license headersMarcin Kurczewski2015-04-131-5/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* x11: ignore mouse enter/leave events due to pointer grabwm42015-03-111-0/+4
| | | | | | | | | | | If you click on a window that doesn't have a focus, a LeaveNotify followed by a EnterNotify event can be generated. The former will have mode set to NotifyGrab, the latter to NotifyUngrab. This will make the player think the mouse left the window, even though this is not the case. Ignore these and only react to those with mode set to NotifyNormal. Probably fixes #1672, and some other strange issues on some WMs.
* x11: fix VOCTRL_GET_WIN_STATEwm42015-03-091-0/+1
| | | | | | | | | | Do not rely on the pointed-to argument to be initialized; VOCTRLs are supposed to completely overwrite them on success (or not to touch them on failure). The currently only caller of VOCTRL_GET_WIN_STATE initializes the value before calling this, so this is merely about correctness and didn't lead to any actual bugs.
* vo_opengl/x11: fix automatic ICC profile loadingMartin Herkt2015-03-071-0/+3
| | | | | | | | | | | | mpv would attempt to load ICC profiles several times during VO init even if no window is displayed. This potentially causes it to load a profile for a different screen than it is going to be displayed on, thereby invalidating the profile cache and rebuilding the LUT every single time. It would not unload a previously loaded profile when the video window is moved to a display without an installed profile. Fix these issues and tweak the log messages a little.
* input: add MOUSE_ENTER keybinding.torque2015-02-181-1/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* x11: fix uninitialized variable readswm42015-02-141-1/+1
| | | | This line of code ended up in the wrong block in commit cd6dfcbe.
* x11: add XK_Cancel to the list of special keysMartin Herkt2015-02-141-0/+1
| | | | | Some IR receivers emit this key by default for remote control buttons. Make it mappable.
* x11: return a framerate even if no window is mappedwm42015-02-131-8/+11
| | | | | Falls back to the first display in the list returned by xrandr. Not entirely correct, but makes some people happy (see #1575).
* x11: make all XF86 special keys mappablewm42015-02-131-0/+7
| | | | | | | | Makes all keys documented in XF86keysym.h mappable. This requires the user to deal with numeric keycodes; no names are queried or exported. This is an easy way to avoid adding all the hundreds of XF86 keys to our X11 lookup table and mpv's keycode/name list.
* video/out: cosmetics: rename VO_EVENT_ICC_PROFILE_PATH_CHANGEDwm42015-01-261-2/+2
| | | | | Remove the "PATH" bit, because VOCTRL_GET_ICC_PROFILE returns an in- memory profile, and not a path. (This was changed a while ago.)
* vo_opengl, x11: implement icc-profile-autowm42015-01-261-4/+33
| | | | | | | | | | | | | | | | | This queries the _ICC_PROFILE property on the root window. It also tries to reload the ICC when it changes, or if the mpv window changes the monitor. (If multiple monitors are covered, mpv will randomly select one of them.) The official spec is a dead link on freedesktop.org, so don't blame me for any bugs. Note that this assumes that Xinerama screen numbers match the way mpv enumerates the xrandr monitors. Although there is some chance that this matches, it most likely doesn't, and we actually have to do complicated things to map the screen numbers. If it turns out that this is required, I will fix it as soon as someone with a suitable setup for testing the fix reports it.
* x11: remove unnecessary codewm42015-01-231-3/+0
|
* x11: fix initial state for --on-all-workspaceswm42015-01-171-0/+6
|
*