Skip to content

Commit be85d16

Browse files
authored
Merge pull request #47 from ua0lnj/master
Fixed fullscreen in windowed mode. Version 1.8.1.
2 parents c1f063a + fd34db6 commit be85d16

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

mpv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "menu_options.h"
2020
#include "mpv_service.h"
2121

22-
static const char *VERSION = "1.8.0"
22+
static const char *VERSION = "1.8.1"
2323
#ifdef GIT_REV
2424
"-GIT" GIT_REV
2525
#endif

player.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ xcb_window_t VideoWindow = 0;
5151
xcb_pixmap_t pixmap = XCB_NONE;
5252
xcb_cursor_t cursor = XCB_NONE;
5353
int is_softhddevice = 0;
54+
int VideoFullscreen = 0;
5455

5556
#ifdef __cplusplus
5657
extern "C"
@@ -439,6 +440,10 @@ void cMpvPlayer::PlayerGetWindow(string need, xcb_connection_t **connect, xcb_wi
439440
//get geometry
440441
xcb_get_geometry_cookie_t geocookie;
441442
xcb_get_geometry_reply_t *georeply;
443+
xcb_get_property_cookie_t procookie;
444+
xcb_get_property_reply_t *proreply;
445+
xcb_intern_atom_reply_t *areply;
446+
xcb_atom_t NetWmState;
442447

443448
geocookie = xcb_get_geometry(*connect, window);
444449
georeply = xcb_get_geometry_reply(*connect, geocookie, NULL);
@@ -449,6 +454,28 @@ void cMpvPlayer::PlayerGetWindow(string need, xcb_connection_t **connect, xcb_wi
449454
y = georeply->y;
450455
free(georeply);
451456
}
457+
areply = xcb_intern_atom_reply(*connect, xcb_intern_atom(*connect, 0, sizeof("_NET_WM_STATE") - 1, "_NET_WM_STATE"), NULL);
458+
if (areply) {
459+
NetWmState = areply->atom;
460+
free(areply);
461+
462+
procookie = xcb_get_property(*connect, 0, window, NetWmState, XCB_ATOM_ATOM, 0, sizeof(xcb_atom_t));
463+
proreply = xcb_get_property_reply(*connect, procookie, NULL);
464+
if (proreply) {
465+
xcb_atom_t NetWmStateFullscreen;
466+
areply = xcb_intern_atom_reply(*connect, xcb_intern_atom(*connect, 0, sizeof("_NET_WM_STATE_FULLSCREEN") - 1, "_NET_WM_STATE_FULLSCREEN"), NULL);
467+
if (areply) {
468+
NetWmStateFullscreen = areply->atom;
469+
free(areply);
470+
471+
if(((xcb_atom_t *)xcb_get_property_value(proreply))[0] == NetWmStateFullscreen)
472+
VideoFullscreen = 1;
473+
else
474+
VideoFullscreen = 0;
475+
free(proreply);
476+
}
477+
}
478+
}
452479
}
453480

454481
if (parent) {
@@ -602,7 +629,7 @@ void cMpvPlayer::PlayerStart()
602629
sprintf(geo, "%dx%d+%d+%d", windowWidth, windowHeight, windowX, windowY);
603630
check_error(mpv_set_option_string(hMpv, "geometry", geo));
604631
}
605-
if (!MpvPluginConfig->Windowed)
632+
if (!MpvPluginConfig->Windowed || VideoFullscreen)
606633
{
607634
check_error(mpv_set_option_string(hMpv, "fullscreen", "yes"));
608635
}

0 commit comments

Comments
 (0)