[PATCH 2/2] clients: Update weston clients to use unstable xdg-shell v7
Adam Goode
agoode at google.com
Mon Dec 19 17:57:06 UTC 2016
This removes some of the decoration binding logic from clients.
The compositor implements decoration bindings in v7. Clients now
tell the compositor when clicks or touches happen on decorations,
and the compositor decides what to do. Previously, all clients
had to implement bindings for move, resize, and show_window_menu
and new actions (like lower) could not be implemented.
Signed-off-by: Adam Goode <agoode at google.com>
---
Makefile.am | 32 +++----
clients/flower.c | 9 +-
clients/fullscreen.c | 10 ++-
clients/scaler.c | 13 ++-
clients/simple-damage.c | 48 +++++-----
clients/simple-dmabuf-intel.c | 48 +++++-----
clients/simple-dmabuf-v4l.c | 48 +++++-----
clients/simple-egl.c | 67 +++++++-------
clients/simple-shm.c | 48 +++++-----
clients/transformed.c | 9 +-
clients/window.c | 198 +++++++++++++++--------------------------
clients/window.h | 4 +-
libweston/compositor-wayland.c | 78 ++++++++--------
shared/cairo-util.h | 19 +---
shared/frame.c | 136 +++++-----------------------
xwayland/window-manager.c | 24 +++--
16 files changed, 327 insertions(+), 464 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a11007d..bba076d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -402,8 +402,8 @@ wayland_backend_la_SOURCES = \
nodist_wayland_backend_la_SOURCES = \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
- protocol/xdg-shell-unstable-v6-protocol.c \
- protocol/xdg-shell-unstable-v6-client-protocol.h
+ protocol/xdg-shell-unstable-v7-protocol.c \
+ protocol/xdg-shell-unstable-v7-client-protocol.h
endif
if ENABLE_HEADLESS_COMPOSITOR
@@ -536,8 +536,8 @@ demo_clients += \
weston_simple_shm_SOURCES = clients/simple-shm.c
nodist_weston_simple_shm_SOURCES = \
- protocol/xdg-shell-unstable-v6-protocol.c \
- protocol/xdg-shell-unstable-v6-client-protocol.h \
+ protocol/xdg-shell-unstable-v7-protocol.c \
+ protocol/xdg-shell-unstable-v7-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/ivi-application-protocol.c \
@@ -549,8 +549,8 @@ weston_simple_damage_SOURCES = clients/simple-damage.c
nodist_weston_simple_damage_SOURCES = \
protocol/viewporter-protocol.c \
protocol/viewporter-client-protocol.h \
- protocol/xdg-shell-unstable-v6-protocol.c \
- protocol/xdg-shell-unstable-v6-client-protocol.h \
+ protocol/xdg-shell-unstable-v7-protocol.c \
+ protocol/xdg-shell-unstable-v7-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h
weston_simple_damage_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
@@ -580,8 +580,8 @@ if BUILD_SIMPLE_EGL_CLIENTS
demo_clients += weston-simple-egl
weston_simple_egl_SOURCES = clients/simple-egl.c
nodist_weston_simple_egl_SOURCES = \
- protocol/xdg-shell-unstable-v6-protocol.c \
- protocol/xdg-shell-unstable-v6-client-protocol.h \
+ protocol/xdg-shell-unstable-v7-protocol.c \
+ protocol/xdg-shell-unstable-v7-client-protocol.h \
protocol/ivi-application-protocol.c \
protocol/ivi-application-client-protocol.h
weston_simple_egl_CFLAGS = $(AM_CFLAGS) $(SIMPLE_EGL_CLIENT_CFLAGS)
@@ -592,8 +592,8 @@ if BUILD_SIMPLE_DMABUF_INTEL_CLIENT
demo_clients += weston-simple-dmabuf-intel
weston_simple_dmabuf_intel_SOURCES = clients/simple-dmabuf-intel.c
nodist_weston_simple_dmabuf_intel_SOURCES = \
- protocol/xdg-shell-unstable-v6-protocol.c \
- protocol/xdg-shell-unstable-v6-client-protocol.h \
+ protocol/xdg-shell-unstable-v7-protocol.c \
+ protocol/xdg-shell-unstable-v7-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/linux-dmabuf-unstable-v1-protocol.c \
@@ -607,8 +607,8 @@ if BUILD_SIMPLE_DMABUF_V4L_CLIENT
demo_clients += weston-simple-dmabuf-v4l
weston_simple_dmabuf_v4l_SOURCES = clients/simple-dmabuf-v4l.c
nodist_weston_simple_dmabuf_v4l_SOURCES = \
- protocol/xdg-shell-unstable-v6-protocol.c \
- protocol/xdg-shell-unstable-v6-client-protocol.h \
+ protocol/xdg-shell-unstable-v7-protocol.c \
+ protocol/xdg-shell-unstable-v7-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/linux-dmabuf-unstable-v1-protocol.c \
@@ -630,8 +630,8 @@ nodist_libtoytoolkit_la_SOURCES = \
protocol/text-cursor-position-client-protocol.h \
protocol/viewporter-protocol.c \
protocol/viewporter-client-protocol.h \
- protocol/xdg-shell-unstable-v6-protocol.c \
- protocol/xdg-shell-unstable-v6-client-protocol.h \
+ protocol/xdg-shell-unstable-v7-protocol.c \
+ protocol/xdg-shell-unstable-v7-client-protocol.h \
protocol/ivi-application-protocol.c \
protocol/ivi-application-client-protocol.h \
protocol/pointer-constraints-unstable-v1-protocol.c \
@@ -849,8 +849,8 @@ BUILT_SOURCES += \
protocol/presentation-time-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
- protocol/xdg-shell-unstable-v6-protocol.c \
- protocol/xdg-shell-unstable-v6-client-protocol.h \
+ protocol/xdg-shell-unstable-v7-protocol.c \
+ protocol/xdg-shell-unstable-v7-client-protocol.h \
protocol/ivi-hmi-controller-protocol.c \
protocol/ivi-hmi-controller-client-protocol.h \
protocol/ivi-application-protocol.c \
diff --git a/clients/flower.c b/clients/flower.c
index 34287fd..5de78d2 100644
--- a/clients/flower.c
+++ b/clients/flower.c
@@ -141,8 +141,9 @@ button_handler(struct widget *widget,
switch (button) {
case BTN_LEFT:
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
- window_move(flower->window, input,
- display_get_serial(flower->display));
+ window_interact_with_decoration(flower->window, input,
+ display_get_serial(flower->display),
+ THEME_LOCATION_TITLEBAR);
break;
case BTN_MIDDLE:
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
@@ -161,7 +162,9 @@ touch_down_handler(struct widget *widget, struct input *input,
float x, float y, void *data)
{
struct flower *flower = data;
- window_move(flower->window, input, display_get_serial(flower->display));
+ window_interact_with_decoration(flower->window, input,
+ display_get_serial(flower->display),
+ THEME_LOCATION_TITLEBAR);
}
int main(int argc, char *argv[])
diff --git a/clients/fullscreen.c b/clients/fullscreen.c
index e2e6477..69828f1 100644
--- a/clients/fullscreen.c
+++ b/clients/fullscreen.c
@@ -400,9 +400,11 @@ button_handler(struct widget *widget,
switch (button) {
case BTN_LEFT:
+ case BTN_MIDDLE:
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
- window_move(fullscreen->window, input,
- display_get_serial(fullscreen->display));
+ window_interact_with_decoration(fullscreen->window, input,
+ display_get_serial(fullscreen->display),
+ THEME_LOCATION_TITLEBAR);
break;
case BTN_RIGHT:
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
@@ -417,7 +419,9 @@ touch_handler(struct widget *widget, struct input *input,
float x, float y, void *data)
{
struct fullscreen *fullscreen = data;
- window_move(fullscreen->window, input, display_get_serial(fullscreen->display));
+ window_interact_with_decoration(fullscreen->window, input,
+ display_get_serial(fullscreen->display),
+ THEME_LOCATION_TITLEBAR);
}
static void
diff --git a/clients/scaler.c b/clients/scaler.c
index 23cc3a4..dd8c919 100644
--- a/clients/scaler.c
+++ b/clients/scaler.c
@@ -203,12 +203,10 @@ button_handler(struct widget *widget,
{
struct box *box = data;
- if (button != BTN_LEFT)
- return;
-
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
- window_move(box->window, input,
- display_get_serial(box->display));
+ window_interact_with_decoration(box->window, input,
+ display_get_serial(box->display),
+ THEME_LOCATION_TITLEBAR);
}
}
@@ -218,8 +216,9 @@ touch_down_handler(struct widget *widget, struct input *input,
float x, float y, void *data)
{
struct box *box = data;
- window_move(box->window, input,
- display_get_serial(box->display));
+ window_interact_with_decoration(box->window, input,
+ display_get_serial(box->display),
+ THEME_LOCATION_TITLEBAR);
}
static void
diff --git a/clients/simple-damage.c b/clients/simple-damage.c
index ea2d3f9..f2582f7 100644
--- a/clients/simple-damage.c
+++ b/clients/simple-damage.c
@@ -39,7 +39,7 @@
#include <wayland-client.h>
#include "shared/os-compatibility.h"
#include "shared/zalloc.h"
-#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-shell-unstable-v7-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "viewporter-client-protocol.h"
@@ -51,7 +51,7 @@ struct display {
int compositor_version;
struct wl_compositor *compositor;
struct wp_viewporter *viewporter;
- struct zxdg_shell_v6 *shell;
+ struct zxdg_shell_v7 *shell;
struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm;
uint32_t formats;
@@ -74,8 +74,8 @@ struct window {
int width, height, border;
struct wl_surface *surface;
struct wp_viewport *viewport;
- struct zxdg_surface_v6 *xdg_surface;
- struct zxdg_toplevel_v6 *xdg_toplevel;
+ struct zxdg_surface_v7 *xdg_surface;
+ struct zxdg_toplevel_v7 *xdg_toplevel;
struct wl_callback *callback;
struct buffer buffers[2];
struct buffer *prev_buffer;
@@ -149,12 +149,12 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
}
static void
-xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface,
+xdg_surface_handle_configure(void *data, struct zxdg_surface_v7 *surface,
uint32_t serial)
{
struct window *window = data;
- zxdg_surface_v6_ack_configure(surface, serial);
+ zxdg_surface_v7_ack_configure(surface, serial);
if (window->wait_for_configure) {
redraw(window, NULL, 0);
@@ -162,24 +162,24 @@ xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface,
}
}
-static const struct zxdg_surface_v6_listener xdg_surface_listener = {
+static const struct zxdg_surface_v7_listener xdg_surface_listener = {
xdg_surface_handle_configure,
};
static void
-xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
+xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v7 *toplevel,
int32_t width, int32_t height,
struct wl_array *states)
{
}
static void
-xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
+xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v7 *xdg_toplevel)
{
running = 0;
}
-static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
+static const struct zxdg_toplevel_v7_listener xdg_toplevel_listener = {
xdg_toplevel_handle_configure,
xdg_toplevel_handle_close,
};
@@ -319,23 +319,23 @@ create_window(struct display *display, int width, int height,
if (display->shell) {
window->xdg_surface =
- zxdg_shell_v6_get_xdg_surface(display->shell,
+ zxdg_shell_v7_get_xdg_surface(display->shell,
window->surface);
assert(window->xdg_surface);
- zxdg_surface_v6_add_listener(window->xdg_surface,
+ zxdg_surface_v7_add_listener(window->xdg_surface,
&xdg_surface_listener, window);
window->xdg_toplevel =
- zxdg_surface_v6_get_toplevel(window->xdg_surface);
+ zxdg_surface_v7_get_toplevel(window->xdg_surface);
assert(window->xdg_toplevel);
- zxdg_toplevel_v6_add_listener(window->xdg_toplevel,
+ zxdg_toplevel_v7_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window);
- zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-damage");
+ zxdg_toplevel_v7_set_title(window->xdg_toplevel, "simple-damage");
window->wait_for_configure = true;
wl_surface_commit(window->surface);
@@ -370,9 +370,9 @@ destroy_window(struct window *window)
wl_buffer_destroy(window->buffers[1].buffer);
if (window->xdg_toplevel)
- zxdg_toplevel_v6_destroy(window->xdg_toplevel);
+ zxdg_toplevel_v7_destroy(window->xdg_toplevel);
if (window->xdg_surface)
- zxdg_surface_v6_destroy(window->xdg_surface);
+ zxdg_surface_v7_destroy(window->xdg_surface);
if (window->viewport)
wp_viewport_destroy(window->viewport);
wl_surface_destroy(window->surface);
@@ -711,12 +711,12 @@ struct wl_shm_listener shm_listener = {
};
static void
-xdg_shell_ping(void *data, struct zxdg_shell_v6*shell, uint32_t serial)
+xdg_shell_ping(void *data, struct zxdg_shell_v7*shell, uint32_t serial)
{
- zxdg_shell_v6_pong(shell, serial);
+ zxdg_shell_v7_pong(shell, serial);
}
-static const struct zxdg_shell_v6_listener xdg_shell_listener = {
+static const struct zxdg_shell_v7_listener xdg_shell_listener = {
xdg_shell_ping,
};
@@ -743,10 +743,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
} else if (strcmp(interface, "wp_viewporter") == 0) {
d->viewporter = wl_registry_bind(registry, id,
&wp_viewporter_interface, 1);
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ } else if (strcmp(interface, "zxdg_shell_v7") == 0) {
d->shell = wl_registry_bind(registry,
- id, &zxdg_shell_v6_interface, 1);
- zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d);
+ id, &zxdg_shell_v7_interface, 1);
+ zxdg_shell_v7_add_listener(d->shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface, 1);
@@ -809,7 +809,7 @@ destroy_display(struct display *display)
wl_shm_destroy(display->shm);
if (display->shell)
- zxdg_shell_v6_destroy(display->shell);
+ zxdg_shell_v7_destroy(display->shell);
if (display->fshell)
zwp_fullscreen_shell_v1_release(display->fshell);
diff --git a/clients/simple-dmabuf-intel.c b/clients/simple-dmabuf-intel.c
index ec5f1cb..4e04afe 100644
--- a/clients/simple-dmabuf-intel.c
+++ b/clients/simple-dmabuf-intel.c
@@ -42,7 +42,7 @@
#include <wayland-client.h>
#include "shared/zalloc.h"
-#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-shell-unstable-v7-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
@@ -50,7 +50,7 @@ struct display {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
- struct zxdg_shell_v6 *shell;
+ struct zxdg_shell_v7 *shell;
struct zwp_fullscreen_shell_v1 *fshell;
struct zwp_linux_dmabuf_v1 *dmabuf;
int xrgb8888_format_found;
@@ -81,8 +81,8 @@ struct window {
struct display *display;
int width, height;
struct wl_surface *surface;
- struct zxdg_surface_v6 *xdg_surface;
- struct zxdg_toplevel_v6 *xdg_toplevel;
+ struct zxdg_surface_v7 *xdg_surface;
+ struct zxdg_toplevel_v7 *xdg_toplevel;
struct buffer buffers[NUM_BUFFERS];
struct buffer *prev_buffer;
struct wl_callback *callback;
@@ -296,36 +296,36 @@ error:
}
static void
-xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface,
+xdg_surface_handle_configure(void *data, struct zxdg_surface_v7 *surface,
uint32_t serial)
{
struct window *window = data;
- zxdg_surface_v6_ack_configure(surface, serial);
+ zxdg_surface_v7_ack_configure(surface, serial);
if (window->initialized && window->wait_for_configure)
redraw(window, NULL, 0);
window->wait_for_configure = false;
}
-static const struct zxdg_surface_v6_listener xdg_surface_listener = {
+static const struct zxdg_surface_v7_listener xdg_surface_listener = {
xdg_surface_handle_configure,
};
static void
-xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
+xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v7 *toplevel,
int32_t width, int32_t height,
struct wl_array *states)
{
}
static void
-xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
+xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v7 *xdg_toplevel)
{
running = 0;
}
-static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
+static const struct zxdg_toplevel_v7_listener xdg_toplevel_listener = {
xdg_toplevel_handle_configure,
xdg_toplevel_handle_close,
};
@@ -349,23 +349,23 @@ create_window(struct display *display, int width, int height)
if (display->shell) {
window->xdg_surface =
- zxdg_shell_v6_get_xdg_surface(display->shell,
+ zxdg_shell_v7_get_xdg_surface(display->shell,
window->surface);
assert(window->xdg_surface);
- zxdg_surface_v6_add_listener(window->xdg_surface,
+ zxdg_surface_v7_add_listener(window->xdg_surface,
&xdg_surface_listener, window);
window->xdg_toplevel =
- zxdg_surface_v6_get_toplevel(window->xdg_surface);
+ zxdg_surface_v7_get_toplevel(window->xdg_surface);
assert(window->xdg_toplevel);
- zxdg_toplevel_v6_add_listener(window->xdg_toplevel,
+ zxdg_toplevel_v7_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window);
- zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-dmabuf");
+ zxdg_toplevel_v7_set_title(window->xdg_toplevel, "simple-dmabuf");
window->wait_for_configure = true;
wl_surface_commit(window->surface);
@@ -408,9 +408,9 @@ destroy_window(struct window *window)
}
if (window->xdg_toplevel)
- zxdg_toplevel_v6_destroy(window->xdg_toplevel);
+ zxdg_toplevel_v7_destroy(window->xdg_toplevel);
if (window->xdg_surface)
- zxdg_surface_v6_destroy(window->xdg_surface);
+ zxdg_surface_v7_destroy(window->xdg_surface);
wl_surface_destroy(window->surface);
free(window);
}
@@ -475,12 +475,12 @@ static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
};
static void
-xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
+xdg_shell_ping(void *data, struct zxdg_shell_v7 *shell, uint32_t serial)
{
- zxdg_shell_v6_pong(shell, serial);
+ zxdg_shell_v7_pong(shell, serial);
}
-static const struct zxdg_shell_v6_listener xdg_shell_listener = {
+static const struct zxdg_shell_v7_listener xdg_shell_listener = {
xdg_shell_ping,
};
@@ -494,10 +494,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->compositor =
wl_registry_bind(registry,
id, &wl_compositor_interface, 1);
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ } else if (strcmp(interface, "zxdg_shell_v7") == 0) {
d->shell = wl_registry_bind(registry,
- id, &zxdg_shell_v6_interface, 1);
- zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d);
+ id, &zxdg_shell_v7_interface, 1);
+ zxdg_shell_v7_add_listener(d->shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface, 1);
@@ -561,7 +561,7 @@ destroy_display(struct display *display)
zwp_linux_dmabuf_v1_destroy(display->dmabuf);
if (display->shell)
- zxdg_shell_v6_destroy(display->shell);
+ zxdg_shell_v7_destroy(display->shell);
if (display->fshell)
zwp_fullscreen_shell_v1_release(display->fshell);
diff --git a/clients/simple-dmabuf-v4l.c b/clients/simple-dmabuf-v4l.c
index af25d0e..6e73e95 100644
--- a/clients/simple-dmabuf-v4l.c
+++ b/clients/simple-dmabuf-v4l.c
@@ -44,7 +44,7 @@
#include <wayland-client.h>
#include "shared/zalloc.h"
-#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-shell-unstable-v7-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
@@ -97,7 +97,7 @@ struct display {
struct wl_compositor *compositor;
struct wl_seat *seat;
struct wl_keyboard *keyboard;
- struct zxdg_shell_v6 *shell;
+ struct zxdg_shell_v7 *shell;
struct zwp_fullscreen_shell_v1 *fshell;
struct zwp_linux_dmabuf_v1 *dmabuf;
bool requested_format_found;
@@ -122,8 +122,8 @@ struct buffer {
struct window {
struct display *display;
struct wl_surface *surface;
- struct zxdg_surface_v6 *xdg_surface;
- struct zxdg_toplevel_v6 *xdg_toplevel;
+ struct zxdg_surface_v7 *xdg_surface;
+ struct zxdg_toplevel_v7 *xdg_toplevel;
struct buffer buffers[NUM_BUFFERS];
struct wl_callback *callback;
bool wait_for_configure;
@@ -535,36 +535,36 @@ start_capture(struct display *display)
}
static void
-xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface,
+xdg_surface_handle_configure(void *data, struct zxdg_surface_v7 *surface,
uint32_t serial)
{
struct window *window = data;
- zxdg_surface_v6_ack_configure(surface, serial);
+ zxdg_surface_v7_ack_configure(surface, serial);
if (window->initialized && window->wait_for_configure)
redraw(window, NULL, 0);
window->wait_for_configure = false;
}
-static const struct zxdg_surface_v6_listener xdg_surface_listener = {
+static const struct zxdg_surface_v7_listener xdg_surface_listener = {
xdg_surface_handle_configure,
};
static void
-xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
+xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v7 *toplevel,
int32_t width, int32_t height,
struct wl_array *states)
{
}
static void
-xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
+xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v7 *xdg_toplevel)
{
running = 0;
}
-static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
+static const struct zxdg_toplevel_v7_listener xdg_toplevel_listener = {
xdg_toplevel_handle_configure,
xdg_toplevel_handle_close,
};
@@ -584,23 +584,23 @@ create_window(struct display *display)
if (display->shell) {
window->xdg_surface =
- zxdg_shell_v6_get_xdg_surface(display->shell,
+ zxdg_shell_v7_get_xdg_surface(display->shell,
window->surface);
assert(window->xdg_surface);
- zxdg_surface_v6_add_listener(window->xdg_surface,
+ zxdg_surface_v7_add_listener(window->xdg_surface,
&xdg_surface_listener, window);
window->xdg_toplevel =
- zxdg_surface_v6_get_toplevel(window->xdg_surface);
+ zxdg_surface_v7_get_toplevel(window->xdg_surface);
assert(window->xdg_toplevel);
- zxdg_toplevel_v6_add_listener(window->xdg_toplevel,
+ zxdg_toplevel_v7_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window);
- zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-dmabuf-v4l");
+ zxdg_toplevel_v7_set_title(window->xdg_toplevel, "simple-dmabuf-v4l");
window->wait_for_configure = true;
wl_surface_commit(window->surface);
@@ -626,9 +626,9 @@ destroy_window(struct window *window)
wl_callback_destroy(window->callback);
if (window->xdg_toplevel)
- zxdg_toplevel_v6_destroy(window->xdg_toplevel);
+ zxdg_toplevel_v7_destroy(window->xdg_toplevel);
if (window->xdg_surface)
- zxdg_surface_v6_destroy(window->xdg_surface);
+ zxdg_surface_v7_destroy(window->xdg_surface);
wl_surface_destroy(window->surface);
for (i = 0; i < NUM_BUFFERS; i++) {
@@ -779,12 +779,12 @@ static const struct wl_seat_listener seat_listener = {
};
static void
-xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
+xdg_shell_ping(void *data, struct zxdg_shell_v7 *shell, uint32_t serial)
{
- zxdg_shell_v6_pong(shell, serial);
+ zxdg_shell_v7_pong(shell, serial);
}
-static const struct zxdg_shell_v6_listener xdg_shell_listener = {
+static const struct zxdg_shell_v7_listener xdg_shell_listener = {
xdg_shell_ping,
};
@@ -802,10 +802,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->seat = wl_registry_bind(registry,
id, &wl_seat_interface, 1);
wl_seat_add_listener(d->seat, &seat_listener, d);
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ } else if (strcmp(interface, "zxdg_shell_v7") == 0) {
d->shell = wl_registry_bind(registry,
- id, &zxdg_shell_v6_interface, 1);
- zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d);
+ id, &zxdg_shell_v7_interface, 1);
+ zxdg_shell_v7_add_listener(d->shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface,
@@ -874,7 +874,7 @@ destroy_display(struct display *display)
zwp_linux_dmabuf_v1_destroy(display->dmabuf);
if (display->shell)
- zxdg_shell_v6_destroy(display->shell);
+ zxdg_shell_v7_destroy(display->shell);
if (display->fshell)
zwp_fullscreen_shell_v1_release(display->fshell);
diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index 9b6fa1f..36fdf6d 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -42,7 +42,7 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-shell-unstable-v7-client-protocol.h"
#include <sys/types.h>
#include <unistd.h>
#include "ivi-application-client-protocol.h"
@@ -59,7 +59,7 @@ struct display {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
- struct zxdg_shell_v6 *shell;
+ struct zxdg_shell_v7 *shell;
struct wl_seat *seat;
struct wl_pointer *pointer;
struct wl_touch *touch;
@@ -95,8 +95,8 @@ struct window {
uint32_t benchmark_time, frames;
struct wl_egl_window *native;
struct wl_surface *surface;
- struct zxdg_surface_v6 *xdg_surface;
- struct zxdg_toplevel_v6 *xdg_toplevel;
+ struct zxdg_surface_v7 *xdg_surface;
+ struct zxdg_toplevel_v7 *xdg_toplevel;
struct ivi_surface *ivi_surface;
EGLSurface egl_surface;
struct wl_callback *callback;
@@ -294,22 +294,22 @@ init_gl(struct window *window)
}
static void
-handle_surface_configure(void *data, struct zxdg_surface_v6 *surface,
+handle_surface_configure(void *data, struct zxdg_surface_v7 *surface,
uint32_t serial)
{
struct window *window = data;
- zxdg_surface_v6_ack_configure(surface, serial);
+ zxdg_surface_v7_ack_configure(surface, serial);
window->wait_for_configure = false;
}
-static const struct zxdg_surface_v6_listener xdg_surface_listener = {
+static const struct zxdg_surface_v7_listener xdg_surface_listener = {
handle_surface_configure
};
static void
-handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
+handle_toplevel_configure(void *data, struct zxdg_toplevel_v7 *toplevel,
int32_t width, int32_t height,
struct wl_array *states)
{
@@ -320,7 +320,7 @@ handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
wl_array_for_each(p, states) {
uint32_t state = *p;
switch (state) {
- case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
+ case ZXDG_TOPLEVEL_V7_STATE_FULLSCREEN:
window->fullscreen = 1;
break;
}
@@ -344,12 +344,12 @@ handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
}
static void
-handle_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
+handle_toplevel_close(void *data, struct zxdg_toplevel_v7 *xdg_toplevel)
{
running = 0;
}
-static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
+static const struct zxdg_toplevel_v7_listener xdg_toplevel_listener = {
handle_toplevel_configure,
handle_toplevel_close,
};
@@ -376,17 +376,17 @@ static const struct ivi_surface_listener ivi_surface_listener = {
static void
create_xdg_surface(struct window *window, struct display *display)
{
- window->xdg_surface = zxdg_shell_v6_get_xdg_surface(display->shell,
+ window->xdg_surface = zxdg_shell_v7_get_xdg_surface(display->shell,
window->surface);
- zxdg_surface_v6_add_listener(window->xdg_surface,
+ zxdg_surface_v7_add_listener(window->xdg_surface,
&xdg_surface_listener, window);
window->xdg_toplevel =
- zxdg_surface_v6_get_toplevel(window->xdg_surface);
- zxdg_toplevel_v6_add_listener(window->xdg_toplevel,
+ zxdg_surface_v7_get_toplevel(window->xdg_surface);
+ zxdg_toplevel_v7_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window);
- zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-egl");
+ zxdg_toplevel_v7_set_title(window->xdg_toplevel, "simple-egl");
window->wait_for_configure = true;
wl_surface_commit(window->surface);
@@ -446,7 +446,7 @@ create_surface(struct window *window)
return;
if (window->fullscreen)
- zxdg_toplevel_v6_set_fullscreen(window->xdg_toplevel, NULL);
+ zxdg_toplevel_v7_set_fullscreen(window->xdg_toplevel, NULL);
}
static void
@@ -462,9 +462,9 @@ destroy_surface(struct window *window)
wl_egl_window_destroy(window->native);
if (window->xdg_toplevel)
- zxdg_toplevel_v6_destroy(window->xdg_toplevel);
+ zxdg_toplevel_v7_destroy(window->xdg_toplevel);
if (window->xdg_surface)
- zxdg_surface_v6_destroy(window->xdg_surface);
+ zxdg_surface_v7_destroy(window->xdg_surface);
if (window->display->ivi_application)
ivi_surface_destroy(window->ivi_surface);
wl_surface_destroy(window->surface);
@@ -623,9 +623,10 @@ pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
if (!display->window->xdg_toplevel)
return;
- if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED)
- zxdg_toplevel_v6_move(display->window->xdg_toplevel,
- display->seat, serial);
+ if (state == WL_POINTER_BUTTON_STATE_PRESSED)
+ zxdg_toplevel_v7_interact_with_decoration(display->window->xdg_toplevel,
+ display->seat, serial,
+ ZXDG_TOPLEVEL_V7_DECORATION_PART_TITLEBAR);
}
static void
@@ -652,7 +653,9 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
if (!d->shell)
return;
- zxdg_toplevel_v6_move(d->window->xdg_toplevel, d->seat, serial);
+ zxdg_toplevel_v7_interact_with_decoration(d->window->xdg_toplevel,
+ d->seat, serial,
+ ZXDG_TOPLEVEL_V7_INTERACT_WITH_DECORATION);
}
static void
@@ -716,9 +719,9 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
if (key == KEY_F11 && state) {
if (d->window->fullscreen)
- zxdg_toplevel_v6_unset_fullscreen(d->window->xdg_toplevel);
+ zxdg_toplevel_v7_unset_fullscreen(d->window->xdg_toplevel);
else
- zxdg_toplevel_v6_set_fullscreen(d->window->xdg_toplevel,
+ zxdg_toplevel_v7_set_fullscreen(d->window->xdg_toplevel,
NULL);
} else if (key == KEY_ESC && state)
running = 0;
@@ -777,12 +780,12 @@ static const struct wl_seat_listener seat_listener = {
};
static void
-xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
+xdg_shell_ping(void *data, struct zxdg_shell_v7 *shell, uint32_t serial)
{
- zxdg_shell_v6_pong(shell, serial);
+ zxdg_shell_v7_pong(shell, serial);
}
-static const struct zxdg_shell_v6_listener xdg_shell_listener = {
+static const struct zxdg_shell_v7_listener xdg_shell_listener = {
xdg_shell_ping,
};
@@ -796,10 +799,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->compositor =
wl_registry_bind(registry, name,
&wl_compositor_interface, 1);
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ } else if (strcmp(interface, "zxdg_shell_v7") == 0) {
d->shell = wl_registry_bind(registry, name,
- &zxdg_shell_v6_interface, 1);
- zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d);
+ &zxdg_shell_v7_interface, 1);
+ zxdg_shell_v7_add_listener(d->shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "wl_seat") == 0) {
d->seat = wl_registry_bind(registry, name,
&wl_seat_interface, 1);
@@ -930,7 +933,7 @@ main(int argc, char **argv)
wl_cursor_theme_destroy(display.cursor_theme);
if (display.shell)
- zxdg_shell_v6_destroy(display.shell);
+ zxdg_shell_v7_destroy(display.shell);
if (display.ivi_application)
ivi_application_destroy(display.ivi_application);
diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index 9fa2e21..45a8764 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -37,7 +37,7 @@
#include <wayland-client.h>
#include "shared/os-compatibility.h"
#include "shared/zalloc.h"
-#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-shell-unstable-v7-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include <sys/types.h>
@@ -48,7 +48,7 @@ struct display {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
- struct zxdg_shell_v6 *shell;
+ struct zxdg_shell_v7 *shell;
struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm;
bool has_xrgb;
@@ -65,8 +65,8 @@ struct window {
struct display *display;
int width, height;
struct wl_surface *surface;
- struct zxdg_surface_v6 *xdg_surface;
- struct zxdg_toplevel_v6 *xdg_toplevel;
+ struct zxdg_surface_v7 *xdg_surface;
+ struct zxdg_toplevel_v7 *xdg_toplevel;
struct ivi_surface *ivi_surface;
struct buffer buffers[2];
struct buffer *prev_buffer;
@@ -130,12 +130,12 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
}
static void
-handle_xdg_surface_configure(void *data, struct zxdg_surface_v6 *surface,
+handle_xdg_surface_configure(void *data, struct zxdg_surface_v7 *surface,
uint32_t serial)
{
struct window *window = data;
- zxdg_surface_v6_ack_configure(surface, serial);
+ zxdg_surface_v7_ack_configure(surface, serial);
if (window->wait_for_configure) {
redraw(window, NULL, 0);
@@ -143,24 +143,24 @@ handle_xdg_surface_configure(void *data, struct zxdg_surface_v6 *surface,
}
}
-static const struct zxdg_surface_v6_listener xdg_surface_listener = {
+static const struct zxdg_surface_v7_listener xdg_surface_listener = {
handle_xdg_surface_configure,
};
static void
-handle_xdg_toplevel_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel,
+handle_xdg_toplevel_configure(void *data, struct zxdg_toplevel_v7 *xdg_toplevel,
int32_t width, int32_t height,
struct wl_array *state)
{
}
static void
-handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
+handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v7 *xdg_toplevel)
{
running = 0;
}
-static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
+static const struct zxdg_toplevel_v7_listener xdg_toplevel_listener = {
handle_xdg_toplevel_configure,
handle_xdg_toplevel_close,
};
@@ -193,19 +193,19 @@ create_window(struct display *display, int width, int height)
if (display->shell) {
window->xdg_surface =
- zxdg_shell_v6_get_xdg_surface(display->shell,
+ zxdg_shell_v7_get_xdg_surface(display->shell,
window->surface);
assert(window->xdg_surface);
- zxdg_surface_v6_add_listener(window->xdg_surface,
+ zxdg_surface_v7_add_listener(window->xdg_surface,
&xdg_surface_listener, window);
window->xdg_toplevel =
- zxdg_surface_v6_get_toplevel(window->xdg_surface);
+ zxdg_surface_v7_get_toplevel(window->xdg_surface);
assert(window->xdg_toplevel);
- zxdg_toplevel_v6_add_listener(window->xdg_toplevel,
+ zxdg_toplevel_v7_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window);
- zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-shm");
+ zxdg_toplevel_v7_set_title(window->xdg_toplevel, "simple-shm");
wl_surface_commit(window->surface);
window->wait_for_configure = true;
} else if (display->fshell) {
@@ -245,9 +245,9 @@ destroy_window(struct window *window)
wl_buffer_destroy(window->buffers[1].buffer);
if (window->xdg_toplevel)
- zxdg_toplevel_v6_destroy(window->xdg_toplevel);
+ zxdg_toplevel_v7_destroy(window->xdg_toplevel);
if (window->xdg_surface)
- zxdg_surface_v6_destroy(window->xdg_surface);
+ zxdg_surface_v7_destroy(window->xdg_surface);
wl_surface_destroy(window->surface);
free(window);
}
@@ -376,12 +376,12 @@ struct wl_shm_listener shm_listener = {
};
static void
-xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
+xdg_shell_ping(void *data, struct zxdg_shell_v7 *shell, uint32_t serial)
{
- zxdg_shell_v6_pong(shell, serial);
+ zxdg_shell_v7_pong(shell, serial);
}
-static const struct zxdg_shell_v6_listener xdg_shell_listener = {
+static const struct zxdg_shell_v7_listener xdg_shell_listener = {
xdg_shell_ping,
};
@@ -395,10 +395,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->compositor =
wl_registry_bind(registry,
id, &wl_compositor_interface, 1);
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ } else if (strcmp(interface, "zxdg_shell_v7") == 0) {
d->shell = wl_registry_bind(registry,
- id, &zxdg_shell_v6_interface, 1);
- zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d);
+ id, &zxdg_shell_v7_interface, 1);
+ zxdg_shell_v7_add_listener(d->shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface, 1);
@@ -505,7 +505,7 @@ destroy_display(struct display *display)
wl_shm_destroy(display->shm);
if (display->shell)
- zxdg_shell_v6_destroy(display->shell);
+ zxdg_shell_v7_destroy(display->shell);
if (display->fshell)
zwp_fullscreen_shell_v1_release(display->fshell);
diff --git a/clients/transformed.c b/clients/transformed.c
index 6687a4a..26b83fa 100644
--- a/clients/transformed.c
+++ b/clients/transformed.c
@@ -199,8 +199,9 @@ button_handler(struct widget *widget,
switch (button) {
case BTN_LEFT:
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
- window_move(transformed->window, input,
- display_get_serial(transformed->display));
+ window_interact_with_decoration(transformed->window, input,
+ display_get_serial(transformed->display),
+ THEME_LOCATION_TITLEBAR);
break;
case BTN_MIDDLE:
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
@@ -219,7 +220,9 @@ touch_handler(struct widget *widget, struct input *input,
float x, float y, void *data)
{
struct transformed *transformed = data;
- window_move(transformed->window, input, display_get_serial(transformed->display));
+ window_interact_with_decoration(transformed->window, input,
+ display_get_serial(transformed->display),
+ THEME_LOCATION_TITLEBAR);
}
static void
diff --git a/clients/window.c b/clients/window.c
index ac35c3d..e74373f 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -74,7 +74,7 @@ typedef void *EGLContext;
#include "shared/helpers.h"
#include "shared/xalloc.h"
#include "shared/zalloc.h"
-#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-shell-unstable-v7-client-protocol.h"
#include "text-cursor-position-client-protocol.h"
#include "pointer-constraints-unstable-v1-client-protocol.h"
#include "relative-pointer-unstable-v1-client-protocol.h"
@@ -106,7 +106,7 @@ struct display {
struct wl_shm *shm;
struct wl_data_device_manager *data_device_manager;
struct text_cursor_position *text_cursor_position;
- struct zxdg_shell_v6 *xdg_shell;
+ struct zxdg_shell_v7 *xdg_shell;
struct ivi_application *ivi_application; /* ivi style shell */
struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
struct zwp_pointer_constraints_v1 *pointer_constraints;
@@ -262,9 +262,9 @@ struct window {
window_locked_pointer_motion_handler_t locked_pointer_motion_handler;
struct surface *main_surface;
- struct zxdg_surface_v6 *xdg_surface;
- struct zxdg_toplevel_v6 *xdg_toplevel;
- struct zxdg_popup_v6 *xdg_popup;
+ struct zxdg_surface_v7 *xdg_surface;
+ struct zxdg_toplevel_v7 *xdg_toplevel;
+ struct zxdg_popup_v7 *xdg_popup;
struct window *parent;
struct window *last_parent;
@@ -416,10 +416,6 @@ struct window_frame {
struct widget *widget;
struct widget *child;
struct frame *frame;
-
- uint32_t last_time;
- uint32_t did_double, double_click;
- int32_t last_id, double_id;
};
struct menu {
@@ -1598,11 +1594,11 @@ window_destroy(struct window *window)
window_frame_destroy(window->frame);
if (window->xdg_toplevel)
- zxdg_toplevel_v6_destroy(window->xdg_toplevel);
+ zxdg_toplevel_v7_destroy(window->xdg_toplevel);
if (window->xdg_popup)
- zxdg_popup_v6_destroy(window->xdg_popup);
+ zxdg_popup_v7_destroy(window->xdg_popup);
if (window->xdg_surface)
- zxdg_surface_v6_destroy(window->xdg_surface);
+ zxdg_surface_v7_destroy(window->xdg_surface);
if (window->ivi_surface)
ivi_surface_destroy(window->ivi_surface);
@@ -2433,28 +2429,20 @@ frame_handle_status(struct window_frame *frame, struct input *input,
return;
}
- if ((status & FRAME_STATUS_MOVE) && window->xdg_toplevel) {
+ if ((status & FRAME_STATUS_INTERACT_WITH_DECORATION) &&
+ window->xdg_toplevel) {
input_ungrab(input);
- zxdg_toplevel_v6_move(window->xdg_toplevel,
- input_get_seat(input),
- window->display->serial);
- frame_status_clear(frame->frame, FRAME_STATUS_MOVE);
- }
-
- if ((status & FRAME_STATUS_RESIZE) && window->xdg_toplevel) {
- input_ungrab(input);
+ zxdg_toplevel_v7_interact_with_decoration(window->xdg_toplevel,
+ input_get_seat(input),
+ window->display->serial,
+ location);
- zxdg_toplevel_v6_resize(window->xdg_toplevel,
- input_get_seat(input),
- window->display->serial,
- location);
-
- frame_status_clear(frame->frame, FRAME_STATUS_RESIZE);
+ frame_status_clear(frame->frame,
+ FRAME_STATUS_INTERACT_WITH_DECORATION);
}
}
-#define DOUBLE_CLICK_PERIOD 250
static void
frame_button_handler(struct widget *widget,
struct input *input, uint32_t time,
@@ -2465,27 +2453,7 @@ frame_button_handler(struct widget *widget,
struct window_frame *frame = data;
enum theme_location location;
- frame->double_click = 0;
- if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
- if (time - frame->last_time <= DOUBLE_CLICK_PERIOD) {
- frame->double_click = 1;
- frame->did_double = 1;
- } else
- frame->did_double = 0;
-
- frame->last_time = time;
- } else if (frame->did_double == 1) {
- frame->double_click = 1;
- frame->did_double = 0;
- }
-
- if (frame->double_click)
- location = frame_double_click(frame->frame, input,
- button, state);
- else
- location = frame_pointer_button(frame->frame, input,
- button, state);
-
+ location = frame_pointer_button(frame->frame, input, button, state);
frame_handle_status(frame, input, time, location);
}
@@ -2496,23 +2464,7 @@ frame_touch_down_handler(struct widget *widget, struct input *input,
{
struct window_frame *frame = data;
- frame->double_click = 0;
- if (time - frame->last_time <= DOUBLE_CLICK_PERIOD &&
- frame->last_id == id) {
- frame->double_click = 1;
- frame->did_double = 1;
- frame->double_id = id;
- } else
- frame->did_double = 0;
-
- frame->last_time = time;
- frame->last_id = id;
-
- if (frame->double_click)
- frame_double_touch_down(frame->frame, input, id, x, y);
- else
- frame_touch_down(frame->frame, input, id, x, y);
-
+ frame_touch_down(frame->frame, input, id, x, y);
frame_handle_status(frame, input, time, THEME_LOCATION_CLIENT_AREA);
}
@@ -2523,12 +2475,7 @@ frame_touch_up_handler(struct widget *widget,
{
struct window_frame *frame = data;
- if (frame->double_id == id && frame->did_double) {
- frame->did_double = 0;
- frame->double_id = 0;
- frame_double_touch_up(frame->frame, input, id);
- } else
- frame_touch_up(frame->frame, input, id);
+ frame_touch_up(frame->frame, input, id);
frame_handle_status(frame, input, time, THEME_LOCATION_CLIENT_AREA);
}
@@ -4056,12 +4003,13 @@ input_receive_selection_data_to_fd(struct input *input,
}
void
-window_move(struct window *window, struct input *input, uint32_t serial)
+window_interact_with_decoration(struct window *window, struct input *input,
+ uint32_t serial, enum theme_location location)
{
if (!window->xdg_toplevel)
return;
- zxdg_toplevel_v6_move(window->xdg_toplevel, input->seat, serial);
+ zxdg_toplevel_v7_interact_with_decoration(window->xdg_toplevel, input->seat, serial, location);
}
static void
@@ -4284,12 +4232,12 @@ window_uninhibit_redraw(struct window *window)
static void
xdg_surface_handle_configure(void *data,
- struct zxdg_surface_v6 *zxdg_surface_v6,
+ struct zxdg_surface_v7 *zxdg_surface_v7,
uint32_t serial)
{
struct window *window = data;
- zxdg_surface_v6_ack_configure(window->xdg_surface, serial);
+ zxdg_surface_v7_ack_configure(window->xdg_surface, serial);
if (window->state_changed_handler)
window->state_changed_handler(window, window->user_data);
@@ -4297,12 +4245,12 @@ xdg_surface_handle_configure(void *data,
window_uninhibit_redraw(window);
}
-static const struct zxdg_surface_v6_listener xdg_surface_listener = {
+static const struct zxdg_surface_v7_listener xdg_surface_listener = {
xdg_surface_handle_configure
};
static void
-xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel,
+xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v7 *xdg_toplevel,
int32_t width, int32_t height,
struct wl_array *states)
{
@@ -4317,16 +4265,16 @@ xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel,
wl_array_for_each(p, states) {
uint32_t state = *p;
switch (state) {
- case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
+ case ZXDG_TOPLEVEL_V7_STATE_MAXIMIZED:
window->maximized = 1;
break;
- case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
+ case ZXDG_TOPLEVEL_V7_STATE_FULLSCREEN:
window->fullscreen = 1;
break;
- case ZXDG_TOPLEVEL_V6_STATE_RESIZING:
+ case ZXDG_TOPLEVEL_V7_STATE_RESIZING:
window->resizing = 1;
break;
- case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED:
+ case ZXDG_TOPLEVEL_V7_STATE_ACTIVATED:
window->focused = 1;
break;
default:
@@ -4367,13 +4315,13 @@ xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel,
}
static void
-xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_surface)
+xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v7 *xdg_surface)
{
struct window *window = data;
window_close(window);
}
-static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
+static const struct zxdg_toplevel_v7_listener xdg_toplevel_listener = {
xdg_toplevel_handle_configure,
xdg_toplevel_handle_close,
};
@@ -4381,7 +4329,7 @@ static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
static void
window_sync_parent(struct window *window)
{
- struct zxdg_toplevel_v6 *parent_toplevel;
+ struct zxdg_toplevel_v7 *parent_toplevel;
if (!window->xdg_surface)
return;
@@ -4394,7 +4342,7 @@ window_sync_parent(struct window *window)
else
parent_toplevel = NULL;
- zxdg_toplevel_v6_set_parent(window->xdg_toplevel, parent_toplevel);
+ zxdg_toplevel_v7_set_parent(window->xdg_toplevel, parent_toplevel);
window->last_parent = window->parent;
}
@@ -4426,7 +4374,7 @@ window_sync_geometry(struct window *window)
geometry.height == window->last_geometry.height)
return;
- zxdg_surface_v6_set_window_geometry(window->xdg_surface,
+ zxdg_surface_v7_set_window_geometry(window->xdg_surface,
geometry.x,
geometry.y,
geometry.width,
@@ -4637,9 +4585,9 @@ window_set_fullscreen(struct window *window, int fullscreen)
return;
if (fullscreen)
- zxdg_toplevel_v6_set_fullscreen(window->xdg_toplevel, NULL);
+ zxdg_toplevel_v7_set_fullscreen(window->xdg_toplevel, NULL);
else
- zxdg_toplevel_v6_unset_fullscreen(window->xdg_toplevel);
+ zxdg_toplevel_v7_unset_fullscreen(window->xdg_toplevel);
}
int
@@ -4658,9 +4606,9 @@ window_set_maximized(struct window *window, int maximized)
return;
if (maximized)
- zxdg_toplevel_v6_set_maximized(window->xdg_toplevel);
+ zxdg_toplevel_v7_set_maximized(window->xdg_toplevel);
else
- zxdg_toplevel_v6_unset_maximized(window->xdg_toplevel);
+ zxdg_toplevel_v7_unset_maximized(window->xdg_toplevel);
}
int
@@ -4675,7 +4623,7 @@ window_set_minimized(struct window *window)
if (!window->xdg_toplevel)
return;
- zxdg_toplevel_v6_set_minimized(window->xdg_toplevel);
+ zxdg_toplevel_v7_set_minimized(window->xdg_toplevel);
}
void
@@ -4779,7 +4727,7 @@ window_set_title(struct window *window, const char *title)
widget_schedule_redraw(window->frame->widget);
}
if (window->xdg_toplevel)
- zxdg_toplevel_v6_set_title(window->xdg_toplevel, title);
+ zxdg_toplevel_v7_set_title(window->xdg_toplevel, title);
}
const char *
@@ -5221,18 +5169,18 @@ window_create(struct display *display)
if (window->display->xdg_shell) {
window->xdg_surface =
- zxdg_shell_v6_get_xdg_surface(window->display->xdg_shell,
+ zxdg_shell_v7_get_xdg_surface(window->display->xdg_shell,
window->main_surface->surface);
fail_on_null(window->xdg_surface, 0, __FILE__, __LINE__);
- zxdg_surface_v6_add_listener(window->xdg_surface,
+ zxdg_surface_v7_add_listener(window->xdg_surface,
&xdg_surface_listener, window);
window->xdg_toplevel =
- zxdg_surface_v6_get_toplevel(window->xdg_surface);
+ zxdg_surface_v7_get_toplevel(window->xdg_surface);
fail_on_null(window->xdg_toplevel, 0, __FILE__, __LINE__);
- zxdg_toplevel_v6_add_listener(window->xdg_toplevel,
+ zxdg_toplevel_v7_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window);
window_inhibit_redraw(window);
@@ -5398,7 +5346,7 @@ menu_redraw_handler(struct widget *widget, void *data)
static void
xdg_popup_handle_configure(void *data,
- struct zxdg_popup_v6 *zxdg_popup_v6,
+ struct zxdg_popup_v7 *zxdg_popup_v7,
int32_t x,
int32_t y,
int32_t width,
@@ -5407,7 +5355,7 @@ xdg_popup_handle_configure(void *data,
}
static void
-xdg_popup_handle_popup_done(void *data, struct zxdg_popup_v6 *xdg_popup)
+xdg_popup_handle_popup_done(void *data, struct zxdg_popup_v7 *xdg_popup)
{
struct window *window = data;
struct menu *menu = window->main_surface->widget->user_data;
@@ -5416,7 +5364,7 @@ xdg_popup_handle_popup_done(void *data, struct zxdg_popup_v6 *xdg_popup)
menu_destroy(menu);
}
-static const struct zxdg_popup_v6_listener xdg_popup_listener = {
+static const struct zxdg_popup_v7_listener xdg_popup_listener = {
xdg_popup_handle_configure,
xdg_popup_handle_popup_done,
};
@@ -5472,22 +5420,22 @@ create_menu(struct display *display,
return menu;
}
-static struct zxdg_positioner_v6 *
+static struct zxdg_positioner_v7 *
create_simple_positioner(struct display *display,
int x, int y, int w, int h)
{
- struct zxdg_positioner_v6 *positioner;
+ struct zxdg_positioner_v7 *positioner;
- positioner = zxdg_shell_v6_create_positioner(display->xdg_shell);
+ positioner = zxdg_shell_v7_create_positioner(display->xdg_shell);
fail_on_null(positioner, 0, __FILE__, __LINE__);
- zxdg_positioner_v6_set_anchor_rect(positioner, x, y, 1, 1);
- zxdg_positioner_v6_set_size(positioner, w, h);
- zxdg_positioner_v6_set_anchor(positioner,
- ZXDG_POSITIONER_V6_ANCHOR_TOP |
- ZXDG_POSITIONER_V6_ANCHOR_LEFT);
- zxdg_positioner_v6_set_gravity(positioner,
- ZXDG_POSITIONER_V6_ANCHOR_BOTTOM |
- ZXDG_POSITIONER_V6_ANCHOR_RIGHT);
+ zxdg_positioner_v7_set_anchor_rect(positioner, x, y, 1, 1);
+ zxdg_positioner_v7_set_size(positioner, w, h);
+ zxdg_positioner_v7_set_anchor(positioner,
+ ZXDG_POSITIONER_V7_ANCHOR_TOP |
+ ZXDG_POSITIONER_V7_ANCHOR_LEFT);
+ zxdg_positioner_v7_set_gravity(positioner,
+ ZXDG_POSITIONER_V7_ANCHOR_BOTTOM |
+ ZXDG_POSITIONER_V7_ANCHOR_RIGHT);
return positioner;
}
@@ -5502,7 +5450,7 @@ window_show_menu(struct display *display,
struct window *window;
int32_t ix, iy;
struct rectangle parent_geometry;
- struct zxdg_positioner_v6 *positioner;
+ struct zxdg_positioner_v7 *positioner;
menu = create_menu(display, input, time, func, entries, count, parent);
@@ -5524,11 +5472,11 @@ window_show_menu(struct display *display,
return;
window->xdg_surface =
- zxdg_shell_v6_get_xdg_surface(display->xdg_shell,
+ zxdg_shell_v7_get_xdg_surface(display->xdg_shell,
window->main_surface->surface);
fail_on_null(window->xdg_surface, 0, __FILE__, __LINE__);
- zxdg_surface_v6_add_listener(window->xdg_surface,
+ zxdg_surface_v7_add_listener(window->xdg_surface,
&xdg_surface_listener, window);
positioner = create_simple_positioner(display,
@@ -5537,15 +5485,15 @@ window_show_menu(struct display *display,
frame_width(menu->frame),
frame_height(menu->frame));
window->xdg_popup =
- zxdg_surface_v6_get_popup(window->xdg_surface,
+ zxdg_surface_v7_get_popup(window->xdg_surface,
parent->xdg_surface,
positioner);
fail_on_null(window->xdg_popup, 0, __FILE__, __LINE__);
- zxdg_positioner_v6_destroy(positioner);
- zxdg_popup_v6_grab(window->xdg_popup,
+ zxdg_positioner_v7_destroy(positioner);
+ zxdg_popup_v7_grab(window->xdg_popup,
input->seat,
display_get_serial(window->display));
- zxdg_popup_v6_add_listener(window->xdg_popup,
+ zxdg_popup_v7_add_listener(window->xdg_popup,
&xdg_popup_listener, window);
window_inhibit_redraw(window);
@@ -5945,12 +5893,12 @@ struct wl_shm_listener shm_listener = {
};
static void
-xdg_shell_handle_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
+xdg_shell_handle_ping(void *data, struct zxdg_shell_v7 *shell, uint32_t serial)
{
- zxdg_shell_v6_pong(shell, serial);
+ zxdg_shell_v7_pong(shell, serial);
}
-static const struct zxdg_shell_v6_listener xdg_shell_listener = {
+static const struct zxdg_shell_v7_listener xdg_shell_listener = {
xdg_shell_handle_ping,
};
@@ -5995,10 +5943,10 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
wl_registry_bind(registry, id,
&wl_data_device_manager_interface,
d->data_device_manager_version);
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ } else if (strcmp(interface, "zxdg_shell_v7") == 0) {
d->xdg_shell = wl_registry_bind(registry, id,
- &zxdg_shell_v6_interface, 1);
- zxdg_shell_v6_add_listener(d->xdg_shell, &xdg_shell_listener, d);
+ &zxdg_shell_v7_interface, 1);
+ zxdg_shell_v7_add_listener(d->xdg_shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "text_cursor_position") == 0) {
d->text_cursor_position =
wl_registry_bind(registry, id,
@@ -6309,7 +6257,7 @@ display_destroy(struct display *display)
wl_subcompositor_destroy(display->subcompositor);
if (display->xdg_shell)
- zxdg_shell_v6_destroy(display->xdg_shell);
+ zxdg_shell_v7_destroy(display->xdg_shell);
if (display->ivi_application)
ivi_application_destroy(display->ivi_application);
diff --git a/clients/window.h b/clients/window.h
index 1ec9eac..2d9b633 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -30,6 +30,7 @@
#include <xkbcommon/xkbcommon.h>
#include <wayland-client.h>
#include <cairo.h>
+#include "shared/cairo-util.h"
#include "shared/config-parser.h"
#include "shared/zalloc.h"
#include "shared/platform.h"
@@ -370,7 +371,8 @@ typedef void (*data_func_t)(void *data, size_t len,
struct display *
window_get_display(struct window *window);
void
-window_move(struct window *window, struct input *input, uint32_t time);
+window_interact_with_decoration(struct window *window, struct input *input,
+ uint32_t serial, enum theme_location location);
void
window_get_allocation(struct window *window, struct rectangle *allocation);
void
diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index d1e387d..05f943e 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -51,7 +51,7 @@
#include "shared/os-compatibility.h"
#include "shared/cairo-util.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
-#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-shell-unstable-v7-client-protocol.h"
#include "presentation-time-server-protocol.h"
#include "linux-dmabuf.h"
#include "windowed-output-api.h"
@@ -67,7 +67,7 @@ struct wayland_backend {
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shell *shell;
- struct zxdg_shell_v6 *xdg_shell;
+ struct zxdg_shell_v7 *xdg_shell;
struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm;
@@ -100,8 +100,8 @@ struct wayland_output {
uint32_t global_id;
struct wl_shell_surface *shell_surface;
- struct zxdg_surface_v6 *xdg_surface;
- struct zxdg_toplevel_v6 *xdg_toplevel;
+ struct zxdg_surface_v7 *xdg_surface;
+ struct zxdg_toplevel_v7 *xdg_toplevel;
int configure_width, configure_height;
bool wait_for_configure;
} parent;
@@ -630,10 +630,10 @@ static void
wayland_backend_destroy_output_surface(struct wayland_output *output)
{
if (output->parent.xdg_toplevel)
- zxdg_toplevel_v6_destroy(output->parent.xdg_toplevel);
+ zxdg_toplevel_v7_destroy(output->parent.xdg_toplevel);
if (output->parent.xdg_surface)
- zxdg_surface_v6_destroy(output->parent.xdg_surface);
+ zxdg_surface_v7_destroy(output->parent.xdg_surface);
if (output->parent.shell_surface)
wl_shell_surface_destroy(output->parent.shell_surface);
@@ -838,7 +838,7 @@ wayland_output_set_windowed(struct wayland_output *output)
}
if (output->parent.xdg_toplevel)
- zxdg_toplevel_v6_set_title(output->parent.xdg_toplevel, title);
+ zxdg_toplevel_v7_set_title(output->parent.xdg_toplevel, title);
if (!b->theme) {
b->theme = theme_create();
@@ -880,7 +880,7 @@ wayland_output_set_fullscreen(struct wayland_output *output,
wayland_output_resize_surface(output);
if (output->parent.xdg_toplevel) {
- zxdg_toplevel_v6_set_fullscreen(output->parent.xdg_toplevel, target);
+ zxdg_toplevel_v7_set_fullscreen(output->parent.xdg_toplevel, target);
} else if (output->parent.shell_surface) {
wl_shell_surface_set_fullscreen(output->parent.shell_surface,
method, framerate, target);
@@ -1055,18 +1055,18 @@ err_output:
}
static void
-handle_xdg_surface_configure(void *data, struct zxdg_surface_v6 *surface,
+handle_xdg_surface_configure(void *data, struct zxdg_surface_v7 *surface,
uint32_t serial)
{
- zxdg_surface_v6_ack_configure(surface, serial);
+ zxdg_surface_v7_ack_configure(surface, serial);
}
-static const struct zxdg_surface_v6_listener xdg_surface_listener = {
+static const struct zxdg_surface_v7_listener xdg_surface_listener = {
handle_xdg_surface_configure
};
static void
-handle_xdg_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
+handle_xdg_toplevel_configure(void *data, struct zxdg_toplevel_v7 *toplevel,
int32_t width, int32_t height,
struct wl_array *states)
{
@@ -1080,11 +1080,11 @@ handle_xdg_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
}
static void
-handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
+handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v7 *xdg_toplevel)
{
}
-static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
+static const struct zxdg_toplevel_v7_listener xdg_toplevel_listener = {
handle_xdg_toplevel_configure,
handle_xdg_toplevel_close,
};
@@ -1105,14 +1105,14 @@ wayland_backend_create_output_surface(struct wayland_output *output)
if (b->parent.xdg_shell) {
output->parent.xdg_surface =
- zxdg_shell_v6_get_xdg_surface(b->parent.xdg_shell,
+ zxdg_shell_v7_get_xdg_surface(b->parent.xdg_shell,
output->parent.surface);
- zxdg_surface_v6_add_listener(output->parent.xdg_surface,
+ zxdg_surface_v7_add_listener(output->parent.xdg_surface,
&xdg_surface_listener, output);
output->parent.xdg_toplevel =
- zxdg_surface_v6_get_toplevel(output->parent.xdg_surface);
- zxdg_toplevel_v6_add_listener(output->parent.xdg_toplevel,
+ zxdg_surface_v7_get_toplevel(output->parent.xdg_surface);
+ zxdg_toplevel_v7_add_listener(output->parent.xdg_toplevel,
&xdg_toplevel_listener, output);
wl_surface_commit(output->parent.surface);
@@ -1122,7 +1122,7 @@ wayland_backend_create_output_surface(struct wayland_output *output)
while (output->parent.wait_for_configure)
wl_display_dispatch(b->parent.wl_display);
- weston_log("wayland-backend: Using xdg_shell_v6\n");
+ weston_log("wayland-backend: Using xdg_shell_v7\n");
}
else if (b->parent.shell) {
output->parent.shell_surface =
@@ -1187,7 +1187,7 @@ wayland_output_enable(struct weston_output *base)
output->mode.refresh, output->parent.output);
if (output->parent.xdg_toplevel) {
- zxdg_toplevel_v6_set_fullscreen(output->parent.xdg_toplevel,
+ zxdg_toplevel_v7_set_fullscreen(output->parent.xdg_toplevel,
output->parent.output);
}
else if (output->parent.shell_surface) {
@@ -1370,7 +1370,7 @@ wayland_output_create_fullscreen(struct wayland_backend *b)
/* What should size be set if conditional is false? */
if (b->parent.xdg_shell || b->parent.shell) {
if (output->parent.xdg_toplevel)
- zxdg_toplevel_v6_set_fullscreen(output->parent.xdg_toplevel,
+ zxdg_toplevel_v7_set_fullscreen(output->parent.xdg_toplevel,
output->parent.output);
else if (output->parent.shell_surface)
wl_shell_surface_set_fullscreen(output->parent.shell_surface,
@@ -1591,15 +1591,18 @@ input_handle_button(void *data, struct wl_pointer *pointer,
location = frame_pointer_button(input->output->frame, input,
button, state);
- if (frame_status(input->output->frame) & FRAME_STATUS_MOVE) {
+ if (frame_status(input->output->frame) &
+ FRAME_STATUS_INTERACT_WITH_DECORATION) {
if (input->output->parent.xdg_toplevel)
- zxdg_toplevel_v6_move(input->output->parent.xdg_toplevel,
- input->parent.seat, serial);
+ zxdg_toplevel_v7_interact_with_decoration(input->output->parent.xdg_toplevel,
+ input->parent.seat,
+ serial,
+ ZXDG_TOPLEVEL_V7_DECORATION_PART_TITLEBAR);
else if (input->output->parent.shell_surface)
wl_shell_surface_move(input->output->parent.shell_surface,
input->parent.seat, serial);
frame_status_clear(input->output->frame,
- FRAME_STATUS_MOVE);
+ FRAME_STATUS_INTERACT_WITH_DECORATION);
return;
}
@@ -1924,16 +1927,19 @@ input_handle_touch_down(void *data, struct wl_touch *wl_touch,
if (frame_status(output->frame) & FRAME_STATUS_REPAINT)
weston_output_schedule_repaint(&output->base);
- if (first_touch && (frame_status(output->frame) & FRAME_STATUS_MOVE)) {
+ if (first_touch && (frame_status(output->frame) &
+ FRAME_STATUS_INTERACT_WITH_DECORATION)) {
input->touch_points--;
if (output->parent.xdg_toplevel)
- zxdg_toplevel_v6_move(output->parent.xdg_toplevel,
- input->parent.seat, serial);
+ zxdg_toplevel_v7_interact_with_decoration(output->parent.xdg_toplevel,
+ input->parent.seat,
+ serial,
+ location);
else if (output->parent.shell_surface)
wl_shell_surface_move(output->parent.shell_surface,
input->parent.seat, serial);
frame_status_clear(output->frame,
- FRAME_STATUS_MOVE);
+ FRAME_STATUS_INTERACT_WITH_DECORATION);
return;
}
@@ -2259,12 +2265,12 @@ wayland_parent_output_destroy(struct wayland_parent_output *output)
}
static void
-xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
+xdg_shell_ping(void *data, struct zxdg_shell_v7 *shell, uint32_t serial)
{
- zxdg_shell_v6_pong(shell, serial);
+ zxdg_shell_v7_pong(shell, serial);
}
-static const struct zxdg_shell_v6_listener xdg_shell_listener = {
+static const struct zxdg_shell_v7_listener xdg_shell_listener = {
xdg_shell_ping,
};
@@ -2278,11 +2284,11 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
b->parent.compositor =
wl_registry_bind(registry, name,
&wl_compositor_interface, 1);
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ } else if (strcmp(interface, "zxdg_shell_v7") == 0) {
b->parent.xdg_shell =
wl_registry_bind(registry, name,
- &zxdg_shell_v6_interface, 1);
- zxdg_shell_v6_add_listener(b->parent.xdg_shell,
+ &zxdg_shell_v7_interface, 1);
+ zxdg_shell_v7_add_listener(b->parent.xdg_shell,
&xdg_shell_listener, b);
} else if (strcmp(interface, "wl_shell") == 0) {
b->parent.shell =
@@ -2361,7 +2367,7 @@ wayland_destroy(struct weston_compositor *ec)
wl_shm_destroy(b->parent.shm);
if (b->parent.xdg_shell)
- zxdg_shell_v6_destroy(b->parent.xdg_shell);
+ zxdg_shell_v7_destroy(b->parent.xdg_shell);
if (b->parent.shell)
wl_shell_destroy(b->parent.shell);
diff --git a/shared/cairo-util.h b/shared/cairo-util.h
index 84cf005..34e5840 100644
--- a/shared/cairo-util.h
+++ b/shared/cairo-util.h
@@ -106,9 +106,8 @@ enum frame_status {
FRAME_STATUS_MAXIMIZE = 0x4,
FRAME_STATUS_CLOSE = 0x8,
FRAME_STATUS_MENU = 0x10,
- FRAME_STATUS_RESIZE = 0x20,
- FRAME_STATUS_MOVE = 0x40,
- FRAME_STATUS_ALL = 0x7f
+ FRAME_STATUS_INTERACT_WITH_DECORATION = 0x20,
+ FRAME_STATUS_ALL = 0x3f
};
enum frame_flag {
@@ -199,8 +198,7 @@ frame_pointer_leave(struct frame *frame, void *pointer);
* FRAME_STATUS_MAXIMIZE
* FRAME_STATUS_CLOSE
* FRAME_STATUS_MENU
- * FRAME_STATUS_RESIZE
- * FRAME_STATUS_MOVE
+ * FRAME_STATUS_INTERACT_WITH_DECORATION
*/
enum theme_location
frame_pointer_button(struct frame *frame, void *pointer,
@@ -212,17 +210,6 @@ frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y);
void
frame_touch_up(struct frame *frame, void *data, int32_t id);
-enum theme_location
-frame_double_click(struct frame *frame, void *pointer,
- uint32_t button, enum wl_pointer_button_state state);
-
-void
-frame_double_touch_down(struct frame *frame, void *data, int32_t id,
- int x, int y);
-
-void
-frame_double_touch_up(struct frame *frame, void *data, int32_t id);
-
void
frame_repaint(struct frame *frame, cairo_t *cr);
diff --git a/shared/frame.c b/shared/frame.c
index eb0cd77..68fbc72 100644
--- a/shared/frame.c
+++ b/shared/frame.c
@@ -669,37 +669,29 @@ static void
frame_pointer_button_press(struct frame *frame, struct frame_pointer *pointer,
struct frame_pointer_button *button)
{
- if (button->button == BTN_RIGHT) {
- if (button->press_location == THEME_LOCATION_TITLEBAR)
- frame->status |= FRAME_STATUS_MENU;
-
+ if ((button->button == BTN_RIGHT) &&
+ (button->press_location == THEME_LOCATION_TITLEBAR)) {
+ frame->status |= FRAME_STATUS_MENU;
frame_pointer_button_destroy(button);
-
- } else if (button->button == BTN_LEFT) {
- if (pointer->hover_button) {
- frame_button_press(pointer->hover_button);
- } else {
- switch (button->press_location) {
- case THEME_LOCATION_TITLEBAR:
- frame->status |= FRAME_STATUS_MOVE;
-
- frame_pointer_button_destroy(button);
- break;
- case THEME_LOCATION_RESIZING_TOP:
- case THEME_LOCATION_RESIZING_BOTTOM:
- case THEME_LOCATION_RESIZING_LEFT:
- case THEME_LOCATION_RESIZING_RIGHT:
- case THEME_LOCATION_RESIZING_TOP_LEFT:
- case THEME_LOCATION_RESIZING_TOP_RIGHT:
- case THEME_LOCATION_RESIZING_BOTTOM_LEFT:
- case THEME_LOCATION_RESIZING_BOTTOM_RIGHT:
- frame->status |= FRAME_STATUS_RESIZE;
-
- frame_pointer_button_destroy(button);
- break;
- default:
- break;
- }
+ } else if ((button->button == BTN_LEFT) &&
+ (pointer->hover_button)) {
+ frame_button_press(pointer->hover_button);
+ } else {
+ switch (button->press_location) {
+ case THEME_LOCATION_TITLEBAR:
+ case THEME_LOCATION_RESIZING_TOP:
+ case THEME_LOCATION_RESIZING_BOTTOM:
+ case THEME_LOCATION_RESIZING_LEFT:
+ case THEME_LOCATION_RESIZING_RIGHT:
+ case THEME_LOCATION_RESIZING_TOP_LEFT:
+ case THEME_LOCATION_RESIZING_TOP_RIGHT:
+ case THEME_LOCATION_RESIZING_BOTTOM_LEFT:
+ case THEME_LOCATION_RESIZING_BOTTOM_RIGHT:
+ frame->status |= FRAME_STATUS_INTERACT_WITH_DECORATION;
+ frame_pointer_button_destroy(button);
+ break;
+ default:
+ break;
}
}
}
@@ -810,8 +802,6 @@ frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y)
switch (location) {
case THEME_LOCATION_TITLEBAR:
- frame->status |= FRAME_STATUS_MOVE;
- break;
case THEME_LOCATION_RESIZING_TOP:
case THEME_LOCATION_RESIZING_BOTTOM:
case THEME_LOCATION_RESIZING_LEFT:
@@ -820,7 +810,7 @@ frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y)
case THEME_LOCATION_RESIZING_TOP_RIGHT:
case THEME_LOCATION_RESIZING_BOTTOM_LEFT:
case THEME_LOCATION_RESIZING_BOTTOM_RIGHT:
- frame->status |= FRAME_STATUS_RESIZE;
+ frame->status |= FRAME_STATUS_INTERACT_WITH_DECORATION;
break;
default:
break;
@@ -842,86 +832,6 @@ frame_touch_up(struct frame *frame, void *data, int32_t id)
}
}
-enum theme_location
-frame_double_click(struct frame *frame, void *data,
- uint32_t btn, enum wl_pointer_button_state state)
-{
- struct frame_pointer *pointer = frame_pointer_get(frame, data);
- struct frame_button *button;
- enum theme_location location = THEME_LOCATION_EXTERIOR;
-
- location = theme_get_location(frame->theme, pointer->x, pointer->y,
- frame->width, frame->height,
- frame->flags & FRAME_FLAG_MAXIMIZED ?
- THEME_FRAME_MAXIMIZED : 0);
-
- button = frame_find_button(frame, pointer->x, pointer->y);
-
- if (location != THEME_LOCATION_TITLEBAR || btn != BTN_LEFT)
- return location;
-
- if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
- if (button)
- frame_button_press(button);
- else
- frame->status |= FRAME_STATUS_MAXIMIZE;
- } else if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
- if (button)
- frame_button_release(button);
- }
-
- return location;
-}
-
-void
-frame_double_touch_down(struct frame *frame, void *data, int32_t id,
- int x, int y)
-{
- struct frame_touch *touch = frame_touch_get(frame, data);
- struct frame_button *button = frame_find_button(frame, x, y);
- enum theme_location location;
-
- if (touch && button) {
- touch->button = button;
- frame_button_press(touch->button);
- return;
- }
-
- location = theme_get_location(frame->theme, x, y,
- frame->width, frame->height,
- frame->flags & FRAME_FLAG_MAXIMIZED ?
- THEME_FRAME_MAXIMIZED : 0);
-
- switch (location) {
- case THEME_LOCATION_TITLEBAR:
- frame->status |= FRAME_STATUS_MAXIMIZE;
- break;
- case THEME_LOCATION_RESIZING_TOP:
- case THEME_LOCATION_RESIZING_BOTTOM:
- case THEME_LOCATION_RESIZING_LEFT:
- case THEME_LOCATION_RESIZING_RIGHT:
- case THEME_LOCATION_RESIZING_TOP_LEFT:
- case THEME_LOCATION_RESIZING_TOP_RIGHT:
- case THEME_LOCATION_RESIZING_BOTTOM_LEFT:
- case THEME_LOCATION_RESIZING_BOTTOM_RIGHT:
- frame->status |= FRAME_STATUS_RESIZE;
- break;
- default:
- break;
- }
-}
-
-void
-frame_double_touch_up(struct frame *frame, void *data, int32_t id)
-{
- struct frame_touch *touch = frame_touch_get(frame, data);
-
- if (touch && touch->button) {
- frame_button_release(touch->button);
- frame_touch_destroy(touch);
- }
-}
-
void
frame_repaint(struct frame *frame, cairo_t *cr)
{
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 628109f..58d1c97 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -1350,7 +1350,8 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
THEME_LOCATION_RESIZING_BOTTOM_RIGHT,
THEME_LOCATION_RESIZING_BOTTOM,
THEME_LOCATION_RESIZING_BOTTOM_LEFT,
- THEME_LOCATION_RESIZING_LEFT
+ THEME_LOCATION_RESIZING_LEFT,
+ THEME_LOCATION_TITLEBAR
};
struct weston_wm *wm = window->wm;
@@ -1368,8 +1369,6 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
detail = client_message->data.data32[2];
switch (detail) {
case _NET_WM_MOVERESIZE_MOVE:
- xwayland_interface->interact_with_decoration(window->shsurf, pointer, THEME_LOCATION_TITLEBAR);
- break;
case _NET_WM_MOVERESIZE_SIZE_TOPLEFT:
case _NET_WM_MOVERESIZE_SIZE_TOP:
case _NET_WM_MOVERESIZE_SIZE_TOPRIGHT:
@@ -1378,7 +1377,8 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
case _NET_WM_MOVERESIZE_SIZE_BOTTOM:
case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT:
case _NET_WM_MOVERESIZE_SIZE_LEFT:
- xwayland_interface->interact_with_decoration(window->shsurf, pointer, map[detail]);
+ xwayland_interface->interact_with_decoration(window->shsurf,
+ pointer, map[detail]);
break;
case _NET_WM_MOVERESIZE_CANCEL:
break;
@@ -1797,16 +1797,14 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
if (frame_status(window->frame) & FRAME_STATUS_REPAINT)
weston_wm_window_schedule_repaint(window);
- if (frame_status(window->frame) & FRAME_STATUS_MOVE) {
- if (pointer)
- xwayland_interface->interact_with_decoration(window->shsurf, pointer, THEME_LOCATION_TITLEBAR);
- frame_status_clear(window->frame, FRAME_STATUS_MOVE);
- }
-
- if (frame_status(window->frame) & FRAME_STATUS_RESIZE) {
+ if (frame_status(window->frame) &
+ FRAME_STATUS_INTERACT_WITH_DECORATION) {
if (pointer)
- xwayland_interface->interact_with_decoration(window->shsurf, pointer, location);
- frame_status_clear(window->frame, FRAME_STATUS_RESIZE);
+ xwayland_interface->interact_with_decoration(window->shsurf,
+ pointer,
+ location);
+ frame_status_clear(window->frame,
+ FRAME_STATUS_INTERACT_WITH_DECORATION);
}
if (frame_status(window->frame) & FRAME_STATUS_CLOSE) {
--
2.8.0.rc3.226.g39d4020
More information about the wayland-devel
mailing list