
- For already mapped windows, the window drag session is started straight away; - For about-to-be-mapped window (ie: undocking window use case): - The "shown" signal for the dragged window triggers the actual MetaWindowDrag once it's mapped. - MetaWindowWayland now handles the case of toplevel-drag and position the window about to be mapped according to the toplevel-drag parameters. - While attached to a toplevel-drag, the window state is updated to: - Actor's "reactive" state is set to false, which in practice excludes it from the possible drag target list; - WindowActor's "tied to drag" state is set to true, which results in initial placement constraints to be skipped, so newly created (detached) windows can be freely dragged around. - Toplevel drag session ends upon: - dnd drop and cancellation. - xdg_toplevel_drag_v1 object destruction (client-side). - data source destruction. Status: - [x] Basic window drag triggering - [x] Exclude the dragged window from event targets - [x] Event forwarding (window drag vs wayland grabs) - [x] Offset calc relative to toplevel geometry - [x] Attach already mapped windows - [x] Properly support not-yet-mapped windows - [ ] Disable visibility change animations - [ ] Dnd events stream adaptations Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com> Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
55 lines
1.6 KiB
C
55 lines
1.6 KiB
C
/*
|
|
* Copyright (C) 2024 Igalia, S.L.
|
|
*
|
|
* Author: Nick Yamane <nickdiego@igalia.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <glib.h>
|
|
#include <stdint.h>
|
|
|
|
#include "compositor/meta-window-drag.h"
|
|
#include "mtk/mtk.h"
|
|
#include "wayland/meta-wayland-types.h"
|
|
#include "wayland/meta-wayland-data-source.h"
|
|
|
|
struct _MetaWaylandToplevelDrag
|
|
{
|
|
struct wl_resource *resource;
|
|
|
|
MetaWaylandDataSource *data_source;
|
|
MetaWaylandSurface *dragged_surface;
|
|
int32_t x_offset, y_offset;
|
|
|
|
MetaWindowDrag *window_drag;
|
|
gulong window_unmanaging_handler_id;
|
|
gulong window_shown_handler_id;
|
|
gulong drag_ended_handler_id;
|
|
gulong source_destroyed_handler_id;
|
|
};
|
|
|
|
void
|
|
meta_wayland_init_toplevel_drag (MetaWaylandCompositor *compositor);
|
|
|
|
gboolean
|
|
meta_wayland_toplevel_drag_calc_origin_for_dragged_window (MetaWaylandToplevelDrag *drag,
|
|
MtkRectangle *bounds_out);
|
|
|
|
void
|
|
meta_wayland_toplevel_drag_end (MetaWaylandToplevelDrag *drag);
|