mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
compositor: Make type derivable
This is so that we can split it up properly into X11 compositor and display server compositor sub types. https://gitlab.gnome.org/GNOME/mutter/merge_requests/727
This commit is contained in:
parent
55cd110c63
commit
12ea2fcb51
@ -335,7 +335,10 @@ handle_host_xevent (MetaBackend *backend,
|
||||
if (display)
|
||||
{
|
||||
MetaCompositor *compositor = display->compositor;
|
||||
if (meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event))
|
||||
MetaPluginManager *plugin_mgr =
|
||||
meta_compositor_get_plugin_manager (compositor);
|
||||
|
||||
if (meta_plugin_manager_xevent_filter (plugin_mgr, event))
|
||||
bypass_clutter = TRUE;
|
||||
|
||||
if (meta_dnd_handle_xdnd_event (backend, compositor, priv->xdisplay, event))
|
||||
|
@ -11,47 +11,17 @@
|
||||
#include "meta/compositor.h"
|
||||
#include "meta/display.h"
|
||||
|
||||
struct _MetaCompositor
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
MetaDisplay *display;
|
||||
|
||||
guint pre_paint_func_id;
|
||||
guint post_paint_func_id;
|
||||
|
||||
gulong stage_presented_id;
|
||||
gulong stage_after_paint_id;
|
||||
|
||||
gint64 server_time_query_time;
|
||||
gint64 server_time_offset;
|
||||
|
||||
guint server_time_is_monotonic_time : 1;
|
||||
|
||||
ClutterActor *stage, *window_group, *top_window_group, *feedback_group;
|
||||
GList *windows;
|
||||
Window output;
|
||||
|
||||
CoglContext *context;
|
||||
|
||||
MetaWindowActor *top_window_actor;
|
||||
gulong top_window_actor_destroy_id;
|
||||
|
||||
/* Used for unredirecting fullscreen windows */
|
||||
guint disable_unredirect_count;
|
||||
MetaWindow *unredirected_window;
|
||||
|
||||
gint switch_workspace_in_progress;
|
||||
|
||||
MetaPluginManager *plugin_mgr;
|
||||
|
||||
gboolean frame_has_updated_xsurfaces;
|
||||
gboolean have_x11_sync_object;
|
||||
};
|
||||
|
||||
/* Wait 2ms after vblank before starting to draw next frame */
|
||||
#define META_SYNC_DELAY 2
|
||||
|
||||
struct _MetaCompositorClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
void meta_compositor_remove_window_actor (MetaCompositor *compositor,
|
||||
MetaWindowActor *window_actor);
|
||||
|
||||
void meta_switch_workspace_completed (MetaCompositor *compositor);
|
||||
|
||||
gboolean meta_begin_modal_for_plugin (MetaCompositor *compositor,
|
||||
@ -62,6 +32,8 @@ void meta_end_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
guint32 timestamp);
|
||||
|
||||
MetaPluginManager * meta_compositor_get_plugin_manager (MetaCompositor *compositor);
|
||||
|
||||
gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
|
||||
gint64 monotonic_time);
|
||||
|
||||
@ -78,4 +50,12 @@ void meta_compositor_locate_pointer (MetaCompositor *compositor);
|
||||
|
||||
void meta_compositor_redirect_x11_windows (MetaCompositor *compositor);
|
||||
|
||||
MetaDisplay * meta_compositor_get_display (MetaCompositor *compositor);
|
||||
|
||||
Window meta_compositor_get_output_xwindow (MetaCompositor *compositor);
|
||||
|
||||
ClutterStage * meta_compositor_get_stage (MetaCompositor *compositor);
|
||||
|
||||
gboolean meta_compositor_is_switching_workspace (MetaCompositor *compositor);
|
||||
|
||||
#endif /* META_COMPOSITOR_PRIVATE_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -174,13 +174,16 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
|
||||
XEvent *xev)
|
||||
{
|
||||
MetaDnd *dnd = meta_backend_get_dnd (backend);
|
||||
Window output_window = compositor->output;
|
||||
Window output_window;
|
||||
ClutterStage *stage;
|
||||
|
||||
if (xev->xany.type != ClientMessage)
|
||||
return FALSE;
|
||||
|
||||
output_window = meta_compositor_get_output_xwindow (compositor);
|
||||
stage = meta_compositor_get_stage (compositor);
|
||||
if (xev->xany.window != output_window &&
|
||||
xev->xany.window != clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage)))
|
||||
xev->xany.window != clutter_x11_get_stage_window (stage))
|
||||
return FALSE;
|
||||
|
||||
if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndPosition", TRUE))
|
||||
@ -285,20 +288,22 @@ meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor)
|
||||
if (priv->handler_id[0] == 0 &&
|
||||
meta_wayland_data_device_get_current_grab (&wl_compositor->seat->data_device) != NULL)
|
||||
{
|
||||
ClutterStage *stage = meta_compositor_get_stage (compositor);
|
||||
|
||||
priv->compositor = compositor;
|
||||
priv->wl_compositor = wl_compositor;
|
||||
|
||||
priv->handler_id[0] = g_signal_connect (compositor->stage,
|
||||
priv->handler_id[0] = g_signal_connect (stage,
|
||||
"motion-event",
|
||||
G_CALLBACK (meta_dnd_wayland_on_motion_event),
|
||||
dnd);
|
||||
|
||||
priv->handler_id[1] = g_signal_connect (compositor->stage,
|
||||
priv->handler_id[1] = g_signal_connect (stage,
|
||||
"button-release-event",
|
||||
G_CALLBACK (meta_dnd_wayland_on_button_released),
|
||||
dnd);
|
||||
|
||||
priv->handler_id[2] = g_signal_connect (compositor->stage,
|
||||
priv->handler_id[2] = g_signal_connect (stage,
|
||||
"key-press-event",
|
||||
G_CALLBACK (meta_dnd_wayland_on_key_pressed),
|
||||
dnd);
|
||||
@ -312,6 +317,7 @@ meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor)
|
||||
{
|
||||
MetaDnd *dnd = meta_backend_get_dnd (meta_get_backend ());
|
||||
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
|
||||
ClutterStage *stage = meta_compositor_get_stage (compositor);
|
||||
unsigned int i;
|
||||
|
||||
if (!priv->compositor)
|
||||
@ -319,7 +325,7 @@ meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor)
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (priv->handler_id); i++)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->compositor->stage, priv->handler_id[i]);
|
||||
g_signal_handler_disconnect (stage, priv->handler_id[i]);
|
||||
priv->handler_id[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -52,10 +52,11 @@ static void
|
||||
meta_feedback_actor_constructed (GObject *object)
|
||||
{
|
||||
MetaDisplay *display;
|
||||
ClutterActor *feedback_group;
|
||||
|
||||
display = meta_get_display ();
|
||||
clutter_actor_add_child (display->compositor->feedback_group,
|
||||
CLUTTER_ACTOR (object));
|
||||
feedback_group = meta_get_feedback_group_for_display (display);
|
||||
clutter_actor_add_child (feedback_group, CLUTTER_ACTOR (object));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -156,7 +156,7 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
MetaDisplay *display = meta_compositor_get_display (plugin_mgr->compositor);
|
||||
gboolean retval = FALSE;
|
||||
|
||||
if (display->display_opening)
|
||||
@ -225,7 +225,7 @@ meta_plugin_manager_event_size_change (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
MetaDisplay *display = meta_compositor_get_display (plugin_mgr->compositor);
|
||||
|
||||
if (display->display_opening)
|
||||
return FALSE;
|
||||
@ -254,7 +254,7 @@ meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
MetaDisplay *display = meta_compositor_get_display (plugin_mgr->compositor);
|
||||
gboolean retval = FALSE;
|
||||
|
||||
if (display->display_opening)
|
||||
@ -312,7 +312,7 @@ meta_plugin_manager_show_tile_preview (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
MetaDisplay *display = meta_compositor_get_display (plugin_mgr->compositor);
|
||||
|
||||
if (display->display_opening)
|
||||
return FALSE;
|
||||
@ -331,7 +331,7 @@ meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
MetaDisplay *display = meta_compositor_get_display (plugin_mgr->compositor);
|
||||
|
||||
if (display->display_opening)
|
||||
return FALSE;
|
||||
@ -354,7 +354,7 @@ meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
MetaDisplay *display = meta_compositor_get_display (plugin_mgr->compositor);
|
||||
|
||||
if (display->display_opening)
|
||||
return;
|
||||
@ -371,7 +371,7 @@ meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
MetaDisplay *display = meta_compositor_get_display (plugin_mgr->compositor);
|
||||
|
||||
if (display->display_opening)
|
||||
return;
|
||||
|
@ -199,8 +199,9 @@ MetaDisplay *
|
||||
meta_plugin_get_display (MetaPlugin *plugin)
|
||||
{
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
MetaDisplay *display = meta_compositor_get_display (priv->compositor);
|
||||
|
||||
return priv->compositor->display;
|
||||
return display;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -272,7 +272,7 @@ assign_frame_counter_to_frames (MetaWindowActorX11 *actor_x11)
|
||||
MetaWindow *window =
|
||||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||
MetaCompositor *compositor = window->display->compositor;
|
||||
ClutterStage *stage = CLUTTER_STAGE (compositor->stage);
|
||||
ClutterStage *stage = meta_compositor_get_stage (compositor);
|
||||
GList *l;
|
||||
|
||||
/* If the window is obscured, then we're expecting to deal with sending
|
||||
|
@ -465,7 +465,7 @@ meta_window_actor_dispose (GObject *object)
|
||||
g_clear_pointer (&priv->unfocused_shadow, meta_shadow_unref);
|
||||
g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
|
||||
|
||||
compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
|
||||
meta_compositor_remove_window_actor (compositor, self);
|
||||
|
||||
g_clear_object (&priv->window);
|
||||
|
||||
@ -921,10 +921,12 @@ start_simple_effect (MetaWindowActor *self,
|
||||
MetaWindowActorPrivate *priv =
|
||||
meta_window_actor_get_instance_private (self);
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
MetaPluginManager *plugin_mgr =
|
||||
meta_compositor_get_plugin_manager (compositor);
|
||||
gint *counter = NULL;
|
||||
gboolean use_freeze_thaw = FALSE;
|
||||
|
||||
g_assert (compositor->plugin_mgr != NULL);
|
||||
g_assert (plugin_mgr != NULL);
|
||||
|
||||
switch (event)
|
||||
{
|
||||
@ -957,7 +959,7 @@ start_simple_effect (MetaWindowActor *self,
|
||||
|
||||
(*counter)++;
|
||||
|
||||
if (!meta_plugin_manager_event_simple (compositor->plugin_mgr, self, event))
|
||||
if (!meta_plugin_manager_event_simple (plugin_mgr, self, event))
|
||||
{
|
||||
(*counter)--;
|
||||
if (use_freeze_thaw)
|
||||
@ -1216,7 +1218,7 @@ meta_window_actor_show (MetaWindowActor *self,
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
if (compositor->switch_workspace_in_progress ||
|
||||
if (meta_compositor_is_switching_workspace (compositor) ||
|
||||
!start_simple_effect (self, event))
|
||||
{
|
||||
clutter_actor_show (CLUTTER_ACTOR (self));
|
||||
@ -1240,7 +1242,7 @@ meta_window_actor_hide (MetaWindowActor *self,
|
||||
* hold off on hiding the window, and do it after the workspace
|
||||
* switch completes
|
||||
*/
|
||||
if (compositor->switch_workspace_in_progress)
|
||||
if (meta_compositor_is_switching_workspace (compositor))
|
||||
return;
|
||||
|
||||
switch (effect)
|
||||
@ -1271,11 +1273,13 @@ meta_window_actor_size_change (MetaWindowActor *self,
|
||||
MetaWindowActorPrivate *priv =
|
||||
meta_window_actor_get_instance_private (self);
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
MetaPluginManager *plugin_mgr =
|
||||
meta_compositor_get_plugin_manager (compositor);
|
||||
|
||||
priv->size_change_in_progress++;
|
||||
meta_window_actor_freeze (self);
|
||||
|
||||
if (!meta_plugin_manager_event_size_change (compositor->plugin_mgr, self,
|
||||
if (!meta_plugin_manager_event_size_change (plugin_mgr, self,
|
||||
which_change, old_frame_rect, old_buffer_rect))
|
||||
{
|
||||
priv->size_change_in_progress--;
|
||||
|
@ -30,7 +30,8 @@
|
||||
|
||||
#define META_TYPE_COMPOSITOR (meta_compositor_get_type ())
|
||||
META_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (MetaCompositor, meta_compositor, META, COMPOSITOR, GObject)
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaCompositor, meta_compositor,
|
||||
META, COMPOSITOR, GObject)
|
||||
|
||||
/**
|
||||
* MetaCompEffect:
|
||||
|
Loading…
Reference in New Issue
Block a user