Hello community, here is the log from the commit of package wlc for openSUSE:Factory checked in at 2017-03-10 21:46:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wlc (Old) and /work/SRC/openSUSE:Factory/.wlc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wlc" Fri Mar 10 21:46:10 2017 rev:8 rq:477651 version:0.0.8 Changes: -------- --- /work/SRC/openSUSE:Factory/wlc/wlc.changes 2016-12-29 22:52:38.702020409 +0100 +++ /work/SRC/openSUSE:Factory/.wlc.new/wlc.changes 2017-03-10 21:46:11.287450082 +0100 @@ -0,0 +1,26 @@ + +------------------------------------------------------------------- +Tue Feb 28 21:00:56 UTC 2017 - [email protected] + +- bump to 0.0.8 + Add fireplace window manager and bindings to README + Fix: ... and calling wlc_xdg_positioner_protocol_set_constraint_adjustment + sets anchor too + Fix: Calling wlc_xdg_positioner_protocol_set_gravity + actually sets anchor + wlc: Use eglGetPlatformDisplayEXT where available + Feature: add wlc_view_get_instance() + Fully implemented xdg-positioner and added getters for + stored data. Fixes Cloudef/wlc#210 + Implemented skelet of xdg-positioner, responds to + requests, but stores no data. + Turned non-implemented xdg_cb_popup_grab into warning + Use WM_CLASS class instead of instance + Include sys/sysmacros.h for major/minor(3) (Linux) + Fix error in precondition + Add gamma control API + Fix XWayland and security on FreeBSD + CMake: s/WLPROTO/WAYLANDPROTOCOLS/ + CMake: Fix FindWaylandProtocol.cmake + CMake: Move FindPackage(WaylandProtocols) to root + Old: ---- wlc-0.0.7.tar.bz2 wlc-0.0.7.tar.bz2.asc New: ---- wlc-0.0.8.tar.bz2 wlc-0.0.8.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wlc.spec ++++++ --- /var/tmp/diff_new_pack.SFeAsA/_old 2017-03-10 21:46:11.915361024 +0100 +++ /var/tmp/diff_new_pack.SFeAsA/_new 2017-03-10 21:46:11.919360457 +0100 @@ -1,7 +1,7 @@ # # spec file for package wlc # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define wayland_minimal 1.7 Name: wlc -Version: 0.0.7 +Version: 0.0.8 Release: 0 Summary: A Wayland Compositor Library License: MIT ++++++ wlc-0.0.7.tar.bz2 -> wlc-0.0.8.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/CMake/FindWaylandProtocols.cmake new/wlc-0.0.8/CMake/FindWaylandProtocols.cmake --- old/wlc-0.0.7/CMake/FindWaylandProtocols.cmake 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/CMake/FindWaylandProtocols.cmake 2017-02-21 16:25:29.000000000 +0100 @@ -1,5 +1,5 @@ #.rst: -# Findwlproto +# FindWaylandProtocols # ------- # # Find wayland protocol description files @@ -8,8 +8,8 @@ # # :: # -# WLPROTO_FOUND - True if wayland protocol files are available -# WLPROTO_PATH - Path to wayland protocol files +# WAYLANDPROTOCOLS_FOUND - True if wayland protocol files are available +# WAYLANDPROTOCOLS_PATH - Path to wayland protocol files # #============================================================================= # Copyright (c) 2015 Jari Vetoniemi @@ -22,18 +22,18 @@ #============================================================================= include(FeatureSummary) -set_package_properties(wlproto PROPERTIES +set_package_properties(WaylandProtocols PROPERTIES URL "https://cgit.freedesktop.org/wayland/wayland-protocols" DESCRIPTION "Wayland protocol development") -unset(WLPROTO_PATH) +unset(WAYLANDPROTOCOLS_PATH) find_package(PkgConfig) if (PKG_CONFIG_FOUND) execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols - OUTPUT_VARIABLE WLPROTO_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_VARIABLE WAYLANDPROTOCOLS_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) endif () include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(wlproto DEFAULT_MSG WLPROTO_PATH) -mark_as_advanced(WLPROTO_PATH) +find_package_handle_standard_args(WaylandProtocols DEFAULT_MSG WAYLANDPROTOCOLS_PATH) +mark_as_advanced(WAYLANDPROTOCOLS_PATH) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/CMakeLists.txt new/wlc-0.0.8/CMakeLists.txt --- old/wlc-0.0.7/CMakeLists.txt 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/CMakeLists.txt 2017-02-21 16:25:29.000000000 +0100 @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1) -PROJECT(wlc VERSION 0.0.7 LANGUAGES C) +PROJECT(wlc VERSION 0.0.8 LANGUAGES C) set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/CMake") # Subprojects @@ -39,6 +39,7 @@ find_package(XKBCommon REQUIRED) find_package(Udev REQUIRED) find_package(LibInput REQUIRED) +find_package(WaylandProtocols REQUIRED) if (WLC_X11_SUPPORT) find_package(X11 REQUIRED COMPONENTS X11-xcb Xfixes) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/README.rst new/wlc-0.0.8/README.rst --- old/wlc-0.0.7/README.rst 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/README.rst 2017-02-21 16:25:29.000000000 +0100 @@ -122,7 +122,7 @@ - pixman - wayland 1.7+ -- wayland-protocols 1.0+ [1] +- wayland-protocols 1.7+ [1] - libxkbcommon - udev - libinput @@ -133,7 +133,7 @@ - libEGL (GPU drivers and mesa provide this) - libGLESv2 (GPU drivers and mesa provide this) -1: Also bundled as submodule. Using submodule is recommended, as updates to unstable protocols won't break build. To force building from submodule even though wayland-protocols is installed in system use CMake option -DSOURCE_WLPROTO=ON. +1: Also bundled as submodule. To build from submodule use -DSOURCE_WLPROTO=ON. And optionally: @@ -174,6 +174,7 @@ - `ocaml-wlc <https://github.com/Armael/ocaml-wlc>`_ - OCaml (experimental) - `go-wlc <https://github.com/mikkeloscar/go-wlc>`_ - Go - `rust-wlc <https://github.com/Immington-Industries/rust-wlc>`_ - Rust +- `wlc.rs <https://github.com/Drakulix/wlc.rs>`_ - Rust SOFTWARE USING WLC ------------------ @@ -182,6 +183,7 @@ - `ocaml-loliwm <https://github.com/Armael/ocaml-loliwm>`_ - Translation of loliwm to OCaml - `sway <https://github.com/SirCmpwn/sway>`_ - i3-compatible window manager for Wayland - `way-cooler <https://github.com/Immington-Industries/way-cooler>`_ - customizeable window manager written in Rust +- `fireplace <https://github.com/Drakulix/fireplace>`_ - Modular wayland window manager written in Rust SIMILAR SOFTWARE ---------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/example/example.c new/wlc-0.0.8/example/example.c --- old/wlc-0.0.7/example/example.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/example/example.c 2017-02-21 16:25:29.000000000 +0100 @@ -78,25 +78,52 @@ size_t memb; const wlc_handle *views = wlc_output_get_views(output, &memb); - + + size_t positioned = 0; + for (size_t i = 0; i < memb; ++i) + if (wlc_view_positioner_get_anchor_rect(views[i]) == NULL) + positioned ++; + bool toggle = false; uint32_t y = 0; - const uint32_t n = chck_maxu32((1 + memb) / 2, 1); + const uint32_t n = chck_maxu32((1 + positioned) / 2, 1); const uint32_t w = r->w / 2, h = r->h / n; const uint32_t ew = r->w - w * 2, eh = r->h - h * n; + size_t j = 0; for (size_t i = 0; i < memb; ++i) { - const struct wlc_geometry g = { - .origin = { - .x = (toggle ? w + ew : 0), - .y = y - }, - .size = { - .w = (!toggle && i == memb - 1 ? r->w : (toggle ? w : w + ew)), - .h = (i < 2 ? h + eh : h) + const struct wlc_geometry* anchor_rect = wlc_view_positioner_get_anchor_rect(views[i]); + if (anchor_rect == NULL) { + const struct wlc_geometry g = { + .origin = { + .x = (toggle ? w + ew : 0), + .y = y + }, + .size = { + .w = (!toggle && j == positioned - 1 ? r->w : (toggle ? w : w + ew)), + .h = (j < 2 ? h + eh : h) + } + }; + wlc_view_set_geometry(views[i], 0, &g); + y = y + (!(toggle = !toggle) ? g.size.h : 0); + j ++; + } else { + struct wlc_size size_req = *wlc_view_positioner_get_size(views[i]); + if ((size_req.w <= 0) || (size_req.h <= 0)) { + const struct wlc_geometry* current = wlc_view_get_geometry(views[i]); + size_req = current->size; + } + struct wlc_geometry g = { + .origin = anchor_rect->origin, + .size = size_req + }; + wlc_handle parent = wlc_view_get_parent(views[i]); + if (parent) { + const struct wlc_geometry* parent_geometry = wlc_view_get_geometry(parent); + g.origin.x += parent_geometry->origin.x; + g.origin.y += parent_geometry->origin.y; } - }; - wlc_view_set_geometry(views[i], 0, &g); - y = y + (!(toggle = !toggle) ? g.size.h : 0); + wlc_view_set_geometry(views[i], 0, &g); + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/include/wlc/wlc.h new/wlc-0.0.8/include/wlc/wlc.h --- old/wlc-0.0.7/include/wlc/wlc.h 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/include/wlc/wlc.h 2017-02-21 16:25:29.000000000 +0100 @@ -124,6 +124,35 @@ WLC_TOUCH_CANCEL, }; +/** wlc_view_positioner_get_anchor(); */ +enum wlc_positioner_anchor_bit { + WLC_BIT_ANCHOR_NONE = 0, + WLC_BIT_ANCHOR_TOP = 1<<0, + WLC_BIT_ANCHOR_BOTTOM = 1<<1, + WLC_BIT_ANCHOR_LEFT = 1<<2, + WLC_BIT_ANCHOR_RIGHT = 1<<3 +}; + +/** wlc_view_positioner_get_gravity(); */ +enum wlc_positioner_gravity_bit { + WLC_BIT_GRAVITY_NONE = 0, + WLC_BIT_GRAVITY_TOP = 1<<0, + WLC_BIT_GRAVITY_BOTTOM = 1<<1, + WLC_BIT_GRAVITY_LEFT = 1<<2, + WLC_BIT_GRAVITY_RIGHT = 1<<3 +}; + +/** wlc_view_positioner_get_gravity(); */ +enum wlc_positioner_constraint_adjustment_bit { + WLC_BIT_CONSTRAINT_ADJUSTMENT_NONE = 0, + WLC_BIT_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1<<0, + WLC_BIT_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 1<<1, + WLC_BIT_CONSTRAINT_ADJUSTMENT_FLIP_X = 1<<2, + WLC_BIT_CONSTRAINT_ADJUSTMENT_FLIP_Y = 1<<3, + WLC_BIT_CONSTRAINT_ADJUSTMENT_RESIZE_X = 1<<4, + WLC_BIT_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 1<<5 +}; + /** State of keyboard modifiers in various functions. */ struct wlc_modifiers { uint32_t leds, mods; @@ -280,6 +309,12 @@ /** Wake up / sleep. */ void wlc_output_set_sleep(wlc_handle output, bool sleep); +/** Set gamma. R, G, and B are color ramp arrays of size elements. */ +void wlc_output_set_gamma(wlc_handle output, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b); + +/** Get gamma size */ +uint16_t wlc_output_get_gamma_size(wlc_handle output); + /** * Get real resolution. * Resolution applied by either wlc_output_set_resolution call or initially. @@ -357,6 +392,46 @@ /** Get current geometry. (what client sees) */ const struct wlc_geometry* wlc_view_get_geometry(wlc_handle view); +/** + * Get size requested by positioner, as defined in xdg-shell v6. + * Returns NULL if view has no valid positioner + */ +const struct wlc_size* wlc_view_positioner_get_size(wlc_handle view); + +/** + * Get anchor rectangle requested by positioner, as defined in xdg-shell v6. + * Returns NULL if view has no valid positioner. + */ +const struct wlc_geometry* wlc_view_positioner_get_anchor_rect(wlc_handle view); + +/** + * Get offset requested by positioner, as defined in xdg-shell v6. + * Returns NULL if view has no valid positioner, + * or default value (0, 0) if positioner has no offset set. + */ +const struct wlc_point* wlc_view_positioner_get_offset(wlc_handle view); + +/** + * Get anchor requested by positioner, as defined in xdg-shell v6. + * Returns default value WLC_BIT_ANCHOR_NONE if view has no valid positioner + * or if positioner has no anchor set. + */ +enum wlc_positioner_anchor_bit wlc_view_positioner_get_anchor(wlc_handle view); + +/** + * Get anchor requested by positioner, as defined in xdg-shell v6. + * Returns default value WLC_BIT_GRAVITY_NONE if view has no valid positioner + * or if positioner has no gravity set. + */ +enum wlc_positioner_gravity_bit wlc_view_positioner_get_gravity(wlc_handle view); + +/** + * Get constraint adjustment requested by positioner, as defined in xdg-shell v6. + * Returns default value WLC_BIT_CONSTRAINT_ADJUSTMENT_NONE if view has no + * valid positioner or if positioner has no constraint adjustment set. + */ +enum wlc_positioner_constraint_adjustment_bit wlc_view_positioner_get_constraint_adjustment(wlc_handle view); + /** Get visible geometry. (what wlc displays) */ void wlc_view_get_visible_geometry(wlc_handle view, struct wlc_geometry *out_geometry); @@ -384,6 +459,9 @@ /** Get title. */ const char* wlc_view_get_title(wlc_handle view); +/** Get instance. (shell-surface only) */ +const char* wlc_view_get_instance(wlc_handle view); + /** Get class. (shell-surface only) */ const char* wlc_view_get_class(wlc_handle view); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/protos/CMakeLists.txt new/wlc-0.0.8/protos/CMakeLists.txt --- old/wlc-0.0.7/protos/CMakeLists.txt 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/protos/CMakeLists.txt 2017-02-21 16:25:29.000000000 +0100 @@ -1,8 +1,7 @@ include(Wayland) -find_package(WaylandProtocols) -if (WLPROTO_FOUND AND NOT SOURCE_WLPROTO) - set(prefix "${WLPROTO_PATH}") +if (WAYLANDPROTOCOLS_FOUND AND NOT SOURCE_WLPROTO) + set(prefix "${WAYLANDPROTOCOLS_PATH}") else () set(prefix "wayland-protocols") endif () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/CMakeLists.txt new/wlc-0.0.8/src/CMakeLists.txt --- old/wlc-0.0.7/src/CMakeLists.txt 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/CMakeLists.txt 2017-02-21 16:25:29.000000000 +0100 @@ -53,6 +53,7 @@ resources/types/shell-surface.c resources/types/surface.c resources/types/xdg-toplevel.c + resources/types/xdg-positioner.c session/fd.c session/tty.c session/udev.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/compositor/output.c new/wlc-0.0.8/src/compositor/output.c --- old/wlc-0.0.7/src/compositor/output.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/compositor/output.c 2017-02-21 16:25:29.000000000 +0100 @@ -818,6 +818,16 @@ } void +wlc_output_set_gamma_ptr(struct wlc_output *output, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b) +{ + if (!output) + return; + + if (output->bsurface.api.set_gamma) + output->bsurface.api.set_gamma(&output->bsurface, size, r, g, b); +} + +void wlc_output_set_mask_ptr(struct wlc_output *output, uint32_t mask) { if (!output) @@ -913,6 +923,23 @@ wlc_output_set_sleep_ptr(convert_from_wlc_handle(output, "output"), sleep); } +WLC_API void +wlc_output_set_gamma(wlc_handle output, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b) +{ + wlc_output_set_gamma_ptr(convert_from_wlc_handle(output, "output"), size, r, g, b); +} + +WLC_API uint16_t +wlc_output_get_gamma_size(wlc_handle output) +{ + struct wlc_output *_output = convert_from_wlc_handle(output, "output"); + + if (!_output || !_output->bsurface.api.get_gamma_size) + return 0; + + return _output->bsurface.api.get_gamma_size(&_output->bsurface); +} + WLC_API uint32_t wlc_output_get_mask(wlc_handle output) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/compositor/output.h new/wlc-0.0.8/src/compositor/output.h --- old/wlc-0.0.7/src/compositor/output.h 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/compositor/output.h 2017-02-21 16:25:29.000000000 +0100 @@ -105,6 +105,7 @@ void wlc_output_focus_ptr(struct wlc_output *output); void wlc_output_set_sleep_ptr(struct wlc_output *output, bool sleep); +void wlc_output_set_gamma_ptr(struct wlc_output *output, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b); WLC_NONULLV(2) bool wlc_output_set_resolution_ptr(struct wlc_output *output, const struct wlc_size *resolution, uint32_t scale); void wlc_output_set_mask_ptr(struct wlc_output *output, uint32_t mask); WLC_NONULLV(2) void wlc_output_get_pixels_ptr(struct wlc_output *output, bool (*pixels)(const struct wlc_size *size, uint8_t *rgba, void *arg), void *arg); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/compositor/shell/xdg-shell.c new/wlc-0.0.8/src/compositor/shell/xdg-shell.c --- old/wlc-0.0.7/src/compositor/shell/xdg-shell.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/compositor/shell/xdg-shell.c 2017-02-21 16:25:29.000000000 +0100 @@ -8,6 +8,8 @@ #include "compositor/output.h" #include "compositor/view.h" #include "resources/types/xdg-toplevel.h" +#include "resources/types/xdg-positioner.h" +#include "resources/types/xdg-popup.h" struct xdg_surface { wlc_resource surface; @@ -23,7 +25,7 @@ xdg_cb_popup_grab(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial) { (void)client, (void)seat, (void)serial; - STUB(resource); + STUBL(resource); } static const struct zxdg_popup_v6_interface zxdg_popup_v6_implementation = { @@ -32,19 +34,26 @@ }; 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) +xdg_cb_surface_get_popup(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *parent, struct wl_resource *wl_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; + if (!wl_resource_get_user_data(parent) || !convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(parent), "view")) + 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; + struct wlc_xdg_popup *xdg_popup = convert_from_wlc_resource(r, "xdg-popup"); + assert(xdg_popup); + + struct wlc_xdg_positioner *positioner; + if ((positioner = wl_resource_get_user_data(wl_positioner))) + xdg_popup->xdg_positioner = positioner; + wlc_resource_implement(r, &zxdg_popup_v6_implementation, NULL); { @@ -136,8 +145,17 @@ static void xdg_cb_create_positioner(struct wl_client *client, struct wl_resource *resource, uint32_t id) { - (void)client, (void)id; - STUB(resource); + struct wlc_xdg_shell *xdg_shell; + if (!(xdg_shell = wl_resource_get_user_data(resource)) ) + return; + + wlc_resource r; + if (!(r = wlc_resource_create(&xdg_shell->positioners, client, &zxdg_positioner_v6_interface, wl_resource_get_version(resource), 1, id))) + return; + + struct wlc_xdg_positioner *positioner = convert_from_wlc_resource(r, "xdg-positioner"); + wlc_resource_implement(r, wlc_xdg_positioner_implementation(), NULL); + wl_resource_set_user_data(wl_resource_from_wlc_resource(r, "xdg-positioner"), (void*)positioner); } static void @@ -182,6 +200,7 @@ wlc_source_release(&xdg_shell->surfaces); wlc_source_release(&xdg_shell->toplevels); wlc_source_release(&xdg_shell->popups); + wlc_source_release(&xdg_shell->positioners); memset(xdg_shell, 0, sizeof(struct wlc_xdg_shell)); } @@ -196,7 +215,8 @@ 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))) + !wlc_source(&xdg_shell->popups, "xdg-popup", NULL, NULL, 32, sizeof(struct wlc_xdg_popup)) || + !wlc_source(&xdg_shell->positioners, "xdg-positioner", NULL, NULL, 32, sizeof(struct wlc_xdg_positioner))) goto fail; return xdg_shell; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/compositor/shell/xdg-shell.h new/wlc-0.0.8/src/compositor/shell/xdg-shell.h --- old/wlc-0.0.7/src/compositor/shell/xdg-shell.h 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/compositor/shell/xdg-shell.h 2017-02-21 16:25:29.000000000 +0100 @@ -4,7 +4,7 @@ #include "resources/resources.h" struct wlc_xdg_shell { - struct wlc_source surfaces, toplevels, popups; + struct wlc_source surfaces, toplevels, popups, positioners; struct { struct wl_global *xdg_shell; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/compositor/view.c new/wlc-0.0.8/src/compositor/view.c --- old/wlc-0.0.7/src/compositor/view.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/compositor/view.c 2017-02-21 16:25:29.000000000 +0100 @@ -10,6 +10,8 @@ #include "visibility.h" #include "output.h" #include "resources/types/xdg-toplevel.h" +#include "resources/types/xdg-popup.h" +#include "resources/types/xdg-positioner.h" #include "resources/types/shell-surface.h" #include "resources/types/surface.h" @@ -46,7 +48,13 @@ struct wl_array states = { .size = view->wl_state.items.used, .alloc = view->wl_state.items.allocated, .data = view->wl_state.items.buffer }; 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); + struct wlc_xdg_popup *xdg_popup = convert_from_wlc_resource(view->xdg_popup, "xdg-popup"); + struct wlc_size size = g->size; + + if (xdg_popup->xdg_positioner && (xdg_popup->xdg_positioner->flags & WLC_XDG_POSITIONER_HAS_SIZE)) + size = xdg_popup->xdg_positioner->size; + + zxdg_popup_v6_send_configure(r, g->origin.x, g->origin.y, size.w, 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)) { @@ -434,6 +442,14 @@ } void +wlc_view_set_instance_ptr(struct wlc_view *view, const char *instance_, size_t length) +{ + if (view && !chck_cstrneq(view->data._instance.data, instance_, length) && chck_string_set_cstr_with_length(&view->data._instance, instance_, length, true)) { + WLC_INTERFACE_EMIT(view.properties_updated, convert_to_wlc_handle(view), WLC_BIT_PROPERTY_CLASS); + } +} + +void wlc_view_set_class_ptr(struct wlc_view *view, const char *class_, size_t length) { if (view && !chck_cstrneq(view->data._class.data, class_, length) && chck_string_set_cstr_with_length(&view->data._class, class_, length, true)) { @@ -527,6 +543,19 @@ return (view && !chck_string_is_empty(string) ? string->data : NULL); } +static struct wlc_xdg_positioner* +get_xdg_positioner_for_handle(wlc_handle view) +{ + struct wlc_view *v = convert_from_wlc_handle(view, "view"); + if ( (v) && (v->xdg_popup) && wl_resource_from_wlc_resource(v->xdg_popup, "xdg-popup") ) { + struct wlc_xdg_popup *popup = convert_from_wlc_resource(v->xdg_popup, "xdg-popup"); + // xdg_positioner object is complete only if it has size and anchor rectangle set + if ((popup->xdg_positioner) && (popup->xdg_positioner->flags & (WLC_XDG_POSITIONER_HAS_SIZE | WLC_XDG_POSITIONER_HAS_ANCHOR_RECT))) + return popup->xdg_positioner; + } + return NULL; +} + WLC_API void wlc_view_focus(wlc_handle view) { @@ -594,6 +623,60 @@ return get(convert_from_wlc_handle(view, "view"), offsetof(struct wlc_view, pending.geometry)); } +WLC_API const struct wlc_size* +wlc_view_positioner_get_size(wlc_handle view) +{ + struct wlc_xdg_positioner *ps; + if ((ps = get_xdg_positioner_for_handle(view))) + return &(ps->size); + return NULL; +} + +WLC_API const struct wlc_geometry* +wlc_view_positioner_get_anchor_rect(wlc_handle view) +{ + struct wlc_xdg_positioner *ps; + if ((ps = get_xdg_positioner_for_handle(view))) + return &(ps->anchor_rect); + return NULL; +} + +WLC_API const struct wlc_point* +wlc_view_positioner_get_offset(wlc_handle view) +{ + struct wlc_xdg_positioner *ps; + if ((ps = get_xdg_positioner_for_handle(view))) + return &(ps->offset); + return NULL; +} + +WLC_API enum wlc_positioner_anchor_bit +wlc_view_positioner_get_anchor(wlc_handle view) +{ + struct wlc_xdg_positioner *ps; + if ((ps = get_xdg_positioner_for_handle(view))) + return ps->anchor; + return WLC_BIT_ANCHOR_NONE; +} + +WLC_API enum wlc_positioner_gravity_bit +wlc_view_positioner_get_gravity(wlc_handle view) +{ + struct wlc_xdg_positioner *ps; + if ((ps = get_xdg_positioner_for_handle(view))) + return ps->gravity; + return WLC_BIT_GRAVITY_NONE; +} + +WLC_API enum wlc_positioner_constraint_adjustment_bit +wlc_view_positioner_get_constraint_adjustment(wlc_handle view) +{ + struct wlc_xdg_positioner *ps; + if ((ps = get_xdg_positioner_for_handle(view))) + return ps->constraint_adjustment; + return WLC_BIT_CONSTRAINT_ADJUSTMENT_NONE; +} + WLC_API void wlc_view_get_visible_geometry(wlc_handle view, struct wlc_geometry *out_geometry) { @@ -658,6 +741,12 @@ } WLC_API const char* +wlc_view_get_instance(wlc_handle view) +{ + return get_cstr(convert_from_wlc_handle(view, "view"), offsetof(struct wlc_view, data._instance)); +} + +WLC_API const char* wlc_view_get_class(wlc_handle view) { return get_cstr(convert_from_wlc_handle(view, "view"), offsetof(struct wlc_view, data._class)); @@ -699,6 +788,7 @@ wlc_resource_release(view->xdg_popup); chck_string_release(&view->data.title); + chck_string_release(&view->data._instance); chck_string_release(&view->data._class); chck_string_release(&view->data.app_id); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/compositor/view.h new/wlc-0.0.8/src/compositor/view.h --- old/wlc-0.0.7/src/compositor/view.h 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/compositor/view.h 2017-02-21 16:25:29.000000000 +0100 @@ -48,6 +48,7 @@ struct { struct chck_string app_id; struct chck_string title; + struct chck_string _instance; struct chck_string _class; pid_t pid; enum wl_shell_surface_fullscreen_method fullscreen_mode; @@ -100,6 +101,7 @@ void wlc_view_set_parent_ptr(struct wlc_view *view, struct wlc_view *parent); void wlc_view_set_minimized_ptr(struct wlc_view *view, bool minimized); void wlc_view_set_title_ptr(struct wlc_view *view, const char *title, size_t length); +void wlc_view_set_instance_ptr(struct wlc_view *view, const char *instance_, size_t length); void wlc_view_set_class_ptr(struct wlc_view *view, const char *class_, size_t length); void wlc_view_set_app_id_ptr(struct wlc_view *view, const char *app_id); void wlc_view_set_pid_ptr(struct wlc_view *view, pid_t pid); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/platform/backend/backend.h new/wlc-0.0.8/src/platform/backend/backend.h --- old/wlc-0.0.7/src/platform/backend/backend.h 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/platform/backend/backend.h 2017-02-21 16:25:29.000000000 +0100 @@ -12,11 +12,14 @@ size_t internal_size; EGLNativeDisplayType display; EGLNativeWindowType window; + EGLint display_type; struct { WLC_NONULL void (*terminate)(struct wlc_backend_surface *surface); WLC_NONULL void (*sleep)(struct wlc_backend_surface *surface, bool sleep); WLC_NONULL bool (*page_flip)(struct wlc_backend_surface *surface); + WLC_NONULL void (*set_gamma)(struct wlc_backend_surface *bsurface, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b); + WLC_NONULL uint16_t (*get_gamma_size)(struct wlc_backend_surface *bsurface); } api; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/platform/backend/drm.c new/wlc-0.0.8/src/platform/backend/drm.c --- old/wlc-0.0.7/src/platform/backend/drm.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/platform/backend/drm.c 2017-02-21 16:25:29.000000000 +0100 @@ -191,6 +191,20 @@ } static void +set_gamma(struct wlc_backend_surface *bsurface, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b) +{ + struct drm_surface *dsurface = bsurface->internal; + drmModeCrtcSetGamma(drm.fd, dsurface->crtc->crtc_id, size, r, g, b); +} + +static uint16_t +get_gamma_size(struct wlc_backend_surface *bsurface) +{ + struct drm_surface *dsurface = bsurface->internal; + return dsurface->crtc->gamma_size; +} + +static void surface_release(struct wlc_backend_surface *bsurface) { struct drm_surface *dsurface = bsurface->internal; @@ -229,9 +243,12 @@ dsurface->device = device; bsurface.display = (EGLNativeDisplayType)device; + bsurface.display_type = EGL_PLATFORM_GBM_MESA; bsurface.window = (EGLNativeWindowType)surface; bsurface.api.sleep = surface_sleep; bsurface.api.page_flip = page_flip; + bsurface.api.set_gamma = set_gamma; + bsurface.api.get_gamma_size = get_gamma_size; struct wlc_output_event ev = { .add = { &bsurface, &info->info }, .type = WLC_OUTPUT_EVENT_ADD }; wl_signal_emit(&wlc_system_signals()->output, &ev); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/platform/backend/x11.c new/wlc-0.0.8/src/platform/backend/x11.c --- old/wlc-0.0.7/src/platform/backend/x11.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/platform/backend/x11.c 2017-02-21 16:25:29.000000000 +0100 @@ -69,6 +69,7 @@ bsurface.window = window; bsurface.display = x11.display; + bsurface.display_type = EGL_PLATFORM_X11_EXT; bsurface.api.page_flip = page_flip; struct wlc_output_event ev = { .add = { &bsurface, info }, .type = WLC_OUTPUT_EVENT_ADD }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/platform/context/egl.c new/wlc-0.0.8/src/platform/context/egl.c --- old/wlc-0.0.7/src/platform/context/egl.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/platform/context/egl.c 2017-02-21 16:25:29.000000000 +0100 @@ -148,6 +148,47 @@ free(context); } +/* + * Taken from glamor_egl.c from the Xorg xserver, which is MIT licensed like wlc + * + * Create an EGLDisplay from a native display type. This is a little quirky + * for a few reasons. + * + * 1: GetPlatformDisplayEXT and GetPlatformDisplay are the API you want to + * use, note these have different function signatures in the third argument. + * + * 2: You can't tell whether you have EGL 1.5 at this point, because + * eglQueryString(EGL_VERSION) is a property of the display, which we don't + * have yet. So you have to query for extensions no matter what. + * + * 3. There is no EGL_KHR_platform_base to complement the EXT one, thus one + * needs to know EGL 1.5 is supported in order to use the eglGetPlatformDisplay + * function pointer. + * + * We can workaround this (circular dependency) by probing for the EGL 1.5 + * platform extensions (EGL_KHR_platform_gbm and friends) yet it doesn't seem + * like mesa will be able to adverise these (even though it can do EGL 1.5). + */ +static EGLDisplay +get_display(struct ctx *context, EGLint type, void *native) +{ + PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplayEXT; + + /* Initialize extensions to those of the NULL display, for has_extension */ + context->extensions = EGL_CALL(eglQueryString(NULL, EGL_EXTENSIONS)); + + /* In practise any EGL 1.5 implementation would support the EXT extension */ + if (has_extension(context, "EGL_EXT_platform_base")) { + PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplayEXT = + (void *) eglGetProcAddress("eglGetPlatformDisplayEXT"); + if (getPlatformDisplayEXT) + return getPlatformDisplayEXT(type, native, NULL); + } + + /* Welp, everything is awful. */ + return eglGetDisplay(native); +} + static struct ctx* create_context(struct wlc_backend_surface *bsurface) { @@ -157,7 +198,8 @@ if (!(context = calloc(1, sizeof(struct ctx)))) return NULL; - if (!(context->display = eglGetDisplay(bsurface->display))) + context->display = get_display(context, bsurface->display_type, bsurface->display); + if (!context->display) goto egl_fail; EGLint major, minor; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/resources/types/xdg-popup.h new/wlc-0.0.8/src/resources/types/xdg-popup.h --- old/wlc-0.0.7/src/resources/types/xdg-popup.h 1970-01-01 01:00:00.000000000 +0100 +++ new/wlc-0.0.8/src/resources/types/xdg-popup.h 2017-02-21 16:25:29.000000000 +0100 @@ -0,0 +1,10 @@ +#ifndef _WLC_XDG_POPUP_H_ +#define _WLC_XDG_POPUP_H_ + +#include "resources/types/xdg-positioner.h" + +struct wlc_xdg_popup { + struct wlc_xdg_positioner* xdg_positioner; +}; + +#endif /* _WLC_XDG_POPUP_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/resources/types/xdg-positioner.c new/wlc-0.0.8/src/resources/types/xdg-positioner.c --- old/wlc-0.0.7/src/resources/types/xdg-positioner.c 1970-01-01 01:00:00.000000000 +0100 +++ new/wlc-0.0.8/src/resources/types/xdg-positioner.c 2017-02-21 16:25:29.000000000 +0100 @@ -0,0 +1,140 @@ +#include <stdlib.h> +#include <assert.h> +#include "xdg-positioner.h" +#include "internal.h" +#include "macros.h" + +static void +wlc_xdg_positioner_protocol_set_size(struct wl_client *client, struct wl_resource *resource, int32_t width, int32_t height) +{ + (void)client; + struct wlc_xdg_positioner *positioner; + if (!(positioner = wl_resource_get_user_data(resource))) + return; + + if (width < 1 || height < 1) { + wl_resource_post_error(resource, + ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, + "width and height must be positives and non-zero"); + return; + } + positioner->size.w = width; + positioner->size.h = height; + positioner->flags |= WLC_XDG_POSITIONER_HAS_SIZE; +} + +static void +wlc_xdg_positioner_protocol_set_anchor_rect(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) +{ + (void)client; + struct wlc_xdg_positioner *positioner; + if (!(positioner = wl_resource_get_user_data(resource))) + return; + + if (width < 1 || height < 1) { + wl_resource_post_error(resource, + ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, + "width and height must be positives and non-zero"); + return; + } + positioner->anchor_rect.origin.x = x; + positioner->anchor_rect.origin.y = y; + positioner->anchor_rect.size.w = width; + positioner->anchor_rect.size.h = height; + positioner->flags |= WLC_XDG_POSITIONER_HAS_ANCHOR_RECT; +} + +static void +wlc_xdg_positioner_protocol_set_anchor(struct wl_client *client, struct wl_resource *resource, enum zxdg_positioner_v6_anchor anchor) +{ + (void)client; + struct wlc_xdg_positioner *positioner; + if (!(positioner = wl_resource_get_user_data(resource))) + return; + + if (((anchor & ZXDG_POSITIONER_V6_ANCHOR_TOP ) && + (anchor & ZXDG_POSITIONER_V6_ANCHOR_BOTTOM)) || + ((anchor & ZXDG_POSITIONER_V6_ANCHOR_LEFT) && + (anchor & ZXDG_POSITIONER_V6_ANCHOR_RIGHT))) { + wl_resource_post_error(resource, + ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, + "same-axis values are not allowed"); + return; + } + + positioner->anchor = WLC_BIT_ANCHOR_NONE; + if (anchor & ZXDG_POSITIONER_V6_ANCHOR_TOP) positioner->anchor |= WLC_BIT_ANCHOR_TOP; + if (anchor & ZXDG_POSITIONER_V6_ANCHOR_BOTTOM) positioner->anchor |= WLC_BIT_ANCHOR_BOTTOM; + if (anchor & ZXDG_POSITIONER_V6_ANCHOR_LEFT) positioner->anchor |= WLC_BIT_ANCHOR_LEFT; + if (anchor & ZXDG_POSITIONER_V6_ANCHOR_RIGHT) positioner->anchor |= WLC_BIT_ANCHOR_RIGHT; +} + +static void +wlc_xdg_positioner_protocol_set_gravity(struct wl_client *client, struct wl_resource *resource, enum zxdg_positioner_v6_gravity gravity) +{ + (void)client; + struct wlc_xdg_positioner *positioner; + if (!(positioner = wl_resource_get_user_data(resource))) + return; + + if (((gravity & ZXDG_POSITIONER_V6_GRAVITY_TOP) && + (gravity & ZXDG_POSITIONER_V6_GRAVITY_BOTTOM)) || + ((gravity & ZXDG_POSITIONER_V6_GRAVITY_LEFT) && + (gravity & ZXDG_POSITIONER_V6_GRAVITY_RIGHT))) { + wl_resource_post_error(resource, + ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, + "same-axis values are not allowed"); + return; + } + + positioner->gravity = WLC_BIT_GRAVITY_NONE; + if (gravity & ZXDG_POSITIONER_V6_GRAVITY_TOP) positioner->gravity |= WLC_BIT_GRAVITY_TOP; + if (gravity & ZXDG_POSITIONER_V6_GRAVITY_BOTTOM) positioner->gravity |= WLC_BIT_GRAVITY_BOTTOM; + if (gravity & ZXDG_POSITIONER_V6_GRAVITY_LEFT) positioner->gravity |= WLC_BIT_GRAVITY_LEFT; + if (gravity & ZXDG_POSITIONER_V6_GRAVITY_RIGHT) positioner->gravity |= WLC_BIT_GRAVITY_RIGHT; +} + +static void +wlc_xdg_positioner_protocol_set_constraint_adjustment(struct wl_client *client, struct wl_resource *resource, enum zxdg_positioner_v6_constraint_adjustment constraint_adjustment) +{ + (void)client; + struct wlc_xdg_positioner *positioner; + if (!(positioner = wl_resource_get_user_data(resource))) + return; + + positioner->constraint_adjustment = WLC_BIT_CONSTRAINT_ADJUSTMENT_NONE; + if (constraint_adjustment & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X) positioner->constraint_adjustment |= WLC_BIT_CONSTRAINT_ADJUSTMENT_SLIDE_X; + if (constraint_adjustment & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y) positioner->constraint_adjustment |= WLC_BIT_CONSTRAINT_ADJUSTMENT_SLIDE_Y; + if (constraint_adjustment & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X) positioner->constraint_adjustment |= WLC_BIT_CONSTRAINT_ADJUSTMENT_FLIP_X; + if (constraint_adjustment & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y) positioner->constraint_adjustment |= WLC_BIT_CONSTRAINT_ADJUSTMENT_FLIP_Y; + if (constraint_adjustment & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X) positioner->constraint_adjustment |= WLC_BIT_CONSTRAINT_ADJUSTMENT_RESIZE_X; + if (constraint_adjustment & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y) positioner->constraint_adjustment |= WLC_BIT_CONSTRAINT_ADJUSTMENT_RESIZE_Y; +} + +static void +wlc_xdg_positioner_protocol_set_offset(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y) +{ + (void)client; + struct wlc_xdg_positioner *positioner; + if (!(positioner = wl_resource_get_user_data(resource))) + return; + + positioner->offset.x = x; + positioner->offset.y = y; +} + +WLC_CONST const struct zxdg_positioner_v6_interface* +wlc_xdg_positioner_implementation(void) +{ + static const struct zxdg_positioner_v6_interface zxdg_positioner_v6_implementation = { + .destroy = wlc_cb_resource_destructor, + .set_size = wlc_xdg_positioner_protocol_set_size, + .set_anchor_rect = wlc_xdg_positioner_protocol_set_anchor_rect, + .set_anchor = wlc_xdg_positioner_protocol_set_anchor, + .set_gravity = wlc_xdg_positioner_protocol_set_gravity, + .set_constraint_adjustment = wlc_xdg_positioner_protocol_set_constraint_adjustment, + .set_offset = wlc_xdg_positioner_protocol_set_offset, + }; + + return &zxdg_positioner_v6_implementation; +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/resources/types/xdg-positioner.h new/wlc-0.0.8/src/resources/types/xdg-positioner.h --- old/wlc-0.0.7/src/resources/types/xdg-positioner.h 1970-01-01 01:00:00.000000000 +0100 +++ new/wlc-0.0.8/src/resources/types/xdg-positioner.h 2017-02-21 16:25:29.000000000 +0100 @@ -0,0 +1,27 @@ +#ifndef _WLC_XDG_POSITIONER_H_ +#define _WLC_XDG_POSITIONER_H_ + +#include <wayland-server.h> +#include <wlc/wlc.h> +#include <wlc/geometry.h> +#include "wayland-xdg-shell-unstable-v6-server-protocol.h" + +const struct zxdg_positioner_v6_interface* wlc_xdg_positioner_implementation(void); + +enum wlc_xdg_positioner_flags { + WLC_XDG_POSITIONER_HAS_SIZE = 1<<1, + WLC_XDG_POSITIONER_HAS_ANCHOR_RECT = 1<<2, + // offset, anchor and rest has default values +}; + +struct wlc_xdg_positioner { + enum wlc_xdg_positioner_flags flags; + struct wlc_size size; + struct wlc_point offset; + struct wlc_geometry anchor_rect; + enum wlc_positioner_anchor_bit anchor; + enum wlc_positioner_gravity_bit gravity; + enum wlc_positioner_constraint_adjustment_bit constraint_adjustment; +}; + +#endif /* _WLC_XDG_POSITIONER_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/session/fd.c new/wlc-0.0.8/src/session/fd.c --- old/wlc-0.0.7/src/session/fd.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/session/fd.c 2017-02-21 16:25:29.000000000 +0100 @@ -10,7 +10,10 @@ #include <sys/select.h> #include <sys/socket.h> #include <sys/types.h> +#ifdef __linux__ #include <linux/major.h> +#include <sys/sysmacros.h> +#endif #include <xf86drm.h> #include "internal.h" #include "macros.h" @@ -171,6 +174,7 @@ } /* we will only open allowed paths */ +#ifdef __linux__ #define FILTER(x, m) { x, (sizeof(x) > 32 ? 32 : sizeof(x)) - 1, m } static struct { const char *base; @@ -181,11 +185,14 @@ FILTER("/dev/dri/card", DRM_MAJOR), // WLC_FD_DRM }; #undef FILTER +#endif +#ifdef __linux__ if (type > WLC_FD_LAST || memcmp(path, allow[type].base, allow[type].size)) { wlc_log(WLC_LOG_WARN, "Denying open from: %s", path); return -1; } +#endif struct stat st; if (stat(path, &st) < 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/session/logind.c new/wlc-0.0.8/src/session/logind.c --- old/wlc-0.0.7/src/session/logind.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/session/logind.c 2017-02-21 16:25:29.000000000 +0100 @@ -5,6 +5,7 @@ #include <dlfcn.h> #include <fcntl.h> #include <sys/stat.h> +#include <sys/sysmacros.h> #include <systemd/sd-login.h> #include <chck/string/string.h> #include "internal.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/session/tty.c new/wlc-0.0.8/src/session/tty.c --- old/wlc-0.0.7/src/session/tty.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/session/tty.c 2017-02-21 16:25:29.000000000 +0100 @@ -15,6 +15,7 @@ # include <linux/kd.h> # include <linux/major.h> # include <linux/vt.h> +# include <sys/sysmacros.h> #elif defined(__FreeBSD__) # include <sys/consio.h> # include <sys/kbio.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/xwayland/xwayland.c new/wlc-0.0.8/src/xwayland/xwayland.c --- old/wlc-0.0.7/src/xwayland/xwayland.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/xwayland/xwayland.c 2017-02-21 16:25:29.000000000 +0100 @@ -21,6 +21,7 @@ #define LOCK_FMT "/tmp/.X%d-lock" #define SOCKET_FMT "/tmp/.X11-unix/X%d" +#define SOCKET2_FMT "/tmp/.X11-unix/X%d_" static const char *socket_dir = "/tmp/.X11-unix"; static struct { @@ -131,8 +132,12 @@ close(lock_fd); struct sockaddr_un addr = { .sun_family = AF_LOCAL }; +#ifdef __linux__ addr.sun_path[0] = '\0'; size_t path_size = snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1, SOCKET_FMT, dpy); +#else + size_t path_size = snprintf(addr.sun_path, sizeof(addr.sun_path), SOCKET2_FMT, dpy); +#endif if ((socks[0] = open_socket(&addr, path_size)) < 0) { unlink(lock_name); unlink(addr.sun_path + 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlc-0.0.7/src/xwayland/xwm.c new/wlc-0.0.8/src/xwayland/xwm.c --- old/wlc-0.0.7/src/xwayland/xwm.c 2016-10-25 21:46:35.000000000 +0200 +++ new/wlc-0.0.8/src/xwayland/xwm.c 2017-02-21 16:25:29.000000000 +0100 @@ -205,7 +205,23 @@ // Class && Name // STRING == latin1, but we naively just read it as is. For full support we should convert to utf8. if (props[i] == XCB_ATOM_WM_CLASS) { - wlc_view_set_class_ptr(view, xcb_get_property_value(reply), xcb_get_property_value_length(reply)); + char *class = xcb_get_property_value(reply); + size_t class_total_len = xcb_get_property_value_length(reply); + + /* unpack two sequentially stored strings (instance, class) */ + size_t class_instance_len = strnlen(class, class_total_len); + + if (class_instance_len >= class_total_len) { + /* there doesn't exist a second string in tuple */ + wlc_view_set_instance_ptr(view, class, class_instance_len); + wlc_view_set_class_ptr(view, class, class_instance_len); + } else { + /* different instance and class strings */ + size_t class_class_offset = class_instance_len +1; + wlc_view_set_instance_ptr(view, class, class_instance_len); + wlc_view_set_class_ptr(view, class+class_class_offset, class_total_len-class_class_offset); + } + wlc_dlog(WLC_DBG_XWM, "WM_INSTANCE: %s", view->data._instance.data); wlc_dlog(WLC_DBG_XWM, "WM_CLASS: %s", view->data._class.data); } else if (props[i] == XCB_ATOM_WM_NAME || props[i] == x11.atoms[NET_WM_NAME]) { if (reply->type != XCB_ATOM_STRING || !win->has_utf8_title) {
