Commit 238f3eba authored by Marco Trevisan's avatar Marco Trevisan 🎺

logical-monitor: Reuse rectangle neighbor definition

Since a monitor is just a rectangle we can reuse the same definition.
parent 4fd5b6a0
......@@ -45,6 +45,7 @@
#include "backends/meta-backend-private.h"
#include "backends/meta-crtc.h"
#include "backends/meta-output.h"
#include "core/boxes-private.h"
G_DEFINE_TYPE (MetaLogicalMonitor, meta_logical_monitor, G_TYPE_OBJECT)
......@@ -302,37 +303,6 @@ meta_logical_monitor_has_neighbor (MetaLogicalMonitor *logical_monitor,
MetaLogicalMonitor *neighbor,
MetaDisplayDirection neighbor_direction)
{
switch (neighbor_direction)
{
case META_DISPLAY_RIGHT:
if (neighbor->rect.x == (logical_monitor->rect.x +
logical_monitor->rect.width) &&
meta_rectangle_vert_overlap (&neighbor->rect,
&logical_monitor->rect))
return TRUE;
break;
case META_DISPLAY_LEFT:
if (logical_monitor->rect.x == (neighbor->rect.x +
neighbor->rect.width) &&
meta_rectangle_vert_overlap (&neighbor->rect,
&logical_monitor->rect))
return TRUE;
break;
case META_DISPLAY_UP:
if (logical_monitor->rect.y == (neighbor->rect.y +
neighbor->rect.height) &&
meta_rectangle_horiz_overlap (&neighbor->rect,
&logical_monitor->rect))
return TRUE;
break;
case META_DISPLAY_DOWN:
if (neighbor->rect.y == (logical_monitor->rect.y +
logical_monitor->rect.height) &&
meta_rectangle_horiz_overlap (&neighbor->rect,
&logical_monitor->rect))
return TRUE;
break;
}
return FALSE;
return meta_rectangle_has_neighbor (&logical_monitor->rect, &neighbor->rect,
(MetaSide) neighbor_direction);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment