summaryrefslogtreecommitdiff
path: root/src/compositor
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2017-09-24 11:47:35 -0400
committerraveit65 <[email protected]>2017-11-10 19:51:41 +0100
commitb5d6dd0341c31e5ce5c528180774d4dce54ee0a9 (patch)
treee0aa8b2c71bdff68d66f0b36b679152125df1fde /src/compositor
parent9e4ecf38f639c437d5a2678892e38527ce8ab5ec (diff)
downloadmarco-b5d6dd0341c31e5ce5c528180774d4dce54ee0a9.tar.bz2
marco-b5d6dd0341c31e5ce5c528180774d4dce54ee0a9.tar.xz
Make XPresent optional
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor-xrender.c57
1 files changed, 39 insertions, 18 deletions
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index 3773f7ca..33d6ef81 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -1163,12 +1163,12 @@ static gboolean
present_flip (MetaScreen *screen, XserverRegion region, Pixmap pixmap)
{
static uint32_t present_serial;
+ gboolean debug;
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
- /* FIXME: Things break here with BadWindow error */
meta_error_trap_push (display);
XPresentPixmap(xdisplay,
info->output,
@@ -1184,7 +1184,16 @@ present_flip (MetaScreen *screen, XserverRegion region, Pixmap pixmap)
error_code = meta_error_trap_pop_with_return (display, FALSE);
if (error_code)
{
- g_warning ("XPresentPixmap window %p pixmap %p error: %i", (void *)info->output, (void *)pixmap, error_code);
+ debug = DISPLAY_COMPOSITOR (display)->debug;
+
+ if (debug)
+ fprintf (stderr, "XPresentPixmap window %p pixmap %p error: %i\n",
+ (void *)info->output, (void *)pixmap, error_code);
+
+ if (error_code == BadWindow)
+ g_warning ("XPresent is not compatible with your current system configuration.");
+
+ /* Disable the Present extension for this session to prevent frozen windows */
info->use_present = FALSE;
return FALSE;
}
@@ -1477,7 +1486,6 @@ repair_screen (MetaScreen *screen)
damage = info->prev_damage;
}
- /* TODO: Check which region (in damage) gets sent here... */
paint_all (screen, damage, info->root_current);
if (++info->root_current >= NUM_BUFFER)
@@ -2566,6 +2574,7 @@ process_shape (MetaCompositorXRender *compositor,
}
}
+#ifdef HAVE_PRESENT
static void
xrender_present_complete(MetaScreen *screen,
XPresentCompleteNotifyEvent *ce)
@@ -2575,6 +2584,7 @@ xrender_present_complete(MetaScreen *screen,
info->present_pending = False;
repair_screen(screen);
}
+#endif /* HAVE_PRESENT */
static void
process_generic(MetaCompositorXRender *compositor,
@@ -2582,22 +2592,27 @@ process_generic(MetaCompositorXRender *compositor,
{
XGenericEventCookie *ge = (XGenericEventCookie *) event;
- if (ge->extension == compositor->present_major) {
- Display *xdisplay = meta_display_get_xdisplay (compositor->display);
- XGetEventData(xdisplay, ge);
- switch (ge->evtype) {
- case PresentConfigureNotify:
- break;
- case PresentCompleteNotify: {
- XPresentCompleteNotifyEvent *ce = ge->data;
- MetaScreen *screen = find_screen_from_output(compositor->display, ce->window);
- if (screen)
- xrender_present_complete(screen, ce);
- }
- break;
+ if (ge->extension == compositor->present_major)
+ {
+ Display *xdisplay = meta_display_get_xdisplay (compositor->display);
+ XGetEventData(xdisplay, ge);
+ switch (ge->evtype)
+ {
+#ifdef HAVE_PRESENT
+ case PresentConfigureNotify:
+ break;
+ case PresentCompleteNotify:
+ {
+ XPresentCompleteNotifyEvent *ce = ge->data;
+ MetaScreen *screen = find_screen_from_output(compositor->display, ce->window);
+ if (screen)
+ xrender_present_complete(screen, ce);
+ }
+ break;
+#endif /* HAVE_PRESENT */
+ }
+ XFreeEventData(xdisplay, ge);
}
- XFreeEventData(xdisplay, ge);
- }
}
static int
@@ -2763,8 +2778,10 @@ xrender_manage_screen (MetaCompositor *compositor,
if (xrc->has_present)
{
+#ifdef HAVE_PRESENT
info->present_eid = XPresentSelectInput(xdisplay, info->output,
PresentCompleteNotifyMask);
+#endif /* HAVE_PRESENT */
info->use_present = TRUE;
info->present_pending = FALSE;
}
@@ -3266,7 +3283,11 @@ meta_compositor_xrender_new (MetaDisplay *display)
xrc->atom_net_wm_window_type_tooltip = atoms[14];
xrc->show_redraw = FALSE;
xrc->debug = FALSE;
+#ifdef HAVE_PRESENT
xrc->has_present = XPresentQueryExtension(xdisplay, &xrc->present_major, NULL, NULL);
+#else
+ xrc->has_present = 0;
+#endif /* HAVE_PRESENT */
#ifdef USE_IDLE_REPAINT
meta_verbose ("Using idle repaint\n");