Hello community, here is the log from the commit of package wlc for openSUSE:Factory checked in at 2016-11-03 11:14:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wlc (Old) and /work/SRC/openSUSE:Factory/.wlc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wlc" Changes: -------- --- /work/SRC/openSUSE:Factory/wlc/wlc.changes 2016-10-06 12:45:46.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.wlc.new/wlc.changes 2016-11-03 11:14:16.000000000 +0100 @@ -1,0 +2,7 @@ +Wed Oct 26 10:06:04 UTC 2016 - sleep_wal...@opensuse.org + +- bump to 0.0.7 + partially implement xdg-shell v6 + surface: Fix bad use of wlc_size_max + +------------------------------------------------------------------- Old: ---- wlc-0.0.6.tar.bz2 wlc-0.0.6.tar.bz2.asc New: ---- wlc-0.0.7.tar.bz2 wlc-0.0.7.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wlc.spec ++++++ --- /var/tmp/diff_new_pack.tg6nH5/_old 2016-11-03 11:14:18.000000000 +0100 +++ /var/tmp/diff_new_pack.tg6nH5/_new 2016-11-03 11:14:18.000000000 +0100 @@ -19,7 +19,7 @@ %define wayland_minimal 1.7 Name: wlc -Version: 0.0.6 +Version: 0.0.7 Release: 0 Summary: A Wayland Compositor Library License: MIT ++++++ wlc-0.0.6.tar.bz2 -> wlc-0.0.7.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/CMakeLists.txt new/wlc-0.0.7/CMakeLists.txt --- old/wlc-0.0.6/CMakeLists.txt 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/CMakeLists.txt 2016-10-25 21:46:35.000000000 +0200 @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1) -PROJECT(wlc VERSION 0.0.6 LANGUAGES C) +PROJECT(wlc VERSION 0.0.7 LANGUAGES C) set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/CMake") # Subprojects diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/protos/CMakeLists.txt new/wlc-0.0.7/protos/CMakeLists.txt --- old/wlc-0.0.6/protos/CMakeLists.txt 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/protos/CMakeLists.txt 2016-10-25 21:46:35.000000000 +0200 @@ -12,7 +12,7 @@ ) set(protos - "${prefix}/unstable/xdg-shell/xdg-shell-unstable-v5") + "${prefix}/unstable/xdg-shell/xdg-shell-unstable-v6") foreach(proto ${protos}) add_feature_info(${proto} proto "Protocol extension") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/CMakeLists.txt new/wlc-0.0.7/src/CMakeLists.txt --- old/wlc-0.0.6/src/CMakeLists.txt 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/CMakeLists.txt 2016-10-25 21:46:35.000000000 +0200 @@ -52,7 +52,7 @@ resources/types/region.c resources/types/shell-surface.c resources/types/surface.c - resources/types/xdg-surface.c + resources/types/xdg-toplevel.c session/fd.c session/tty.c session/udev.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/compositor/compositor.c new/wlc-0.0.7/src/compositor/compositor.c --- old/wlc-0.0.6/src/compositor/compositor.c 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/compositor/compositor.c 2016-10-25 21:46:35.000000000 +0200 @@ -340,12 +340,14 @@ wlc_resource *res[WLC_SURFACE_ROLE_LAST] = { &view->shell_surface, &view->xdg_surface, + &view->xdg_toplevel, &view->custom_surface, }; const char *name[WLC_SURFACE_ROLE_LAST] = { "shell-surface", "xdg-surface", + "xdg-toplevel", "custom-surface", }; @@ -356,7 +358,7 @@ } static void -attach_popup_to_view_or_create(struct wlc_compositor *compositor, struct wlc_surface *surface, struct wlc_surface *parent, struct wlc_point *origin, wlc_resource resource) +attach_popup_to_view_or_create(struct wlc_compositor *compositor, struct wlc_surface *surface, struct wlc_surface *parent, wlc_resource role) { assert(compositor && surface && parent); @@ -364,11 +366,10 @@ if (!(view = wlc_compositor_view_for_surface(compositor, surface))) return; - view->xdg_popup = resource; - view->pending.geometry.origin = *origin; + view->xdg_popup = role; wlc_view_set_parent_ptr(view, convert_from_wlc_handle(parent->view, "view")); wlc_view_set_type_ptr(view, WLC_BIT_POPUP, true); - wl_resource_set_user_data(wl_resource_from_wlc_resource(resource, "xdg-popup"), (void*)convert_to_wlc_handle(view)); + wl_resource_set_user_data(wl_resource_from_wlc_resource(role, "xdg-popup"), (void*)convert_to_wlc_handle(view)); } static void @@ -384,7 +385,7 @@ break; case WLC_SURFACE_EVENT_REQUEST_VIEW_POPUP: - attach_popup_to_view_or_create(compositor, ev->surface, ev->popup.parent, &ev->popup.origin, ev->popup.resource); + attach_popup_to_view_or_create(compositor, ev->surface, ev->popup.parent, ev->popup.role); break; case WLC_SURFACE_EVENT_DESTROYED: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/compositor/shell/xdg-shell.c new/wlc-0.0.7/src/compositor/shell/xdg-shell.c --- old/wlc-0.0.6/src/compositor/shell/xdg-shell.c 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/compositor/shell/xdg-shell.c 2016-10-25 21:46:35.000000000 +0200 @@ -7,60 +7,137 @@ #include "compositor/compositor.h" #include "compositor/output.h" #include "compositor/view.h" -#include "resources/types/xdg-surface.h" +#include "resources/types/xdg-toplevel.h" -static_assert_x(XDG_SHELL_VERSION_CURRENT == 5, generated_protocol_and_implementation_version_are_different); +struct xdg_surface { + wlc_resource surface; +}; + +static struct wlc_surface* +xdg_surface_get_surface(struct xdg_surface *xdg_surface) +{ + return (xdg_surface ? convert_from_wlc_resource(xdg_surface->surface, "surface") : NULL); +} static void -xdg_cb_shell_use_unstable_version(struct wl_client *client, struct wl_resource *resource, int32_t version) +xdg_cb_popup_grab(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial) { - (void)client; - if (version != XDG_SHELL_VERSION_CURRENT) { - wl_resource_post_error(resource, 1, "xdg-shell :: unsupported version %u, supported %u", version, XDG_SHELL_VERSION_CURRENT); + (void)client, (void)seat, (void)serial; + STUB(resource); +} + +static const struct zxdg_popup_v6_interface zxdg_popup_v6_implementation = { + .destroy = wlc_cb_resource_destructor, + .grab = xdg_cb_popup_grab, +}; + +static void +xdg_cb_surface_get_popup(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *parent, struct wl_resource *positioner) +{ + (void)positioner; + + struct wlc_xdg_shell *xdg_shell; + struct wlc_surface *surface, *psurface; + if (!(xdg_shell = wl_resource_get_user_data(resource)) || !(surface = xdg_surface_get_surface(convert_from_wl_resource(resource, "xdg-surface"))) || !(psurface = xdg_surface_get_surface(convert_from_wl_resource(parent, "xdg-surface")))) return; + + wlc_resource r; + if (!(r = wlc_resource_create(&xdg_shell->popups, client, &zxdg_popup_v6_interface, wl_resource_get_version(resource), 1, id))) + return; + + wlc_resource_implement(r, &zxdg_popup_v6_implementation, NULL); + + { + struct wlc_surface_event ev = { .attach = { .type = WLC_XDG_SURFACE, .role = wlc_resource_from_wl_resource(resource) }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_ATTACH }; + wl_signal_emit(&wlc_system_signals()->surface, &ev); } + + { + struct wlc_surface_event ev = { .popup = { .parent = psurface, .role = r }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_POPUP }; + wl_signal_emit(&wlc_system_signals()->surface, &ev); + } + + zxdg_surface_v6_send_configure(resource, wl_display_next_serial(wlc_display())); } static void -xdg_cb_shell_get_surface(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource) +xdg_cb_surface_get_toplevel(struct wl_client *client, struct wl_resource *resource, uint32_t id) { struct wlc_surface *surface; struct wlc_xdg_shell *xdg_shell; - if (!(xdg_shell = wl_resource_get_user_data(resource)) || !(surface = convert_from_wl_resource(surface_resource, "surface"))) + if (!(xdg_shell = wl_resource_get_user_data(resource)) || !(surface = xdg_surface_get_surface(convert_from_wl_resource(resource, "xdg-surface")))) return; wlc_resource r; - if (!(r = wlc_resource_create(&xdg_shell->surfaces, client, &xdg_surface_interface, wl_resource_get_version(resource), 1, id))) + if (!(r = wlc_resource_create(&xdg_shell->toplevels, client, &zxdg_toplevel_v6_interface, wl_resource_get_version(resource), 1, id))) return; - wlc_resource_implement(r, wlc_xdg_surface_implementation(), NULL); + wlc_resource_implement(r, wlc_xdg_toplevel_implementation(), NULL); + + { + struct wlc_surface_event ev = { .attach = { .type = WLC_XDG_SURFACE, .role = wlc_resource_from_wl_resource(resource) }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_ATTACH }; + wl_signal_emit(&wlc_system_signals()->surface, &ev); + } + + { + struct wlc_surface_event ev = { .attach = { .type = WLC_XDG_TOPLEVEL_SURFACE, .role = r }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_ATTACH }; + wl_signal_emit(&wlc_system_signals()->surface, &ev); + } + + zxdg_surface_v6_send_configure(resource, wl_display_next_serial(wlc_display())); +} + +static void +xdg_cb_surface_ack_configure(struct wl_client *client, struct wl_resource *resource, uint32_t serial) +{ + (void)client, (void)serial, (void)resource; +} + +static void +xdg_cb_surface_set_window_geometry(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) +{ + (void)client; - struct wlc_surface_event ev = { .attach = { .type = WLC_XDG_SURFACE, .role = r }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_ATTACH }; - wl_signal_emit(&wlc_system_signals()->surface, &ev); + struct wlc_view *view; + if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) + return; + + view->surface_pending.visible = (struct wlc_geometry){ { x, y }, { width, height } }; + wlc_view_update(view); } -static const struct xdg_popup_interface xdg_popup_implementation = { +static const struct zxdg_surface_v6_interface zxdg_surface_v6_implementation = { .destroy = wlc_cb_resource_destructor, + .get_toplevel = xdg_cb_surface_get_toplevel, + .get_popup = xdg_cb_surface_get_popup, + .ack_configure = xdg_cb_surface_ack_configure, + .set_window_geometry = xdg_cb_surface_set_window_geometry, }; static void -xdg_cb_shell_get_popup(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource, struct wl_resource *parent_resource, struct wl_resource *seat_resource, uint32_t serial, int32_t x, int32_t y) +xdg_cb_shell_get_surface(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource) { - (void)seat_resource, (void)serial; - - struct wlc_surface *surface, *psurface; + struct wlc_surface *surface; struct wlc_xdg_shell *xdg_shell; - if (!(xdg_shell = wl_resource_get_user_data(resource)) || !(surface = convert_from_wl_resource(surface_resource, "surface")) || !(psurface = convert_from_wl_resource(parent_resource, "surface"))) + if (!(xdg_shell = wl_resource_get_user_data(resource)) || !(surface = convert_from_wl_resource(surface_resource, "surface"))) return; wlc_resource r; - if (!(r = wlc_resource_create(&xdg_shell->popups, client, &xdg_popup_interface, wl_resource_get_version(resource), 1, id))) + if (!(r = wlc_resource_create(&xdg_shell->surfaces, client, &zxdg_surface_v6_interface, wl_resource_get_version(resource), 1, id))) return; - wlc_resource_implement(r, &xdg_popup_implementation, NULL); + struct xdg_surface *xdg_surface = convert_from_wlc_resource(r, "xdg-surface"); + assert(xdg_surface); + xdg_surface->surface = wlc_resource_from_wl_resource(surface_resource); - struct wlc_surface_event ev = { .popup = { .parent = psurface, .origin = { x, y }, .resource = r }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_POPUP }; - wl_signal_emit(&wlc_system_signals()->surface, &ev); + wlc_resource_implement(r, &zxdg_surface_v6_implementation, xdg_shell); +} + +static void +xdg_cb_create_positioner(struct wl_client *client, struct wl_resource *resource, uint32_t id) +{ + (void)client, (void)id; + STUB(resource); } static void @@ -76,22 +153,21 @@ (void)client, (void)resource; } -static const struct xdg_shell_interface xdg_shell_implementation = { - .use_unstable_version = xdg_cb_shell_use_unstable_version, +static const struct zxdg_shell_v6_interface zxdg_shell_v6_implementation = { + .destroy = xdg_cb_destroy, + .create_positioner = xdg_cb_create_positioner, .get_xdg_surface = xdg_cb_shell_get_surface, - .get_xdg_popup = xdg_cb_shell_get_popup, .pong = xdg_cb_shell_pong, - .destroy = xdg_cb_destroy, }; static void xdg_shell_bind(struct wl_client *client, void *data, unsigned int version, unsigned int id) { struct wl_resource *resource; - if (!(resource = wl_resource_create_checked(client, &xdg_shell_interface, version, 1, id))) + if (!(resource = wl_resource_create_checked(client, &zxdg_shell_v6_interface, version, 1, id))) return; - wl_resource_set_implementation(resource, &xdg_shell_implementation, data, NULL); + wl_resource_set_implementation(resource, &zxdg_shell_v6_implementation, data, NULL); } void @@ -104,6 +180,7 @@ wl_global_destroy(xdg_shell->wl.xdg_shell); wlc_source_release(&xdg_shell->surfaces); + wlc_source_release(&xdg_shell->toplevels); wlc_source_release(&xdg_shell->popups); memset(xdg_shell, 0, sizeof(struct wlc_xdg_shell)); } @@ -114,11 +191,12 @@ assert(xdg_shell); memset(xdg_shell, 0, sizeof(struct wlc_xdg_shell)); - if (!(xdg_shell->wl.xdg_shell = wl_global_create(wlc_display(), &xdg_shell_interface, 1, xdg_shell, xdg_shell_bind))) + if (!(xdg_shell->wl.xdg_shell = wl_global_create(wlc_display(), &zxdg_shell_v6_interface, 1, xdg_shell, xdg_shell_bind))) goto xdg_shell_interface_fail; - if (!wlc_source(&xdg_shell->surfaces, "xdg-surface", NULL, NULL, 32, sizeof(struct wlc_resource)) || - !wlc_source(&xdg_shell->popups, "xdg-popup", NULL, NULL, 4, sizeof(struct wlc_resource))) + if (!wlc_source(&xdg_shell->surfaces, "xdg-surface", NULL, NULL, 32, sizeof(struct xdg_surface)) || + !wlc_source(&xdg_shell->toplevels, "xdg-toplevel", NULL, NULL, 32, sizeof(struct wlc_resource)) || + !wlc_source(&xdg_shell->popups, "xdg-popup", NULL, NULL, 32, sizeof(struct wlc_resource))) goto fail; return xdg_shell; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/compositor/shell/xdg-shell.h new/wlc-0.0.7/src/compositor/shell/xdg-shell.h --- old/wlc-0.0.6/src/compositor/shell/xdg-shell.h 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/compositor/shell/xdg-shell.h 2016-10-25 21:46:35.000000000 +0200 @@ -4,7 +4,7 @@ #include "resources/resources.h" struct wlc_xdg_shell { - struct wlc_source surfaces, popups; + struct wlc_source surfaces, toplevels, popups; struct { struct wl_global *xdg_shell; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/compositor/view.c new/wlc-0.0.7/src/compositor/view.c --- old/wlc-0.0.6/src/compositor/view.c 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/compositor/view.c 2016-10-25 21:46:35.000000000 +0200 @@ -9,7 +9,7 @@ #include "macros.h" #include "visibility.h" #include "output.h" -#include "resources/types/xdg-surface.h" +#include "resources/types/xdg-toplevel.h" #include "resources/types/shell-surface.h" #include "resources/types/surface.h" @@ -42,15 +42,19 @@ assert(view && g); struct wl_resource *r; - if (view->xdg_surface && (r = wl_resource_from_wlc_resource(view->xdg_surface, "xdg-surface"))) { - const uint32_t serial = wl_display_next_serial(wlc_display()); + if (view->xdg_toplevel && (r = wl_resource_from_wlc_resource(view->xdg_toplevel, "xdg-toplevel"))) { struct wl_array states = { .size = view->wl_state.items.used, .alloc = view->wl_state.items.allocated, .data = view->wl_state.items.buffer }; - xdg_surface_send_configure(r, g->size.w, g->size.h, &states, serial); + zxdg_toplevel_v6_send_configure(r, g->size.w, g->size.h, &states); + } else if (view->xdg_popup && (r = wl_resource_from_wlc_resource(view->xdg_popup, "xdg-popup"))) { + zxdg_popup_v6_send_configure(r, g->origin.x, g->origin.y, g->size.w, g->size.h); } else if (view->shell_surface && (r = wl_resource_from_wlc_resource(view->shell_surface, "shell-surface"))) { wl_shell_surface_send_configure(r, edges, g->size.w, g->size.h); } else if (is_x11_view(view)) { wlc_x11_window_configure(&view->x11, g); } + + if (view->xdg_surface && (r = wl_resource_from_wlc_resource(view->xdg_surface, "xdg-surface"))) + zxdg_surface_v6_send_configure(r, wl_display_next_serial(wlc_display())); } void @@ -129,10 +133,10 @@ enum wlc_view_state_bit bit; uint32_t state; } map[] = { - { WLC_BIT_MAXIMIZED, XDG_SURFACE_STATE_MAXIMIZED }, - { WLC_BIT_FULLSCREEN, XDG_SURFACE_STATE_FULLSCREEN }, - { WLC_BIT_RESIZING, XDG_SURFACE_STATE_RESIZING }, - { WLC_BIT_ACTIVATED, XDG_SURFACE_STATE_ACTIVATED }, + { WLC_BIT_MAXIMIZED, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }, + { WLC_BIT_FULLSCREEN, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN }, + { WLC_BIT_RESIZING, ZXDG_TOPLEVEL_V6_STATE_RESIZING }, + { WLC_BIT_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }, }; chck_iter_pool_flush(&view->wl_state); @@ -187,7 +191,7 @@ if (!(surface = convert_from_wlc_resource(view->surface, "surface"))) return; - if (view->xdg_surface && !wlc_size_equals(&view->surface_commit.visible.size, &wlc_size_zero)) { + if (view->xdg_toplevel && !wlc_size_equals(&view->surface_commit.visible.size, &wlc_size_zero)) { // xdg-surface client that draws drop shadows or other stuff. struct wlc_geometry v = view->surface_commit.visible; v.origin.x = chck_clamp32(v.origin.x, 0, surface->size.w); @@ -462,12 +466,12 @@ return; struct wl_resource *r; - if (view->xdg_surface && (r = wl_resource_from_wlc_resource(view->xdg_surface, "xdg-surface"))) { - xdg_surface_send_close(r); + if (view->xdg_toplevel && (r = wl_resource_from_wlc_resource(view->xdg_toplevel, "xdg-toplevel"))) { + zxdg_toplevel_v6_send_close(r); } else if (is_x11_view(view)) { wlc_x11_window_close(&view->x11); } else if (view->xdg_popup && (r = wl_resource_from_wlc_resource(view->xdg_popup, "xdg-popup"))) { - xdg_popup_send_popup_done(r); + zxdg_popup_v6_send_popup_done(r); } else if (view->shell_surface && (r = wl_resource_from_wlc_resource(view->shell_surface, "shell-surface"))) { if (view->type & WLC_BIT_POPUP) { wl_shell_surface_send_popup_done(r); @@ -691,7 +695,7 @@ wlc_view_set_parent_ptr(view, NULL); wlc_resource_release(view->shell_surface); - wlc_resource_release(view->xdg_surface); + wlc_resource_release(view->xdg_toplevel); wlc_resource_release(view->xdg_popup); chck_string_release(&view->data.title); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/compositor/view.h new/wlc-0.0.7/src/compositor/view.h --- old/wlc-0.0.6/src/compositor/view.h 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/compositor/view.h 2016-10-25 21:46:35.000000000 +0200 @@ -41,6 +41,7 @@ wlc_resource surface; wlc_resource shell_surface; wlc_resource xdg_surface; + wlc_resource xdg_toplevel; wlc_resource xdg_popup; wlc_resource custom_surface; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/internal.h new/wlc-0.0.7/src/internal.h --- old/wlc-0.0.6/src/internal.h 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/internal.h 2016-10-25 21:46:35.000000000 +0200 @@ -188,6 +188,7 @@ enum wlc_surface_role { WLC_SHELL_SURFACE, WLC_XDG_SURFACE, + WLC_XDG_TOPLEVEL_SURFACE, WLC_CUSTOM_SURFACE, WLC_SURFACE_ROLE_LAST } type; @@ -197,8 +198,7 @@ // WLC_SURFACE_EVENT_REQUEST_VIEW_POPUP struct wlc_surface_event_request_view_popup { struct wlc_surface *parent; - struct wlc_point origin; - wlc_resource resource; + wlc_resource role; } popup; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/platform/render/gles2.c new/wlc-0.0.7/src/platform/render/gles2.c --- old/wlc-0.0.6/src/platform/render/gles2.c 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/platform/render/gles2.c 2016-10-25 21:46:35.000000000 +0200 @@ -14,7 +14,7 @@ #include "compositor/view.h" #include "xwayland/xwm.h" #include "resources/types/surface.h" -#include "resources/types/xdg-surface.h" +#include "resources/types/xdg-toplevel.h" #include "resources/types/buffer.h" static bool DRAW_OPAQUE = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/resources/types/surface.c new/wlc-0.0.7/src/resources/types/surface.c --- old/wlc-0.0.6/src/resources/types/surface.c 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/resources/types/surface.c 2016-10-25 21:46:35.000000000 +0200 @@ -363,7 +363,7 @@ if (buffer) size = buffer->size; - wlc_size_max(&size, &size, &(struct wlc_size){1, 1}); + wlc_size_max(&size, &(struct wlc_size){1, 1}, &size); size.w /= surface->commit.scale; size.h /= surface->commit.scale; surface->size = size; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/resources/types/xdg-surface.c new/wlc-0.0.7/src/resources/types/xdg-surface.c --- old/wlc-0.0.6/src/resources/types/xdg-surface.c 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/resources/types/xdg-surface.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,182 +0,0 @@ -#include <stdlib.h> -#include <assert.h> -#include "xdg-surface.h" -#include "internal.h" -#include "macros.h" -#include "compositor/view.h" -#include "compositor/output.h" -#include "compositor/seat/seat.h" -#include "compositor/seat/pointer.h" -#include "resources/types/surface.h" - -static_assert_x(XDG_SHELL_VERSION_CURRENT == 5, generated_protocol_and_implementation_version_are_different); - -static void -xdg_cb_surface_set_parent(struct wl_client *client, struct wl_resource *resource, struct wl_resource *parent_resource) -{ - (void)client; - - struct wlc_view *view; - if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) - return; - - struct wlc_view *parent = (parent_resource ? convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(parent_resource), "view") : NULL); - wlc_view_set_parent_ptr(view, parent); -} - -static void -xdg_cb_surface_set_title(struct wl_client *client, struct wl_resource *resource, const char *title) -{ - (void)client; - wlc_view_set_title_ptr(convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"), title, strlen(title)); -} - -static void -xdg_cb_surface_set_app_id(struct wl_client *client, struct wl_resource *resource, const char *app_id) -{ - (void)client; - wlc_view_set_app_id_ptr(convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"), app_id); -} - -static void -xdg_cb_surface_show_window_menu(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial, int32_t x, int32_t y) -{ - (void)client, (void)resource, (void)seat, (void)serial, (void)x, (void)y; - STUBL(resource); -} - -static void -xdg_cb_surface_move(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial) -{ - (void)client, (void)resource, (void)serial; - - struct wlc_seat *seat; - if (!(seat = wl_resource_get_user_data(seat_resource))) - return; - - if (!seat->pointer.focused.view) - return; - - wlc_dlog(WLC_DBG_REQUEST, "(%" PRIuWLC ") requested move", seat->pointer.focused.view); - const struct wlc_point o = { seat->pointer.pos.x, seat->pointer.pos.y }; - WLC_INTERFACE_EMIT(view.request.move, seat->pointer.focused.view, &o); -} - -static void -xdg_cb_surface_resize(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial, uint32_t edges) -{ - (void)client, (void)resource, (void)serial; - - struct wlc_seat *seat; - if (!(seat = wl_resource_get_user_data(seat_resource))) - return; - - if (!seat->pointer.focused.view) - return; - - wlc_dlog(WLC_DBG_REQUEST, "(%" PRIuWLC ") requested resize", seat->pointer.focused.view); - const struct wlc_point o = { seat->pointer.pos.x, seat->pointer.pos.y }; - WLC_INTERFACE_EMIT(view.request.resize, seat->pointer.focused.view, edges, &o); -} - -static void -xdg_cb_surface_ack_configure(struct wl_client *client, struct wl_resource *resource, uint32_t serial) -{ - (void)client, (void)serial, (void)resource; -} - -static void -xdg_cb_surface_set_window_geometry(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) -{ - (void)client; - - struct wlc_view *view; - if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) - return; - - view->surface_pending.visible = (struct wlc_geometry){ { x, y }, { width, height } }; - wlc_view_update(view); -} - -static void -xdg_cb_surface_set_maximized(struct wl_client *client, struct wl_resource *resource) -{ - (void)client; - - struct wlc_view *view; - if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) - return; - - wlc_view_request_state(view, WLC_BIT_MAXIMIZED, true); -} - -static void -xdg_cb_surface_unset_maximized(struct wl_client *client, struct wl_resource *resource) -{ - (void)client; - - struct wlc_view *view; - if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) - return; - - wlc_view_request_state(view, WLC_BIT_MAXIMIZED, false); -} - -static void -xdg_cb_surface_set_fullscreen(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource) -{ - (void)client; - - struct wlc_view *view; - if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) - return; - - if (!wlc_view_request_state(view, WLC_BIT_FULLSCREEN, true)) - return; - - struct wlc_output *output; - if (output_resource && ((output = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(output_resource), "output")))) - wlc_view_set_output_ptr(view, output); -} - -static void -xdg_cb_surface_unset_fullscreen(struct wl_client *client, struct wl_resource *resource) -{ - (void)client; - - struct wlc_view *view; - if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) - return; - - wlc_view_request_state(view, WLC_BIT_FULLSCREEN, false); -} - -static void -xdg_cb_surface_set_minimized(struct wl_client *client, struct wl_resource *resource) -{ - (void)client; - wlc_view_set_minimized_ptr(convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"), true); -} - -WLC_CONST const struct xdg_surface_interface* -wlc_xdg_surface_implementation(void) -{ - static const struct xdg_surface_interface xdg_surface_implementation = { - .destroy = wlc_cb_resource_destructor, - .set_parent = xdg_cb_surface_set_parent, - .set_title = xdg_cb_surface_set_title, - .set_app_id = xdg_cb_surface_set_app_id, - .show_window_menu = xdg_cb_surface_show_window_menu, - .move = xdg_cb_surface_move, - .resize = xdg_cb_surface_resize, - .ack_configure = xdg_cb_surface_ack_configure, - .set_window_geometry = xdg_cb_surface_set_window_geometry, - .set_maximized = xdg_cb_surface_set_maximized, - .unset_maximized = xdg_cb_surface_unset_maximized, - .set_fullscreen = xdg_cb_surface_set_fullscreen, - .unset_fullscreen = xdg_cb_surface_unset_fullscreen, - .set_minimized = xdg_cb_surface_set_minimized - }; - - return &xdg_surface_implementation; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/resources/types/xdg-surface.h new/wlc-0.0.7/src/resources/types/xdg-surface.h --- old/wlc-0.0.6/src/resources/types/xdg-surface.h 2016-09-27 17:31:13.000000000 +0200 +++ new/wlc-0.0.7/src/resources/types/xdg-surface.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -#ifndef _WLC_XDG_SURFACE_H_ -#define _WLC_XDG_SURFACE_H_ - -#include <wayland-server.h> -#include "wayland-xdg-shell-unstable-v5-server-protocol.h" - -const struct xdg_surface_interface* wlc_xdg_surface_implementation(void); - -#endif /* _WLC_XDG_SURFACE_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/resources/types/xdg-toplevel.c new/wlc-0.0.7/src/resources/types/xdg-toplevel.c --- old/wlc-0.0.6/src/resources/types/xdg-toplevel.c 1970-01-01 01:00:00.000000000 +0100 +++ new/wlc-0.0.7/src/resources/types/xdg-toplevel.c 2016-10-25 21:46:35.000000000 +0200 @@ -0,0 +1,173 @@ +#include <stdlib.h> +#include <assert.h> +#include "xdg-toplevel.h" +#include "internal.h" +#include "macros.h" +#include "compositor/view.h" +#include "compositor/output.h" +#include "compositor/seat/seat.h" +#include "compositor/seat/pointer.h" +#include "resources/types/surface.h" + +static void +xdg_cb_toplevel_set_parent(struct wl_client *client, struct wl_resource *resource, struct wl_resource *parent_resource) +{ + (void)client; + + struct wlc_view *view; + if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) + return; + + struct wlc_view *parent = (parent_resource ? convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(parent_resource), "view") : NULL); + wlc_view_set_parent_ptr(view, parent); +} + +static void +xdg_cb_toplevel_set_title(struct wl_client *client, struct wl_resource *resource, const char *title) +{ + (void)client; + wlc_view_set_title_ptr(convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"), title, strlen(title)); +} + +static void +xdg_cb_toplevel_set_app_id(struct wl_client *client, struct wl_resource *resource, const char *app_id) +{ + (void)client; + wlc_view_set_app_id_ptr(convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"), app_id); +} + +static void +xdg_cb_toplevel_show_window_menu(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial, int32_t x, int32_t y) +{ + (void)client, (void)resource, (void)seat, (void)serial, (void)x, (void)y; + STUBL(resource); +} + +static void +xdg_cb_toplevel_move(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial) +{ + (void)client, (void)resource, (void)serial; + + struct wlc_seat *seat; + if (!(seat = wl_resource_get_user_data(seat_resource))) + return; + + if (!seat->pointer.focused.view) + return; + + wlc_dlog(WLC_DBG_REQUEST, "(%" PRIuWLC ") requested move", seat->pointer.focused.view); + const struct wlc_point o = { seat->pointer.pos.x, seat->pointer.pos.y }; + WLC_INTERFACE_EMIT(view.request.move, seat->pointer.focused.view, &o); +} + +static void +xdg_cb_toplevel_resize(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial, uint32_t edges) +{ + (void)client, (void)resource, (void)serial; + + struct wlc_seat *seat; + if (!(seat = wl_resource_get_user_data(seat_resource))) + return; + + if (!seat->pointer.focused.view) + return; + + wlc_dlog(WLC_DBG_REQUEST, "(%" PRIuWLC ") requested resize", seat->pointer.focused.view); + const struct wlc_point o = { seat->pointer.pos.x, seat->pointer.pos.y }; + WLC_INTERFACE_EMIT(view.request.resize, seat->pointer.focused.view, edges, &o); +} + +static void +xdg_cb_toplevel_set_max_size(struct wl_client *client, struct wl_resource *resource, int32_t width, int32_t height) +{ + (void)client, (void)resource, (void)width, (void)height; +} + +static void +xdg_cb_toplevel_set_min_size(struct wl_client *client, struct wl_resource *resource, int32_t width, int32_t height) +{ + (void)client, (void)resource, (void)width, (void)height; +} + +static void +xdg_cb_toplevel_set_maximized(struct wl_client *client, struct wl_resource *resource) +{ + (void)client; + + struct wlc_view *view; + if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) + return; + + wlc_view_request_state(view, WLC_BIT_MAXIMIZED, true); +} + +static void +xdg_cb_toplevel_unset_maximized(struct wl_client *client, struct wl_resource *resource) +{ + (void)client; + + struct wlc_view *view; + if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) + return; + + wlc_view_request_state(view, WLC_BIT_MAXIMIZED, false); +} + +static void +xdg_cb_toplevel_set_fullscreen(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource) +{ + (void)client; + + struct wlc_view *view; + if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) + return; + + if (!wlc_view_request_state(view, WLC_BIT_FULLSCREEN, true)) + return; + + struct wlc_output *output; + if (output_resource && ((output = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(output_resource), "output")))) + wlc_view_set_output_ptr(view, output); +} + +static void +xdg_cb_toplevel_unset_fullscreen(struct wl_client *client, struct wl_resource *resource) +{ + (void)client; + + struct wlc_view *view; + if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) + return; + + wlc_view_request_state(view, WLC_BIT_FULLSCREEN, false); +} + +static void +xdg_cb_toplevel_set_minimized(struct wl_client *client, struct wl_resource *resource) +{ + (void)client; + wlc_view_set_minimized_ptr(convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"), true); +} + +WLC_CONST const struct zxdg_toplevel_v6_interface* +wlc_xdg_toplevel_implementation(void) +{ + static const struct zxdg_toplevel_v6_interface zxdg_toplevel_v6_implementation = { + .destroy = wlc_cb_resource_destructor, + .set_parent = xdg_cb_toplevel_set_parent, + .set_title = xdg_cb_toplevel_set_title, + .set_app_id = xdg_cb_toplevel_set_app_id, + .show_window_menu = xdg_cb_toplevel_show_window_menu, + .move = xdg_cb_toplevel_move, + .resize = xdg_cb_toplevel_resize, + .set_max_size = xdg_cb_toplevel_set_max_size, + .set_min_size = xdg_cb_toplevel_set_min_size, + .set_maximized = xdg_cb_toplevel_set_maximized, + .unset_maximized = xdg_cb_toplevel_unset_maximized, + .set_fullscreen = xdg_cb_toplevel_set_fullscreen, + .unset_fullscreen = xdg_cb_toplevel_unset_fullscreen, + .set_minimized = xdg_cb_toplevel_set_minimized + }; + + return &zxdg_toplevel_v6_implementation; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.6/src/resources/types/xdg-toplevel.h new/wlc-0.0.7/src/resources/types/xdg-toplevel.h --- old/wlc-0.0.6/src/resources/types/xdg-toplevel.h 1970-01-01 01:00:00.000000000 +0100 +++ new/wlc-0.0.7/src/resources/types/xdg-toplevel.h 2016-10-25 21:46:35.000000000 +0200 @@ -0,0 +1,9 @@ +#ifndef _WLC_XDG_TOPLEVEL_H_ +#define _WLC_XDG_TOPLEVEL_H_ + +#include <wayland-server.h> +#include "wayland-xdg-shell-unstable-v6-server-protocol.h" + +const struct zxdg_toplevel_v6_interface* wlc_xdg_toplevel_implementation(void); + +#endif /* _WLC_XDG_TOPLEVEL_H_ */