Rename MetaMonitorInfo MetaLogicalMonitor

In preparation for further refactorizations, rename the MetaMonitorInfo
struct to MetaLogicalMonitor. Eventually, part of MetaLogicalMonitor
will be split into a MetaMonitor type.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2016-11-25 14:31:38 +08:00
parent e1b10769e5
commit 842ff5d6aa
31 changed files with 515 additions and 462 deletions

View File

@ -114,11 +114,17 @@ static void
center_pointer (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaMonitorInfo *monitors, *primary;
guint n_monitors;
MetaMonitorManager *monitor_manager = priv->monitor_manager;
MetaLogicalMonitor *logical_monitors, *primary;
unsigned int n_logical_monitors;
int primary_monitor_index;
monitors = meta_monitor_manager_get_monitor_infos (priv->monitor_manager, &n_monitors);
primary = &monitors[meta_monitor_manager_get_primary_index (priv->monitor_manager)];
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
primary_monitor_index =
meta_monitor_manager_get_primary_index (monitor_manager);
primary = &logical_monitors[primary_monitor_index];
meta_backend_warp_pointer (backend,
primary->rect.x + primary->rect.width / 2,
primary->rect.y + primary->rect.height / 2);

View File

@ -125,8 +125,8 @@ MetaInputSettings * meta_input_settings_create (void);
GSettings * meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
ClutterInputDevice *device);
MetaMonitorInfo * meta_input_settings_get_tablet_monitor_info (MetaInputSettings *settings,
ClutterInputDevice *device);
MetaLogicalMonitor * meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,
ClutterInputDevice *device);
GDesktopTabletMapping meta_input_settings_get_tablet_mapping (MetaInputSettings *settings,
ClutterInputDevice *device);

View File

@ -1425,9 +1425,9 @@ meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
return info ? g_object_ref (info->settings) : NULL;
}
MetaMonitorInfo *
meta_input_settings_get_tablet_monitor_info (MetaInputSettings *settings,
ClutterInputDevice *device)
MetaLogicalMonitor *
meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,
ClutterInputDevice *device)
{
MetaInputSettingsPrivate *priv;
DeviceMappingInfo *info;

View File

@ -50,10 +50,11 @@
typedef struct _MetaMonitorConfigClass MetaMonitorConfigClass;
typedef struct _MetaMonitorConfig MetaMonitorConfig;
typedef struct _MetaLogicalMonitor MetaLogicalMonitor;
typedef struct _MetaCRTC MetaCRTC;
typedef struct _MetaOutput MetaOutput;
typedef struct _MetaMonitorMode MetaMonitorMode;
typedef struct _MetaMonitorInfo MetaMonitorInfo;
typedef struct _MetaCRTCInfo MetaCRTCInfo;
typedef struct _MetaOutputInfo MetaOutputInfo;
typedef struct _MetaTileInfo MetaTileInfo;
@ -136,7 +137,7 @@ struct _MetaOutput
gboolean is_dirty;
/* The low-level bits used to build the high-level info
in MetaMonitorInfo
in MetaLogicalMonitor
XXX: flags maybe?
There is a lot of code that uses MonitorInfo->is_primary,
@ -169,7 +170,7 @@ struct _MetaCRTC
/* Only used to build the logical configuration
from the HW one
*/
MetaMonitorInfo *logical_monitor;
MetaLogicalMonitor *logical_monitor;
/* Used when changing configuration */
gboolean is_dirty;
@ -198,16 +199,14 @@ struct _MetaMonitorMode
#define META_MAX_OUTPUTS_PER_MONITOR 4
/**
* MetaMonitorInfo:
* MetaLogicalMonitor:
*
* A structure with high-level information about monitors.
* This corresponds to a subset of the compositor coordinate space.
* Clones are only reported once, irrespective of the way
* they're implemented (two CRTCs configured for the same
* coordinates or one CRTCs driving two outputs). Inactive CRTCs
* are ignored, and so are disabled outputs.
* A structure with high-level information about regions of the whole screen
* output. It corresponds to a subset of the compositor coordinate space, and
* may have one or more actual monitors associated with it. No two logical
* monitors will cover the same screen output.
*/
struct _MetaMonitorInfo
struct _MetaLogicalMonitor
{
int number;
int xinerama_index;
@ -294,7 +293,7 @@ struct _MetaMonitorManager
/* Outputs refer to physical screens,
CRTCs refer to stuff that can drive outputs
(like encoders, but less tied to the HW),
while monitor_infos refer to logical ones.
while logical_monitors refer to logical ones.
*/
MetaOutput *outputs;
unsigned int n_outputs;
@ -305,8 +304,8 @@ struct _MetaMonitorManager
MetaCRTC *crtcs;
unsigned int n_crtcs;
MetaMonitorInfo *monitor_infos;
unsigned int n_monitor_infos;
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
int primary_monitor_index;
int dbus_name_id;
@ -355,7 +354,7 @@ struct _MetaMonitorManagerClass
unsigned short *);
void (*add_monitor) (MetaMonitorManager *,
MetaMonitorInfo *);
MetaLogicalMonitor *);
void (*delete_monitor) (MetaMonitorManager *,
int monitor_winsys_xid);
@ -364,8 +363,8 @@ struct _MetaMonitorManagerClass
void meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager);
MetaMonitorInfo *meta_monitor_manager_get_monitor_infos (MetaMonitorManager *manager,
unsigned int *n_infos);
MetaLogicalMonitor *meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager,
unsigned int *n_logical_monitors);
MetaOutput *meta_monitor_manager_get_outputs (MetaMonitorManager *manager,
unsigned int *n_outputs);

View File

