2013-08-30 12:03:30 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef META_WAYLAND_SURFACE_H
|
|
|
|
#define META_WAYLAND_SURFACE_H
|
|
|
|
|
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <xkbcommon/xkbcommon.h>
|
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <cairo.h>
|
|
|
|
|
|
|
|
#include <meta/meta-cursor-tracker.h>
|
|
|
|
#include "meta-wayland-types.h"
|
2013-11-22 15:24:06 -05:00
|
|
|
#include "meta-surface-actor.h"
|
2013-08-30 12:03:30 -04:00
|
|
|
|
wayland-surface: Don't do pending move/resizes on all commits
We assume in meta_window_wayland_move_resize that the next commit that
changes the geometry will always be for our next pending operation, so
if we have a move pending on a resize, the next commit will trigger the
move. This is, of course, fundamentally wrong.
We broke this assumption even more now that we don't fizzle out calls to
meta_window_move_resize_internal and now call it on every commit, which
means that a simple damage and then commit would complete a pending
move.
This was even broken by apps like weston-terminal, which, when clicking
on the maximize button, first redraws the terminal with the maximize
button state back on hover on press, and would only redraw when it got
the configure event with the coordinates.
To track the correct commit to apply the move for, we implement the
ack_configure request and ignore all move/resizes that happen before
that.
Right now, we actually fizzle out the entire move/resize if there's a
future pending configure we're waiting on.
2014-07-27 11:23:17 -04:00
|
|
|
struct _MetaWaylandSerial {
|
|
|
|
gboolean set;
|
|
|
|
uint32_t value;
|
|
|
|
};
|
|
|
|
|
2013-08-30 12:03:30 -04:00
|
|
|
struct _MetaWaylandBuffer
|
|
|
|
{
|
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wl_signal destroy_signal;
|
|
|
|
struct wl_listener destroy_listener;
|
|
|
|
|
2013-09-16 07:42:59 -04:00
|
|
|
CoglTexture *texture;
|
2014-02-01 17:45:51 -05:00
|
|
|
uint32_t ref_count;
|
2013-08-30 12:03:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* wl_surface.attach */
|
|
|
|
gboolean newly_attached;
|
|
|
|
MetaWaylandBuffer *buffer;
|
|
|
|
struct wl_listener buffer_destroy_listener;
|
2013-09-03 06:00:29 -04:00
|
|
|
int32_t dx;
|
|
|
|
int32_t dy;
|
2013-08-30 12:03:30 -04:00
|
|
|
|
2014-04-26 04:27:34 -04:00
|
|
|
int scale;
|
|
|
|
|
2013-08-30 12:03:30 -04:00
|
|
|
/* wl_surface.damage */
|
|
|
|
cairo_region_t *damage;
|
|
|
|
|
|
|
|
cairo_region_t *input_region;
|
|
|
|
cairo_region_t *opaque_region;
|
|
|
|
|
|
|
|
/* wl_surface.frame */
|
|
|
|
struct wl_list frame_callback_list;
|
2014-02-09 18:23:07 -05:00
|
|
|
|
2014-07-17 14:07:38 -04:00
|
|
|
MetaRectangle new_geometry;
|
|
|
|
gboolean has_new_geometry;
|
2014-04-18 18:07:05 -04:00
|
|
|
} MetaWaylandPendingState;
|
2013-08-30 03:40:36 -04:00
|
|
|
|
2013-09-16 07:42:59 -04:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct wl_resource *resource;
|
|
|
|
} MetaWaylandSurfaceExtension;
|
|
|
|
|
2013-08-30 12:03:30 -04:00
|
|
|
struct _MetaWaylandSurface
|
|
|
|
{
|
2014-10-06 23:15:18 -04:00
|
|
|
/* Generic stuff */
|
2013-08-30 12:03:30 -04:00
|
|
|
struct wl_resource *resource;
|
|
|
|
MetaWaylandCompositor *compositor;
|
2013-11-22 15:24:06 -05:00
|
|
|
MetaSurfaceActor *surface_actor;
|
2013-08-30 12:03:30 -04:00
|
|
|
MetaWindow *window;
|
2014-10-06 23:15:18 -04:00
|
|
|
MetaWaylandBuffer *buffer;
|
|
|
|
struct wl_listener buffer_destroy_listener;
|
|
|
|
int scale;
|
|
|
|
int32_t offset_x, offset_y;
|
|
|
|
GList *subsurfaces;
|
|
|
|
|
|
|
|
/* All the pending state that wl_surface.commit will apply. */
|
|
|
|
MetaWaylandPendingState pending;
|
|
|
|
|
|
|
|
/* Extension structs. */
|
2013-11-19 17:32:59 -05:00
|
|
|
MetaWaylandSurfaceExtension xdg_surface;
|
2013-11-14 21:55:37 -05:00
|
|
|
MetaWaylandSurfaceExtension xdg_popup;
|
2014-02-28 00:18:42 -05:00
|
|
|
MetaWaylandSurfaceExtension wl_shell_surface;
|
2013-11-19 17:32:59 -05:00
|
|
|
MetaWaylandSurfaceExtension gtk_surface;
|
2013-11-25 16:26:02 -05:00
|
|
|
MetaWaylandSurfaceExtension subsurface;
|
2014-02-03 18:36:46 -05:00
|
|
|
|
2014-10-06 23:15:18 -04:00
|
|
|
/* xdg_surface stuff */
|
|
|
|
struct wl_resource *xdg_shell_resource;
|
|
|
|
MetaWaylandSerial acked_configure_serial;
|
|
|
|
gboolean has_set_geometry;
|
2014-01-12 16:02:09 -05:00
|
|
|
|
2014-10-06 23:15:18 -04:00
|
|
|
/* wl_subsurface stuff. */
|
2014-01-12 16:02:09 -05:00
|
|
|
struct {
|
|
|
|
MetaWaylandSurface *parent;
|
|
|
|
struct wl_listener parent_destroy_listener;
|
2014-01-12 17:17:29 -05:00
|
|
|
|
2014-04-18 18:12:54 -04:00
|
|
|
/* When the surface is synchronous, its state will be applied
|
|
|
|
* when the parent is committed. This is done by moving the
|
|
|
|
* "real" pending state below to here when this surface is
|
|
|
|
* committed and in synchronous mode.
|
|
|
|
*
|
|
|
|
* When the parent surface is committed, we apply the pending
|
|
|
|
* state here.
|
|
|
|
*/
|
2014-01-13 17:31:25 -05:00
|
|
|
gboolean synchronous;
|
2014-04-18 18:12:54 -04:00
|
|
|
MetaWaylandPendingState pending;
|
2014-01-13 17:31:25 -05:00
|
|
|
|
2014-01-12 17:17:29 -05:00
|
|
|
int32_t pending_x;
|
|
|
|
int32_t pending_y;
|
|
|
|
gboolean pending_pos;
|
2014-01-12 17:24:00 -05:00
|
|
|
GSList *pending_placement_ops;
|
2014-01-12 16:02:09 -05:00
|
|
|
} sub;
|
2013-08-30 12:03:30 -04:00
|
|
|
};
|
|
|
|
|
2014-04-22 18:05:44 -04:00
|
|
|
void meta_wayland_shell_init (MetaWaylandCompositor *compositor);
|
2013-08-30 12:26:18 -04:00
|
|
|
|
|
|
|
MetaWaylandSurface *meta_wayland_surface_create (MetaWaylandCompositor *compositor,
|
2014-04-22 18:22:13 -04:00
|
|
|
struct wl_client *client,
|
|
|
|
struct wl_resource *compositor_resource,
|
|
|
|
guint32 id);
|
2014-02-18 16:39:23 -05:00
|
|
|
|
2014-04-02 10:37:08 -04:00
|
|
|
void meta_wayland_surface_set_window (MetaWaylandSurface *surface,
|
|
|
|
MetaWindow *window);
|
2014-02-18 16:39:23 -05:00
|
|
|
|
2013-09-03 06:00:29 -04:00
|
|
|
void meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
|
wayland-surface: Don't do pending move/resizes on all commits
We assume in meta_window_wayland_move_resize that the next commit that
changes the geometry will always be for our next pending operation, so
if we have a move pending on a resize, the next commit will trigger the
move. This is, of course, fundamentally wrong.
We broke this assumption even more now that we don't fizzle out calls to
meta_window_move_resize_internal and now call it on every commit, which
means that a simple damage and then commit would complete a pending
move.
This was even broken by apps like weston-terminal, which, when clicking
on the maximize button, first redraws the terminal with the maximize
button state back on hover on press, and would only redraw when it got
the configure event with the coordinates.
To track the correct commit to apply the move for, we implement the
ack_configure request and ignore all move/resizes that happen before
that.
Right now, we actually fizzle out the entire move/resize if there's a
future pending configure we're waiting on.
2014-07-27 11:23:17 -04:00
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
MetaWaylandSerial *sent_serial);
|
2013-11-12 15:52:03 -05:00
|
|
|
|
2013-11-21 14:20:52 -05:00
|
|
|
void meta_wayland_surface_ping (MetaWaylandSurface *surface,
|
|
|
|
guint32 serial);
|
2014-02-07 17:28:33 -05:00
|
|
|
void meta_wayland_surface_delete (MetaWaylandSurface *surface);
|
2013-11-21 14:20:52 -05:00
|
|
|
|
2014-02-28 00:18:42 -05:00
|
|
|
void meta_wayland_surface_popup_done (MetaWaylandSurface *surface);
|
|
|
|
|
2013-08-30 12:03:30 -04:00
|
|
|
#endif
|