diff options
author | wm4 <wm4@nowhere> | 2014-11-02 20:48:45 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-02 20:55:07 +0100 |
commit | 416c86f3cb3535a5b252b8c08a7f4cb253fa495a (patch) | |
tree | e4124d52d879ee55ceca6896da16ebf832f49129 /video/out/x11_common.c | |
parent | 4e2574f025b9f143140008cbed48f6ee9705f813 (diff) | |
download | mpv-416c86f3cb3535a5b252b8c08a7f4cb253fa495a.tar.bz2 mpv-416c86f3cb3535a5b252b8c08a7f4cb253fa495a.tar.xz |
command: add window-minimized property (X11 only)
More or less requested by #1237.
Should be simple to extend this to other backends.
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r-- | video/out/x11_common.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 04f475ec5f..1779c5c29e 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -952,6 +952,8 @@ int vo_x11_check_events(struct vo *vo) MP_VERBOSE(x11, "not waiting for MapNotify\n"); x11->pseudo_mapped = true; } + } else if (Event.xproperty.atom == x11->atom_wm_state) { + x11->pending_vo_events |= VO_EVENT_WIN_STATE; } break; default: @@ -1229,6 +1231,7 @@ static void vo_x11_create_window(struct vo *vo, XVisualInfo *vis, } x11->atom_frame_exts = XA(x11, _NET_FRAME_EXTENTS); + x11->atom_wm_state = XA(x11, _NET_WM_STATE); } static void vo_x11_map_window(struct vo *vo, struct mp_rect rc) @@ -1584,6 +1587,22 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg) } return VO_TRUE; } + case VOCTRL_GET_WIN_STATE: { + if (!x11->window) + return VO_FALSE; + int num_elems; + long *elems = x11_get_property(x11, x11->window, x11->atom_wm_state, + XA_ATOM, 32, &num_elems); + if (elems) { + Atom hidden = XA(x11, _NET_WM_STATE_HIDDEN); + for (int n = 0; n < num_elems; n++) { + if (elems[n] == hidden) + *(int *)arg |= VO_WIN_STATE_MINIMIZED; + } + XFree(elems); + } + return VO_TRUE; + } case VOCTRL_SET_CURSOR_VISIBILITY: vo_set_cursor_hidden(vo, !(*(bool *)arg)); return VO_TRUE; |