clutter: Remove 'features'

There are no 'features' left, the last one, GLSL shader support, was
moved to Cogl.

This also move the Cogl context creation to a more sensible place, as it
was hidden away in the feature initialization.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2015>
This commit is contained in:
Jonas Ådahl 2021-09-17 23:17:24 +02:00 committed by Marge Bot
parent 74230038c9
commit 9a68fb19e4
9 changed files with 1 additions and 212 deletions

View File

@ -71,7 +71,6 @@ struct _ClutterBackendClass
ClutterStageWindow * (* create_stage) (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error);
void (* init_features) (ClutterBackend *backend);
CoglRenderer * (* get_renderer) (ClutterBackend *backend,
GError **error);
CoglDisplay * (* get_display) (ClutterBackend *backend,

View File

@ -903,20 +903,6 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/
CLUTTER_SCROLL_SMOOTH
} ClutterScrollDirection;
/**
* ClutterFeatureFlags:
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
*
* Runtime flags indicating specific features available via Clutter window
* system and graphics backend.
*
* Since: 0.4
*/
typedef enum
{
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
} ClutterFeatureFlags;
/**
* ClutterFlowOrientation:
* @CLUTTER_FLOW_HORIZONTAL: Arrange the children of the flow layout

View File

@ -1,142 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
/**
* SECTION:clutter-feature
* @short_description: Run-time detection of Clutter features
*
* Parts of Clutter depend on the underlying platform, including the
* capabilities of the backend used and the OpenGL features exposed through the
* Clutter and COGL API.
*
* It is possible to ask whether Clutter has support for specific features at
* run-time.
*/
#include "clutter-build-config.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "clutter-backend-private.h"
#include "clutter-feature.h"
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-debug.h"
#include "cogl/cogl.h"
typedef struct ClutterFeatures
{
ClutterFeatureFlags flags;
guint features_set : 1;
} ClutterFeatures;
static ClutterFeatures* __features = NULL;
static ClutterFeatureFlags
clutter_features_from_cogl (void)
{
ClutterFeatureFlags clutter_flags = 0;
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
return clutter_flags;
}
gboolean
clutter_feature_init (ClutterMainContext *context,
GError **error)
{
CLUTTER_NOTE (MISC, "checking features");
if (!__features)
{
CLUTTER_NOTE (MISC, "allocating features data");
__features = g_new0 (ClutterFeatures, 1);
__features->features_set = FALSE; /* don't rely on zero-ing */
}
if (__features->features_set)
return TRUE;
/* makes sure we have a GL context; if we have, this is a no-op */
if (!_clutter_backend_create_context (context->backend, error))
return FALSE;
__features->flags = clutter_features_from_cogl ();
__features->features_set = TRUE;
CLUTTER_NOTE (MISC, "features checked");
return TRUE;
}
/**
* clutter_feature_available:
* @feature: a #ClutterFeatureFlags
*
* Checks whether @feature is available. @feature can be a logical
* OR of #ClutterFeatureFlags.
*
* Return value: %TRUE if a feature is available
*
* Since: 0.2
*/
gboolean
clutter_feature_available (ClutterFeatureFlags feature)
{
if (G_UNLIKELY (!__features))
{
g_critical ("Unable to check features. Have you initialized Clutter?");
return FALSE;
}
return (__features->flags & feature);
}
/**
* clutter_feature_get_all:
*
* Returns all the supported features.
*
* Return value: a logical OR of all the supported features.
*
* Since: 0.2
*/
ClutterFeatureFlags
clutter_feature_get_all (void)
{
if (G_UNLIKELY (!__features))
{
g_critical ("Unable to check features. Have you initialized Clutter?");
return FALSE;
}
return __features->flags;
}

View File

@ -1,42 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_FEATURE_H__
#define __CLUTTER_FEATURE_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
CLUTTER_EXPORT
gboolean clutter_feature_available (ClutterFeatureFlags feature);
CLUTTER_EXPORT
ClutterFeatureFlags clutter_feature_get_all (void);
G_END_DECLS
#endif /* __CLUTTER_FEATURE_H__ */

View File

@ -55,7 +55,6 @@
#include "clutter-backend-private.h"
#include "clutter-debug.h"
#include "clutter-event-private.h"
#include "clutter-feature.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-graphene.h"
@ -522,10 +521,7 @@ clutter_init_real (ClutterMainContext *clutter_context,
if (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)
g_message ("Enabling damaged region");
/* this will take care of initializing Cogl's state and
* query the GL machinery for features
*/
if (!clutter_feature_init (clutter_context, error))
if (!_clutter_backend_create_context (clutter_context->backend, error))
return FALSE;
clutter_text_direction = clutter_get_text_direction ();

View File

@ -34,7 +34,6 @@
#include "clutter-backend.h"
#include "clutter-effect.h"
#include "clutter-event.h"
#include "clutter-feature.h"
#include "clutter-id-pool.h"
#include "clutter-layout-manager.h"
#include "clutter-settings.h"
@ -167,9 +166,6 @@ CLUTTER_EXPORT
gboolean _clutter_context_is_initialized (void);
gboolean _clutter_context_get_show_fps (void);
gboolean clutter_feature_init (ClutterMainContext *clutter_context,
GError **error);
/* Diagnostic mode */
gboolean _clutter_diagnostic_enabled (void);
void _clutter_diagnostic_message (const char *fmt, ...) G_GNUC_PRINTF (1, 2);

View File

@ -119,7 +119,6 @@
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-feature.h"
#include "clutter-private.h"
#include "clutter-shader-types.h"

View File

@ -59,7 +59,6 @@
#include "clutter-enums.h"
#include "clutter-enum-types.h"
#include "clutter-event.h"
#include "clutter-feature.h"
#include "clutter-fixed-layout.h"
#include "clutter-flow-layout.h"
#include "clutter-frame-clock.h"

View File

@ -33,7 +33,6 @@ clutter_headers = [
'clutter-effect.h',
'clutter-enums.h',
'clutter-event.h',
'clutter-feature.h',
'clutter-fixed-layout.h',
'clutter-flow-layout.h',
'clutter-frame-clock.h',
@ -123,7 +122,6 @@ clutter_sources = [
'clutter-desaturate-effect.c',
'clutter-effect.c',
'clutter-event.c',
'clutter-feature.c',
'clutter-fixed-layout.c',
'clutter-flatten-effect.c',
'clutter-flow-layout.c',