summaryrefslogtreecommitdiff
path: root/src/compositor
diff options
context:
space:
mode:
authorArmin Krezović <krezovic.armin@gmail.com>2017-08-26 21:22:34 +0200
committerJonas Ådahl <jadahl@gmail.com>2018-07-06 19:47:16 +0200
commite1c67a1824d32a581fa0c649ee8ffea47d56a228 (patch)
treed45671814af10dfcb58a74e3d1cfd580277f1839 /src/compositor
parent68f261e8e22d94236866b92d7d21d55c68de41da (diff)
downloadmutter-e1c67a1824d32a581fa0c649ee8ffea47d56a228.tar.gz
Move monitor management API to MetaDisplay
This includes changing various users to use MetaDisplay directly, who used MetaScreen only for this before. https://bugzilla.gnome.org/show_bug.cgi?id=759538
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/meta-background-actor.c13
-rw-r--r--src/compositor/meta-background.c57
-rw-r--r--src/compositor/plugins/default.c7
3 files changed, 40 insertions, 37 deletions
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index 197a62c0f..f7a4fc450 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -82,6 +82,7 @@
#include "meta-background-actor-private.h"
#include "meta-background-private.h"
#include "meta-cullable.h"
+#include "meta/display.h"
enum
{
@@ -213,7 +214,9 @@ get_preferred_size (MetaBackgroundActor *self,
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (self)->priv;
MetaRectangle monitor_geometry;
- meta_screen_get_monitor_geometry (priv->screen, priv->monitor, &monitor_geometry);
+ meta_display_get_monitor_geometry (meta_screen_get_display (priv->screen),
+ priv->monitor,
+ &monitor_geometry);
if (width != NULL)
*width = monitor_geometry.width;
@@ -381,7 +384,8 @@ setup_pipeline (MetaBackgroundActor *self,
MetaRectangle monitor_geometry;
float gradient_height_perc;
- meta_screen_get_monitor_geometry (priv->screen, priv->monitor, &monitor_geometry);
+ meta_display_get_monitor_geometry (meta_screen_get_display (priv->screen),
+ priv->monitor, &monitor_geometry);
gradient_height_perc = MAX (0.0001, priv->gradient_height / (float)monitor_geometry.height);
cogl_pipeline_set_uniform_1f (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
@@ -923,12 +927,13 @@ meta_background_actor_set_monitor (MetaBackgroundActor *self,
MetaBackgroundActorPrivate *priv = self->priv;
MetaRectangle old_monitor_geometry;
MetaRectangle new_monitor_geometry;
+ MetaDisplay *display = meta_screen_get_display (priv->screen);
if(priv->monitor == monitor)
return;
- meta_screen_get_monitor_geometry (priv->screen, priv->monitor, &old_monitor_geometry);
- meta_screen_get_monitor_geometry (priv->screen, monitor, &new_monitor_geometry);
+ meta_display_get_monitor_geometry (display, priv->monitor, &old_monitor_geometry);
+ meta_display_get_monitor_geometry (display, monitor, &new_monitor_geometry);
if(old_monitor_geometry.height != new_monitor_geometry.height)
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index 321f406a6..a17bf3da5 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -28,7 +28,6 @@
// XXX: Remove this once transition to MetaDisplay has been completed
#include "core/display-private.h"
-#include "core/screen-private.h"
enum
{
@@ -49,7 +48,7 @@ struct _MetaBackgroundMonitor
struct _MetaBackgroundPrivate
{
- MetaScreen *screen;
+ MetaDisplay *display;
MetaBackgroundMonitor *monitors;
int n_monitors;
@@ -73,7 +72,7 @@ struct _MetaBackgroundPrivate
enum
{
- PROP_META_SCREEN = 1,
+ PROP_META_DISPLAY = 1,
PROP_MONITOR,
};
@@ -142,11 +141,11 @@ invalidate_monitor_backgrounds (MetaBackground *self)
priv->monitors = NULL;
priv->n_monitors = 0;
- if (priv->screen)
+ if (priv->display)
{
int i;
- priv->n_monitors = meta_screen_get_n_monitors (priv->screen);
+ priv->n_monitors = meta_display_get_n_monitors (priv->display);
priv->monitors = g_new0 (MetaBackgroundMonitor, priv->n_monitors);
for (i = 0; i < priv->n_monitors; i++)
@@ -162,23 +161,23 @@ on_monitors_changed (MetaDisplay *display,
}
static void
-set_screen (MetaBackground *self,
- MetaScreen *screen)
+set_display (MetaBackground *self,
+ MetaDisplay *display)
{
MetaBackgroundPrivate *priv = self->priv;
- if (priv->screen != NULL && priv->screen->display != NULL)
+ if (priv->display)
{
- g_signal_handlers_disconnect_by_func (priv->screen->display,
+ g_signal_handlers_disconnect_by_func (priv->display,
(gpointer)on_monitors_changed,
self);
}
- g_set_object (&priv->screen, screen);
+ g_set_object (&priv->display, display);
- if (priv->screen != NULL && priv->screen->display != NULL)
+ if (priv->display)
{
- g_signal_connect (priv->screen->display, "monitors-changed",
+ g_signal_connect (priv->display, "monitors-changed",
G_CALLBACK (on_monitors_changed), self);
}
@@ -193,8 +192,8 @@ meta_background_set_property (GObject *object,
{
switch (prop_id)
{
- case PROP_META_SCREEN:
- set_screen (META_BACKGROUND (object), g_value_get_object (value));
+ case PROP_META_DISPLAY:
+ set_display (META_BACKGROUND (object), g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -212,8 +211,8 @@ meta_background_get_property (GObject *object,
switch (prop_id)
{
- case PROP_META_SCREEN:
- g_value_set_object (value, priv->screen);
+ case PROP_META_DISPLAY:
+ g_value_set_object (value, priv->display);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -315,7 +314,7 @@ meta_background_dispose (GObject *object)
set_file (self, &priv->file1, &priv->background_image1, NULL);
set_file (self, &priv->file2, &priv->background_image2, NULL);
- set_screen (self, NULL);
+ set_display (self, NULL);
G_OBJECT_CLASS (meta_background_parent_class)->dispose (object);
}
@@ -336,7 +335,7 @@ meta_background_constructed (GObject *object)
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
- g_signal_connect_object (meta_screen_get_display (priv->screen), "gl-video-memory-purged",
+ g_signal_connect_object (priv->display, "gl-video-memory-purged",
G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
}
@@ -362,14 +361,14 @@ meta_background_class_init (MetaBackgroundClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);
- param_spec = g_param_spec_object ("meta-screen",
- "MetaScreen",
- "MetaScreen",
- META_TYPE_SCREEN,
+ param_spec = g_param_spec_object ("meta-display",
+ "MetaDisplay",
+ "MetaDisplay",
+ META_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class,
- PROP_META_SCREEN,
+ PROP_META_DISPLAY,
param_spec);
}
@@ -399,7 +398,6 @@ get_texture_area (MetaBackground *self,
CoglTexture *texture,
cairo_rectangle_int_t *texture_area)
{
- MetaDisplay *display;
MetaBackgroundPrivate *priv = self->priv;
cairo_rectangle_int_t image_area;
int screen_width, screen_height;
@@ -408,7 +406,6 @@ get_texture_area (MetaBackground *self,
texture_width = cogl_texture_get_width (texture);
texture_height = cogl_texture_get_height (texture);
- display = meta_screen_get_display (priv->screen);
switch (priv->style)
{
@@ -420,7 +417,7 @@ get_texture_area (MetaBackground *self,
set_texture_area_from_monitor_area (monitor_rect, texture_area);
break;
case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
- meta_display_get_size (display, &screen_width, &screen_height);
+ meta_display_get_size (priv->display, &screen_width, &screen_height);
/* Start off by centering a tile in the middle of the
* total screen area.
@@ -489,7 +486,7 @@ get_texture_area (MetaBackground *self,
/* paint region is the union of all monitors, with the origin
* of the region set to align with monitor associated with the background.
*/
- meta_display_get_size (display, &screen_width, &screen_height);
+ meta_display_get_size (priv->display, &screen_width, &screen_height);
/* unclipped texture area is whole screen */
image_area.width = screen_width;
@@ -763,7 +760,7 @@ meta_background_get_texture (MetaBackground *self,
monitor = &priv->monitors[monitor_index];
- meta_screen_get_monitor_geometry (priv->screen, monitor_index, &geometry);
+ meta_display_get_monitor_geometry (priv->display, monitor_index, &geometry);
monitor_area.x = geometry.x;
monitor_area.y = geometry.y;
monitor_area.width = geometry.width;
@@ -892,10 +889,10 @@ meta_background_get_texture (MetaBackground *self,
}
MetaBackground *
-meta_background_new (MetaScreen *screen)
+meta_background_new (MetaDisplay *display)
{
return g_object_new (META_TYPE_BACKGROUND,
- "meta-screen", screen,
+ "meta-display", display,
NULL);
}
diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c
index 5e7273611..d3fbd5c62 100644
--- a/src/compositor/plugins/default.c
+++ b/src/compositor/plugins/default.c
@@ -332,7 +332,7 @@ on_monitors_changed (MetaDisplay *display,
clutter_actor_destroy_all_children (self->priv->background_group);
- n = meta_screen_get_n_monitors (screen);
+ n = meta_display_get_n_monitors (meta_screen_get_display (screen));
for (i = 0; i < n; i++)
{
MetaRectangle rect;
@@ -340,7 +340,8 @@ on_monitors_changed (MetaDisplay *display,
MetaBackground *background;
ClutterColor color;
- meta_screen_get_monitor_geometry (screen, i, &rect);
+ meta_display_get_monitor_geometry (meta_screen_get_display (screen),
+ i, &rect);
background_actor = meta_background_actor_new (screen, i);
@@ -357,7 +358,7 @@ on_monitors_changed (MetaDisplay *display,
g_rand_int_range (rand, 0, 255),
255);
- background = meta_background_new (screen);
+ background = meta_background_new (display);
meta_background_set_color (background, &color);
meta_background_actor_set_background (META_BACKGROUND_ACTOR (background_actor), background);
g_object_unref (background);