diff --git a/src/backends/meta-input-capture-session.c b/src/backends/meta-input-capture-session.c index ddf4b6d7e..73cb6e61f 100644 --- a/src/backends/meta-input-capture-session.c +++ b/src/backends/meta-input-capture-session.c @@ -748,6 +748,33 @@ check_barrier (MetaInputCaptureSession *session, } } + if (has_adjacent_monitor && y1 == y2) + { + MetaLogicalMonitor *monitor; + MetaLogicalMonitor *next; + MtkRectangle layout, fake_layout; + + monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager, 0, 0); + while ((next = meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager, monitor, META_DISPLAY_RIGHT))) + monitor = next; + + layout = meta_logical_monitor_get_layout (monitor); + fake_layout = (MtkRectangle) { + .x = layout.x + layout.width, + .y = layout.y, + .width = layout.width, + .height = layout.height, + }; + + LineAdjacency adjacency = get_barrier_adjacency (&fake_layout, x1, y1, x2, y2, error); + if (adjacency != LINE_ADJACENCY_NONE) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, + "Line extends into nonexisting monitor region"); + return FALSE; + } + } + return has_adjacent_monitor; } diff --git a/src/tests/input-capture-test-client.c b/src/tests/input-capture-test-client.c index 759883e11..217f9fb35 100644 --- a/src/tests/input-capture-test-client.c +++ b/src/tests/input-capture-test-client.c @@ -702,8 +702,8 @@ test_barriers (void) * +==============+ */ barrier1 = input_capture_session_add_barrier (session, 0, 0, 0, 600); - barrier2 = input_capture_session_add_barrier (session, 800, 768, 1824, 768); - barrier3 = input_capture_session_add_barrier (session, 800, 0, 1824, 0); + barrier2 = input_capture_session_add_barrier (session, 800, 768, 1823, 768); + barrier3 = input_capture_session_add_barrier (session, 800, 0, 1823, 0); g_assert_cmpuint (barrier1, !=, 0); g_assert_cmpuint (barrier2, !=, 0);