summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r--video/out/x11_common.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 034f785cbc..647a91049c 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -280,6 +280,9 @@ static void vo_set_cursor_hidden(struct vo *vo, bool cursor_hidden)
static int x11_errorhandler(Display *display, XErrorEvent *event)
{
struct mp_log *log = x11_error_output;
+ if (!log)
+ return 0;
+
char msg[60];
XGetErrorText(display, event->error_code, (char *) &msg, sizeof(msg));
@@ -746,8 +749,8 @@ void vo_x11_uninit(struct vo *vo)
if (x11->xim)
XCloseIM(x11->xim);
if (x11->display) {
- x11_error_output = NULL;
XSetErrorHandler(NULL);
+ x11_error_output = NULL;
XCloseDisplay(x11->display);
}
@@ -950,6 +953,22 @@ static int get_mods(unsigned int state)
return modifiers;
}
+static void vo_x11_update_composition_hint(struct vo *vo)
+{
+ struct vo_x11_state *x11 = vo->x11;
+
+ long hint = 0;
+ switch (vo->opts->x11_bypass_compositor) {
+ case 0: hint = 0; break; // leave default
+ case 1: hint = 1; break; // always bypass
+ case 2: hint = x11->fs ? 1 : 0; break; // bypass in FS
+ case 3: hint = 2; break; // always enable
+ }
+
+ XChangeProperty(x11->display, x11->window, XA(x11,_NET_WM_BYPASS_COMPOSITOR),
+ XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&hint, 1);
+}
+
static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
@@ -986,6 +1005,8 @@ static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo)
x11->size_changed_during_fs = false;
x11->pos_changed_during_fs = false;
+
+ vo_x11_update_composition_hint(vo);
}
}
}
@@ -1437,15 +1458,11 @@ static void vo_x11_create_window(struct vo *vo, XVisualInfo *vis,
}
if (!x11->parent) {
- if (vo->opts->x11_bypass_compositor) {
- long v = 1; // request disabling compositor
- XChangeProperty(x11->display, x11->window,
- XA(x11,_NET_WM_BYPASS_COMPOSITOR), XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)&v, 1);
- }
+ vo_x11_update_composition_hint(vo);
vo_x11_set_wm_icon(x11);
vo_x11_update_window_title(vo);
vo_x11_dnd_init_window(vo);
+ vo_x11_set_property_utf8(vo, XA(x11, _GTK_THEME_VARIANT), "dark");
}
vo_x11_xembed_update(x11, 0);
}
@@ -1485,6 +1502,8 @@ static void vo_x11_map_window(struct vo *vo, struct mp_rect rc)
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&v, 1);
}
+ vo_x11_update_composition_hint(vo);
+
// map window
int events = StructureNotifyMask | ExposureMask | PropertyChangeMask |
LeaveWindowMask | EnterWindowMask;
@@ -1731,6 +1750,8 @@ static void vo_x11_fullscreen(struct vo *vo)
x11->size_changed_during_fs = false;
x11->pos_changed_during_fs = false;
+
+ vo_x11_update_composition_hint(vo);
}
int vo_x11_control(struct vo *vo, int *events, int request, void *arg)