mutter/clutter/clutter/clutter-mutter.h

131 lines
4.5 KiB
C
Raw Normal View History

/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2016 Red Hat Inc.
*
* 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_MUTTER_H__
#define __CLUTTER_MUTTER_H__
#define __CLUTTER_H_INSIDE__
#include "clutter-backend.h"
#include "clutter-backend-private.h"
#include "clutter-damage-history.h"
#include "clutter-event-private.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-macros.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
Introduce regional stage rendering Add support for drawing a stage using multiple framebuffers each making up one part of the stage. This works by the stage backend (ClutterStageWindow) providing a list of views which will be for splitting up the stage in different regions. A view layout, for now, is a set of rectangles. The stage window (i.e. stage "backend" will use this information when drawing a frame, using one framebuffer for each view. The scene graph is adapted to explictly take a view when painting the stage. It will use this view, its assigned framebuffer and layout to offset and clip the drawing accordingly. This effectively removes any notion of "stage framebuffer", since each stage now may consist of multiple framebuffers. Therefore, API involving this has been deprecated and made no-ops; namely clutter_stage_ensure_context(). Callers are now assumed to either always use a framebuffer reference explicitly, or push/pop the framebuffer of a given view where the code has not yet changed to use the explicit-buffer-using cogl API. Currently only the nested X11 backend supports this mode fully, and the per view framebuffers are all offscreen. Upon frame completion, it'll blit each view's framebuffer onto the onscreen framebuffer before swapping. Other backends (X11 CM and native/KMS) are adapted to manage a full-stage view. The X11 CM backend will continue to use this method, while the native/KMS backend will be adopted to use multiple view drawing. https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-05-27 03:09:24 +00:00
#include "clutter-stage-view.h"
#include "clutter-stage-view-private.h"
#include "clutter.h"
Explicitly create the clutter context and backend This changes the setup phase of clutter to not be result of calling an init function that sets up a few global singletons, via global singleton setup vfuncs. The way it worked was that mutter first did some initial setup (connecting to the X11 server), then set a "custom backend" setup vfunc global, before calling clutter_init(). During the clutter_init() call, the context and backend was setup by calling the global singleton getters, which implicitly created the backend and context on-demand. This has now changed to mutter explicitly creating a `ClutterContext` (which is actually a `ClutterMainContext`, but with the name shortened to be consistent with `CoglContext` and `MetaContext`), calling it with a backend constructor vfunc and user data pointer. This function now explicitly creates the backend, without having to go via the previously set global vfunc. This changes the behavior of some "get_default()" like functions, which will now fail if called after mutter has shut down, as when it does so, it now destroys the backends and contexts, not only its own, but the clutter ones too. The "ownership" of the clutter backend is also moved to `ClutterContext`, and MetaBackend is changed to fetch it via the clutter context. This also removed the unused option parsing that existed in clutter. In some places, NULL checks for fetching the clutter context, or backend, and fetching the cogl context from the clutter backend, had to be added. The reason for this is that some code that handles EGL contexts attempts to restore the cogl EGL context tracking so that the right EGL context is used by cogl the next time. This makes no sense to do before Cogl and Clutter are even initialized, which was the case. It wasn't noticed because the relevant singletons were initialized on demand via their "getters". Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2002>
2021-09-16 09:38:49 +00:00
typedef struct _ClutterMainContext ClutterContext;
typedef ClutterBackend * (* ClutterBackendConstructor) (gpointer user_data);
/**
* clutter_context_new: (skip)
*/
CLUTTER_EXPORT
ClutterContext * clutter_context_new (ClutterBackendConstructor backend_constructor,
gpointer user_data,
GError **error);
/**
* clutter_context_free: (skip)
*/
CLUTTER_EXPORT
void clutter_context_free (ClutterContext *clutter_context);
/**
* clutter_context_get_backend:
*
* Returns: (transfer none): The corresponding %ClutterBackend
*/
CLUTTER_EXPORT
ClutterBackend * clutter_context_get_backend (ClutterContext *clutter_context);
CLUTTER_EXPORT
GList * clutter_stage_peek_stage_views (ClutterStage *stage);
CLUTTER_EXPORT
gboolean clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
ClutterStageView *view);
CLUTTER_EXPORT
int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_capture_view_into (ClutterStage *stage,
ClutterStageView *view,
cairo_rectangle_int_t *rect,
uint8_t *data,
int stride);
CLUTTER_EXPORT
void clutter_stage_clear_stage_views (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_view_assign_next_scanout (ClutterStageView *stage_view,
CoglScanout *scanout);
CLUTTER_EXPORT
gboolean clutter_actor_has_damage (ClutterActor *actor);
CLUTTER_EXPORT
gboolean clutter_actor_has_transitions (ClutterActor *actor);
CLUTTER_EXPORT
ClutterFrameClock * clutter_actor_pick_frame_clock (ClutterActor *self,
ClutterActor **out_actor);
CLUTTER_EXPORT
gboolean clutter_seat_handle_event_post (ClutterSeat *seat,
const ClutterEvent *event);
CLUTTER_EXPORT
void clutter_stage_update_device (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t point,
uint32_t time,
ClutterActor *new_actor,
cairo_region_t *region,
gboolean emit_crossing);
CLUTTER_EXPORT
void clutter_stage_get_device_coords (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *coords);
CLUTTER_EXPORT
void clutter_stage_repick_device (ClutterStage *stage,
ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_get_debug_flags (ClutterDebugFlag *debug_flags,
ClutterDrawDebugFlag *draw_flags,
ClutterPickDebugFlag *pick_flags);
#undef __CLUTTER_H_INSIDE__
#endif /* __CLUTTER_MUTTER_H__ */