monitor-manager: Make logical monitor from point API take floats
Change meta_monitor_manager_get_logical_monitor_at() to use floats, replace users of meta_monitor_manager_get_monitor_at_point() to use the API that returns a logical monitor and remove the now unused function. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
a422d6fe08
commit
c98bab8327
@ -146,8 +146,8 @@ meta_backend_monitors_changed (MetaBackend *backend)
|
|||||||
if (clutter_input_device_get_coords (device, NULL, &point))
|
if (clutter_input_device_get_coords (device, NULL, &point))
|
||||||
{
|
{
|
||||||
/* If we're outside all monitors, warp the pointer back inside */
|
/* If we're outside all monitors, warp the pointer back inside */
|
||||||
if (meta_monitor_manager_get_monitor_at_point (monitor_manager,
|
if (!meta_monitor_manager_get_logical_monitor_at (monitor_manager,
|
||||||
point.x, point.y) < 0)
|
point.x, point.y))
|
||||||
center_pointer (backend);
|
center_pointer (backend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,8 +374,8 @@ MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_from_number (MetaMo
|
|||||||
MetaLogicalMonitor *meta_monitor_manager_get_primary_logical_monitor (MetaMonitorManager *manager);
|
MetaLogicalMonitor *meta_monitor_manager_get_primary_logical_monitor (MetaMonitorManager *manager);
|
||||||
|
|
||||||
MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_at (MetaMonitorManager *manager,
|
MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_at (MetaMonitorManager *manager,
|
||||||
int x,
|
float x,
|
||||||
int y);
|
float y);
|
||||||
|
|
||||||
MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_from_rect (MetaMonitorManager *manager,
|
MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_from_rect (MetaMonitorManager *manager,
|
||||||
MetaRectangle *rect);
|
MetaRectangle *rect);
|
||||||
@ -427,10 +427,6 @@ gboolean meta_monitor_manager_get_monitor_matrix (MetaMonitorManager *
|
|||||||
MetaOutput *output,
|
MetaOutput *output,
|
||||||
gfloat matrix[6]);
|
gfloat matrix[6]);
|
||||||
|
|
||||||
gint meta_monitor_manager_get_monitor_at_point (MetaMonitorManager *manager,
|
|
||||||
gfloat x,
|
|
||||||
gfloat y);
|
|
||||||
|
|
||||||
void meta_monitor_manager_clear_output (MetaOutput *output);
|
void meta_monitor_manager_clear_output (MetaOutput *output);
|
||||||
void meta_monitor_manager_clear_mode (MetaMonitorMode *mode);
|
void meta_monitor_manager_clear_mode (MetaMonitorMode *mode);
|
||||||
void meta_monitor_manager_clear_crtc (MetaCRTC *crtc);
|
void meta_monitor_manager_clear_crtc (MetaCRTC *crtc);
|
||||||
|
@ -1331,8 +1331,8 @@ meta_monitor_manager_get_primary_logical_monitor (MetaMonitorManager *manager)
|
|||||||
|
|
||||||
MetaLogicalMonitor *
|
MetaLogicalMonitor *
|
||||||
meta_monitor_manager_get_logical_monitor_at (MetaMonitorManager *manager,
|
meta_monitor_manager_get_logical_monitor_at (MetaMonitorManager *manager,
|
||||||
int x,
|
float x,
|
||||||
int y)
|
float y)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -1726,30 +1726,6 @@ meta_monitor_manager_get_monitor_for_output (MetaMonitorManager *manager,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
|
||||||
meta_monitor_manager_get_monitor_at_point (MetaMonitorManager *manager,
|
|
||||||
gfloat x,
|
|
||||||
gfloat y)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < manager->n_logical_monitors; i++)
|
|
||||||
{
|
|
||||||
MetaLogicalMonitor *logical_monitor = &manager->logical_monitors[i];
|
|
||||||
int left, right, top, bottom;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
|
meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +247,8 @@ pointer_constrain_callback (ClutterInputDevice *device,
|
|||||||
&n_logical_monitors);
|
&n_logical_monitors);
|
||||||
|
|
||||||
/* if we're moving inside a monitor, we're fine */
|
/* 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)
|
if (meta_monitor_manager_get_logical_monitor_at (monitor_manager,
|
||||||
|
*new_x, *new_y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* if we're trying to escape, clamp to the CRTC we're coming from */
|
/* if we're trying to escape, clamp to the CRTC we're coming from */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user