From fd34db6fa562e3a3af8f815dcaf19c99d58d517f Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 Jan 2025 21:29:10 +1000 Subject: [PATCH] Fixed fullscreen in windowed mode. Version 1.8.1. --- mpv.c | 2 +- player.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/mpv.c b/mpv.c index 9e3c174..aea9f9e 100644 --- a/mpv.c +++ b/mpv.c @@ -19,7 +19,7 @@ #include "menu_options.h" #include "mpv_service.h" -static const char *VERSION = "1.8.0" +static const char *VERSION = "1.8.1" #ifdef GIT_REV "-GIT" GIT_REV #endif diff --git a/player.c b/player.c index 6b6a8a0..4182d80 100644 --- a/player.c +++ b/player.c @@ -51,6 +51,7 @@ xcb_window_t VideoWindow = 0; xcb_pixmap_t pixmap = XCB_NONE; xcb_cursor_t cursor = XCB_NONE; int is_softhddevice = 0; +int VideoFullscreen = 0; #ifdef __cplusplus extern "C" @@ -439,6 +440,10 @@ void cMpvPlayer::PlayerGetWindow(string need, xcb_connection_t **connect, xcb_wi //get geometry xcb_get_geometry_cookie_t geocookie; xcb_get_geometry_reply_t *georeply; + xcb_get_property_cookie_t procookie; + xcb_get_property_reply_t *proreply; + xcb_intern_atom_reply_t *areply; + xcb_atom_t NetWmState; geocookie = xcb_get_geometry(*connect, window); georeply = xcb_get_geometry_reply(*connect, geocookie, NULL); @@ -449,6 +454,28 @@ void cMpvPlayer::PlayerGetWindow(string need, xcb_connection_t **connect, xcb_wi y = georeply->y; free(georeply); } + areply = xcb_intern_atom_reply(*connect, xcb_intern_atom(*connect, 0, sizeof("_NET_WM_STATE") - 1, "_NET_WM_STATE"), NULL); + if (areply) { + NetWmState = areply->atom; + free(areply); + + procookie = xcb_get_property(*connect, 0, window, NetWmState, XCB_ATOM_ATOM, 0, sizeof(xcb_atom_t)); + proreply = xcb_get_property_reply(*connect, procookie, NULL); + if (proreply) { + xcb_atom_t NetWmStateFullscreen; + areply = xcb_intern_atom_reply(*connect, xcb_intern_atom(*connect, 0, sizeof("_NET_WM_STATE_FULLSCREEN") - 1, "_NET_WM_STATE_FULLSCREEN"), NULL); + if (areply) { + NetWmStateFullscreen = areply->atom; + free(areply); + + if(((xcb_atom_t *)xcb_get_property_value(proreply))[0] == NetWmStateFullscreen) + VideoFullscreen = 1; + else + VideoFullscreen = 0; + free(proreply); + } + } + } } if (parent) { @@ -602,7 +629,7 @@ void cMpvPlayer::PlayerStart() sprintf(geo, "%dx%d+%d+%d", windowWidth, windowHeight, windowX, windowY); check_error(mpv_set_option_string(hMpv, "geometry", geo)); } - if (!MpvPluginConfig->Windowed) + if (!MpvPluginConfig->Windowed || VideoFullscreen) { check_error(mpv_set_option_string(hMpv, "fullscreen", "yes")); }