Skip to content

Commit

Permalink
Merge pull request #47 from ua0lnj/master
Browse files Browse the repository at this point in the history
Fixed fullscreen in windowed mode. Version 1.8.1.
  • Loading branch information
ua0lnj authored Jan 14, 2025
2 parents c1f063a + fd34db6 commit be85d16
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mpv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 28 additions & 1 deletion player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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"));
}
Expand Down

0 comments on commit be85d16

Please sign in to comment.