display: Move composite version checks here

This commit is contained in:
Jasper St. Pierre 2014-08-13 19:32:39 -04:00
parent 879407c10c
commit e935b52e51
3 changed files with 7 additions and 31 deletions

View File

@ -91,18 +91,6 @@ is_modal (MetaDisplay *display)
return display->grab_op == META_GRAB_OP_COMPOSITOR;
}
static inline gboolean
composite_at_least_version (MetaDisplay *display, int maj, int min)
{
static int major = -1;
static int minor = -1;
if (major == -1)
meta_display_get_compositor_version (display, &major, &minor);
return (major > maj || (major == maj && minor >= min));
}
static void sync_actor_stacking (MetaCompositor *compositor);
static void
@ -1197,11 +1185,7 @@ meta_compositor_new (MetaDisplay *display)
{
MetaCompositor *compositor;
if (!composite_at_least_version (display, 0, 3))
return NULL;
compositor = g_new0 (MetaCompositor, 1);
compositor->display = display;
if (g_getenv("META_DISABLE_MIPMAPS"))

View File

@ -415,11 +415,15 @@ enable_compositor (MetaDisplay *display)
return;
}
if (!display->compositor)
display->compositor = meta_compositor_new (display);
int version = (display->composite_major_version * 10) + display->composite_minor_version;
if (version < 3)
{
meta_warning ("Your version of COMPOSITE is too old.");
return;
}
if (!display->compositor)
return;
display->compositor = meta_compositor_new (display);
meta_compositor_manage (display->compositor);
}
@ -3095,15 +3099,6 @@ meta_display_modifiers_accelerator_activate (MetaDisplay *display)
return freeze;
}
void
meta_display_get_compositor_version (MetaDisplay *display,
int *major,
int *minor)
{
*major = display->composite_major_version;
*minor = display->composite_minor_version;
}
/**
* meta_display_get_xinput_opcode: (skip)
* @display: a #MetaDisplay

View File

@ -66,9 +66,6 @@ GType meta_display_get_type (void) G_GNUC_CONST;
#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
void meta_display_get_compositor_version (MetaDisplay *display,
int *major,
int *minor);
int meta_display_get_xinput_opcode (MetaDisplay *display);
gboolean meta_display_supports_extended_barriers (MetaDisplay *display);
Display *meta_display_get_xdisplay (MetaDisplay *display);