@ -82,35 +82,37 @@ meta_monitor_manager_init (MetaMonitorManager *manager)
*/
static void
construct_tile_monitor (MetaMonitorManager *manager,
GArray *monitor_infos,
guint32 tile_group_id)
GArray *logical_monitors,
uint32_t tile_group_id)
{
MetaMonitorInfo info;
MetaLogicalMonitor new_logical_monitor;
unsigned i;
for (i = 0; i < monitor_infos->len; i++)
for (i = 0; i < logical_monitors->len; i++)
{
MetaMonitorInfo *pinfo = &g_array_index (monitor_infos, MetaMonitorInfo, i);
MetaLogicalMonitor *logical_monitor = &g_array_index (logical_monitors,
MetaLogicalMonitor,
i);
if (pinfo->tile_group_id == tile_group_id)
if (logical_monitor->tile_group_id == tile_group_id)
return;
}
/* didn't find it */
info.number = monitor_infos->len;
info.tile_group_id = tile_group_id;
info.is_presentation = FALSE;
info.refresh_rate = 0.0;
info.width_mm = 0;
info.height_mm = 0;
info.is_primary = FALSE;
info.rect.x = INT_MAX;
info.rect.y = INT_MAX;
info.rect.width = 0;
info.rect.height = 0;
info.winsys_id = 0;
info.n_outputs = 0;
info.monitor_winsys_xid = 0;
new_logical_monitor.number = logical_monitors->len;
new_logical_monitor.tile_group_id = tile_group_id;
new_logical_monitor.is_presentation = FALSE;
new_logical_monitor.refresh_rate = 0.0;
new_logical_monitor.width_mm = 0;
new_logical_monitor.height_mm = 0;
new_logical_monitor.is_primary = FALSE;
new_logical_monitor.rect.x = INT_MAX;
new_logical_monitor.rect.y = INT_MAX;
new_logical_monitor.rect.width = 0;
new_logical_monitor.rect.height = 0;
new_logical_monitor.winsys_id = 0;
new_logical_monitor.n_outputs = 0;
new_logical_monitor.monitor_winsys_xid = 0;
for (i = 0; i < manager->n_outputs; i++)
{
@ -131,42 +133,42 @@ construct_tile_monitor (MetaMonitorManager *manager,
if (output->tile_info.loc_h_tile == 0 && output->tile_info.loc_v_tile == 0)
{
info.refresh_rate = output->crtc->current_mode->refresh_rate;
info.width_mm = output->width_mm;
info.height_mm = output->height_mm;
info.winsys_id = output->winsys_id;
new_logical_monitor.refresh_rate = output->crtc->current_mode->refresh_rate;
new_logical_monitor.width_mm = output->width_mm;
new_logical_monitor.height_mm = output->height_mm;
new_logical_monitor.winsys_id = output->winsys_id;
}
/* hack */
if (output->crtc->rect.x < info.rect.x)
info.rect.x = output->crtc->rect.x;
if (output->crtc->rect.y < info.rect.y)
info.rect.y = output->crtc->rect.y;
if (output->crtc->rect.x < new_logical_monitor.rect.x)
new_logical_monitor.rect.x = output->crtc->rect.x;
if (output->crtc->rect.y < new_logical_monitor.rect.y)
new_logical_monitor.rect.y = output->crtc->rect.y;
if (output->tile_info.loc_h_tile == 0)
info.rect.height += output->tile_info.tile_h;
new_logical_monitor.rect.height += output->tile_info.tile_h;
if (output->tile_info.loc_v_tile == 0)
info.rect.width += output->tile_info.tile_w;
new_logical_monitor.rect.width += output->tile_info.tile_w;
if (info.n_outputs > META_MAX_OUTPUTS_PER_MONITOR)
if (new_logical_monitor.n_outputs > META_MAX_OUTPUTS_PER_MONITOR)
continue;
info.outputs[info.n_outputs++] = output;
new_logical_monitor.outputs[new_logical_monitor.n_outputs++] = output;
}
/* if we don't have a winsys id, i.e. we haven't found tile 0,0
don't try and add this to the monitor infos */
if (!info.winsys_id)
if (!new_logical_monitor.winsys_id)
return;
g_array_append_val (monitor_infos, info);
g_array_append_val (logical_monitors, new_logical_monitor);
}
/*
* make_logical_config:
*
* Turn outputs and CRTCs into logical MetaMonitorInfo,
* Turn outputs and CRTCs into logical MetaLogicalMonitor,
* that will be used by the core and API layer (MetaScreen
* and friends)
*/
@ -174,13 +176,13 @@ static void
make_logical_config (MetaMonitorManager *manager)
{
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (manager);
GArray *monitor_infos;
GArray *logical_monitors;
unsigned int i, j;
monitor_infos = g_array_sized_new (FALSE, TRUE, sizeof (MetaMonitorInfo),
manager->n_crtcs);
logical_monitors = g_array_sized_new (FALSE, TRUE, sizeof (MetaLogicalMonitor),
manager->n_crtcs);
/* Walk the list of MetaCRTCs, and build a MetaMonitorInfo
/* Walk the list of MetaCRTCs, and build a MetaLogicalMonitor
for each of them, unless they reference a rectangle that
is already there.
*/
@ -190,7 +192,8 @@ make_logical_config (MetaMonitorManager *manager)
MetaOutput *output = &manager->outputs[i];
if (output->tile_info.group_id)
construct_tile_monitor (manager, monitor_infos, output->tile_info.group_id);
construct_tile_monitor (manager, logical_monitors,
output->tile_info.group_id);
}
for (i = 0; i < manager->n_crtcs; i++)
@ -201,41 +204,43 @@ make_logical_config (MetaMonitorManager *manager)
if (crtc->current_mode == NULL)
continue;
for (j = 0; j < monitor_infos->len; j++)
for (j = 0; j < logical_monitors->len; j++)
{
MetaMonitorInfo *info = &g_array_index (monitor_infos, MetaMonitorInfo, j);
if (meta_rectangle_contains_rect (&info->rect,
MetaLogicalMonitor *logical_monitor =
&g_array_index (logical_monitors, MetaLogicalMonitor, j);
if (meta_rectangle_contains_rect (&logical_monitor->rect,
&crtc->rect))
{
crtc->logical_monitor = info;
crtc->logical_monitor = logical_monitor;
break;
}
}
if (crtc->logical_monitor == NULL)
{
MetaMonitorInfo info;
MetaLogicalMonitor logical_monitor;
info.number = monitor_infos->len;
info.tile_group_id = 0;
info.rect = crtc->rect;
info.refresh_rate = crtc->current_mode->refresh_rate;
info.scale = 1;
info.is_primary = FALSE;
logical_monitor.number = logical_monitors->len;
logical_monitor.tile_group_id = 0;
logical_monitor.rect = crtc->rect;
logical_monitor.refresh_rate = crtc->current_mode->refresh_rate;
logical_monitor.scale = 1;
logical_monitor.is_primary = FALSE;
/* This starts true because we want
is_presentation only if all outputs are
marked as such (while for primary it's enough
that any is marked)
*/
info.is_presentation = TRUE;
info.in_fullscreen = -1;
info.winsys_id = 0;
info.n_outputs = 0;
info.monitor_winsys_xid = 0;
g_array_append_val (monitor_infos, info);
logical_monitor.is_presentation = TRUE;
logical_monitor.in_fullscreen = -1;
logical_monitor.winsys_id = 0;
logical_monitor.n_outputs = 0;
logical_monitor.monitor_winsys_xid = 0;
g_array_append_val (logical_monitors, logical_monitor);
crtc->logical_monitor = &g_array_index (monitor_infos, MetaMonitorInfo,
info.number);
crtc->logical_monitor = &g_array_index (logical_monitors,
MetaLogicalMonitor,
logical_monitor.number);
}
}
@ -245,7 +250,7 @@ make_logical_config (MetaMonitorManager *manager)
for (i = 0; i < manager->n_outputs; i++)
{
MetaOutput *output;
MetaMonitorInfo *info;
MetaLogicalMonitor *logical_monitor;
output = &manager->outputs[i];
@ -259,32 +264,34 @@ make_logical_config (MetaMonitorManager *manager)
/* We must have a logical monitor on every CRTC at this point */
g_assert (output->crtc->logical_monitor != NULL);
info = output->crtc->logical_monitor;
logical_monitor = output->crtc->logical_monitor;
info->is_primary = info->is_primary || output->is_primary;
info->is_presentation = info->is_presentation && output->is_presentation;
logical_monitor->is_primary =
logical_monitor->is_primary || output->is_primary;
logical_monitor->is_presentation =
logical_monitor->is_presentation && output->is_presentation;
info->width_mm = output->width_mm;
info->height_mm = output->height_mm;
logical_monitor->width_mm = output->width_mm;
logical_monitor->height_mm = output->height_mm;
info->outputs[0] = output;
info->n_outputs = 1;
logical_monitor->outputs[0] = output;
logical_monitor->n_outputs = 1;
info->scale = output->scale;
logical_monitor->scale = output->scale;
if (output->is_primary || info->winsys_id == 0)
info->winsys_id = output->winsys_id;
if (output->is_primary || logical_monitor->winsys_id == 0)
logical_monitor->winsys_id = output->winsys_id;
if (info->is_primary)
manager->primary_monitor_index = info->number;
if (logical_monitor->is_primary)
manager->primary_monitor_index = logical_monitor->number;
}
manager->n_monitor_infos = monitor_infos->len;
manager->monitor_infos = (void*)g_array_free (monitor_infos, FALSE);
manager->n_logical_monitors = logical_monitors->len;
manager->logical_monitors = (void*)g_array_free (logical_monitors, FALSE);
if (manager_class->add_monitor)
for (i = 0; i < manager->n_monitor_infos; i++)
manager_class->add_monitor (manager, &manager->monitor_infos[i]);
for (i = 0; i < manager->n_logical_monitors; i++)
manager_class->add_monitor (manager, &manager->logical_monitors[i]);
}
static void
@ -426,7 +433,7 @@ meta_monitor_manager_finalize (GObject *object)
meta_monitor_manager_free_output_array (manager->outputs, manager->n_outputs);
meta_monitor_manager_free_mode_array (manager->modes, manager->n_modes);
meta_monitor_manager_free_crtc_array (manager->crtcs, manager->n_crtcs);
g_free (manager->monitor_infos);
g_free (manager->logical_monitors);
G_OBJECT_CLASS (meta_monitor_manager_parent_class)->finalize (object);
}
@ -1283,12 +1290,12 @@ meta_monitor_manager_get (void)
return meta_backend_get_monitor_manager (backend);
}
MetaMonitorInfo *
meta_monitor_manager_get_monitor_infos (MetaMonitorManager *manager,
unsigned int *n_infos)
MetaLogicalMonitor *
meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager,
unsigned int *n_logical_monitors)
{
*n_infos = manager->n_monitor_infos;
return manager->monitor_infos;
*n_logical_monitors = manager->n_logical_monitors;
return manager->logical_monitors;
}
MetaOutput *
@ -1380,11 +1387,11 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (manager);
MetaMonitorInfo *old_monitor_infos;
unsigned old_n_monitor_infos;
MetaLogicalMonitor *old_logical_monitors;
unsigned old_n_logical_monitors;
unsigned i, j;
old_monitor_infos = manager->monitor_infos;
old_n_monitor_infos = manager->n_monitor_infos;
old_logical_monitors = manager->logical_monitors;
old_n_logical_monitors = manager->n_logical_monitors;
if (manager->in_init)
return;
@ -1393,19 +1400,25 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
if (manager_class->delete_monitor)
{
for (i = 0; i < old_n_monitor_infos; i++)
for (i = 0; i < old_n_logical_monitors; i++)
{
int old_monitor_winsys_xid =
old_logical_monitors[i].monitor_winsys_xid;
gboolean delete_mon = TRUE;
for (j = 0; j < manager->n_monitor_infos; j++)
for (j = 0; j < manager->n_logical_monitors; j++)
{
if (manager->monitor_infos[j].monitor_winsys_xid == old_monitor_infos[i].monitor_winsys_xid)
int new_monitor_winsys_xid =
manager->logical_monitors[j].monitor_winsys_xid;
if (new_monitor_winsys_xid == old_monitor_winsys_xid)
{
delete_mon = FALSE;
break;
}
}
if (delete_mon)
manager_class->delete_monitor (manager, old_monitor_infos[i].monitor_winsys_xid);
manager_class->delete_monitor (manager, old_monitor_winsys_xid);
}
}
@ -1417,7 +1430,7 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
g_signal_emit_by_name (manager, "monitors-changed");
g_free (old_monitor_infos);
g_free (old_logical_monitors);
}
void
@ -1576,8 +1589,8 @@ meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager,
if (!output || !output->crtc)
return -1;
for (i = 0; i < manager->n_monitor_infos; i++)
if (meta_rectangle_contains_rect (&manager->monitor_infos[i].rect,
for (i = 0; i < manager->n_logical_monitors; i++)
if (meta_rectangle_contains_rect (&manager->logical_monitors[i].rect,
&output->crtc->rect))
return i;
@ -1591,15 +1604,15 @@ meta_monitor_manager_get_monitor_at_point (MetaMonitorManager *manager,
{
unsigned int i;
for (i = 0; i < manager->n_monitor_infos; i++)
for (i = 0; i < manager->n_logical_monitors; i++)
{
MetaMonitorInfo *monitor = &manager->monitor_infos[i];
MetaLogicalMonitor *logical_monitor = &manager->logical_monitors[i];
int left, right, top, bottom;
left = monitor->rect.x;
right = left + monitor->rect.width;
top = monitor->rect.y;
bottom = top + monitor->rect.height;
left = logical_monitor->rect.x;
right = left + logical_monitor->rect.width;
top = logical_monitor->rect.y;
bottom = top + logical_monitor->rect.height;
if ((x >= left) && (x < right) && (y >= top) && (y < bottom))
return i;

View File

@ -39,16 +39,16 @@ struct _MetaRendererView
ClutterStageViewCogl parent;
MetaMonitorTransform transform;
MetaMonitorInfo *monitor_info;
MetaLogicalMonitor *logical_monitor;
};
G_DEFINE_TYPE (MetaRendererView, meta_renderer_view,
CLUTTER_TYPE_STAGE_VIEW_COGL)
MetaMonitorInfo *
meta_renderer_view_get_monitor_info (MetaRendererView *view)
MetaLogicalMonitor *
meta_renderer_view_get_logical_monitor (MetaRendererView *view)
{
return view->monitor_info;
return view->logical_monitor;
}
static void
@ -128,7 +128,7 @@ meta_renderer_view_get_property (GObject *object,
switch (prop_id)
{
case PROP_MONITOR_INFO:
g_value_set_pointer (value, view->monitor_info);
g_value_set_pointer (value, view->logical_monitor);
break;
case PROP_TRANSFORM:
g_value_set_uint (value, view->transform);
@ -150,7 +150,7 @@ meta_renderer_view_set_property (GObject *object,
switch (prop_id)
{
case PROP_MONITOR_INFO:
view->monitor_info = g_value_get_pointer (value);
view->logical_monitor = g_value_get_pointer (value);
break;
case PROP_TRANSFORM:
meta_renderer_view_set_transform (view, g_value_get_uint (value));
@ -181,9 +181,9 @@ meta_renderer_view_class_init (MetaRendererViewClass *klass)
object_class->set_property = meta_renderer_view_set_property;
obj_props[PROP_MONITOR_INFO] =
g_param_spec_pointer ("monitor-info",
"MetaMonitorInfo",
"The monitor info of the view",
g_param_spec_pointer ("logical-monitor",
"MetaLogicalMonitor",
"The logical monitor of the view",
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT_ONLY);

View File

@ -26,6 +26,6 @@ G_DECLARE_FINAL_TYPE (MetaRendererView, meta_renderer_view,
META, RENDERER_VIEW,
ClutterStageViewCogl)
MetaMonitorInfo *meta_renderer_view_get_monitor_info (MetaRendererView *view);
MetaLogicalMonitor *meta_renderer_view_get_logical_monitor (MetaRendererView *view);
#endif /* META_RENDERER_VIEW_H */

View File

@ -43,11 +43,11 @@ meta_renderer_create_cogl_renderer (MetaRenderer *renderer)
}
static MetaRendererView *
meta_renderer_create_view (MetaRenderer *renderer,
MetaMonitorInfo *monitor_info)
meta_renderer_create_view (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor)
{
return META_RENDERER_GET_CLASS (renderer)->create_view (renderer,
monitor_info);
logical_monitor);
}
void
@ -57,21 +57,22 @@ meta_renderer_rebuild_views (MetaRenderer *renderer)
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaMonitorInfo *monitor_infos;
unsigned int num_monitor_infos;
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
unsigned int i;
g_list_free_full (priv->views, g_object_unref);
priv->views = NULL;
monitor_infos = meta_monitor_manager_get_monitor_infos (monitor_manager,
&num_monitor_infos);
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
for (i = 0; i < num_monitor_infos; i++)
for (i = 0; i < n_logical_monitors; i++)
{
MetaRendererView *view;
view = meta_renderer_create_view (renderer, &monitor_infos[i]);
view = meta_renderer_create_view (renderer, &logical_monitors[i]);
priv->views = g_list_append (priv->views, view);
}
}

View File

@ -40,8 +40,8 @@ struct _MetaRendererClass
GObjectClass parent_class;
CoglRenderer * (* create_cogl_renderer) (MetaRenderer *renderer);
MetaRendererView * (* create_view) (MetaRenderer *renderer,
MetaMonitorInfo *monitor_info);
MetaRendererView * (* create_view) (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor);
};
CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer);

View File

@ -174,10 +174,10 @@ constrain_to_client_constraint (ClutterInputDevice *device,
static void
constrain_all_screen_monitors (ClutterInputDevice *device,
MetaMonitorInfo *monitors,
unsigned n_monitors,
float *x,
float *y)
MetaLogicalMonitor *logical_monitors,
unsigned int n_logical_monitors,
float *x,
float *y)
{
ClutterPoint current;
unsigned int i;
@ -189,15 +189,15 @@ constrain_all_screen_monitors (ClutterInputDevice *device,
cy = current.y;
/* if we're trying to escape, clamp to the CRTC we're coming from */
for (i = 0; i < n_monitors; i++)
for (i = 0; i < n_logical_monitors; i++)
{
MetaMonitorInfo *monitor = &monitors[i];
MetaLogicalMonitor *logical_monitor = &logical_monitors[i];
int left, right, top, bottom;
left = monitor->rect.x;
right = left + monitor->rect.width;
top = monitor->rect.y;
bottom = top + monitor->rect.height;
left = logical_monitor->rect.x;
right = left + logical_monitor->rect.width;
top = logical_monitor->rect.y;
bottom = top + logical_monitor->rect.height;
if ((cx >= left) && (cx < right) && (cy >= top) && (cy < bottom))
{
@ -225,8 +225,8 @@ pointer_constrain_callback (ClutterInputDevice *device,
gpointer user_data)
{
MetaMonitorManager *monitor_manager;
MetaMonitorInfo *monitors;
unsigned int n_monitors;
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
/* Constrain to barriers */
constrain_to_barriers (device, time, new_x, new_y);
@ -235,14 +235,18 @@ pointer_constrain_callback (ClutterInputDevice *device,
constrain_to_client_constraint (device, time, prev_x, prev_y, new_x, new_y);
monitor_manager = meta_monitor_manager_get ();
monitors = meta_monitor_manager_get_monitor_infos (monitor_manager, &n_monitors);
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager,
&n_logical_monitors);
/* if we're moving inside a monitor, we're fine */
if (meta_monitor_manager_get_monitor_at_point (monitor_manager, *new_x, *new_y) >= 0)
return;
/* if we're trying to escape, clamp to the CRTC we're coming from */
constrain_all_screen_monitors(device, monitors, n_monitors, new_x, new_y);
constrain_all_screen_monitors (device,
logical_monitors, n_logical_monitors,
new_x, new_y);
}
static ClutterBackend *

View File

@ -617,7 +617,7 @@ meta_onscreen_native_set_crtc_modes (MetaOnscreenNative *onscreen_native)
META_MONITOR_MANAGER_KMS (monitor_manager);
MetaRendererView *view = onscreen_native->view;
uint32_t fb_id = 0;
MetaMonitorInfo *monitor_info;
MetaLogicalMonitor *logical_monitor;
switch (renderer_native->mode)
{
@ -633,18 +633,18 @@ meta_onscreen_native_set_crtc_modes (MetaOnscreenNative *onscreen_native)
g_assert (fb_id != 0);
monitor_info = meta_renderer_view_get_monitor_info (view);
if (monitor_info)
logical_monitor = meta_renderer_view_get_logical_monitor (view);
if (logical_monitor)
{
unsigned int i;
for (i = 0; i < monitor_manager->n_crtcs; i++)
{
MetaCRTC *crtc = &monitor_manager->crtcs[i];
int x = crtc->rect.x - monitor_info->rect.x;
int y = crtc->rect.y - monitor_info->rect.y;
int x = crtc->rect.x - logical_monitor->rect.x;
int y = crtc->rect.y - logical_monitor->rect.y;
if (crtc->logical_monitor != monitor_info)
if (crtc->logical_monitor != logical_monitor)
continue;
meta_monitor_manager_kms_apply_crtc_mode (monitor_manager_kms,
@ -679,7 +679,7 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
meta_backend_get_monitor_manager (backend);
MetaRendererView *view = onscreen_native->view;
GClosure *flip_closure;
MetaMonitorInfo *monitor_info;
MetaLogicalMonitor *logical_monitor;
gboolean fb_in_use = FALSE;
/*
@ -700,18 +700,18 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
/* Either flip the CRTC's of the monitor info, if we are drawing just part
* of the stage, or all of the CRTC's if we are drawing the whole stage.
*/
monitor_info = meta_renderer_view_get_monitor_info (view);
if (monitor_info)
logical_monitor = meta_renderer_view_get_logical_monitor (view);
if (logical_monitor)
{
unsigned int i;
for (i = 0; i < monitor_manager->n_crtcs; i++)
{
MetaCRTC *crtc = &monitor_manager->crtcs[i];
int x = crtc->rect.x - monitor_info->rect.x;
int y = crtc->rect.y - monitor_info->rect.y;
int x = crtc->rect.x - logical_monitor->rect.x;
int y = crtc->rect.y - logical_monitor->rect.y;
if (crtc->logical_monitor != monitor_info)
if (crtc->logical_monitor != logical_monitor)
continue;
meta_onscreen_native_flip_crtc (onscreen_native, flip_closure,
@ -951,7 +951,7 @@ meta_renderer_native_create_surface_gbm (MetaRendererNative *renderer_native,
#ifdef HAVE_EGL_DEVICE
static gboolean
meta_renderer_native_create_surface_egl_device (MetaRendererNative *renderer_native,
MetaMonitorInfo *monitor_info,
MetaLogicalMonitor *logical_monitor,
int width,
int height,
EGLStreamKHR *out_egl_stream,
@ -974,11 +974,11 @@ meta_renderer_native_create_surface_egl_device (MetaRendererNative *renderer_nat
EGLOutputLayerEXT output_layer;
EGLAttrib output_attribs[] = {
/*
* An "monitor_info" may have multiple outputs/crtcs in case its tiled,
* An "logical_monitor" may have multiple outputs/crtcs in case its tiled,
* but as far as I can tell, EGL only allows you to pass one crtc_id, so
* lets pass the first one.
*/
EGL_DRM_CRTC_EXT, monitor_info->outputs[0]->crtc->crtc_id,
EGL_DRM_CRTC_EXT, logical_monitor->outputs[0]->crtc->crtc_id,
EGL_NONE,
};
EGLint stream_attribs[] = {
@ -1222,7 +1222,7 @@ meta_onscreen_native_allocate (CoglOnscreen *onscreen,
int height;
#ifdef HAVE_EGL_DEVICE
MetaRendererView *view;
MetaMonitorInfo *monitor_info;
MetaLogicalMonitor *logical_monitor;
EGLStreamKHR egl_stream;
#endif
@ -1258,9 +1258,9 @@ meta_onscreen_native_allocate (CoglOnscreen *onscreen,
return FALSE;
view = onscreen_native->view;
monitor_info = meta_renderer_view_get_monitor_info (view);
logical_monitor = meta_renderer_view_get_logical_monitor (view);
if (!meta_renderer_native_create_surface_egl_device (renderer_native,
monitor_info,
logical_monitor,
width, height,
&egl_stream,
&egl_surface,
@ -1385,8 +1385,8 @@ meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
}
static MetaMonitorTransform
meta_renderer_native_get_monitor_info_transform (MetaRenderer *renderer,
MetaMonitorInfo *monitor_info)
meta_renderer_native_get_logical_monitor_transform (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
@ -1394,10 +1394,10 @@ meta_renderer_native_get_monitor_info_transform (MetaRenderer *renderer,
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
g_assert (monitor_info->n_outputs > 0);
g_assert (logical_monitor->n_outputs > 0);
return meta_monitor_manager_kms_get_view_transform (monitor_manager_kms,
monitor_info->outputs[0]->crtc);
logical_monitor->outputs[0]->crtc);
}
static CoglOnscreen *
@ -1673,8 +1673,8 @@ meta_renderer_native_create_legacy_view (MetaRendererNative *renderer_native)
}
static MetaRendererView *
meta_renderer_native_create_view (MetaRenderer *renderer,
MetaMonitorInfo *monitor_info)
meta_renderer_native_create_view (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor)
{
MetaBackend *backend = meta_get_backend ();
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
@ -1688,14 +1688,14 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
MetaRendererView *view;
GError *error = NULL;
transform = meta_renderer_native_get_monitor_info_transform (renderer,
monitor_info);
transform = meta_renderer_native_get_logical_monitor_transform (renderer,
logical_monitor);
onscreen = meta_renderer_native_create_onscreen (META_RENDERER_NATIVE (renderer),
cogl_context,
transform,
monitor_info->rect.width,
monitor_info->rect.height);
logical_monitor->rect.width,
logical_monitor->rect.height);
if (!onscreen)
meta_fatal ("Failed to allocate onscreen framebuffer\n");
@ -1704,17 +1704,17 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
offscreen = meta_renderer_native_create_offscreen (META_RENDERER_NATIVE (renderer),
cogl_context,
transform,
monitor_info->rect.width,
monitor_info->rect.height);
logical_monitor->rect.width,
logical_monitor->rect.height);
if (!offscreen)
meta_fatal ("Failed to allocate back buffer texture\n");
}
view = g_object_new (META_TYPE_RENDERER_VIEW,
"layout", &monitor_info->rect,
"layout", &logical_monitor->rect,
"framebuffer", onscreen,
"offscreen", offscreen,
"monitor-info", monitor_info,
"logical-monitor", logical_monitor,
"transform", transform,
NULL);
g_clear_pointer (&offscreen, cogl_object_unref);

View File

@ -1332,8 +1332,8 @@ meta_monitor_manager_xrandr_set_crtc_gamma (MetaMonitorManager *manager,
#ifdef HAVE_XRANDR15
static void
meta_monitor_manager_xrandr_add_monitor(MetaMonitorManager *manager,
MetaMonitorInfo *monitor)
meta_monitor_manager_xrandr_add_monitor (MetaMonitorManager *manager,
MetaLogicalMonitor *logical_monitor)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
XRRMonitorInfo *m;
@ -1344,25 +1344,29 @@ meta_monitor_manager_xrandr_add_monitor(MetaMonitorManager *manager,
if (manager_xrandr->has_randr15 == FALSE)
return;
if (monitor->n_outputs <= 1)
if (logical_monitor->n_outputs <= 1)
return;
if (monitor->outputs[0]->product)
snprintf (name_buf, 40, "%s-%d", monitor->outputs[0]->product, monitor->outputs[0]->tile_info.group_id);
if (logical_monitor->outputs[0]->product)
snprintf (name_buf, 40, "%s-%d",
logical_monitor->outputs[0]->product,
logical_monitor->outputs[0]->tile_info.group_id);
else
snprintf (name_buf, 40, "Tiled-%d", monitor->outputs[0]->tile_info.group_id);
snprintf (name_buf, 40, "Tiled-%d",
logical_monitor->outputs[0]->tile_info.group_id);
name = XInternAtom (manager_xrandr->xdisplay, name_buf, False);
monitor->monitor_winsys_xid = name;
m = XRRAllocateMonitor (manager_xrandr->xdisplay, monitor->n_outputs);
logical_monitor->monitor_winsys_xid = name;
m = XRRAllocateMonitor (manager_xrandr->xdisplay,
logical_monitor->n_outputs);
if (!m)
return;
m->name = name;
m->primary = monitor->is_primary;
m->primary = logical_monitor->is_primary;
m->automatic = True;
for (o = 0; o < monitor->n_outputs; o++) {
MetaOutput *output = monitor->outputs[o];
for (o = 0; o < logical_monitor->n_outputs; o++) {
MetaOutput *output = logical_monitor->outputs[o];
m->outputs[o] = output->winsys_id;
}
XRRSetMonitor (manager_xrandr->xdisplay,
@ -1372,8 +1376,8 @@ meta_monitor_manager_xrandr_add_monitor(MetaMonitorManager *manager,
}
static void
meta_monitor_manager_xrandr_delete_monitor(MetaMonitorManager *manager,
int monitor_winsys_xid)
meta_monitor_manager_xrandr_delete_monitor (MetaMonitorManager *manager,
int monitor_winsys_xid)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
@ -1385,7 +1389,7 @@ meta_monitor_manager_xrandr_delete_monitor(MetaMonitorManager *manager,
}
static void
meta_monitor_manager_xrandr_init_monitors(MetaMonitorManagerXrandr *manager_xrandr)
meta_monitor_manager_xrandr_init_monitors (MetaMonitorManagerXrandr *manager_xrandr)
{
XRRMonitorInfo *m;
int n, i;

View File

@ -69,8 +69,8 @@ meta_renderer_x11_create_cogl_renderer (MetaRenderer *renderer)
}
static MetaRendererView *
meta_renderer_x11_create_view (MetaRenderer *renderer,
MetaMonitorInfo *monitor_info)
meta_renderer_x11_create_view (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor)
{
MetaBackend *backend = meta_get_backend ();
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
@ -82,8 +82,8 @@ meta_renderer_x11_create_view (MetaRenderer *renderer,
g_assert (meta_is_wayland_compositor ());
width = monitor_info->rect.width;
height = monitor_info->rect.height;
width = logical_monitor->rect.width;
height = logical_monitor->rect.height;
texture_2d = cogl_texture_2d_new_with_size (cogl_context, width, height);
offscreen = cogl_offscreen_new_with_texture (COGL_TEXTURE (texture_2d));
@ -91,7 +91,7 @@ meta_renderer_x11_create_view (MetaRenderer *renderer,
meta_fatal ("Couldn't allocate framebuffer: %s", error->message);
return g_object_new (META_TYPE_RENDERER_VIEW,
"layout", &monitor_info->rect,
"layout", &logical_monitor->rect,
"framebuffer", COGL_FRAMEBUFFER (offscreen),
NULL);
}

View File

@ -267,7 +267,7 @@ meta_surface_actor_wayland_sync_state_recursive (MetaSurfaceActorWayland *self)
gboolean
meta_surface_actor_wayland_is_on_monitor (MetaSurfaceActorWayland *self,
MetaMonitorInfo *monitor)
MetaLogicalMonitor *logical_monitor)
{
float x, y, width, height;
cairo_rectangle_int_t actor_rect;
@ -287,10 +287,10 @@ meta_surface_actor_wayland_is_on_monitor (MetaSurfaceActorWayland *self,
cairo_region_intersect_rectangle (region,
&((cairo_rectangle_int_t) {
.x = monitor->rect.x,
.y = monitor->rect.y,
.width = monitor->rect.width,
.height = monitor->rect.height,
.x = logical_monitor->rect.x,
.y = logical_monitor->rect.y,
.width = logical_monitor->rect.width,
.height = logical_monitor->rect.height,
}));
is_on_monitor = !cairo_region_is_empty (region);

View File

@ -74,7 +74,7 @@ void meta_surface_actor_wayland_sync_state_recursive (MetaSurfaceActorWayland *s
void meta_surface_actor_wayland_sync_subsurface_state (MetaSurfaceActorWayland *self);
gboolean meta_surface_actor_wayland_is_on_monitor (MetaSurfaceActorWayland *self,
MetaMonitorInfo *monitor);
MetaLogicalMonitor *logical_monitor);
void meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
struct wl_list *frame_callbacks);

View File

@ -328,7 +328,7 @@ setup_constraint_info (ConstraintInfo *info,
const MetaRectangle *orig,
MetaRectangle *new)
{
const MetaMonitorInfo *monitor_info;
const MetaLogicalMonitor *logical_monitor;
MetaWorkspace *cur_workspace;
info->orig = *orig;
@ -376,15 +376,15 @@ setup_constraint_info (ConstraintInfo *info,
if (!info->is_user_action)
info->fixed_directions = FIXED_DIRECTION_NONE;
monitor_info =
meta_screen_get_monitor_for_rect (window->screen, &info->current);
logical_monitor =
meta_screen_get_logical_monitor_for_rect (window->screen, &info->current);
meta_window_get_work_area_for_monitor (window,
monitor_info->number,
logical_monitor->number,
&info->work_area_monitor);
if (!window->fullscreen || window->fullscreen_monitors[0] == -1)
{
info->entire_monitor = monitor_info->rect;
info->entire_monitor = logical_monitor->rect;
}
else
{
@ -393,12 +393,12 @@ setup_constraint_info (ConstraintInfo *info,
monitor = window->fullscreen_monitors[i];
info->entire_monitor =
window->screen->monitor_infos[monitor].rect;
window->screen->logical_monitors[monitor].rect;
for (i = 1; i <= 3; i++)
{
monitor = window->fullscreen_monitors[i];
meta_rectangle_union (&info->entire_monitor,
&window->screen->monitor_infos[monitor].rect,
&window->screen->logical_monitors[monitor].rect,
&info->entire_monitor);
}
}
@ -408,7 +408,7 @@ setup_constraint_info (ConstraintInfo *info,
meta_workspace_get_onscreen_region (cur_workspace);
info->usable_monitor_region =
meta_workspace_get_onmonitor_region (cur_workspace,
monitor_info->number);
logical_monitor->number);
/* Log all this information for debugging */
meta_topic (META_DEBUG_GEOMETRY,
@ -463,7 +463,7 @@ place_window_if_needed(MetaWindow *window,
MetaRectangle orig_rect;
MetaRectangle placed_rect;
MetaWorkspace *cur_workspace;
const MetaMonitorInfo *monitor_info;
const MetaLogicalMonitor *logical_monitor;
placed_rect = (MetaRectangle) {
.x = window->rect.x,
@ -481,16 +481,16 @@ place_window_if_needed(MetaWindow *window,
/* placing the window may have changed the monitor. Find the
* new monitor and update the ConstraintInfo
*/
monitor_info =
meta_screen_get_monitor_for_rect (window->screen, &placed_rect);
info->entire_monitor = monitor_info->rect;
logical_monitor =
meta_screen_get_logical_monitor_for_rect (window->screen, &placed_rect);
info->entire_monitor = logical_monitor->rect;
meta_window_get_work_area_for_monitor (window,
monitor_info->number,
logical_monitor->number,
&info->work_area_monitor);
cur_workspace = window->screen->active_workspace;
info->usable_monitor_region =
meta_workspace_get_onmonitor_region (cur_workspace,
monitor_info->number);
logical_monitor->number);
info->current.x = placed_rect.x;
info->current.y = placed_rect.y;
@ -1449,12 +1449,12 @@ constrain_to_single_monitor (MetaWindow *window,
* "onscreen" by their own strut) and we can't apply it to frameless windows
* or else users will be unable to move windows such as XMMS across monitors.
*/
if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK ||
window->screen->n_monitor_infos == 1 ||
!window->require_on_single_monitor ||
!window->frame ||
info->is_user_action ||
if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK ||
window->screen->n_logical_monitors == 1 ||
!window->require_on_single_monitor ||
!window->frame ||
info->is_user_action ||
meta_window_get_placement_rule (window))
return TRUE;

View File

@ -3088,7 +3088,7 @@ meta_display_request_pad_osd (MetaDisplay *display,
MetaInputSettings *input_settings;
const gchar *layout_path = NULL;
ClutterActor *osd;
MetaMonitorInfo *monitor;
MetaLogicalMonitor *logical_monitor;
gint monitor_idx;
GSettings *settings;
#ifdef HAVE_LIBWACOM
@ -3107,7 +3107,8 @@ meta_display_request_pad_osd (MetaDisplay *display,
if (input_settings)
{
settings = meta_input_settings_get_tablet_settings (input_settings, pad);
monitor = meta_input_settings_get_tablet_monitor_info (input_settings, pad);
logical_monitor =
meta_input_settings_get_tablet_logical_monitor (input_settings, pad);
#ifdef HAVE_LIBWACOM
wacom_device = meta_input_settings_get_tablet_wacom_device (input_settings,
pad);
@ -3118,10 +3119,11 @@ meta_display_request_pad_osd (MetaDisplay *display,
if (!layout_path || !settings)
return;
if (monitor)
if (logical_monitor)
{
monitor_idx = meta_screen_get_monitor_index_for_rect (display->screen,
&monitor->rect);
monitor_idx =
meta_screen_get_monitor_index_for_rect (display->screen,
&logical_monitor->rect);
}
else
{

View File

@ -3155,7 +3155,7 @@ handle_move_to_monitor (MetaDisplay *display,
gpointer dummy)
{
gint which = binding->handler->data;
const MetaMonitorInfo *current, *new;
const MetaLogicalMonitor *current, *new;
current = window->monitor;
new = meta_screen_get_monitor_neighbor (screen, current->number, which);

View File

@ -517,7 +517,7 @@ find_first_fit (MetaWindow *window,
#ifdef WITH_VERBOSE_MODE
{
char monitor_location_string[RECT_LENGTH];
meta_rectangle_to_string (&window->screen->monitor_infos[monitor].rect,
meta_rectangle_to_string (&window->screen->logical_monitors[monitor].rect,
monitor_location_string);
meta_topic (META_DEBUG_XINERAMA,
"Natural monitor is %s\n",
@ -661,7 +661,7 @@ meta_window_place (MetaWindow *window,
int *new_y)
{
GList *windows = NULL;
const MetaMonitorInfo *xi;
const MetaLogicalMonitor *logical_monitor;
meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc);
@ -810,19 +810,19 @@ meta_window_place (MetaWindow *window,
meta_window_get_frame_rect (window, &frame_rect);
/* Warning, this function is a round trip! */
xi = meta_screen_get_current_monitor_info (window->screen);
logical_monitor = meta_screen_get_current_logical_monitor (window->screen);
w = xi->rect.width;
h = xi->rect.height;
w = logical_monitor->rect.width;
h = logical_monitor->rect.height;
x = (w - frame_rect.width) / 2;
y = (h - frame_rect.height) / 2;
x += xi->rect.x;
y += xi->rect.y;
x += logical_monitor->rect.x;
y += logical_monitor->rect.y;
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s on monitor %d\n",
window->desc, xi->number);
window->desc, logical_monitor->number);
goto done_check_denied_focus;
}
@ -855,7 +855,7 @@ meta_window_place (MetaWindow *window,
}
/* Warning, this is a round trip! */
xi = meta_screen_get_current_monitor_info (window->screen);
logical_monitor = meta_screen_get_current_logical_monitor (window->screen);
/* Maximize windows if they are too big for their work area (bit of
* a hack here). Assume undecorated windows probably don't intend to
@ -868,7 +868,7 @@ meta_window_place (MetaWindow *window,
MetaRectangle frame_rect;
meta_window_get_work_area_for_monitor (window,
xi->number,
logical_monitor->number,
&workarea);
meta_window_get_frame_rect (window, &frame_rect);
@ -883,11 +883,11 @@ meta_window_place (MetaWindow *window,
}
/* "Origin" placement algorithm */
x = xi->rect.x;
y = xi->rect.y;
x = logical_monitor->rect.x;
y = logical_monitor->rect.y;
if (find_first_fit (window, windows,
xi->number,
logical_monitor->number,
x, y, &x, &y))
goto done_check_denied_focus;
@ -920,11 +920,11 @@ meta_window_place (MetaWindow *window,
focus_window_list = g_list_prepend (NULL, focus_window);
/* Reset x and y ("origin" placement algorithm) */
x = xi->rect.x;
y = xi->rect.y;
x = logical_monitor->rect.x;
y = logical_monitor->rect.y;
found_fit = find_first_fit (window, focus_window_list,
xi->number,
logical_monitor->number,
x, y, &x, &y);
g_list_free (focus_window_list);
}

View File

@ -75,8 +75,8 @@ struct _MetaScreen
Atom wm_sn_atom;
guint32 wm_sn_timestamp;
MetaMonitorInfo *monitor_infos;
int n_monitor_infos;
MetaLogicalMonitor *logical_monitors;
int n_logical_monitors;
int primary_monitor_index;
gboolean has_xinerama_indices;
@ -136,23 +136,22 @@ void meta_screen_hide_tile_preview (MetaScreen *screen);
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one);
const MetaMonitorInfo* meta_screen_get_current_monitor_info (MetaScreen *screen);
const MetaMonitorInfo* meta_screen_get_current_monitor_info_for_pos (MetaScreen *screen,
int x,
int y);
const MetaMonitorInfo* meta_screen_get_monitor_for_rect (MetaScreen *screen,
MetaRectangle *rect);
const MetaMonitorInfo* meta_screen_calculate_monitor_for_window (MetaScreen *screen,
MetaWindow *window);
const MetaLogicalMonitor * meta_screen_get_current_logical_monitor (MetaScreen *screen);
const MetaLogicalMonitor * meta_screen_get_current_logical_monitor_for_pos (MetaScreen *screen,
int x,
int y);
const MetaLogicalMonitor * meta_screen_get_logical_monitor_for_rect (MetaScreen *screen,
MetaRectangle *rect);
const MetaLogicalMonitor * meta_screen_calculate_logical_monitor_for_window (MetaScreen *screen,
MetaWindow *window);
const MetaMonitorInfo* meta_screen_get_monitor_for_point (MetaScreen *screen,
int x,
int y);
const MetaLogicalMonitor * meta_screen_get_logical_monitor_for_point (MetaScreen *screen,
int x,
int y);
const MetaMonitorInfo* meta_screen_get_monitor_neighbor (MetaScreen *screen,
int which_monitor,
MetaScreenDirection dir);
const MetaLogicalMonitor * meta_screen_get_monitor_neighbor (MetaScreen *screen,
int which_monitor,
MetaScreenDirection dir);
void meta_screen_update_workspace_layout (MetaScreen *screen);
void meta_screen_update_workspace_names (MetaScreen *screen);

View File

@ -358,15 +358,15 @@ meta_screen_ensure_xinerama_indices (MetaScreen *screen)
return;
}
for (i = 0; i < screen->n_monitor_infos; ++i)
for (i = 0; i < screen->n_logical_monitors; ++i)
{
for (j = 0; j < n_infos; ++j)
{
if (screen->monitor_infos[i].rect.x == infos[j].x_org &&
screen->monitor_infos[i].rect.y == infos[j].y_org &&
screen->monitor_infos[i].rect.width == infos[j].width &&
screen->monitor_infos[i].rect.height == infos[j].height)
screen->monitor_infos[i].xinerama_index = j;
if (screen->logical_monitors[i].rect.x == infos[j].x_org &&
screen->logical_monitors[i].rect.y == infos[j].y_org &&
screen->logical_monitors[i].rect.width == infos[j].width &&
screen->logical_monitors[i].rect.height == infos[j].height)
screen->logical_monitors[i].xinerama_index = j;
}
}
@ -377,11 +377,11 @@ int
meta_screen_monitor_index_to_xinerama_index (MetaScreen *screen,
int index)
{
g_return_val_if_fail (index >= 0 && index < screen->n_monitor_infos, -1);
g_return_val_if_fail (index >= 0 && index < screen->n_logical_monitors, -1);
meta_screen_ensure_xinerama_indices (screen);
return screen->monitor_infos[index].xinerama_index;
return screen->logical_monitors[index].xinerama_index;
}
int
@ -392,18 +392,19 @@ meta_screen_xinerama_index_to_monitor_index (MetaScreen *screen,
meta_screen_ensure_xinerama_indices (screen);
for (i = 0; i < screen->n_monitor_infos; i++)
if (screen->monitor_infos[i].xinerama_index == index)
for (i = 0; i < screen->n_logical_monitors; i++)
if (screen->logical_monitors[i].xinerama_index == index)
return i;
return -1;
}
static void
reload_monitor_infos (MetaScreen *screen)
reload_logical_monitors (MetaScreen *screen)
{
GList *l;
MetaMonitorManager *manager;
unsigned int n_logical_monitors;
for (l = screen->workspaces; l != NULL; l = l->next)
{
@ -411,7 +412,7 @@ reload_monitor_infos (MetaScreen *screen)
meta_workspace_invalidate_work_area (space);
}
/* Any previous screen->monitor_infos or screen->outputs is freed by the caller */
/* Any previous screen->logical_monitors or screen->outputs is freed by the caller */
screen->last_monitor_index = 0;
screen->has_xinerama_indices = FALSE;
@ -419,8 +420,9 @@ reload_monitor_infos (MetaScreen *screen)
manager = meta_monitor_manager_get ();
screen->monitor_infos = meta_monitor_manager_get_monitor_infos (manager,
(unsigned*)&screen->n_monitor_infos);
screen->logical_monitors =
meta_monitor_manager_get_logical_monitors (manager, &n_logical_monitors);
screen->n_logical_monitors = (unsigned int) n_logical_monitors;
screen->primary_monitor_index = meta_monitor_manager_get_primary_index (manager);
}
@ -684,7 +686,7 @@ meta_screen_new (MetaDisplay *display,
* can close the helper that is holding on to it */
meta_restart_finish ();
reload_monitor_infos (screen);
reload_logical_monitors (screen);
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
@ -805,7 +807,7 @@ meta_screen_free (MetaScreen *screen,
if (screen->check_fullscreen_later != 0)
meta_later_remove (screen->check_fullscreen_later);
g_free (screen->monitor_infos);
g_free (screen->logical_monitors);
if (screen->tile_preview_timeout_id)
g_source_remove (screen->tile_preview_timeout_id);
@ -1228,13 +1230,13 @@ root_cursor_prepare_at (MetaCursorSprite *cursor_sprite,
int y,
MetaScreen *screen)
{
const MetaMonitorInfo *monitor;
const MetaLogicalMonitor *logical_monitor;
monitor = meta_screen_get_monitor_for_point (screen, x, y);
logical_monitor = meta_screen_get_logical_monitor_for_point (screen, x, y);
/* Reload the cursor texture if the scale has changed. */
if (monitor)
meta_cursor_sprite_set_theme_scale (cursor_sprite, monitor->scale);
if (logical_monitor)
meta_cursor_sprite_set_theme_scale (cursor_sprite, logical_monitor->scale);
}
static void
@ -1388,21 +1390,21 @@ meta_screen_get_mouse_window (MetaScreen *screen,
return window;
}
const MetaMonitorInfo*
meta_screen_get_monitor_for_rect (MetaScreen *screen,
MetaRectangle *rect)
const MetaLogicalMonitor *
meta_screen_get_logical_monitor_for_rect (MetaScreen *screen,
MetaRectangle *rect)
{
int i;
int best_monitor, monitor_score, rect_area;
if (screen->n_monitor_infos == 1)
return &screen->monitor_infos[0];
if (screen->n_logical_monitors == 1)
return &screen->logical_monitors[0];
best_monitor = 0;
monitor_score = -1;
rect_area = meta_rectangle_area (rect);
for (i = 0; i < screen->n_monitor_infos; i++)
for (i = 0; i < screen->n_logical_monitors; i++)
{
gboolean result;
int cur;
@ -1410,14 +1412,14 @@ meta_screen_get_monitor_for_rect (MetaScreen *screen,
if (rect_area > 0)
{
MetaRectangle dest;
result = meta_rectangle_intersect (&screen->monitor_infos[i].rect,
result = meta_rectangle_intersect (&screen->logical_monitors[i].rect,
rect,
&dest);
cur = meta_rectangle_area (&dest);
}
else
{
result = meta_rectangle_contains_rect (&screen->monitor_infos[i].rect,
result = meta_rectangle_contains_rect (&screen->logical_monitors[i].rect,
rect);
cur = rect_area;
}
@ -1429,59 +1431,61 @@ meta_screen_get_monitor_for_rect (MetaScreen *screen,
}
}
return &screen->monitor_infos[best_monitor];
return &screen->logical_monitors[best_monitor];
}
const MetaMonitorInfo*
meta_screen_calculate_monitor_for_window (MetaScreen *screen,
MetaWindow *window)
const MetaLogicalMonitor *
meta_screen_calculate_logical_monitor_for_window (MetaScreen *screen,
MetaWindow *window)
{
MetaRectangle window_rect;
meta_window_get_frame_rect (window, &window_rect);
return meta_screen_get_monitor_for_rect (screen, &window_rect);
return meta_screen_get_logical_monitor_for_rect (screen, &window_rect);
}
int
meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
MetaRectangle *rect)
{
const MetaMonitorInfo *monitor = meta_screen_get_monitor_for_rect (screen, rect);
const MetaLogicalMonitor *monitor;
monitor = meta_screen_get_logical_monitor_for_rect (screen, rect);
return monitor->number;
}
const MetaMonitorInfo *
meta_screen_get_monitor_for_point (MetaScreen *screen,
int x,
int y)
const MetaLogicalMonitor *
meta_screen_get_logical_monitor_for_point (MetaScreen *screen,
int x,
int y)
{
int i;
if (screen->n_monitor_infos == 1)
return &screen->monitor_infos[0];
if (screen->n_logical_monitors == 1)
return &screen->logical_monitors[0];
for (i = 0; i < screen->n_monitor_infos; i++)
for (i = 0; i < screen->n_logical_monitors; i++)
{
if (POINT_IN_RECT (x, y, screen->monitor_infos[i].rect))
return &screen->monitor_infos[i];
if (POINT_IN_RECT (x, y, screen->logical_monitors[i].rect))
return &screen->logical_monitors[i];
}
return NULL;
}
const MetaMonitorInfo*
const MetaLogicalMonitor *
meta_screen_get_monitor_neighbor (MetaScreen *screen,
int which_monitor,
MetaScreenDirection direction)
{
MetaMonitorInfo* input = screen->monitor_infos + which_monitor;
MetaMonitorInfo* current;
MetaLogicalMonitor *input = screen->logical_monitors + which_monitor;
MetaLogicalMonitor *current;
int i;
for (i = 0; i < screen->n_monitor_infos; i++)
for (i = 0; i < screen->n_logical_monitors; i++)
{
current = screen->monitor_infos + i;
current = screen->logical_monitors + i;
if ((direction == META_SCREEN_RIGHT &&
current->rect.x == input->rect.x + input->rect.width &&
@ -1508,27 +1512,32 @@ meta_screen_get_monitor_neighbor_index (MetaScreen *screen,
int which_monitor,
MetaScreenDirection direction)
{
const MetaMonitorInfo *monitor;
monitor = meta_screen_get_monitor_neighbor (screen, which_monitor, direction);
return monitor ? monitor->number : -1;
const MetaLogicalMonitor *logical_monitor;
logical_monitor = meta_screen_get_monitor_neighbor (screen,
which_monitor,
direction);
return logical_monitor ? logical_monitor->number : -1;
}
const MetaMonitorInfo*
meta_screen_get_current_monitor_info (MetaScreen *screen)
const MetaLogicalMonitor *
meta_screen_get_current_logical_monitor (MetaScreen *screen)
{
int monitor_index;
monitor_index = meta_screen_get_current_monitor (screen);
return &screen->monitor_infos[monitor_index];
return &screen->logical_monitors[monitor_index];
}
const MetaMonitorInfo*
meta_screen_get_current_monitor_info_for_pos (MetaScreen *screen,
int x,
int y)
const MetaLogicalMonitor *
meta_screen_get_current_logical_monitor_for_pos (MetaScreen *screen,
int x,
int y)
{
int monitor_index;
monitor_index = meta_screen_get_current_monitor_for_pos (screen, x, y);
return &screen->monitor_infos[monitor_index];
return &screen->logical_monitors[monitor_index];
}
@ -1547,7 +1556,7 @@ meta_screen_get_current_monitor_for_pos (MetaScreen *screen,
int x,
int y)
{
if (screen->n_monitor_infos == 1)
if (screen->n_logical_monitors == 1)
return 0;
else if (screen->display->monitor_cache_invalidated)
{
@ -1560,9 +1569,9 @@ meta_screen_get_current_monitor_for_pos (MetaScreen *screen,
screen->display->monitor_cache_invalidated = FALSE;
screen->last_monitor_index = 0;
for (i = 0; i < screen->n_monitor_infos; i++)
for (i = 0; i < screen->n_logical_monitors; i++)
{
if (meta_rectangle_contains_rect (&screen->monitor_infos[i].rect,
if (meta_rectangle_contains_rect (&screen->logical_monitors[i].rect,
&pointer_position))
{
screen->last_monitor_index = i;
@ -1593,7 +1602,7 @@ meta_screen_get_current_monitor (MetaScreen *screen)
{
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (screen);
if (screen->n_monitor_infos == 1)
if (screen->n_logical_monitors == 1)
return 0;
/* Sadly, we have to do it this way. Yuck.
@ -1623,7 +1632,7 @@ meta_screen_get_n_monitors (MetaScreen *screen)
{
g_return_val_if_fail (META_IS_SCREEN (screen), 0);
return screen->n_monitor_infos;
return screen->n_logical_monitors;
}
/**
@ -1656,10 +1665,10 @@ meta_screen_get_monitor_geometry (MetaScreen *screen,
MetaRectangle *geometry)
{
g_return_if_fail (META_IS_SCREEN (screen));
g_return_if_fail (monitor >= 0 && monitor < screen->n_monitor_infos);
g_return_if_fail (monitor >= 0 && monitor < screen->n_logical_monitors);
g_return_if_fail (geometry != NULL);
*geometry = screen->monitor_infos[monitor].rect;
*geometry = screen->logical_monitors[monitor].rect;
}
#define _NET_WM_ORIENTATION_HORZ 0
@ -2286,7 +2295,7 @@ on_monitors_changed (MetaMonitorManager *manager,
&screen->rect.width,
&screen->rect.height);
reload_monitor_infos (screen);
reload_logical_monitors (screen);
set_desktop_geometry_hint (screen);
/* Resize the guard window to fill the screen again. */
@ -2779,13 +2788,13 @@ check_fullscreen_func (gpointer data)
g_slist_free (obscured_monitors);
for (i = 0; i < screen->n_monitor_infos; i++)
for (i = 0; i < screen->n_logical_monitors; i++)
{
MetaMonitorInfo *info = &screen->monitor_infos[i];
MetaLogicalMonitor *logical_monitor = &screen->logical_monitors[i];
gboolean in_fullscreen = g_slist_find (fullscreen_monitors, GINT_TO_POINTER (i + 1)) != NULL;
if (in_fullscreen != info->in_fullscreen)
if (in_fullscreen != logical_monitor->in_fullscreen)
{
info->in_fullscreen = in_fullscreen;
logical_monitor->in_fullscreen = in_fullscreen;
in_fullscreen_changed = TRUE;
}
}
@ -2834,10 +2843,11 @@ meta_screen_get_monitor_in_fullscreen (MetaScreen *screen,
int monitor)
{
g_return_val_if_fail (META_IS_SCREEN (screen), FALSE);
g_return_val_if_fail (monitor >= 0 && monitor < screen->n_monitor_infos, FALSE);
g_return_val_if_fail (monitor >= 0 &&
monitor < screen->n_logical_monitors, FALSE);
/* We use -1 as a flag to mean "not known yet" for notification purposes */
return screen->monitor_infos[monitor].in_fullscreen == TRUE;
return screen->logical_monitors[monitor].in_fullscreen == TRUE;
}
gboolean

View File

@ -135,7 +135,7 @@ struct _MetaWindow
MetaDisplay *display;
MetaScreen *screen;
guint64 stamp;
const MetaMonitorInfo *monitor;
const MetaLogicalMonitor *monitor;
MetaWorkspace *workspace;
MetaWindowClientType client_type;
MetaWaylandSurface *surface;
@ -527,7 +527,7 @@ struct _MetaWindowClass
uint32_t (*get_client_pid) (MetaWindow *window);
void (*update_main_monitor) (MetaWindow *window);
void (*main_monitor_changed) (MetaWindow *window,
const MetaMonitorInfo *old);
const MetaLogicalMonitor *old);
};
/* These differ from window->has_foo_func in that they consider

View File

@ -816,8 +816,8 @@ meta_window_update_desc (MetaWindow *window)
}
static void
meta_window_main_monitor_changed (MetaWindow *window,
const MetaMonitorInfo *old)
meta_window_main_monitor_changed (MetaWindow *window,
const MetaLogicalMonitor *old)
{
META_WINDOW_GET_CLASS (window)->main_monitor_changed (window, old);
@ -1027,8 +1027,8 @@ _meta_window_shared_new (MetaDisplay *display,
window->compositor_private = NULL;
window->monitor = meta_screen_calculate_monitor_for_window (window->screen,
window);
window->monitor =
meta_screen_calculate_logical_monitor_for_window (window->screen, window);
window->preferred_output_winsys_id = window->monitor->winsys_id;
window->tile_match = NULL;
@ -1437,7 +1437,7 @@ meta_window_unmanage (MetaWindow *window,
if (window->monitor)
{
const MetaMonitorInfo *old = window->monitor;
const MetaLogicalMonitor *old = window->monitor;
window->monitor = NULL;
meta_window_main_monitor_changed (window, old);
@ -2805,9 +2805,9 @@ meta_window_get_all_monitors (MetaWindow *window, gsize *length)
monitors = g_array_new (FALSE, FALSE, sizeof (int));
meta_window_get_frame_rect (window, &window_rect);
for (i = 0; i < window->screen->n_monitor_infos; i++)
for (i = 0; i < window->screen->n_logical_monitors; i++)
{
MetaRectangle *monitor_rect = &window->screen->monitor_infos[i].rect;
MetaRectangle *monitor_rect = &window->screen->logical_monitors[i].rect;
if (meta_rectangle_overlap (&window_rect, monitor_rect))
g_array_append_val (monitors, i);
@ -3277,10 +3277,10 @@ meta_window_update_fullscreen_monitors (MetaWindow *window,
unsigned long left,
unsigned long right)
{
if ((int)top < window->screen->n_monitor_infos &&
(int)bottom < window->screen->n_monitor_infos &&
(int)left < window->screen->n_monitor_infos &&
(int)right < window->screen->n_monitor_infos)
if ((int) top < window->screen->n_logical_monitors &&
(int) bottom < window->screen->n_logical_monitors &&
(int) left < window->screen->n_logical_monitors &&
(int) right < window->screen->n_logical_monitors)
{
window->fullscreen_monitors[0] = top;
window->fullscreen_monitors[1] = bottom;
@ -3516,18 +3516,18 @@ meta_window_get_monitor (MetaWindow *window)
return window->monitor->number;
}
static MetaMonitorInfo *
static MetaLogicalMonitor *
find_monitor_by_winsys_id (MetaWindow *window,
guint winsys_id)
{
int i;
for (i = 0; i < window->screen->n_monitor_infos; i++)
for (i = 0; i < window->screen->n_logical_monitors; i++)
{
MetaMonitorInfo *info = &window->screen->monitor_infos[i];
MetaLogicalMonitor *logical_monitor = &window->screen->logical_monitors[i];
if (info->winsys_id == winsys_id)
return info;
if (logical_monitor->winsys_id == winsys_id)
return logical_monitor;
}
return NULL;
@ -3538,7 +3538,7 @@ find_monitor_by_winsys_id (MetaWindow *window,
void
meta_window_update_for_monitors_changed (MetaWindow *window)
{
const MetaMonitorInfo *old, *new;
const MetaLogicalMonitor *old, *new;
if (window->override_redirect || window->type == META_WINDOW_DESKTOP)
{
@ -3557,14 +3557,14 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
/* Fall back to primary if everything else failed */
if (!new)
new = &window->screen->monitor_infos[window->screen->primary_monitor_index];
new = &window->screen->logical_monitors[window->screen->primary_monitor_index];
if (window->tile_mode != META_TILE_NONE)
window->tile_monitor_number = new->number;
/* This will eventually reach meta_window_update_monitor that
* will send leave/enter-monitor events. The old != new monitor
* check will always fail (due to the new monitor_infos set) so
* check will always fail (due to the new logical_monitors set) so
* we will always send the events, even if the new and old monitor
* index is the same. That is right, since the enumeration of the
* monitors changed and the same index could be refereing
@ -3578,7 +3578,7 @@ void
meta_window_update_monitor (MetaWindow *window,
gboolean user_op)
{
const MetaMonitorInfo *old;
const MetaLogicalMonitor *old;
old = window->monitor;
META_WINDOW_GET_CLASS (window)->update_main_monitor (window);
@ -5598,7 +5598,7 @@ update_move (MetaWindow *window,
!META_WINDOW_MAXIMIZED (window) &&
!META_WINDOW_TILED_SIDE_BY_SIDE (window))
{
const MetaMonitorInfo *monitor;
const MetaLogicalMonitor *monitor;
MetaRectangle work_area;
/* For side-by-side tiling we are interested in the inside vertical
@ -5614,7 +5614,8 @@ update_move (MetaWindow *window,
* refers to the monitor which contains the largest part of the window,
* the latter to the one where the pointer is located.
*/
monitor = meta_screen_get_current_monitor_info_for_pos (window->screen, x, y);
monitor = meta_screen_get_current_logical_monitor_for_pos (window->screen,
x, y);
meta_window_get_work_area_for_monitor (window,
monitor->number,
&work_area);
@ -5686,14 +5687,14 @@ update_move (MetaWindow *window,
else if ((window->shaken_loose || META_WINDOW_MAXIMIZED (window)) &&
window->tile_mode != META_TILE_LEFT && window->tile_mode != META_TILE_RIGHT)
{
const MetaMonitorInfo *wmonitor;
const MetaLogicalMonitor *wmonitor;
MetaRectangle work_area;
int monitor;
window->tile_mode = META_TILE_NONE;
wmonitor = window->monitor;
for (monitor = 0; monitor < window->screen->n_monitor_infos; monitor++)
for (monitor = 0; monitor < window->screen->n_logical_monitors; monitor++)
{
meta_window_get_work_area_for_monitor (window, monitor, &work_area);
@ -6068,7 +6069,7 @@ get_work_area_monitor (MetaWindow *window,
g_assert (which_monitor >= 0);
/* Initialize to the whole monitor */
*area = window->screen->monitor_infos[which_monitor].rect;
*area = window->screen->logical_monitors[which_monitor].rect;
tmp = meta_window_get_workspaces (window);
while (tmp != NULL)

View File

@ -294,7 +294,7 @@ meta_workspace_remove (MetaWorkspace *workspace)
if (!workspace->work_areas_invalid)
{
workspace_free_all_struts (workspace);
for (i = 0; i < screen->n_monitor_infos; i++)
for (i = 0; i < screen->n_logical_monitors; i++)
meta_rectangle_free_list_and_elements (workspace->monitor_region[i]);
g_free (workspace->monitor_region);
meta_rectangle_free_list_and_elements (workspace->screen_region);
@ -704,7 +704,7 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
workspace_free_all_struts (workspace);
for (i = 0; i < workspace->screen->n_monitor_infos; i++)
for (i = 0; i < workspace->screen->n_logical_monitors; i++)
meta_rectangle_free_list_and_elements (workspace->monitor_region[i]);
g_free (workspace->monitor_region);
meta_rectangle_free_list_and_elements (workspace->screen_region);
@ -789,12 +789,12 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
g_assert (workspace->screen_region == NULL);
workspace->monitor_region = g_new (GList*,
workspace->screen->n_monitor_infos);
for (i = 0; i < workspace->screen->n_monitor_infos; i++)
workspace->screen->n_logical_monitors);
for (i = 0; i < workspace->screen->n_logical_monitors; i++)
{
workspace->monitor_region[i] =
meta_rectangle_get_minimal_spanning_set_for_region (
&workspace->screen->monitor_infos[i].rect,
&workspace->screen->logical_monitors[i].rect,
workspace->all_struts);
}
workspace->screen_region =
@ -861,11 +861,11 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
/* Now find the work areas for each monitor */
g_free (workspace->work_area_monitor);
workspace->work_area_monitor = g_new (MetaRectangle,
workspace->screen->n_monitor_infos);
workspace->screen->n_logical_monitors);
for (i = 0; i < workspace->screen->n_monitor_infos; i++)
for (i = 0; i < workspace->screen->n_logical_monitors; i++)
{
work_area = workspace->screen->monitor_infos[i].rect;
work_area = workspace->screen->logical_monitors[i].rect;
if (workspace->monitor_region[i] == NULL)
/* FIXME: constraints.c untested with this, but it might be nice for
@ -907,8 +907,8 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
meta_rectangle_find_onscreen_edges (&workspace->screen->rect,
workspace->all_struts);
tmp = NULL;
for (i = 0; i < workspace->screen->n_monitor_infos; i++)
tmp = g_list_prepend (tmp, &workspace->screen->monitor_infos[i].rect);
for (i = 0; i < workspace->screen->n_logical_monitors; i++)
tmp = g_list_prepend (tmp, &workspace->screen->logical_monitors[i].rect);
workspace->monitor_edges =
meta_rectangle_find_nonintersected_monitor_edges (tmp,
workspace->all_struts);
@ -1016,7 +1016,7 @@ meta_workspace_get_work_area_for_monitor (MetaWorkspace *workspace,
g_assert (which_monitor >= 0);
ensure_work_areas_validated (workspace);
g_assert (which_monitor < workspace->screen->n_monitor_infos);
g_assert (which_monitor < workspace->screen->n_logical_monitors);
*area = workspace->work_area_monitor[which_monitor];
}

View File

@ -56,23 +56,21 @@ output_resource_destroy (struct wl_resource *res)
static void
send_output_events (struct wl_resource *resource,
MetaWaylandOutput *wayland_output,
MetaMonitorInfo *monitor_info,
MetaLogicalMonitor *logical_monitor,
gboolean need_all_events)
{
int version = wl_resource_get_version (resource);
MetaOutput *output = monitor_info->outputs[0];
MetaOutput *output = logical_monitor->outputs[0];
guint mode_flags = WL_OUTPUT_MODE_CURRENT;
MetaMonitorInfo *old_monitor_info = wayland_output->monitor_info;
MetaLogicalMonitor *old_logical_monitor = wayland_output->logical_monitor;
guint old_mode_flags = wayland_output->mode_flags;
gint old_scale = wayland_output->scale;
gboolean need_done = FALSE;
if (need_all_events ||
old_monitor_info->rect.x != monitor_info->rect.x ||
old_monitor_info->rect.y != monitor_info->rect.y)
old_logical_monitor->rect.x != logical_monitor->rect.x ||
old_logical_monitor->rect.y != logical_monitor->rect.y)
{
/*
* TODO: When we support wl_surface.set_buffer_transform, pass along
@ -81,10 +79,10 @@ send_output_events (struct wl_resource *resource,
* transform other than 'normal'.
*/
wl_output_send_geometry (resource,
(int)monitor_info->rect.x,
(int)monitor_info->rect.y,
monitor_info->width_mm,
monitor_info->height_mm,
logical_monitor->rect.x,
logical_monitor->rect.y,
logical_monitor->width_mm,
logical_monitor->height_mm,
output->subpixel_order,
output->vendor,
output->product,
@ -96,16 +94,16 @@ send_output_events (struct wl_resource *resource,
mode_flags |= WL_OUTPUT_MODE_PREFERRED;
if (need_all_events ||
old_monitor_info->rect.width != monitor_info->rect.width ||
old_monitor_info->rect.height != monitor_info->rect.height ||
old_monitor_info->refresh_rate != monitor_info->refresh_rate ||
old_logical_monitor->rect.width != logical_monitor->rect.width ||
old_logical_monitor->rect.height != logical_monitor->rect.height ||
old_logical_monitor->refresh_rate != logical_monitor->refresh_rate ||
old_mode_flags != mode_flags)
{
wl_output_send_mode (resource,
mode_flags,
(int)monitor_info->rect.width,
(int)monitor_info->rect.height,
(int)(monitor_info->refresh_rate * 1000));
logical_monitor->rect.width,
logical_monitor->rect.height,
(int32_t) (logical_monitor->refresh_rate * 1000));
need_done = TRUE;
}
@ -130,9 +128,9 @@ bind_output (struct wl_client *client,
guint32 id)
{
MetaWaylandOutput *wayland_output = data;
MetaMonitorInfo *monitor_info = wayland_output->monitor_info;
MetaLogicalMonitor *logical_monitor = wayland_output->logical_monitor;
struct wl_resource *resource;
MetaOutput *output = monitor_info->outputs[0];
MetaOutput *output = logical_monitor->outputs[0];
resource = wl_resource_create (client, &wl_output_interface, version, id);
wayland_output->resources = g_list_prepend (wayland_output->resources, resource);
@ -141,12 +139,12 @@ bind_output (struct wl_client *client,
wl_resource_set_destructor (resource, output_resource_destroy);
meta_verbose ("Binding monitor %p/%s (%u, %u, %u, %u) x %f\n",
monitor_info, output->name,
monitor_info->rect.x, monitor_info->rect.y,
monitor_info->rect.width, monitor_info->rect.height,
monitor_info->refresh_rate);
logical_monitor, output->name,
logical_monitor->rect.x, logical_monitor->rect.y,
logical_monitor->rect.width, logical_monitor->rect.height,
logical_monitor->refresh_rate);
send_output_events (resource, wayland_output, monitor_info, TRUE);
send_output_events (resource, wayland_output, logical_monitor, TRUE);
}
static void
@ -159,12 +157,12 @@ wayland_output_destroy_notify (gpointer data)
}
static void
wayland_output_set_monitor_info (MetaWaylandOutput *wayland_output,
MetaMonitorInfo *monitor_info)
meta_wayland_output_set_logical_monitor (MetaWaylandOutput *wayland_output,
MetaLogicalMonitor *logical_monitor)
{
MetaOutput *output = monitor_info->outputs[0];
MetaOutput *output = logical_monitor->outputs[0];
wayland_output->monitor_info = monitor_info;
wayland_output->logical_monitor = logical_monitor;
wayland_output->mode_flags = WL_OUTPUT_MODE_CURRENT;
if (output->crtc->current_mode == output->preferred_mode)
wayland_output->mode_flags |= WL_OUTPUT_MODE_PREFERRED;
@ -172,25 +170,25 @@ wayland_output_set_monitor_info (MetaWaylandOutput *wayland_output,
}
static void
wayland_output_update_for_output (MetaWaylandOutput *wayland_output,
MetaMonitorInfo *monitor_info)
wayland_output_update_for_output (MetaWaylandOutput *wayland_output,
MetaLogicalMonitor *logical_monitor)
{
GList *iter;
for (iter = wayland_output->resources; iter; iter = iter->next)
{
struct wl_resource *resource = iter->data;
send_output_events (resource, wayland_output, monitor_info, FALSE);
send_output_events (resource, wayland_output, logical_monitor, FALSE);
}
/* It's very important that we change the output pointer here, as
the old structure is about to be freed by MetaMonitorManager */
wayland_output_set_monitor_info (wayland_output, monitor_info);
meta_wayland_output_set_logical_monitor (wayland_output, logical_monitor);
}
static MetaWaylandOutput *
meta_wayland_output_new (MetaWaylandCompositor *compositor,
MetaMonitorInfo *monitor_info)
MetaLogicalMonitor *logical_monitor)
{
MetaWaylandOutput *wayland_output;
@ -199,7 +197,7 @@ meta_wayland_output_new (MetaWaylandCompositor *compositor,
&wl_output_interface,
META_WL_OUTPUT_VERSION,
wayland_output, bind_output);
wayland_output_set_monitor_info (wayland_output, monitor_info);
meta_wayland_output_set_logical_monitor (wayland_output, logical_monitor);
return wayland_output;
}
@ -210,30 +208,40 @@ meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
{
unsigned int i;
GHashTable *new_table;
MetaMonitorInfo *monitor_infos;
unsigned int n_monitor_infos;
MetaLogicalMonitor *logical_monitors;
unsigned int n_logical_monitors;
monitor_infos = meta_monitor_manager_get_monitor_infos (monitors, &n_monitor_infos);
new_table = g_hash_table_new_full (NULL, NULL, NULL, wayland_output_destroy_notify);
logical_monitors = meta_monitor_manager_get_logical_monitors (monitors,
&n_logical_monitors);
new_table = g_hash_table_new_full (NULL, NULL, NULL,
wayland_output_destroy_notify);
for (i = 0; i < n_monitor_infos; i++)
for (i = 0; i < n_logical_monitors; i++)
{
MetaMonitorInfo *info = &monitor_infos[i];
MetaLogicalMonitor *logical_monitor = &logical_monitors[i];
MetaWaylandOutput *wayland_output;
if (info->winsys_id == 0)
if (logical_monitor->winsys_id == 0)
continue;
wayland_output = g_hash_table_lookup (compositor->outputs, GSIZE_TO_POINTER (info->winsys_id));
wayland_output =
g_hash_table_lookup (compositor->outputs,
GSIZE_TO_POINTER (logical_monitor->winsys_id));
if (wayland_output)
{
g_hash_table_steal (compositor->outputs, GSIZE_TO_POINTER (info->winsys_id));
g_hash_table_steal (compositor->outputs,
GSIZE_TO_POINTER (logical_monitor->winsys_id));
}
else
wayland_output = meta_wayland_output_new (compositor, info);
{
wayland_output = meta_wayland_output_new (compositor, logical_monitor);
}
wayland_output_update_for_output (wayland_output, info);
g_hash_table_insert (new_table, GSIZE_TO_POINTER (info->winsys_id), wayland_output);
wayland_output_update_for_output (wayland_output, logical_monitor);
g_hash_table_insert (new_table,
GSIZE_TO_POINTER (logical_monitor->winsys_id),
wayland_output);
}
g_hash_table_destroy (compositor->outputs);

View File

@ -37,7 +37,7 @@ struct _MetaWaylandOutput
GObject parent;
struct wl_global *global;
MetaMonitorInfo *monitor_info;
MetaLogicalMonitor *logical_monitor;
guint mode_flags;
gint scale;

View File

@ -98,14 +98,20 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (role);
MetaDisplay *display = meta_get_display ();
MetaScreen *screen = display->screen;
const MetaMonitorInfo *monitor;
if (!meta_xwayland_is_xwayland_surface (surface))
{
monitor = meta_screen_get_monitor_for_point (screen, x, y);
if (monitor)
meta_cursor_sprite_set_texture_scale (cursor_sprite,
(float) monitor->scale / surface->scale);
const MetaLogicalMonitor *logical_monitor;
logical_monitor = meta_screen_get_logical_monitor_for_point (screen,
x, y);
if (logical_monitor)
{
float texture_scale;
texture_scale = (float) logical_monitor->scale / surface->scale;
meta_cursor_sprite_set_texture_scale (cursor_sprite, texture_scale);
}
}
meta_wayland_surface_update_outputs (surface);
}
@ -172,7 +178,7 @@ cursor_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
static gboolean
cursor_surface_role_is_on_output (MetaWaylandSurfaceRole *role,
MetaMonitorInfo *monitor)
MetaLogicalMonitor *logical_monitor)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (role);
@ -184,7 +190,7 @@ cursor_surface_role_is_on_output (MetaWaylandSurfaceRole *role,
rect = meta_cursor_renderer_calculate_rect (priv->cursor_renderer,
priv->cursor_sprite);
return meta_rectangle_overlap (&rect, &monitor->rect);
return meta_rectangle_overlap (&rect, &logical_monitor->rect);
}
static void

View File

@ -148,7 +148,7 @@ meta_wayland_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
static gboolean
meta_wayland_surface_role_is_on_output (MetaWaylandSurfaceRole *surface_role,
MetaMonitorInfo *info);
MetaLogicalMonitor *logical_monitor);
static MetaWaylandSurface *
meta_wayland_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role);
@ -1171,14 +1171,14 @@ set_surface_is_on_output (MetaWaylandSurface *surface,
static gboolean
actor_surface_is_on_output (MetaWaylandSurfaceRole *surface_role,
MetaMonitorInfo *monitor)
MetaLogicalMonitor *logical_monitor)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaSurfaceActorWayland *actor =
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor);
return meta_surface_actor_wayland_is_on_monitor (actor, monitor);
return meta_surface_actor_wayland_is_on_monitor (actor, logical_monitor);
}
static void
@ -1186,19 +1186,19 @@ update_surface_output_state (gpointer key, gpointer value, gpointer user_data)
{
MetaWaylandOutput *wayland_output = value;
MetaWaylandSurface *surface = user_data;
MetaMonitorInfo *monitor;
MetaLogicalMonitor *logical_monitor;
gboolean is_on_output;
g_assert (surface->role);
monitor = wayland_output->monitor_info;
if (!monitor)
logical_monitor = wayland_output->logical_monitor;
if (!logical_monitor)
{
set_surface_is_on_output (surface, wayland_output, FALSE);
return;
}
is_on_output = meta_wayland_surface_role_is_on_output (surface->role, monitor);
is_on_output = meta_wayland_surface_role_is_on_output (surface->role, logical_monitor);
set_surface_is_on_output (surface, wayland_output, is_on_output);
}
@ -1925,13 +1925,13 @@ meta_wayland_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
static gboolean
meta_wayland_surface_role_is_on_output (MetaWaylandSurfaceRole *surface_role,
MetaMonitorInfo *monitor)
MetaLogicalMonitor *logical_monitor)
{
MetaWaylandSurfaceRoleClass *klass;
klass = META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role);
if (klass->is_on_output)
return klass->is_on_output (surface_role, monitor);
return klass->is_on_output (surface_role, logical_monitor);
else
return FALSE;
}

View File

@ -61,7 +61,7 @@ struct _MetaWaylandSurfaceRoleClass
void (*commit) (MetaWaylandSurfaceRole *surface_role,
MetaWaylandPendingState *pending);
gboolean (*is_on_output) (MetaWaylandSurfaceRole *surface_role,
MetaMonitorInfo *monitor);
MetaLogicalMonitor *logical_monitor);
MetaWaylandSurface * (*get_toplevel) (MetaWaylandSurfaceRole *surface_role);
};

View File

@ -335,9 +335,9 @@ static void
meta_window_wayland_update_main_monitor (MetaWindow *window)
{
MetaWindow *toplevel_window;
const MetaMonitorInfo *from;
const MetaMonitorInfo *to;
const MetaMonitorInfo *scaled_new;
const MetaLogicalMonitor *from;
const MetaLogicalMonitor *to;
const MetaLogicalMonitor *scaled_new;
float scale;
MetaRectangle rect;
@ -357,7 +357,7 @@ meta_window_wayland_update_main_monitor (MetaWindow *window)
* needed to avoid jumping back and forth between the new and the old, since
* changing main monitor may cause the window to be resized so that it no
* longer have that same new main monitor. */
to = meta_screen_calculate_monitor_for_window (window->screen, window);
to = meta_screen_calculate_logical_monitor_for_window (window->screen, window);
if (from == to)
return;
@ -376,7 +376,7 @@ meta_window_wayland_update_main_monitor (MetaWindow *window)
scale = (float)to->scale / from->scale;
rect = window->rect;
scale_rect_size (&rect, scale);
scaled_new = meta_screen_get_monitor_for_rect (window->screen, &rect);
scaled_new = meta_screen_get_logical_monitor_for_rect (window->screen, &rect);
if (to != scaled_new)
return;
@ -384,8 +384,8 @@ meta_window_wayland_update_main_monitor (MetaWindow *window)
}
static void
meta_window_wayland_main_monitor_changed (MetaWindow *window,
const MetaMonitorInfo *old)
meta_window_wayland_main_monitor_changed (MetaWindow *window,
const MetaLogicalMonitor *old)
{
float scale_factor;
MetaWaylandSurface *surface;

View File

@ -1457,13 +1457,13 @@ meta_window_x11_update_icon (MetaWindow *window,
static void
meta_window_x11_update_main_monitor (MetaWindow *window)
{
window->monitor = meta_screen_calculate_monitor_for_window (window->screen,
window);
window->monitor =
meta_screen_calculate_logical_monitor_for_window (window->screen, window);
}
static void
meta_window_x11_main_monitor_changed (MetaWindow *window,
const MetaMonitorInfo *old)
meta_window_x11_main_monitor_changed (MetaWindow *window,
const MetaLogicalMonitor *old)
{
}