mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
Merge pull request #33 from nongio/wayland
This commit is contained in:
commit
e106932ae0
15 changed files with 3579 additions and 1711 deletions
167
Headers/wayland/WaylandServer.h
Normal file → Executable file
167
Headers/wayland/WaylandServer.h
Normal file → Executable file
|
@ -5,6 +5,7 @@
|
|||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
Author: Sergio L. Pascual <slp@sinrega.org>
|
||||
Rewrite: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
||||
Date: February 2016
|
||||
|
||||
This file is part of the GNUstep Backend.
|
||||
|
@ -38,101 +39,117 @@
|
|||
|
||||
#include "cairo/WaylandCairoSurface.h"
|
||||
#include "wayland/xdg-shell-client-protocol.h"
|
||||
#include "wayland/wlr-layer-shell-client-protocol.h"
|
||||
|
||||
struct pointer {
|
||||
struct wl_pointer *wlpointer;
|
||||
float x;
|
||||
float y;
|
||||
uint32_t last_click_button;
|
||||
uint32_t last_click_time;
|
||||
float last_click_x;
|
||||
float last_click_y;
|
||||
struct pointer
|
||||
{
|
||||
struct wl_pointer *wlpointer;
|
||||
float x;
|
||||
float y;
|
||||
uint32_t last_click_button;
|
||||
uint32_t last_click_time;
|
||||
float last_click_x;
|
||||
float last_click_y;
|
||||
|
||||
uint32_t serial;
|
||||
struct window *focus;
|
||||
uint32_t serial;
|
||||
struct window *focus;
|
||||
};
|
||||
|
||||
typedef struct _WaylandConfig {
|
||||
struct wl_display *display;
|
||||
struct wl_registry *registry;
|
||||
struct wl_compositor *compositor;
|
||||
struct wl_shell *shell;
|
||||
struct wl_shm *shm;
|
||||
struct wl_seat *seat;
|
||||
struct wl_keyboard *keyboard;
|
||||
struct xdg_wm_base *wm_base;
|
||||
typedef struct _WaylandConfig
|
||||
{
|
||||
struct wl_display *display;
|
||||
struct wl_registry *registry;
|
||||
struct wl_compositor *compositor;
|
||||
struct wl_shell *shell;
|
||||
struct wl_shm *shm;
|
||||
struct wl_seat *seat;
|
||||
struct wl_keyboard *keyboard;
|
||||
struct xdg_wm_base *wm_base;
|
||||
struct zwlr_layer_shell_v1 *layer_shell;
|
||||
|
||||
struct wl_list output_list;
|
||||
int output_count;
|
||||
struct wl_list window_list;
|
||||
int window_count;
|
||||
int last_window_id;
|
||||
struct wl_list output_list;
|
||||
int output_count;
|
||||
struct wl_list window_list;
|
||||
int window_count;
|
||||
int last_window_id;
|
||||
|
||||
struct pointer pointer;
|
||||
struct xkb_context *xkb_context;
|
||||
struct {
|
||||
struct xkb_keymap *keymap;
|
||||
struct xkb_state *state;
|
||||
xkb_mod_mask_t control_mask;
|
||||
xkb_mod_mask_t alt_mask;
|
||||
xkb_mod_mask_t shift_mask;
|
||||
} xkb;
|
||||
int modifiers;
|
||||
struct pointer pointer;
|
||||
struct xkb_context *xkb_context;
|
||||
struct
|
||||
{
|
||||
struct xkb_keymap *keymap;
|
||||
struct xkb_state *state;
|
||||
xkb_mod_mask_t control_mask;
|
||||
xkb_mod_mask_t alt_mask;
|
||||
xkb_mod_mask_t shift_mask;
|
||||
} xkb;
|
||||
int modifiers;
|
||||
|
||||
int seat_version;
|
||||
int seat_version;
|
||||
|
||||
float mouse_scroll_multiplier;
|
||||
float mouse_scroll_multiplier;
|
||||
} WaylandConfig;
|
||||
|
||||
struct output {
|
||||
WaylandConfig *wlconfig;
|
||||
struct wl_output *output;
|
||||
uint32_t server_output_id;
|
||||
struct wl_list link;
|
||||
int alloc_x;
|
||||
int alloc_y;
|
||||
int width;
|
||||
int height;
|
||||
int transform;
|
||||
int scale;
|
||||
char *make;
|
||||
char *model;
|
||||
struct output
|
||||
{
|
||||
WaylandConfig *wlconfig;
|
||||
struct wl_output *output;
|
||||
uint32_t server_output_id;
|
||||
struct wl_list link;
|
||||
int alloc_x;
|
||||
int alloc_y;
|
||||
int width;
|
||||
int height;
|
||||
int transform;
|
||||
int scale;
|
||||
char *make;
|
||||
char *model;
|
||||
|
||||
void *user_data;
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
struct window {
|
||||
WaylandConfig *wlconfig;
|
||||
id instance;
|
||||
int window_id;
|
||||
struct wl_list link;
|
||||
BOOL configured; // surface has been configured once
|
||||
struct window
|
||||
{
|
||||
WaylandConfig *wlconfig;
|
||||
id instance;
|
||||
int window_id;
|
||||
struct wl_list link;
|
||||
BOOL configured; // surface has been configured once
|
||||
BOOL buffer_needs_attach; // there is a new buffer avaialble for the surface
|
||||
BOOL terminated;
|
||||
BOOL moving;
|
||||
BOOL resizing;
|
||||
|
||||
float pos_x;
|
||||
float pos_y;
|
||||
float width;
|
||||
float height;
|
||||
float saved_pos_x;
|
||||
float saved_pos_y;
|
||||
int is_out;
|
||||
float pos_x;
|
||||
float pos_y;
|
||||
float width;
|
||||
float height;
|
||||
float saved_pos_x;
|
||||
float saved_pos_y;
|
||||
int is_out;
|
||||
int level;
|
||||
|
||||
unsigned char *data;
|
||||
struct wl_buffer *buffer;
|
||||
struct wl_surface *surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *toplevel;
|
||||
|
||||
struct output *output;
|
||||
WaylandCairoSurface *wcs;
|
||||
unsigned char *data;
|
||||
struct wl_buffer *buffer;
|
||||
struct wl_surface *surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *toplevel;
|
||||
struct xdg_popup *popup;
|
||||
struct xdg_positioner *positioner;
|
||||
struct zwlr_layer_surface_v1 *layer_surface;
|
||||
struct output *output;
|
||||
WaylandCairoSurface *wcs;
|
||||
};
|
||||
|
||||
|
||||
@interface WaylandServer : GSDisplayServer
|
||||
{
|
||||
WaylandConfig *wlconfig;
|
||||
WaylandConfig *wlconfig;
|
||||
|
||||
BOOL _mouseInitialized;
|
||||
BOOL _mouseInitialized;
|
||||
}
|
||||
@end
|
||||
@interface
|
||||
WaylandServer (Cursor)
|
||||
@end
|
||||
|
||||
#endif /* _XGServer_h_INCLUDE */
|
||||
#endif /* _WaylandServer_h_INCLUDE */
|
||||
|
|
597
Headers/wayland/wlr-layer-shell-client-protocol.h
Normal file
597
Headers/wayland/wlr-layer-shell-client-protocol.h
Normal file
|
@ -0,0 +1,597 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
#ifndef WLR_LAYER_SHELL_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define WLR_LAYER_SHELL_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_wlr_layer_shell_unstable_v1 The wlr_layer_shell_unstable_v1 protocol
|
||||
* @section page_ifaces_wlr_layer_shell_unstable_v1 Interfaces
|
||||
* - @subpage page_iface_zwlr_layer_shell_v1 - create surfaces that are layers of the desktop
|
||||
* - @subpage page_iface_zwlr_layer_surface_v1 - layer metadata interface
|
||||
* @section page_copyright_wlr_layer_shell_unstable_v1 Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2017 Drew DeVault
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this
|
||||
* software and its documentation for any purpose is hereby granted
|
||||
* without fee, provided that the above copyright notice appear in
|
||||
* all copies and that both that copyright notice and this permission
|
||||
* notice appear in supporting documentation, and that the name of
|
||||
* the copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct wl_output;
|
||||
struct wl_surface;
|
||||
struct xdg_popup;
|
||||
struct zwlr_layer_shell_v1;
|
||||
struct zwlr_layer_surface_v1;
|
||||
|
||||
/**
|
||||
* @page page_iface_zwlr_layer_shell_v1 zwlr_layer_shell_v1
|
||||
* @section page_iface_zwlr_layer_shell_v1_desc Description
|
||||
*
|
||||
* Clients can use this interface to assign the surface_layer role to
|
||||
* wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
* rendered with a defined z-depth respective to each other. They may also be
|
||||
* anchored to the edges and corners of a screen and specify input handling
|
||||
* semantics. This interface should be suitable for the implementation of
|
||||
* many desktop shell components, and a broad number of other applications
|
||||
* that interact with the desktop.
|
||||
* @section page_iface_zwlr_layer_shell_v1_api API
|
||||
* See @ref iface_zwlr_layer_shell_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwlr_layer_shell_v1 The zwlr_layer_shell_v1 interface
|
||||
*
|
||||
* Clients can use this interface to assign the surface_layer role to
|
||||
* wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
* rendered with a defined z-depth respective to each other. They may also be
|
||||
* anchored to the edges and corners of a screen and specify input handling
|
||||
* semantics. This interface should be suitable for the implementation of
|
||||
* many desktop shell components, and a broad number of other applications
|
||||
* that interact with the desktop.
|
||||
*/
|
||||
extern const struct wl_interface zwlr_layer_shell_v1_interface;
|
||||
/**
|
||||
* @page page_iface_zwlr_layer_surface_v1 zwlr_layer_surface_v1
|
||||
* @section page_iface_zwlr_layer_surface_v1_desc Description
|
||||
*
|
||||
* An interface that may be implemented by a wl_surface, for surfaces that
|
||||
* are designed to be rendered as a layer of a stacked desktop-like
|
||||
* environment.
|
||||
*
|
||||
* Layer surface state (layer, size, anchor, exclusive zone,
|
||||
* margin, interactivity) is double-buffered, and will be applied at the
|
||||
* time wl_surface.commit of the corresponding wl_surface is called.
|
||||
* @section page_iface_zwlr_layer_surface_v1_api API
|
||||
* See @ref iface_zwlr_layer_surface_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwlr_layer_surface_v1 The zwlr_layer_surface_v1 interface
|
||||
*
|
||||
* An interface that may be implemented by a wl_surface, for surfaces that
|
||||
* are designed to be rendered as a layer of a stacked desktop-like
|
||||
* environment.
|
||||
*
|
||||
* Layer surface state (layer, size, anchor, exclusive zone,
|
||||
* margin, interactivity) is double-buffered, and will be applied at the
|
||||
* time wl_surface.commit of the corresponding wl_surface is called.
|
||||
*/
|
||||
extern const struct wl_interface zwlr_layer_surface_v1_interface;
|
||||
|
||||
#ifndef ZWLR_LAYER_SHELL_V1_ERROR_ENUM
|
||||
#define ZWLR_LAYER_SHELL_V1_ERROR_ENUM
|
||||
enum zwlr_layer_shell_v1_error {
|
||||
/**
|
||||
* wl_surface has another role
|
||||
*/
|
||||
ZWLR_LAYER_SHELL_V1_ERROR_ROLE = 0,
|
||||
/**
|
||||
* layer value is invalid
|
||||
*/
|
||||
ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER = 1,
|
||||
/**
|
||||
* wl_surface has a buffer attached or committed
|
||||
*/
|
||||
ZWLR_LAYER_SHELL_V1_ERROR_ALREADY_CONSTRUCTED = 2,
|
||||
};
|
||||
#endif /* ZWLR_LAYER_SHELL_V1_ERROR_ENUM */
|
||||
|
||||
#ifndef ZWLR_LAYER_SHELL_V1_LAYER_ENUM
|
||||
#define ZWLR_LAYER_SHELL_V1_LAYER_ENUM
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_shell_v1
|
||||
* available layers for surfaces
|
||||
*
|
||||
* These values indicate which layers a surface can be rendered in. They
|
||||
* are ordered by z depth, bottom-most first. Traditional shell surfaces
|
||||
* will typically be rendered between the bottom and top layers.
|
||||
* Fullscreen shell surfaces are typically rendered at the top layer.
|
||||
* Multiple surfaces can share a single layer, and ordering within a
|
||||
* single layer is undefined.
|
||||
*/
|
||||
enum zwlr_layer_shell_v1_layer {
|
||||
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0,
|
||||
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1,
|
||||
ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2,
|
||||
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3,
|
||||
};
|
||||
#endif /* ZWLR_LAYER_SHELL_V1_LAYER_ENUM */
|
||||
|
||||
#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE 0
|
||||
#define ZWLR_LAYER_SHELL_V1_DESTROY 1
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_shell_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_shell_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SHELL_V1_DESTROY_SINCE_VERSION 3
|
||||
|
||||
/** @ingroup iface_zwlr_layer_shell_v1 */
|
||||
static inline void
|
||||
zwlr_layer_shell_v1_set_user_data(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwlr_layer_shell_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwlr_layer_shell_v1 */
|
||||
static inline void *
|
||||
zwlr_layer_shell_v1_get_user_data(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwlr_layer_shell_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwlr_layer_shell_v1_get_version(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwlr_layer_shell_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_shell_v1
|
||||
*
|
||||
* Create a layer surface for an existing surface. This assigns the role of
|
||||
* layer_surface, or raises a protocol error if another role is already
|
||||
* assigned.
|
||||
*
|
||||
* Creating a layer surface from a wl_surface which has a buffer attached
|
||||
* or committed is a client error, and any attempts by a client to attach
|
||||
* or manipulate a buffer prior to the first layer_surface.configure call
|
||||
* must also be treated as errors.
|
||||
*
|
||||
* You may pass NULL for output to allow the compositor to decide which
|
||||
* output to use. Generally this will be the one that the user most
|
||||
* recently interacted with.
|
||||
*
|
||||
* Clients can specify a namespace that defines the purpose of the layer
|
||||
* surface.
|
||||
*/
|
||||
static inline struct zwlr_layer_surface_v1 *
|
||||
zwlr_layer_shell_v1_get_layer_surface(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1, struct wl_surface *surface, struct wl_output *output, uint32_t layer, const char *namespace)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwlr_layer_shell_v1,
|
||||
ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE, &zwlr_layer_surface_v1_interface, NULL, surface, output, layer, namespace);
|
||||
|
||||
return (struct zwlr_layer_surface_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_shell_v1
|
||||
*
|
||||
* This request indicates that the client will not use the layer_shell
|
||||
* object any more. Objects that have been created through this instance
|
||||
* are not affected.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_shell_v1_destroy(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_shell_v1,
|
||||
ZWLR_LAYER_SHELL_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwlr_layer_shell_v1);
|
||||
}
|
||||
|
||||
#ifndef ZWLR_LAYER_SURFACE_V1_ERROR_ENUM
|
||||
#define ZWLR_LAYER_SURFACE_V1_ERROR_ENUM
|
||||
enum zwlr_layer_surface_v1_error {
|
||||
/**
|
||||
* provided surface state is invalid
|
||||
*/
|
||||
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SURFACE_STATE = 0,
|
||||
/**
|
||||
* size is invalid
|
||||
*/
|
||||
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE = 1,
|
||||
/**
|
||||
* anchor bitfield is invalid
|
||||
*/
|
||||
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_ANCHOR = 2,
|
||||
};
|
||||
#endif /* ZWLR_LAYER_SURFACE_V1_ERROR_ENUM */
|
||||
|
||||
#ifndef ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM
|
||||
#define ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM
|
||||
enum zwlr_layer_surface_v1_anchor {
|
||||
/**
|
||||
* the top edge of the anchor rectangle
|
||||
*/
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP = 1,
|
||||
/**
|
||||
* the bottom edge of the anchor rectangle
|
||||
*/
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM = 2,
|
||||
/**
|
||||
* the left edge of the anchor rectangle
|
||||
*/
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT = 4,
|
||||
/**
|
||||
* the right edge of the anchor rectangle
|
||||
*/
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT = 8,
|
||||
};
|
||||
#endif /* ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
* @struct zwlr_layer_surface_v1_listener
|
||||
*/
|
||||
struct zwlr_layer_surface_v1_listener {
|
||||
/**
|
||||
* suggest a surface change
|
||||
*
|
||||
* The configure event asks the client to resize its surface.
|
||||
*
|
||||
* Clients should arrange their surface for the new states, and
|
||||
* then send an ack_configure request with the serial sent in this
|
||||
* configure event at some point before committing the new surface.
|
||||
*
|
||||
* The client is free to dismiss all but the last configure event
|
||||
* it received.
|
||||
*
|
||||
* The width and height arguments specify the size of the window in
|
||||
* surface-local coordinates.
|
||||
*
|
||||
* The size is a hint, in the sense that the client is free to
|
||||
* ignore it if it doesn't resize, pick a smaller size (to satisfy
|
||||
* aspect ratio or resize in steps of NxM pixels). If the client
|
||||
* picks a smaller size and is anchored to two opposite anchors
|
||||
* (e.g. 'top' and 'bottom'), the surface will be centered on this
|
||||
* axis.
|
||||
*
|
||||
* If the width or height arguments are zero, it means the client
|
||||
* should decide its own window dimension.
|
||||
*/
|
||||
void (*configure)(void *data,
|
||||
struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1,
|
||||
uint32_t serial,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
/**
|
||||
* surface should be closed
|
||||
*
|
||||
* The closed event is sent by the compositor when the surface
|
||||
* will no longer be shown. The output may have been destroyed or
|
||||
* the user may have asked for it to be removed. Further changes to
|
||||
* the surface will be ignored. The client should destroy the
|
||||
* resource after receiving this event, and create a new surface if
|
||||
* they so choose.
|
||||
*/
|
||||
void (*closed)(void *data,
|
||||
struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
static inline int
|
||||
zwlr_layer_surface_v1_add_listener(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1,
|
||||
const struct zwlr_layer_surface_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_SIZE 0
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR 1
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE 2
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN 3
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY 4
|
||||
#define ZWLR_LAYER_SURFACE_V1_GET_POPUP 5
|
||||
#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE 6
|
||||
#define ZWLR_LAYER_SURFACE_V1_DESTROY 7
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_LAYER 8
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_CONFIGURE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_CLOSED_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_SIZE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_GET_POPUP_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*/
|
||||
#define ZWLR_LAYER_SURFACE_V1_SET_LAYER_SINCE_VERSION 2
|
||||
|
||||
/** @ingroup iface_zwlr_layer_surface_v1 */
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_set_user_data(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwlr_layer_surface_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwlr_layer_surface_v1 */
|
||||
static inline void *
|
||||
zwlr_layer_surface_v1_get_user_data(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwlr_layer_surface_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwlr_layer_surface_v1_get_version(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwlr_layer_surface_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* Sets the size of the surface in surface-local coordinates. The
|
||||
* compositor will display the surface centered with respect to its
|
||||
* anchors.
|
||||
*
|
||||
* If you pass 0 for either value, the compositor will assign it and
|
||||
* inform you of the assignment in the configure event. You must set your
|
||||
* anchor to opposite edges in the dimensions you omit; not doing so is a
|
||||
* protocol error. Both values are 0 by default.
|
||||
*
|
||||
* Size is double-buffered, see wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_set_size(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t width, uint32_t height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_SET_SIZE, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* Requests that the compositor anchor the surface to the specified edges
|
||||
* and corners. If two orthogonal edges are specified (e.g. 'top' and
|
||||
* 'left'), then the anchor point will be the intersection of the edges
|
||||
* (e.g. the top left corner of the output); otherwise the anchor point
|
||||
* will be centered on that edge, or in the center if none is specified.
|
||||
*
|
||||
* Anchor is double-buffered, see wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_set_anchor(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t anchor)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_SET_ANCHOR, anchor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* Requests that the compositor avoids occluding an area with other
|
||||
* surfaces. The compositor's use of this information is
|
||||
* implementation-dependent - do not assume that this region will not
|
||||
* actually be occluded.
|
||||
*
|
||||
* A positive value is only meaningful if the surface is anchored to one
|
||||
* edge or an edge and both perpendicular edges. If the surface is not
|
||||
* anchored, anchored to only two perpendicular edges (a corner), anchored
|
||||
* to only two parallel edges or anchored to all edges, a positive value
|
||||
* will be treated the same as zero.
|
||||
*
|
||||
* A positive zone is the distance from the edge in surface-local
|
||||
* coordinates to consider exclusive.
|
||||
*
|
||||
* Surfaces that do not wish to have an exclusive zone may instead specify
|
||||
* how they should interact with surfaces that do. If set to zero, the
|
||||
* surface indicates that it would like to be moved to avoid occluding
|
||||
* surfaces with a positive exclusive zone. If set to -1, the surface
|
||||
* indicates that it would not like to be moved to accommodate for other
|
||||
* surfaces, and the compositor should extend it all the way to the edges
|
||||
* it is anchored to.
|
||||
*
|
||||
* For example, a panel might set its exclusive zone to 10, so that
|
||||
* maximized shell surfaces are not shown on top of it. A notification
|
||||
* might set its exclusive zone to 0, so that it is moved to avoid
|
||||
* occluding the panel, but shell surfaces are shown underneath it. A
|
||||
* wallpaper or lock screen might set their exclusive zone to -1, so that
|
||||
* they stretch below or over the panel.
|
||||
*
|
||||
* The default value is 0.
|
||||
*
|
||||
* Exclusive zone is double-buffered, see wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_set_exclusive_zone(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, int32_t zone)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE, zone);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* Requests that the surface be placed some distance away from the anchor
|
||||
* point on the output, in surface-local coordinates. Setting this value
|
||||
* for edges you are not anchored to has no effect.
|
||||
*
|
||||
* The exclusive zone includes the margin.
|
||||
*
|
||||
* Margin is double-buffered, see wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_set_margin(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, int32_t top, int32_t right, int32_t bottom, int32_t left)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_SET_MARGIN, top, right, bottom, left);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* Set to 1 to request that the seat send keyboard events to this layer
|
||||
* surface. For layers below the shell surface layer, the seat will use
|
||||
* normal focus semantics. For layers above the shell surface layers, the
|
||||
* seat will always give exclusive keyboard focus to the top-most layer
|
||||
* which has keyboard interactivity set to true.
|
||||
*
|
||||
* Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||
* you do not want to receive them, set the input region on your surface
|
||||
* to an empty region.
|
||||
*
|
||||
* Events is double-buffered, see wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_set_keyboard_interactivity(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t keyboard_interactivity)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY, keyboard_interactivity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* This assigns an xdg_popup's parent to this layer_surface. This popup
|
||||
* should have been created via xdg_surface::get_popup with the parent set
|
||||
* to NULL, and this request must be invoked before committing the popup's
|
||||
* initial state.
|
||||
*
|
||||
* See the documentation of xdg_popup for more details about what an
|
||||
* xdg_popup is and how it is used.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_get_popup(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, struct xdg_popup *popup)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_GET_POPUP, popup);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* When a configure event is received, if a client commits the
|
||||
* surface in response to the configure event, then the client
|
||||
* must make an ack_configure request sometime before the commit
|
||||
* request, passing along the serial of the configure event.
|
||||
*
|
||||
* If the client receives multiple configure events before it
|
||||
* can respond to one, it only has to ack the last configure event.
|
||||
*
|
||||
* A client is not required to commit immediately after sending
|
||||
* an ack_configure request - it may even ack_configure several times
|
||||
* before its next surface commit.
|
||||
*
|
||||
* A client may send multiple ack_configure requests before committing, but
|
||||
* only the last request sent before a commit indicates which configure
|
||||
* event the client really is responding to.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_ack_configure(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE, serial);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* This request destroys the layer surface.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_destroy(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwlr_layer_surface_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwlr_layer_surface_v1
|
||||
*
|
||||
* Change the layer that the surface is rendered on.
|
||||
*
|
||||
* Layer is double-buffered, see wl_surface.commit.
|
||||
*/
|
||||
static inline void
|
||||
zwlr_layer_surface_v1_set_layer(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t layer)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
|
||||
ZWLR_LAYER_SURFACE_V1_SET_LAYER, layer);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.17.0 */
|
||||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
#ifndef XDG_SHELL_CLIENT_PROTOCOL_H
|
||||
#define XDG_SHELL_CLIENT_PROTOCOL_H
|
||||
|
@ -284,12 +284,6 @@ extern const struct wl_interface xdg_toplevel_interface;
|
|||
* The parent of an xdg_popup must be mapped (see the xdg_surface
|
||||
* description) before the xdg_popup itself.
|
||||
*
|
||||
* The x and y arguments passed when creating the popup object specify
|
||||
* where the top left of the popup should be placed, relative to the
|
||||
* local surface coordinates of the parent surface. See
|
||||
* xdg_surface.get_popup. An xdg_popup must intersect with or be at least
|
||||
* partially adjacent to its parent surface.
|
||||
*
|
||||
* The client must call wl_surface.commit on the corresponding wl_surface
|
||||
* for the xdg_popup state to take effect.
|
||||
* @section page_iface_xdg_popup_api API
|
||||
|
@ -320,12 +314,6 @@ extern const struct wl_interface xdg_toplevel_interface;
|
|||
* The parent of an xdg_popup must be mapped (see the xdg_surface
|
||||
* description) before the xdg_popup itself.
|
||||
*
|
||||
* The x and y arguments passed when creating the popup object specify
|
||||
* where the top left of the popup should be placed, relative to the
|
||||
* local surface coordinates of the parent surface. See
|
||||
* xdg_surface.get_popup. An xdg_popup must intersect with or be at least
|
||||
* partially adjacent to its parent surface.
|
||||
*
|
||||
* The client must call wl_surface.commit on the corresponding wl_surface
|
||||
* for the xdg_popup state to take effect.
|
||||
*/
|
||||
|
@ -587,6 +575,9 @@ enum xdg_positioner_constraint_adjustment {
|
|||
#define XDG_POSITIONER_SET_GRAVITY 4
|
||||
#define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT 5
|
||||
#define XDG_POSITIONER_SET_OFFSET 6
|
||||
#define XDG_POSITIONER_SET_REACTIVE 7
|
||||
#define XDG_POSITIONER_SET_PARENT_SIZE 8
|
||||
#define XDG_POSITIONER_SET_PARENT_CONFIGURE 9
|
||||
|
||||
|
||||
/**
|
||||
|
@ -617,6 +608,18 @@ enum xdg_positioner_constraint_adjustment {
|
|||
* @ingroup iface_xdg_positioner
|
||||
*/
|
||||
#define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_positioner
|
||||
*/
|
||||
#define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3
|
||||
/**
|
||||
* @ingroup iface_xdg_positioner
|
||||
*/
|
||||
#define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3
|
||||
/**
|
||||
* @ingroup iface_xdg_positioner
|
||||
*/
|
||||
#define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3
|
||||
|
||||
/** @ingroup iface_xdg_positioner */
|
||||
static inline void
|
||||
|
@ -769,6 +772,56 @@ xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int3
|
|||
XDG_POSITIONER_SET_OFFSET, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_positioner
|
||||
*
|
||||
* When set reactive, the surface is reconstrained if the conditions used
|
||||
* for constraining changed, e.g. the parent window moved.
|
||||
*
|
||||
* If the conditions changed and the popup was reconstrained, an
|
||||
* xdg_popup.configure event is sent with updated geometry, followed by an
|
||||
* xdg_surface.configure event.
|
||||
*/
|
||||
static inline void
|
||||
xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_REACTIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_positioner
|
||||
*
|
||||
* Set the parent window geometry the compositor should use when
|
||||
* positioning the popup. The compositor may use this information to
|
||||
* determine the future state the popup should be constrained using. If
|
||||
* this doesn't match the dimension of the parent the popup is eventually
|
||||
* positioned against, the behavior is undefined.
|
||||
*
|
||||
* The arguments are given in the surface-local coordinate space.
|
||||
*/
|
||||
static inline void
|
||||
xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t parent_width, int32_t parent_height)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_PARENT_SIZE, parent_width, parent_height);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_positioner
|
||||
*
|
||||
* Set the serial of a xdg_surface.configure event this positioner will be
|
||||
* used in response to. The compositor may use this information together
|
||||
* with set_parent_size to determine what future state the popup should be
|
||||
* constrained using.
|
||||
*/
|
||||
static inline void
|
||||
xdg_positioner_set_parent_configure(struct xdg_positioner *xdg_positioner, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
|
||||
XDG_POSITIONER_SET_PARENT_CONFIGURE, serial);
|
||||
}
|
||||
|
||||
#ifndef XDG_SURFACE_ERROR_ENUM
|
||||
#define XDG_SURFACE_ERROR_ENUM
|
||||
enum xdg_surface_error {
|
||||
|
@ -1691,6 +1744,12 @@ struct xdg_popup_listener {
|
|||
* The x and y arguments represent the position the popup was
|
||||
* placed at given the xdg_positioner rule, relative to the upper
|
||||
* left corner of the window geometry of the parent surface.
|
||||
*
|
||||
* For version 2 or older, the configure event for an xdg_popup is
|
||||
* only ever sent once for the initial configuration. Starting with
|
||||
* version 3, it may be sent again if the popup is setup with an
|
||||
* xdg_positioner with set_reactive requested, or in response to
|
||||
* xdg_popup.reposition requests.
|
||||
* @param x x position relative to parent surface window geometry
|
||||
* @param y y position relative to parent surface window geometry
|
||||
* @param width window geometry width
|
||||
|
@ -1711,6 +1770,32 @@ struct xdg_popup_listener {
|
|||
*/
|
||||
void (*popup_done)(void *data,
|
||||
struct xdg_popup *xdg_popup);
|
||||
/**
|
||||
* signal the completion of a repositioned request
|
||||
*
|
||||
* The repositioned event is sent as part of a popup
|
||||
* configuration sequence, together with xdg_popup.configure and
|
||||
* lastly xdg_surface.configure to notify the completion of a
|
||||
* reposition request.
|
||||
*
|
||||
* The repositioned event is to notify about the completion of a
|
||||
* xdg_popup.reposition request. The token argument is the token
|
||||
* passed in the xdg_popup.reposition request.
|
||||
*
|
||||
* Immediately after this event is emitted, xdg_popup.configure and
|
||||
* xdg_surface.configure will be sent with the updated size and
|
||||
* position, as well as a new configure serial.
|
||||
*
|
||||
* The client should optionally update the content of the popup,
|
||||
* but must acknowledge the new popup configuration for the new
|
||||
* position to take effect. See xdg_surface.ack_configure for
|
||||
* details.
|
||||
* @param token reposition request token
|
||||
* @since 3
|
||||
*/
|
||||
void (*repositioned)(void *data,
|
||||
struct xdg_popup *xdg_popup,
|
||||
uint32_t token);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1726,6 +1811,7 @@ xdg_popup_add_listener(struct xdg_popup *xdg_popup,
|
|||
|
||||
#define XDG_POPUP_DESTROY 0
|
||||
#define XDG_POPUP_GRAB 1
|
||||
#define XDG_POPUP_REPOSITION 2
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_popup
|
||||
|
@ -1735,6 +1821,10 @@ xdg_popup_add_listener(struct xdg_popup *xdg_popup,
|
|||
* @ingroup iface_xdg_popup
|
||||
*/
|
||||
#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_popup
|
||||
*/
|
||||
#define XDG_POPUP_REPOSITIONED_SINCE_VERSION 3
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_popup
|
||||
|
@ -1744,6 +1834,10 @@ xdg_popup_add_listener(struct xdg_popup *xdg_popup,
|
|||
* @ingroup iface_xdg_popup
|
||||
*/
|
||||
#define XDG_POPUP_GRAB_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_popup
|
||||
*/
|
||||
#define XDG_POPUP_REPOSITION_SINCE_VERSION 3
|
||||
|
||||
/** @ingroup iface_xdg_popup */
|
||||
static inline void
|
||||
|
@ -1835,6 +1929,40 @@ xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t seria
|
|||
XDG_POPUP_GRAB, seat, serial);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_popup
|
||||
*
|
||||
* Reposition an already-mapped popup. The popup will be placed given the
|
||||
* details in the passed xdg_positioner object, and a
|
||||
* xdg_popup.repositioned followed by xdg_popup.configure and
|
||||
* xdg_surface.configure will be emitted in response. Any parameters set
|
||||
* by the previous positioner will be discarded.
|
||||
*
|
||||
* The passed token will be sent in the corresponding
|
||||
* xdg_popup.repositioned event. The new popup position will not take
|
||||
* effect until the corresponding configure event is acknowledged by the
|
||||
* client. See xdg_popup.repositioned for details. The token itself is
|
||||
* opaque, and has no other special meaning.
|
||||
*
|
||||
* If multiple reposition requests are sent, the compositor may skip all
|
||||
* but the last one.
|
||||
*
|
||||
* If the popup is repositioned in response to a configure event for its
|
||||
* parent, the client should send an xdg_positioner.set_parent_configure
|
||||
* and possibly a xdg_positioner.set_parent_size request to allow the
|
||||
* compositor to properly constrain the popup.
|
||||
*
|
||||
* If the popup is repositioned together with a parent that is being
|
||||
* resized, but not in response to a configure event, the client should
|
||||
* send a xdg_positioner.set_parent_size request.
|
||||
*/
|
||||
static inline void
|
||||
xdg_popup_reposition(struct xdg_popup *xdg_popup, struct xdg_positioner *positioner, uint32_t token)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_popup,
|
||||
XDG_POPUP_REPOSITION, positioner, token);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
/* -*- mode:ObjC -*-
|
||||
/* WaylandCairoSurface
|
||||
|
||||
WaylandCairoSurface - Draw with Cairo onto Wayland surfaces
|
||||
|
||||
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
Author: Sergio L. Pascual <slp@sinrega.org>
|
||||
Date: February 2016
|
||||
Rewrite: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
||||
Date: November 2021
|
||||
|
||||
This file is part of the GNU Objective C Backend Library.
|
||||
|
||||
|
@ -36,43 +39,45 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define GSWINDEVICE ((struct window *)gsDevice)
|
||||
#define GSWINDEVICE ((struct window *) gsDevice)
|
||||
|
||||
/* Linux specific version */
|
||||
static int
|
||||
os_create_anonymous_file(off_t size)
|
||||
{
|
||||
static const char template[] = "/weston-shared-XXXXXX";
|
||||
const char *path;
|
||||
char *name;
|
||||
int fd;
|
||||
static const char template[] = "/gnustep-shared-XXXXXX";
|
||||
const char *path;
|
||||
char *name;
|
||||
int fd;
|
||||
|
||||
path = getenv("XDG_RUNTIME_DIR");
|
||||
if (!path) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
path = getenv("XDG_RUNTIME_DIR");
|
||||
if (!path)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
name = malloc(strlen(path) + sizeof(template));
|
||||
if (!name)
|
||||
return -1;
|
||||
name = malloc(strlen(path) + sizeof(template));
|
||||
if (!name)
|
||||
return -1;
|
||||
|
||||
strcpy(name, path);
|
||||
strcat(name, template);
|
||||
strcpy(name, path);
|
||||
strcat(name, template);
|
||||
|
||||
fd = memfd_create(name, MFD_CLOEXEC);
|
||||
fd = memfd_create(name, MFD_CLOEXEC);
|
||||
|
||||
free(name);
|
||||
free(name);
|
||||
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
if (ftruncate(fd, size) != 0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
if (ftruncate(fd, size) != 0)
|
||||
{
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
return fd;
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
|
@ -84,154 +89,148 @@ shm_buffer_stride(struct window *window)
|
|||
static inline size_t
|
||||
shm_buffer_size(struct window *window)
|
||||
{
|
||||
return shm_buffer_stride(window) * window->height;
|
||||
return shm_buffer_stride(window) * window->height;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
create_shm_buffer(struct window *window)
|
||||
{
|
||||
struct wl_shm_pool *pool;
|
||||
cairo_surface_t *surface;
|
||||
int fd, size, stride;
|
||||
struct wl_shm_pool *pool;
|
||||
cairo_surface_t *surface;
|
||||
int fd, size, stride;
|
||||
|
||||
stride = shm_buffer_stride(window);
|
||||
size = shm_buffer_size(window);
|
||||
stride = shm_buffer_stride(window);
|
||||
size = shm_buffer_size(window);
|
||||
|
||||
NSDebugLog(@"WaylandCairoSurface: creating shm buffer of %d bytes", size);
|
||||
fd = os_create_anonymous_file(size);
|
||||
if (fd < 0) {
|
||||
NSLog(@"creating a buffer file for surface failed");
|
||||
return NULL;
|
||||
NSDebugLog(@"WaylandCairoSurface: creating shm buffer of %d bytes", size);
|
||||
fd = os_create_anonymous_file(size);
|
||||
if (fd < 0)
|
||||
{
|
||||
NSLog(@"creating a buffer file for surface failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
window->data =
|
||||
mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (window->data == MAP_FAILED) {
|
||||
NSLog(@"error mapping anonymous file");
|
||||
close(fd);
|
||||
return NULL;
|
||||
window->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (window->data == MAP_FAILED)
|
||||
{
|
||||
NSLog(@"error mapping anonymous file");
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pool = wl_shm_create_pool(window->wlconfig->shm, fd, size);
|
||||
pool = wl_shm_create_pool(window->wlconfig->shm, fd, size);
|
||||
|
||||
surface = cairo_image_surface_create_for_data(window->data,
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
window->width,
|
||||
window->height,
|
||||
stride);
|
||||
surface
|
||||
= cairo_image_surface_create_for_data(window->data, CAIRO_FORMAT_ARGB32,
|
||||
window->width, window->height,
|
||||
stride);
|
||||
|
||||
window->buffer =
|
||||
wl_shm_pool_create_buffer(pool, 0,
|
||||
window->width, window->height, stride,
|
||||
WL_SHM_FORMAT_ARGB8888);
|
||||
wl_shm_pool_destroy(pool);
|
||||
window->buffer
|
||||
= wl_shm_pool_create_buffer(pool, 0, window->width, window->height, stride,
|
||||
WL_SHM_FORMAT_ARGB8888);
|
||||
wl_shm_pool_destroy(pool);
|
||||
|
||||
close(fd);
|
||||
close(fd);
|
||||
|
||||
return surface;
|
||||
return surface;
|
||||
}
|
||||
|
||||
@implementation WaylandCairoSurface
|
||||
|
||||
- (id) initWithDevice: (void*)device
|
||||
- (id)initWithDevice:(void *)device
|
||||
{
|
||||
struct window *window = (struct window *) device;
|
||||
NSDebugLog(@"WaylandCairoSurface: initWithDevice win=%d", window->window_id);
|
||||
struct window *window = (struct window *) device;
|
||||
NSDebugLog(@"WaylandCairoSurface: initWithDevice win=%d", window->window_id);
|
||||
|
||||
gsDevice = device;
|
||||
gsDevice = device;
|
||||
|
||||
_surface = create_shm_buffer(window);
|
||||
if (_surface == NULL) {
|
||||
NSDebugLog(@"can't create cairo surface");
|
||||
return 0;
|
||||
}
|
||||
|
||||
wl_surface_attach(window->surface, window->buffer, 0, 0);
|
||||
window->wcs = self;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
struct window *window = (struct window*) gsDevice;
|
||||
NSDebugLog(@"WaylandCairoSurface: dealloc win=%d", window->window_id);
|
||||
|
||||
// FIXME: This is leaking memory. We need to *correctly* implement
|
||||
// the counterpart to create_shm_buffer.
|
||||
//
|
||||
// For instance, this is the wrong place to destroy the cairo surface:
|
||||
// cairo_surface_destroy(window->surface);
|
||||
// window->surface = NULL;
|
||||
// and likely to unmap the data, and destroy/release the buffer.
|
||||
// "Destroying the wl_buffer after wl_buffer.release does not change
|
||||
// the surface contents. However, if the client destroys the wl_buffer
|
||||
// before receiving the wl_buffer.release event, the surface contents
|
||||
// become undefined immediately."
|
||||
// Hence also skipping:
|
||||
// munmap(window->data, shm_buffer_size(window));
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSSize) size
|
||||
{
|
||||
NSDebugLog(@"WaylandCairoSurface: size");
|
||||
struct window *window = (struct window*) gsDevice;
|
||||
return NSMakeSize(window->width, window->height);
|
||||
}
|
||||
|
||||
- (void) setSurface: (cairo_surface_t*)surface
|
||||
{
|
||||
NSDebugLog(@"WaylandCairoSurface: setSurface");
|
||||
_surface = surface;
|
||||
}
|
||||
|
||||
- (void) handleExposeRect: (NSRect)rect
|
||||
{
|
||||
NSDebugLog(@"handleExposeRect");
|
||||
struct window *window = (struct window*) gsDevice;
|
||||
cairo_surface_t *cairo_surface = _surface;
|
||||
double backupOffsetX = 0;
|
||||
double backupOffsetY = 0;
|
||||
int x = NSMinX(rect);
|
||||
int y = NSMinY(rect);
|
||||
int width = NSWidth(rect);
|
||||
int height = NSHeight(rect);
|
||||
|
||||
NSDebugLog(@"updating region: %dx%d %dx%d", x, y, width, height);
|
||||
|
||||
if (cairo_surface_status(cairo_surface) != CAIRO_STATUS_SUCCESS)
|
||||
_surface = create_shm_buffer(window);
|
||||
window->buffer_needs_attach = YES;
|
||||
if (_surface == NULL)
|
||||
{
|
||||
NSWarnMLog(@"cairo initial window error status: %s\n",
|
||||
cairo_status_to_string(cairo_surface_status(_surface)));
|
||||
NSDebugLog(@"can't create cairo surface");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cairo_surface_get_device_offset(cairo_surface, &backupOffsetX, &backupOffsetY);
|
||||
cairo_surface_set_device_offset(cairo_surface, 0, 0);
|
||||
|
||||
// FIXME: This seems to be creating a context to paint into cairo_surface,
|
||||
// and then copies back into the same cairo_surface.
|
||||
cairo_t *cr = cairo_create(cairo_surface);
|
||||
|
||||
cairo_rectangle(cr, x, y, width, height);
|
||||
cairo_clip(cr);
|
||||
cairo_set_source_surface(cr, cairo_surface, 0, 0);
|
||||
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint(cr);
|
||||
|
||||
cairo_destroy(cr);
|
||||
|
||||
NSDebugLog(@"trying to commit cairo surface for window %d", window->window_id);
|
||||
if (window->configured)
|
||||
if (window->configured)
|
||||
{
|
||||
// we can attach a buffer to the surface only if the surface is configured
|
||||
// this is usually done in the configure event handler
|
||||
// in case of resize of an already configured surface
|
||||
// we should reattach the new allocated buffer
|
||||
NSDebugLog(@"wl_surface_attach: win=%d toplevel_surface",
|
||||
window->window_id);
|
||||
window->buffer_needs_attach = NO;
|
||||
wl_surface_attach(window->surface, window->buffer, 0, 0);
|
||||
wl_surface_commit(window->surface);
|
||||
NSDebugLog(@"done trying to commit cairo surface for window %d", window->window_id);
|
||||
wl_display_dispatch_pending(window->wlconfig->display);
|
||||
wl_display_flush(window->wlconfig->display);
|
||||
}
|
||||
window->wcs = self;
|
||||
|
||||
cairo_surface_set_device_offset(_surface, backupOffsetX, backupOffsetY);
|
||||
return self;
|
||||
}
|
||||
|
||||
NSDebugLog(@"handleExposeRect exit");
|
||||
- (void)dealloc
|
||||
{
|
||||
struct window *window = (struct window *) gsDevice;
|
||||
NSDebugLog(@"WaylandCairoSurface: dealloc win=%d", window->window_id);
|
||||
|
||||
// FIXME: This is leaking memory. We need to *correctly* implement
|
||||
// the counterpart to create_shm_buffer.
|
||||
//
|
||||
// For instance, this is the wrong place to destroy the cairo surface:
|
||||
// cairo_surface_destroy(window->surface);
|
||||
// window->surface = NULL;
|
||||
// and likely to unmap the data, and destroy/release the buffer.
|
||||
// "Destroying the wl_buffer after wl_buffer.release does not change
|
||||
// the surface contents. However, if the client destroys the wl_buffer
|
||||
// before receiving the wl_buffer.release event, the surface contents
|
||||
// become undefined immediately."
|
||||
// Hence also skipping:
|
||||
// munmap(window->data, shm_buffer_size(window));
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSSize)size
|
||||
{
|
||||
// NSDebugLog(@"WaylandCairoSurface: size");
|
||||
struct window *window = (struct window *) gsDevice;
|
||||
return NSMakeSize(window->width, window->height);
|
||||
}
|
||||
|
||||
- (void)setSurface:(cairo_surface_t *)surface
|
||||
{
|
||||
// NSDebugLog(@"WaylandCairoSurface: setSurface");
|
||||
_surface = surface;
|
||||
}
|
||||
|
||||
- (void)handleExposeRect:(NSRect)rect
|
||||
{
|
||||
struct window *window = (struct window *) gsDevice;
|
||||
NSDebugLog(@"[CairoSurface handleExposeRect] %d", window->window_id);
|
||||
|
||||
int x = NSMinX(rect);
|
||||
int y = NSMinY(rect);
|
||||
int width = NSWidth(rect);
|
||||
int height = NSHeight(rect);
|
||||
|
||||
window->buffer_needs_attach = YES;
|
||||
|
||||
if (window->configured)
|
||||
{
|
||||
window->buffer_needs_attach = NO;
|
||||
wl_surface_attach(window->surface, window->buffer, 0, 0);
|
||||
NSDebugLog(@"[%d] updating region: %d,%d %dx%d", window->window_id, 0, 0,
|
||||
window->width, window->height);
|
||||
// FIXME we should update only the damaged area define as x,y,width,height
|
||||
// at the moment it doesnt work
|
||||
wl_surface_damage(window->surface, 0, 0, window->width, window->height);
|
||||
wl_surface_commit(window->surface);
|
||||
wl_display_dispatch_pending(window->wlconfig->display);
|
||||
wl_display_flush(window->wlconfig->display);
|
||||
}
|
||||
|
||||
// NSDebugLog(@"[CairoSurface handleExposeRect end]");
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -40,10 +40,17 @@ wayland_LOCALIZED_RESOURCE_FILES = \
|
|||
# The C source files to be compiled
|
||||
wayland_C_FILES = \
|
||||
xdg-shell-protocol.c \
|
||||
wlr-layer-shell-protocol.c \
|
||||
|
||||
# The Objective-C source files to be compiled
|
||||
wayland_OBJC_FILES = \
|
||||
WaylandServer.m \
|
||||
WaylandServer+Output.m \
|
||||
WaylandServer+Cursor.m \
|
||||
WaylandServer+Keyboard.m \
|
||||
WaylandServer+Seat.m \
|
||||
WaylandServer+Xdgshell.m \
|
||||
WaylandServer+Layershell.m \
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
||||
|
|
650
Source/wayland/WaylandServer+Cursor.m
Executable file
650
Source/wayland/WaylandServer+Cursor.m
Executable file
|
@ -0,0 +1,650 @@
|
|||
/*
|
||||
WaylandServer - Cursor Handling
|
||||
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
||||
Date: November 2021
|
||||
|
||||
This file is part of the GNU Objective C Backend Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "wayland/WaylandServer.h"
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/GSWindowDecorationView.h>
|
||||
#include <AppKit/GSTheme.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
static void
|
||||
pointer_handle_enter(void *data, struct wl_pointer *pointer, uint32_t serial,
|
||||
struct wl_surface *surface, wl_fixed_t sx_w,
|
||||
wl_fixed_t sy_w)
|
||||
{
|
||||
if (!surface)
|
||||
{
|
||||
NSDebugLog(@"no surface");
|
||||
return;
|
||||
}
|
||||
|
||||
WaylandConfig *wlconfig = data;
|
||||
struct window *window = wl_surface_get_user_data(surface);
|
||||
float sx = wl_fixed_to_double(sx_w);
|
||||
float sy = wl_fixed_to_double(sy_w);
|
||||
[GSCurrentServer() initializeMouseIfRequired];
|
||||
|
||||
wlconfig->pointer.x = sx;
|
||||
wlconfig->pointer.y = sy;
|
||||
wlconfig->pointer.focus = window;
|
||||
|
||||
// FIXME: Send NSMouseEntered event.
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_handle_leave(void *data, struct wl_pointer *pointer, uint32_t serial,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
if (!surface)
|
||||
{
|
||||
NSDebugLog(@"no surface");
|
||||
return;
|
||||
}
|
||||
|
||||
WaylandConfig *wlconfig = data;
|
||||
struct window *window = wl_surface_get_user_data(surface);
|
||||
[GSCurrentServer() initializeMouseIfRequired];
|
||||
|
||||
if (wlconfig->pointer.focus->window_id == window->window_id)
|
||||
{
|
||||
wlconfig->pointer.focus = NULL;
|
||||
wlconfig->pointer.serial = 0;
|
||||
}
|
||||
|
||||
// FIXME: Send NSMouseExited event.
|
||||
}
|
||||
|
||||
// triggered when the cursor is over a surface
|
||||
static void
|
||||
pointer_handle_motion(void *data, struct wl_pointer *pointer, uint32_t time,
|
||||
wl_fixed_t sx_w, wl_fixed_t sy_w)
|
||||
{
|
||||
WaylandConfig *wlconfig = data;
|
||||
struct window *window;
|
||||
if (window->moving || window->resizing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
float sx = wl_fixed_to_double(sx_w);
|
||||
float sy = wl_fixed_to_double(sy_w);
|
||||
|
||||
[GSCurrentServer() initializeMouseIfRequired];
|
||||
|
||||
if (wlconfig->pointer.focus && wlconfig->pointer.serial)
|
||||
{
|
||||
window = wlconfig->pointer.focus;
|
||||
NSEvent *event;
|
||||
NSEventType eventType;
|
||||
NSPoint eventLocation;
|
||||
NSGraphicsContext *gcontext;
|
||||
unsigned int eventFlags;
|
||||
float deltaX = sx - window->wlconfig->pointer.x;
|
||||
float deltaY = sy - window->wlconfig->pointer.y;
|
||||
|
||||
// NSDebugLog(@"obtaining locations: wayland=%fx%f pointer=%fx%f",
|
||||
// sx, sy, window->wlconfig->pointer.x,
|
||||
//window->wlconfig->pointer.y);
|
||||
|
||||
gcontext = GSCurrentContext();
|
||||
eventLocation = NSMakePoint(sx, window->height - sy);
|
||||
|
||||
eventFlags = 0;
|
||||
eventType = NSLeftMouseDragged;
|
||||
|
||||
// NSDebugLog(@"sending pointer delta: %fx%f, window=%d", deltaX,
|
||||
//deltaY, window->window_id);
|
||||
|
||||
event = [NSEvent mouseEventWithType:eventType
|
||||
location:eventLocation
|
||||
modifierFlags:eventFlags
|
||||
timestamp:(NSTimeInterval) time / 1000.0
|
||||
windowNumber:(int) window->window_id
|
||||
context:gcontext
|
||||
eventNumber:time
|
||||
clickCount:1
|
||||
pressure:1.0
|
||||
buttonNumber:0 /* FIXME */
|
||||
deltaX:deltaX
|
||||
deltaY:deltaY
|
||||
deltaZ:0.];
|
||||
|
||||
[GSCurrentServer() postEvent:event atStart:NO];
|
||||
}
|
||||
|
||||
wlconfig->pointer.x = sx;
|
||||
wlconfig->pointer.y = sy;
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
|
||||
uint32_t time, uint32_t button, uint32_t state_w)
|
||||
{
|
||||
WaylandConfig *wlconfig = data;
|
||||
NSEvent *event;
|
||||
NSEventType eventType;
|
||||
NSPoint eventLocation;
|
||||
NSGraphicsContext *gcontext;
|
||||
unsigned int eventFlags;
|
||||
float deltaX = 0.0;
|
||||
float deltaY = 0.0;
|
||||
int clickCount = 1;
|
||||
int tick;
|
||||
int buttonNumber;
|
||||
enum wl_pointer_button_state state = state_w;
|
||||
struct window *window = wlconfig->pointer.focus;
|
||||
|
||||
[GSCurrentServer() initializeMouseIfRequired];
|
||||
|
||||
gcontext = GSCurrentContext();
|
||||
eventLocation
|
||||
= NSMakePoint(wlconfig->pointer.x, window->height - wlconfig->pointer.y);
|
||||
eventFlags = 0;
|
||||
|
||||
if (window->toplevel)
|
||||
{
|
||||
// if the window is a toplevel we check if the event is for resizing or
|
||||
// moving the window these actions are delegated to the compositor and
|
||||
// therefore we skip forwarding the events to the NSWindow / NSView
|
||||
|
||||
NSWindow *nswindow = GSWindowWithNumber(window->window_id);
|
||||
if (nswindow != nil)
|
||||
{
|
||||
GSWindowDecorationView *wd = [GSWindowDecorationView windowDecorator];
|
||||
// NSPoint p = [[nswindow contentView] convertPoint:
|
||||
// eventLocation fromView: nil];
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
CGFloat titleHeight = [theme titlebarHeight];
|
||||
CGFloat resizebarHeight = [theme resizebarHeight];
|
||||
NSRect windowframe = [nswindow frame];
|
||||
NSDebugLog(@"[%d] titleHeight: %f", window->window_id, titleHeight);
|
||||
NSDebugLog(@"[%d] resizebarHeight: %f", window->window_id,
|
||||
resizebarHeight);
|
||||
NSDebugLog(@"[%d] windowframe: %f,%f %fx%f", windowframe.origin.x,
|
||||
windowframe.origin.y, windowframe.size.width,
|
||||
windowframe.size.height);
|
||||
NSDebugLog(@"[%d] eventLocation: %f,%f", window->window_id,
|
||||
eventLocation.x, eventLocation.y);
|
||||
|
||||
NSRect titleBarRect = NSZeroRect;
|
||||
NSRect resizeBarRect = NSZeroRect;
|
||||
NSRect closeButtonRect = NSZeroRect;
|
||||
NSRect miniaturizeButtonRect = NSZeroRect;
|
||||
NSUInteger styleMask = [nswindow styleMask];
|
||||
bool hasTitleBar = NO;
|
||||
bool hasResizeBar = NO;
|
||||
bool hasCloseButton = NO;
|
||||
bool hasMiniaturizeButton = NO;
|
||||
|
||||
// wayland controls the window move / resize
|
||||
|
||||
if (styleMask
|
||||
& (NSTitledWindowMask | NSClosableWindowMask
|
||||
| NSMiniaturizableWindowMask))
|
||||
{
|
||||
hasTitleBar = YES;
|
||||
titleBarRect
|
||||
= NSMakeRect(0.0, windowframe.size.height - titleHeight,
|
||||
windowframe.size.width, titleHeight);
|
||||
|
||||
NSDebugLog(@"[%d] titleBarRect: %f,%f %fx%f",
|
||||
titleBarRect.origin.x, titleBarRect.origin.y,
|
||||
titleBarRect.size.width, titleBarRect.size.height);
|
||||
}
|
||||
|
||||
if (styleMask & NSResizableWindowMask)
|
||||
{
|
||||
hasResizeBar = YES;
|
||||
float padding = 10.0;
|
||||
resizeBarRect = NSMakeRect(-padding, -padding,
|
||||
windowframe.size.width + padding * 2,
|
||||
resizebarHeight + padding * 2);
|
||||
|
||||
NSDebugLog(@"[%d] resizeBarRect: %f,%f %fx%f",
|
||||
resizeBarRect.origin.x, resizeBarRect.origin.y,
|
||||
resizeBarRect.size.width, resizeBarRect.size.height);
|
||||
}
|
||||
|
||||
if (styleMask & NSClosableWindowMask)
|
||||
{
|
||||
hasCloseButton = YES;
|
||||
|
||||
closeButtonRect
|
||||
= NSMakeRect(windowframe.size.width - [theme titlebarButtonSize]
|
||||
- [theme titlebarPaddingRight],
|
||||
windowframe.size.height -
|
||||
[theme titlebarButtonSize] -
|
||||
[theme titlebarPaddingTop],
|
||||
[theme titlebarButtonSize],
|
||||
[theme titlebarButtonSize]);
|
||||
}
|
||||
|
||||
if (styleMask & NSMiniaturizableWindowMask)
|
||||
{
|
||||
hasMiniaturizeButton = YES;
|
||||
miniaturizeButtonRect = NSMakeRect([theme titlebarPaddingLeft],
|
||||
windowframe.size.height -
|
||||
[theme titlebarButtonSize] -
|
||||
[theme titlebarPaddingTop],
|
||||
[theme titlebarButtonSize],
|
||||
[theme titlebarButtonSize]);
|
||||
}
|
||||
|
||||
if (hasTitleBar && !NSPointInRect(eventLocation, closeButtonRect)
|
||||
&& !NSPointInRect(eventLocation, miniaturizeButtonRect)
|
||||
&& NSPointInRect(eventLocation, titleBarRect))
|
||||
{
|
||||
NSDebugLog(@"[%d] point in titleBarRect [%f,%f] [%f,%f %fx%f]",
|
||||
window->window_id, eventLocation.x, eventLocation.y,
|
||||
titleBarRect.origin.x, titleBarRect.origin.y,
|
||||
titleBarRect.size.width, titleBarRect.size.height);
|
||||
|
||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||
{
|
||||
xdg_toplevel_move(window->toplevel, wlconfig->seat, serial);
|
||||
window->moving = YES;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
window->moving = NO;
|
||||
}
|
||||
}
|
||||
if (hasResizeBar && NSPointInRect(eventLocation, resizeBarRect))
|
||||
{
|
||||
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
|
||||
NSDebugLog(@"[%d] point in resizeBarRect [%f,%f] [%f,%f %fx%f]",
|
||||
window->window_id, eventLocation.x, eventLocation.y,
|
||||
resizeBarRect.origin.x, resizeBarRect.origin.y,
|
||||
resizeBarRect.size.width, resizeBarRect.size.height);
|
||||
|
||||
if (resizeBarRect.size.width < 30 * 2
|
||||
&& eventLocation.x < resizeBarRect.size.width / 2)
|
||||
{
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
|
||||
}
|
||||
else if (eventLocation.x > resizeBarRect.size.width - 30)
|
||||
{
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
|
||||
}
|
||||
else if (eventLocation.x < 29)
|
||||
{
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
|
||||
}
|
||||
|
||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||
{
|
||||
xdg_toplevel_resize(window->toplevel, wlconfig->seat, serial,
|
||||
edges);
|
||||
window->resizing = YES;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
window->resizing = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // endif window->toplevel
|
||||
|
||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||
{
|
||||
if (button == wlconfig->pointer.last_click_button
|
||||
&& time - wlconfig->pointer.last_click_time < 300
|
||||
&& abs(wlconfig->pointer.x - wlconfig->pointer.last_click_x) < 3
|
||||
&& abs(wlconfig->pointer.y - wlconfig->pointer.last_click_y) < 3)
|
||||
{
|
||||
wlconfig->pointer.last_click_time = 0;
|
||||
clickCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugLog(@"handle_button MISS: b=%d t=%d x=%f y=%f", button, time,
|
||||
wlconfig->pointer.x, wlconfig->pointer.y);
|
||||
wlconfig->pointer.last_click_button = button;
|
||||
wlconfig->pointer.last_click_time = time;
|
||||
wlconfig->pointer.last_click_x = wlconfig->pointer.x;
|
||||
wlconfig->pointer.last_click_y = wlconfig->pointer.y;
|
||||
}
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case BTN_LEFT:
|
||||
eventType = NSLeftMouseDown;
|
||||
break;
|
||||
case BTN_RIGHT:
|
||||
eventType = NSRightMouseDown;
|
||||
break;
|
||||
case BTN_MIDDLE:
|
||||
eventType = NSOtherMouseDown;
|
||||
break;
|
||||
// TODO: handle BTN_SIDE, BTN_EXTRA, BTN_FORWARD, BTN_BACK and other
|
||||
// constants in libinput.
|
||||
// We may just want to send NSOtherMouseDown and populate buttonNumber
|
||||
// with the libinput constant?
|
||||
}
|
||||
wlconfig->pointer.serial = serial;
|
||||
}
|
||||
else if (state == WL_POINTER_BUTTON_STATE_RELEASED)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
case BTN_LEFT:
|
||||
eventType = NSLeftMouseUp;
|
||||
break;
|
||||
case BTN_RIGHT:
|
||||
eventType = NSRightMouseUp;
|
||||
break;
|
||||
case BTN_MIDDLE:
|
||||
eventType = NSOtherMouseUp;
|
||||
break;
|
||||
}
|
||||
wlconfig->pointer.serial = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* FIXME: unlike in _motion and _axis handlers, the argument used in _button
|
||||
is the "serial" of the event, not passed and unavailable in _motion and
|
||||
_axis handlers. Is it allowed to pass "serial" as the eventNumber: in
|
||||
_button handler, but "time" as the eventNumber: in the _motion and _axis
|
||||
handlers? */
|
||||
tick = serial;
|
||||
|
||||
NSDebugLog(@"sending pointer event at: %fx%f, window=%d", wlconfig->pointer.x,
|
||||
wlconfig->pointer.y, window->window_id);
|
||||
|
||||
/* FIXME: X11 backend uses the XGetPointerMapping()-returned values from
|
||||
its map_return argument as constants for buttonNumber. As the variant
|
||||
with buttonNumber: seems to be a GNUstep extension, and the value
|
||||
internal, it might be ok to just provide libinput constant as we're doing
|
||||
here. If this is truly correct, please update this comment to document
|
||||
the correctness of doing so. */
|
||||
buttonNumber = button;
|
||||
|
||||
event = [NSEvent mouseEventWithType:eventType
|
||||
location:eventLocation
|
||||
modifierFlags:eventFlags
|
||||
timestamp:(NSTimeInterval) time / 1000.0
|
||||
windowNumber:(int) window->window_id
|
||||
context:gcontext
|
||||
eventNumber:tick
|
||||
clickCount:clickCount
|
||||
pressure:1.0
|
||||
buttonNumber:buttonNumber
|
||||
deltaX:deltaX /* FIXME unused */
|
||||
deltaY:deltaY /* FIXME unused */
|
||||
deltaZ:0.];
|
||||
|
||||
[GSCurrentServer() postEvent:event atStart:NO];
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_handle_axis(void *data, struct wl_pointer *pointer, uint32_t time,
|
||||
uint32_t axis, wl_fixed_t value)
|
||||
{
|
||||
NSDebugLog(@"pointer_handle_axis: axis=%d value=%g", axis,
|
||||
wl_fixed_to_double(value));
|
||||
WaylandConfig *wlconfig = data;
|
||||
NSEvent *event;
|
||||
NSEventType eventType;
|
||||
NSPoint eventLocation;
|
||||
NSGraphicsContext *gcontext;
|
||||
unsigned int eventFlags;
|
||||
float deltaX = 0.0;
|
||||
float deltaY = 0.0;
|
||||
int clickCount = 1;
|
||||
int buttonNumber;
|
||||
|
||||
struct window *window = wlconfig->pointer.focus;
|
||||
|
||||
[GSCurrentServer() initializeMouseIfRequired];
|
||||
|
||||
gcontext = GSCurrentContext();
|
||||
eventLocation
|
||||
= NSMakePoint(wlconfig->pointer.x, window->height - wlconfig->pointer.y);
|
||||
eventFlags = 0;
|
||||
|
||||
/* FIXME: we should get axis_source out of wl_pointer; however, the wl_pointer
|
||||
is not defined in wayland-client.h. How does one get the axis_source out of
|
||||
it to confirm the source is the physical mouse wheel? */
|
||||
#if 0
|
||||
if (pointer->axis_source != WL_POINTER_AXIS_SOURCE_WHEEL)
|
||||
return;
|
||||
#endif
|
||||
|
||||
float mouse_scroll_multiplier = wlconfig->mouse_scroll_multiplier;
|
||||
/* For smooth-scroll events, we're not doing any cross-event or delta
|
||||
calculations, as is done in button event handling. */
|
||||
switch (axis)
|
||||
{
|
||||
case WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
eventType = NSScrollWheel;
|
||||
deltaY = wl_fixed_to_double(value) * wlconfig->mouse_scroll_multiplier;
|
||||
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
|
||||
eventType = NSScrollWheel;
|
||||
deltaX = wl_fixed_to_double(value) * wlconfig->mouse_scroll_multiplier;
|
||||
}
|
||||
|
||||
NSDebugLog(@"sending pointer scroll at: %fx%f, value %fx%f, window=%d",
|
||||
wlconfig->pointer.x, wlconfig->pointer.y, deltaX, deltaY,
|
||||
window->window_id);
|
||||
|
||||
/* FIXME: X11 backend uses the XGetPointerMapping()-returned values from
|
||||
its map_return argument as constants for buttonNumber. As the variant
|
||||
with buttonNumber: seems to be a GNUstep extension, and the value
|
||||
internal, it might be ok to just not provide any value here.
|
||||
If this is truly correct, please update this comment to document
|
||||
the correctness of doing so. */
|
||||
buttonNumber = 0;
|
||||
|
||||
event = [NSEvent mouseEventWithType:eventType
|
||||
location:eventLocation
|
||||
modifierFlags:eventFlags
|
||||
timestamp:(NSTimeInterval) time / 1000.0
|
||||
windowNumber:(int) window->window_id
|
||||
context:gcontext
|
||||
eventNumber:time
|
||||
clickCount:clickCount
|
||||
pressure:1.0
|
||||
buttonNumber:buttonNumber
|
||||
deltaX:deltaX
|
||||
deltaY:deltaY
|
||||
deltaZ:0.];
|
||||
|
||||
[GSCurrentServer() postEvent:event atStart:NO];
|
||||
}
|
||||
|
||||
const struct wl_pointer_listener pointer_listener = {
|
||||
pointer_handle_enter, pointer_handle_leave, pointer_handle_motion,
|
||||
pointer_handle_button, pointer_handle_axis,
|
||||
};
|
||||
|
||||
@implementation
|
||||
WaylandServer (Cursor)
|
||||
- (NSPoint)mouselocation
|
||||
{
|
||||
int aScreen = -1;
|
||||
struct output *output;
|
||||
|
||||
NSDebugLog(@"mouselocation");
|
||||
|
||||
// FIXME: find a cleaner way to get the first element of a wl_list
|
||||
wl_list_for_each(output, &wlconfig->output_list, link)
|
||||
{
|
||||
aScreen = output->server_output_id;
|
||||
break;
|
||||
}
|
||||
if (aScreen < 0)
|
||||
// No outputs in the wl_list.
|
||||
return NSZeroPoint;
|
||||
|
||||
return [self mouseLocationOnScreen:aScreen window:NULL];
|
||||
}
|
||||
|
||||
- (NSPoint)mouseLocationOnScreen:(int)aScreen window:(int *)win
|
||||
{
|
||||
// NSDebugLog(@"mouseLocationOnScreen: %d %fx%f", win,
|
||||
// wlconfig->pointer.x, wlconfig->pointer.y);
|
||||
struct window *window = wlconfig->pointer.focus;
|
||||
struct output *output;
|
||||
float x;
|
||||
float y;
|
||||
|
||||
/*if (wlconfig->pointer.serial) {
|
||||
NSDebugLog(@"captured");
|
||||
x = wlconfig->pointer.captured_x;
|
||||
y = wlconfig->pointer.captured_y;
|
||||
} else*/
|
||||
{
|
||||
// NSDebugLog(@"NOT captured");
|
||||
x = wlconfig->pointer.x;
|
||||
y = wlconfig->pointer.y;
|
||||
|
||||
if (window)
|
||||
{
|
||||
x += window->pos_x;
|
||||
y += window->pos_y;
|
||||
if (win)
|
||||
{
|
||||
*win = &window->window_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wl_list_for_each(output, &wlconfig->output_list, link)
|
||||
{
|
||||
if (output->server_output_id == aScreen)
|
||||
{
|
||||
y = output->height - y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// NSDebugLog(@"mouseLocationOnScreen: returning %fx%f", x, y);
|
||||
|
||||
return NSMakePoint(x, y);
|
||||
}
|
||||
|
||||
- (BOOL)capturemouse:(int)win
|
||||
{
|
||||
NSDebugLog(@"capturemouse: %d", win);
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)releasemouse
|
||||
{
|
||||
NSDebugLog(@"releasemouse");
|
||||
}
|
||||
|
||||
- (void)setMouseLocation:(NSPoint)mouseLocation onScreen:(int)aScreen
|
||||
{
|
||||
NSDebugLog(@"setMouseLocation");
|
||||
}
|
||||
|
||||
- (void)hidecursor
|
||||
{
|
||||
NSDebugLog(@"hidecursor");
|
||||
}
|
||||
|
||||
- (void)showcursor
|
||||
{
|
||||
NSDebugLog(@"showcursor");
|
||||
}
|
||||
|
||||
- (void)standardcursor:(int)style:(void **)cid
|
||||
{
|
||||
NSDebugLog(@"standardcursor");
|
||||
}
|
||||
|
||||
- (void)imagecursor:(NSPoint)hotp:(NSImage *)image:(void **)cid
|
||||
{
|
||||
NSDebugLog(@"imagecursor");
|
||||
}
|
||||
|
||||
- (void)setcursorcolor:(NSColor *)fg:(NSColor *)bg:(void *)cid
|
||||
{
|
||||
NSLog(@"Call to obsolete method -setcursorcolor:::");
|
||||
[self recolorcursor:fg:bg:cid];
|
||||
[self setcursor:cid];
|
||||
}
|
||||
|
||||
- (void)recolorcursor:(NSColor *)fg:(NSColor *)bg:(void *)cid
|
||||
{
|
||||
NSDebugLog(@"recolorcursor");
|
||||
}
|
||||
|
||||
- (void)setcursor:(void *)cid
|
||||
{
|
||||
NSDebugLog(@"setcursor");
|
||||
}
|
||||
|
||||
- (void)freecursor:(void *)cid
|
||||
{
|
||||
NSDebugLog(@"freecursor");
|
||||
}
|
||||
- (void)setIgnoreMouse:(BOOL)ignoreMouse:(int)win
|
||||
{
|
||||
NSDebugLog(@"setIgnoreMouse");
|
||||
}
|
||||
|
||||
- (void)initializeMouseIfRequired
|
||||
{
|
||||
if (!_mouseInitialized)
|
||||
[self initializeMouse];
|
||||
}
|
||||
|
||||
- (void)initializeMouse
|
||||
{
|
||||
_mouseInitialized = YES;
|
||||
|
||||
[self mouseOptionsChanged:nil];
|
||||
[[NSDistributedNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(mouseOptionsChanged:)
|
||||
name:NSUserDefaultsDidChangeNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (void)mouseOptionsChanged:(NSNotification *)aNotif
|
||||
{
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
wlconfig->mouse_scroll_multiplier =
|
||||
[defs integerForKey:@"GSMouseScrollMultiplier"];
|
||||
if (wlconfig->mouse_scroll_multiplier < 0.0001f)
|
||||
wlconfig->mouse_scroll_multiplier = 1.0f;
|
||||
}
|
||||
@end
|
223
Source/wayland/WaylandServer+Keyboard.m
Executable file
223
Source/wayland/WaylandServer+Keyboard.m
Executable file
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
WaylandServer - Keyboard Handling
|
||||
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
||||
Date: November 2021
|
||||
|
||||
This file is part of the GNU Objective C Backend Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "wayland/WaylandServer.h"
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <linux/input.h>
|
||||
#include <AppKit/NSText.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
static void
|
||||
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
|
||||
uint32_t format, int fd, uint32_t size)
|
||||
{
|
||||
NSDebugLog(@"keyboard_handle_keymap");
|
||||
WaylandConfig *wlconfig = data;
|
||||
struct xkb_keymap *keymap;
|
||||
struct xkb_state *state;
|
||||
char *map_str;
|
||||
|
||||
if (!data)
|
||||
{
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1)
|
||||
{
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (map_str == MAP_FAILED)
|
||||
{
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
wlconfig->xkb_context = xkb_context_new(0);
|
||||
if (wlconfig->xkb_context == NULL)
|
||||
{
|
||||
fprintf(stderr, "Failed to create XKB context\n");
|
||||
return;
|
||||
}
|
||||
|
||||
keymap = xkb_keymap_new_from_string(wlconfig->xkb_context, map_str,
|
||||
XKB_KEYMAP_FORMAT_TEXT_V1, 0);
|
||||
munmap(map_str, size);
|
||||
close(fd);
|
||||
|
||||
if (!keymap)
|
||||
{
|
||||
fprintf(stderr, "failed to compile keymap\n");
|
||||
return;
|
||||
}
|
||||
|
||||
state = xkb_state_new(keymap);
|
||||
if (!state)
|
||||
{
|
||||
fprintf(stderr, "failed to create XKB state\n");
|
||||
xkb_keymap_unref(keymap);
|
||||
return;
|
||||
}
|
||||
|
||||
xkb_keymap_unref(wlconfig->xkb.keymap);
|
||||
xkb_state_unref(wlconfig->xkb.state);
|
||||
wlconfig->xkb.keymap = keymap;
|
||||
wlconfig->xkb.state = state;
|
||||
|
||||
wlconfig->xkb.control_mask
|
||||
= 1 << xkb_keymap_mod_get_index(wlconfig->xkb.keymap, "Control");
|
||||
wlconfig->xkb.alt_mask
|
||||
= 1 << xkb_keymap_mod_get_index(wlconfig->xkb.keymap, "Mod1");
|
||||
wlconfig->xkb.shift_mask
|
||||
= 1 << xkb_keymap_mod_get_index(wlconfig->xkb.keymap, "Shift");
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial,
|
||||
struct wl_surface *surface, struct wl_array *keys)
|
||||
{
|
||||
// NSDebugLog(@"keyboard_handle_enter");
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
// NSDebugLog(@"keyboard_handle_leave");
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
|
||||
uint32_t serial, uint32_t mods_depressed,
|
||||
uint32_t mods_latched, uint32_t mods_locked,
|
||||
uint32_t group)
|
||||
{
|
||||
// NSDebugLog(@"keyboard_handle_modifiers");
|
||||
WaylandConfig *wlconfig = data;
|
||||
xkb_mod_mask_t mask;
|
||||
|
||||
/* If we're not using a keymap, then we don't handle PC-style modifiers */
|
||||
if (!wlconfig->xkb.keymap)
|
||||
return;
|
||||
|
||||
xkb_state_update_mask(wlconfig->xkb.state, mods_depressed, mods_latched,
|
||||
mods_locked, 0, 0, group);
|
||||
mask
|
||||
= xkb_state_serialize_mods(wlconfig->xkb.state, XKB_STATE_MODS_DEPRESSED
|
||||
| XKB_STATE_MODS_LATCHED);
|
||||
wlconfig->modifiers = 0;
|
||||
if (mask & wlconfig->xkb.control_mask)
|
||||
wlconfig->modifiers |= NSCommandKeyMask;
|
||||
if (mask & wlconfig->xkb.alt_mask)
|
||||
wlconfig->modifiers |= NSAlternateKeyMask;
|
||||
if (mask & wlconfig->xkb.shift_mask)
|
||||
wlconfig->modifiers |= NSShiftKeyMask;
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,
|
||||
uint32_t time, uint32_t key, uint32_t state_w)
|
||||
{
|
||||
// NSDebugLog(@"keyboard_handle_key: %d", key);
|
||||
WaylandConfig *wlconfig = data;
|
||||
uint32_t code, num_syms;
|
||||
enum wl_keyboard_key_state state = state_w;
|
||||
const xkb_keysym_t *syms;
|
||||
xkb_keysym_t sym;
|
||||
struct window *window = wlconfig->pointer.focus;
|
||||
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
code = 0;
|
||||
if (key == 28)
|
||||
{
|
||||
sym = NSCarriageReturnCharacter;
|
||||
}
|
||||
else if (key == 14)
|
||||
{
|
||||
sym = NSDeleteCharacter;
|
||||
}
|
||||
else
|
||||
{
|
||||
code = key + 8;
|
||||
|
||||
num_syms = xkb_state_key_get_syms(wlconfig->xkb.state, code, &syms);
|
||||
|
||||
sym = XKB_KEY_NoSymbol;
|
||||
if (num_syms == 1)
|
||||
sym = syms[0];
|
||||
}
|
||||
|
||||
NSString *s = [NSString stringWithUTF8String:&sym];
|
||||
NSEventType eventType;
|
||||
|
||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
||||
{
|
||||
eventType = NSKeyDown;
|
||||
}
|
||||
else
|
||||
{
|
||||
eventType = NSKeyUp;
|
||||
}
|
||||
|
||||
NSEvent *ev = [NSEvent keyEventWithType:eventType
|
||||
location:NSZeroPoint
|
||||
modifierFlags:wlconfig->modifiers
|
||||
timestamp:time / 1000.0
|
||||
windowNumber:window->window_id
|
||||
context:GSCurrentContext()
|
||||
characters:s
|
||||
charactersIgnoringModifiers:s
|
||||
isARepeat:NO
|
||||
keyCode:code];
|
||||
|
||||
[GSCurrentServer() postEvent:ev atStart:NO];
|
||||
|
||||
// NSDebugLog(@"keyboard_handle_key: %@", s);
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_handle_repeat_info(void *data, struct wl_keyboard *keyboard,
|
||||
int32_t rate, int32_t delay)
|
||||
{
|
||||
// NSDebugLog(@"keyboard_handle_repeat_info");
|
||||
}
|
||||
|
||||
const struct wl_keyboard_listener keyboard_listener
|
||||
= {keyboard_handle_keymap, keyboard_handle_enter,
|
||||
keyboard_handle_leave, keyboard_handle_key,
|
||||
keyboard_handle_modifiers, keyboard_handle_repeat_info};
|
||||
|
||||
@implementation
|
||||
WaylandServer (KeyboardOps)
|
||||
|
||||
@end
|
65
Source/wayland/WaylandServer+Layershell.m
Normal file
65
Source/wayland/WaylandServer+Layershell.m
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
WaylandServer - LayerShell Protocol Handling
|
||||
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
||||
Date: November 2021
|
||||
|
||||
This file is part of the GNU Objective C Backend Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "wayland/WaylandServer.h"
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
|
||||
static void
|
||||
layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,
|
||||
uint32_t serial, uint32_t w, uint32_t h)
|
||||
{
|
||||
struct window *window = data;
|
||||
NSDebugLog(@"[%d] layer_surface_configure", window->window_id);
|
||||
WaylandConfig *wlconfig = window->wlconfig;
|
||||
zwlr_layer_surface_v1_ack_configure(surface, serial);
|
||||
window->configured = YES;
|
||||
if (window->buffer_needs_attach)
|
||||
{
|
||||
NSDebugLog(@"attach: win=%d layer", window->window_id);
|
||||
wl_surface_attach(window->surface, window->buffer, 0, 0);
|
||||
wl_surface_commit(window->surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *surface)
|
||||
{
|
||||
struct window *window = data;
|
||||
WaylandConfig *wlconfig = window->wlconfig;
|
||||
NSDebugLog(@"layer_surface_closed %d", window->window_id);
|
||||
// zwlr_layer_surface_v1_destroy(surface);
|
||||
wl_surface_destroy(window->surface);
|
||||
window->surface = NULL;
|
||||
window->configured = NO;
|
||||
window->layer_surface = NULL;
|
||||
}
|
||||
|
||||
const struct zwlr_layer_surface_v1_listener layer_surface_listener = {
|
||||
.configure = layer_surface_configure,
|
||||
.closed = layer_surface_closed,
|
||||
};
|
88
Source/wayland/WaylandServer+Output.m
Executable file
88
Source/wayland/WaylandServer+Output.m
Executable file
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
WaylandServer - Output Handling
|
||||
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
||||
Date: November 2021
|
||||
|
||||
This file is part of the GNU Objective C Backend Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "wayland/WaylandServer.h"
|
||||
|
||||
static void
|
||||
handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
|
||||
int physical_width, int physical_height, int subpixel,
|
||||
const char *make, const char *model, int transform)
|
||||
{
|
||||
NSDebugLog(@"handle_geometry");
|
||||
struct output *output = data;
|
||||
|
||||
output->alloc_x = x;
|
||||
output->alloc_y = y;
|
||||
output->transform = transform;
|
||||
|
||||
if (output->make)
|
||||
free(output->make);
|
||||
output->make = strdup(make);
|
||||
|
||||
if (output->model)
|
||||
free(output->model);
|
||||
output->model = strdup(model);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_done(void *data, struct wl_output *wl_output)
|
||||
{
|
||||
NSDebugLog(@"handle_done");
|
||||
}
|
||||
|
||||
static void
|
||||
handle_scale(void *data, struct wl_output *wl_output, int32_t scale)
|
||||
{
|
||||
NSDebugLog(@"handle_scale");
|
||||
struct output *output = data;
|
||||
|
||||
output->scale = scale;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width,
|
||||
int height, int refresh)
|
||||
{
|
||||
NSDebugLog(@"handle_mode");
|
||||
struct output *output = data;
|
||||
|
||||
if (flags & WL_OUTPUT_MODE_CURRENT)
|
||||
{
|
||||
output->width = width;
|
||||
output->height = height /*- 30*/;
|
||||
NSDebugLog(@"handle_mode output=%dx%d", width, height);
|
||||
|
||||
// XXX - Should we implement this?
|
||||
// if (display->output_configure_handler)
|
||||
// (*display->output_configure_handler)
|
||||
// (output, display->user_data);
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
const struct wl_output_listener output_listener
|
||||
= {handle_geometry, handle_mode, handle_done, handle_scale};
|
92
Source/wayland/WaylandServer+Seat.m
Executable file
92
Source/wayland/WaylandServer+Seat.m
Executable file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
WaylandServer - Seat Handling
|
||||
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
||||
Date: November 2021
|
||||
|
||||
This file is part of the GNU Objective C Backend Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "wayland/WaylandServer.h"
|
||||
|
||||
extern const struct wl_keyboard_listener keyboard_listener;
|
||||
|
||||
extern const struct wl_pointer_listener pointer_listener;
|
||||
|
||||
static void
|
||||
seat_handle_capabilities(void *data, struct wl_seat *seat,
|
||||
enum wl_seat_capability caps)
|
||||
{
|
||||
WaylandConfig *wlconfig = data;
|
||||
|
||||
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !wlconfig->pointer.wlpointer)
|
||||
{
|
||||
wlconfig->pointer.wlpointer = wl_seat_get_pointer(seat);
|
||||
wl_pointer_set_user_data(wlconfig->pointer.wlpointer, wlconfig);
|
||||
wl_pointer_add_listener(wlconfig->pointer.wlpointer, &pointer_listener,
|
||||
wlconfig);
|
||||
}
|
||||
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && wlconfig->pointer.wlpointer)
|
||||
{
|
||||
if (wlconfig->seat_version >= WL_POINTER_RELEASE_SINCE_VERSION)
|
||||
wl_pointer_release(wlconfig->pointer.wlpointer);
|
||||
else
|
||||
wl_pointer_destroy(wlconfig->pointer.wlpointer);
|
||||
wlconfig->pointer.wlpointer = NULL;
|
||||
}
|
||||
|
||||
wl_display_dispatch_pending(wlconfig->display);
|
||||
wl_display_flush(wlconfig->display);
|
||||
|
||||
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !wlconfig->keyboard)
|
||||
{
|
||||
wlconfig->keyboard = wl_seat_get_keyboard(seat);
|
||||
wl_keyboard_set_user_data(wlconfig->keyboard, wlconfig);
|
||||
wl_keyboard_add_listener(wlconfig->keyboard, &keyboard_listener,
|
||||
wlconfig);
|
||||
}
|
||||
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && wlconfig->keyboard)
|
||||
{
|
||||
if (wlconfig->seat_version >= WL_KEYBOARD_RELEASE_SINCE_VERSION)
|
||||
wl_keyboard_release(wlconfig->keyboard);
|
||||
else
|
||||
wl_keyboard_destroy(wlconfig->keyboard);
|
||||
wlconfig->keyboard = NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) {
|
||||
input->touch = wl_seat_get_touch(seat);
|
||||
wl_touch_set_user_data(input->touch, input);
|
||||
wl_touch_add_listener(input->touch, &touch_listener, input);
|
||||
} else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) {
|
||||
if (input->seat_version >= WL_TOUCH_RELEASE_SINCE_VERSION)
|
||||
wl_touch_release(input->touch);
|
||||
else
|
||||
wl_touch_destroy(input->touch);
|
||||
input->touch = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const struct wl_seat_listener seat_listener = {
|
||||
seat_handle_capabilities,
|
||||
};
|
169
Source/wayland/WaylandServer+Xdgshell.m
Executable file
169
Source/wayland/WaylandServer+Xdgshell.m
Executable file
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
WaylandServer - XdgShell Protocol Handling
|
||||
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
||||
Date: November 2021
|
||||
|
||||
This file is part of the GNU Objective C Backend Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "wayland/WaylandServer.h"
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
|
||||
static void
|
||||
xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
struct window *window = data;
|
||||
|
||||
NSDebugLog(@"xdg_surface_on_configure: win=%d", window->window_id);
|
||||
|
||||
if (window->terminated == YES)
|
||||
{
|
||||
NSDebugLog(@"deleting window win=%d", window->window_id);
|
||||
free(window);
|
||||
return;
|
||||
}
|
||||
WaylandConfig *wlconfig = window->wlconfig;
|
||||
|
||||
NSEvent *ev = nil;
|
||||
NSWindow *nswindow = GSWindowWithNumber(window->window_id);
|
||||
|
||||
// NSDebugLog(@"Acknowledging surface configure %p %d (window_id=%d)",
|
||||
// xdg_surface, serial, window->window_id);
|
||||
|
||||
xdg_surface_ack_configure(xdg_surface, serial);
|
||||
window->configured = YES;
|
||||
|
||||
if (window->buffer_needs_attach)
|
||||
{
|
||||
NSDebugLog(@"attach: win=%d toplevel", window->window_id);
|
||||
wl_surface_attach(window->surface, window->buffer, 0, 0);
|
||||
wl_surface_commit(window->surface);
|
||||
}
|
||||
|
||||
if (wlconfig->pointer.focus
|
||||
&& wlconfig->pointer.focus->window_id == window->window_id)
|
||||
{
|
||||
ev = [NSEvent otherEventWithType:NSAppKitDefined
|
||||
location:NSZeroPoint
|
||||
modifierFlags:0
|
||||
timestamp:0
|
||||
windowNumber:(int) window->window_id
|
||||
context:GSCurrentContext()
|
||||
subtype:GSAppKitWindowFocusIn
|
||||
data1:0
|
||||
data2:0];
|
||||
|
||||
[nswindow sendEvent:ev];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
|
||||
int32_t width, int32_t height, struct wl_array *states)
|
||||
{
|
||||
struct window *window = data;
|
||||
WaylandConfig *wlconfig = window->wlconfig;
|
||||
|
||||
NSDebugLog(@"[%d] xdg_toplevel_configure %ldx%ld", window->window_id, width,
|
||||
height);
|
||||
|
||||
// the compositor can send 0.0x0.0
|
||||
if (width == 0 || height == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (window->width != width || window->height != height)
|
||||
{
|
||||
window->width = width;
|
||||
window->height = height;
|
||||
|
||||
xdg_surface_set_window_geometry(window->xdg_surface, 0, 0, window->width,
|
||||
window->height);
|
||||
|
||||
NSEvent *ev = [NSEvent otherEventWithType:NSAppKitDefined
|
||||
location:NSMakePoint(0.0, 0.0)
|
||||
modifierFlags:0
|
||||
timestamp:0
|
||||
windowNumber:window->window_id
|
||||
context:GSCurrentContext()
|
||||
subtype:GSAppKitWindowResized
|
||||
data1:window->width
|
||||
data2:window->height];
|
||||
[(GSWindowWithNumber(window->window_id)) sendEvent:ev];
|
||||
}
|
||||
NSDebugLog(@"[%d] notify resize from backend=%ldx%ld", window->window_id,
|
||||
width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_toplevel_close_handler(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
|
||||
{
|
||||
NSDebugLog(@"xdg_toplevel_close_handler");
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x,
|
||||
int32_t y, int32_t width, int32_t height)
|
||||
{
|
||||
struct window *window = data;
|
||||
WaylandConfig *wlconfig = window->wlconfig;
|
||||
|
||||
NSDebugLog(@"xdg_popup_configure");
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_popup_done(void *data, struct xdg_popup *xdg_popup)
|
||||
{
|
||||
struct window *window = data;
|
||||
WaylandConfig *wlconfig = window->wlconfig;
|
||||
window->terminated = YES;
|
||||
xdg_popup_destroy(xdg_popup);
|
||||
wl_surface_destroy(window->surface);
|
||||
}
|
||||
|
||||
static void
|
||||
wm_base_handle_ping(void *data, struct xdg_wm_base *xdg_wm_base,
|
||||
uint32_t serial)
|
||||
{
|
||||
NSDebugLog(@"wm_base_handle_ping");
|
||||
xdg_wm_base_pong(xdg_wm_base, serial);
|
||||
}
|
||||
|
||||
const struct xdg_surface_listener xdg_surface_listener = {
|
||||
xdg_surface_on_configure,
|
||||
};
|
||||
|
||||
const struct xdg_wm_base_listener wm_base_listener = {
|
||||
.ping = wm_base_handle_ping,
|
||||
};
|
||||
|
||||
const struct xdg_popup_listener xdg_popup_listener = {
|
||||
.configure = xdg_popup_configure,
|
||||
.popup_done = xdg_popup_done,
|
||||
};
|
||||
|
||||
const struct xdg_toplevel_listener xdg_toplevel_listener = {
|
||||
.configure = xdg_toplevel_configure,
|
||||
.close = xdg_toplevel_close_handler,
|
||||
};
|
File diff suppressed because it is too large
Load diff
311
Source/wayland/protocols/wlr-layer-shell-unstable-v1.xml
Normal file
311
Source/wayland/protocols/wlr-layer-shell-unstable-v1.xml
Normal file
|
@ -0,0 +1,311 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="wlr_layer_shell_unstable_v1">
|
||||
<copyright>
|
||||
Copyright © 2017 Drew DeVault
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation, and that the name of
|
||||
the copyright holders not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission. The copyright holders make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="3">
|
||||
<description summary="create surfaces that are layers of the desktop">
|
||||
Clients can use this interface to assign the surface_layer role to
|
||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
rendered with a defined z-depth respective to each other. They may also be
|
||||
anchored to the edges and corners of a screen and specify input handling
|
||||
semantics. This interface should be suitable for the implementation of
|
||||
many desktop shell components, and a broad number of other applications
|
||||
that interact with the desktop.
|
||||
</description>
|
||||
|
||||
<request name="get_layer_surface">
|
||||
<description summary="create a layer_surface from a surface">
|
||||
Create a layer surface for an existing surface. This assigns the role of
|
||||
layer_surface, or raises a protocol error if another role is already
|
||||
assigned.
|
||||
|
||||
Creating a layer surface from a wl_surface which has a buffer attached
|
||||
or committed is a client error, and any attempts by a client to attach
|
||||
or manipulate a buffer prior to the first layer_surface.configure call
|
||||
must also be treated as errors.
|
||||
|
||||
You may pass NULL for output to allow the compositor to decide which
|
||||
output to use. Generally this will be the one that the user most
|
||||
recently interacted with.
|
||||
|
||||
Clients can specify a namespace that defines the purpose of the layer
|
||||
surface.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
|
||||
<arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
|
||||
<arg name="namespace" type="string" summary="namespace for the layer surface"/>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="role" value="0" summary="wl_surface has another role"/>
|
||||
<entry name="invalid_layer" value="1" summary="layer value is invalid"/>
|
||||
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
|
||||
</enum>
|
||||
|
||||
<enum name="layer">
|
||||
<description summary="available layers for surfaces">
|
||||
These values indicate which layers a surface can be rendered in. They
|
||||
are ordered by z depth, bottom-most first. Traditional shell surfaces
|
||||
will typically be rendered between the bottom and top layers.
|
||||
Fullscreen shell surfaces are typically rendered at the top layer.
|
||||
Multiple surfaces can share a single layer, and ordering within a
|
||||
single layer is undefined.
|
||||
</description>
|
||||
|
||||
<entry name="background" value="0"/>
|
||||
<entry name="bottom" value="1"/>
|
||||
<entry name="top" value="2"/>
|
||||
<entry name="overlay" value="3"/>
|
||||
</enum>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
|
||||
<request name="destroy" type="destructor" since="3">
|
||||
<description summary="destroy the layer_shell object">
|
||||
This request indicates that the client will not use the layer_shell
|
||||
object any more. Objects that have been created through this instance
|
||||
are not affected.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="3">
|
||||
<description summary="layer metadata interface">
|
||||
An interface that may be implemented by a wl_surface, for surfaces that
|
||||
are designed to be rendered as a layer of a stacked desktop-like
|
||||
environment.
|
||||
|
||||
Layer surface state (layer, size, anchor, exclusive zone,
|
||||
margin, interactivity) is double-buffered, and will be applied at the
|
||||
time wl_surface.commit of the corresponding wl_surface is called.
|
||||
</description>
|
||||
|
||||
<request name="set_size">
|
||||
<description summary="sets the size of the surface">
|
||||
Sets the size of the surface in surface-local coordinates. The
|
||||
compositor will display the surface centered with respect to its
|
||||
anchors.
|
||||
|
||||
If you pass 0 for either value, the compositor will assign it and
|
||||
inform you of the assignment in the configure event. You must set your
|
||||
anchor to opposite edges in the dimensions you omit; not doing so is a
|
||||
protocol error. Both values are 0 by default.
|
||||
|
||||
Size is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="width" type="uint"/>
|
||||
<arg name="height" type="uint"/>
|
||||
</request>
|
||||
|
||||
<request name="set_anchor">
|
||||
<description summary="configures the anchor point of the surface">
|
||||
Requests that the compositor anchor the surface to the specified edges
|
||||
and corners. If two orthogonal edges are specified (e.g. 'top' and
|
||||
'left'), then the anchor point will be the intersection of the edges
|
||||
(e.g. the top left corner of the output); otherwise the anchor point
|
||||
will be centered on that edge, or in the center if none is specified.
|
||||
|
||||
Anchor is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="anchor" type="uint" enum="anchor"/>
|
||||
</request>
|
||||
|
||||
<request name="set_exclusive_zone">
|
||||
<description summary="configures the exclusive geometry of this surface">
|
||||
Requests that the compositor avoids occluding an area with other
|
||||
surfaces. The compositor's use of this information is
|
||||
implementation-dependent - do not assume that this region will not
|
||||
actually be occluded.
|
||||
|
||||
A positive value is only meaningful if the surface is anchored to one
|
||||
edge or an edge and both perpendicular edges. If the surface is not
|
||||
anchored, anchored to only two perpendicular edges (a corner), anchored
|
||||
to only two parallel edges or anchored to all edges, a positive value
|
||||
will be treated the same as zero.
|
||||
|
||||
A positive zone is the distance from the edge in surface-local
|
||||
coordinates to consider exclusive.
|
||||
|
||||
Surfaces that do not wish to have an exclusive zone may instead specify
|
||||
how they should interact with surfaces that do. If set to zero, the
|
||||
surface indicates that it would like to be moved to avoid occluding
|
||||
surfaces with a positive exclusive zone. If set to -1, the surface
|
||||
indicates that it would not like to be moved to accommodate for other
|
||||
surfaces, and the compositor should extend it all the way to the edges
|
||||
it is anchored to.
|
||||
|
||||
For example, a panel might set its exclusive zone to 10, so that
|
||||
maximized shell surfaces are not shown on top of it. A notification
|
||||
might set its exclusive zone to 0, so that it is moved to avoid
|
||||
occluding the panel, but shell surfaces are shown underneath it. A
|
||||
wallpaper or lock screen might set their exclusive zone to -1, so that
|
||||
they stretch below or over the panel.
|
||||
|
||||
The default value is 0.
|
||||
|
||||
Exclusive zone is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="zone" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="set_margin">
|
||||
<description summary="sets a margin from the anchor point">
|
||||
Requests that the surface be placed some distance away from the anchor
|
||||
point on the output, in surface-local coordinates. Setting this value
|
||||
for edges you are not anchored to has no effect.
|
||||
|
||||
The exclusive zone includes the margin.
|
||||
|
||||
Margin is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="top" type="int"/>
|
||||
<arg name="right" type="int"/>
|
||||
<arg name="bottom" type="int"/>
|
||||
<arg name="left" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="set_keyboard_interactivity">
|
||||
<description summary="requests keyboard events">
|
||||
Set to 1 to request that the seat send keyboard events to this layer
|
||||
surface. For layers below the shell surface layer, the seat will use
|
||||
normal focus semantics. For layers above the shell surface layers, the
|
||||
seat will always give exclusive keyboard focus to the top-most layer
|
||||
which has keyboard interactivity set to true.
|
||||
|
||||
Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||
you do not want to receive them, set the input region on your surface
|
||||
to an empty region.
|
||||
|
||||
Events is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="keyboard_interactivity" type="uint"/>
|
||||
</request>
|
||||
|
||||
<request name="get_popup">
|
||||
<description summary="assign this layer_surface as an xdg_popup parent">
|
||||
This assigns an xdg_popup's parent to this layer_surface. This popup
|
||||
should have been created via xdg_surface::get_popup with the parent set
|
||||
to NULL, and this request must be invoked before committing the popup's
|
||||
initial state.
|
||||
|
||||
See the documentation of xdg_popup for more details about what an
|
||||
xdg_popup is and how it is used.
|
||||
</description>
|
||||
<arg name="popup" type="object" interface="xdg_popup"/>
|
||||
</request>
|
||||
|
||||
<request name="ack_configure">
|
||||
<description summary="ack a configure event">
|
||||
When a configure event is received, if a client commits the
|
||||
surface in response to the configure event, then the client
|
||||
must make an ack_configure request sometime before the commit
|
||||
request, passing along the serial of the configure event.
|
||||
|
||||
If the client receives multiple configure events before it
|
||||
can respond to one, it only has to ack the last configure event.
|
||||
|
||||
A client is not required to commit immediately after sending
|
||||
an ack_configure request - it may even ack_configure several times
|
||||
before its next surface commit.
|
||||
|
||||
A client may send multiple ack_configure requests before committing, but
|
||||
only the last request sent before a commit indicates which configure
|
||||
event the client really is responding to.
|
||||
</description>
|
||||
<arg name="serial" type="uint" summary="the serial from the configure event"/>
|
||||
</request>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the layer_surface">
|
||||
This request destroys the layer surface.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="configure">
|
||||
<description summary="suggest a surface change">
|
||||
The configure event asks the client to resize its surface.
|
||||
|
||||
Clients should arrange their surface for the new states, and then send
|
||||
an ack_configure request with the serial sent in this configure event at
|
||||
some point before committing the new surface.
|
||||
|
||||
The client is free to dismiss all but the last configure event it
|
||||
received.
|
||||
|
||||
The width and height arguments specify the size of the window in
|
||||
surface-local coordinates.
|
||||
|
||||
The size is a hint, in the sense that the client is free to ignore it if
|
||||
it doesn't resize, pick a smaller size (to satisfy aspect ratio or
|
||||
resize in steps of NxM pixels). If the client picks a smaller size and
|
||||
is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
|
||||
surface will be centered on this axis.
|
||||
|
||||
If the width or height arguments are zero, it means the client should
|
||||
decide its own window dimension.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="width" type="uint"/>
|
||||
<arg name="height" type="uint"/>
|
||||
</event>
|
||||
|
||||
<event name="closed">
|
||||
<description summary="surface should be closed">
|
||||
The closed event is sent by the compositor when the surface will no
|
||||
longer be shown. The output may have been destroyed or the user may
|
||||
have asked for it to be removed. Further changes to the surface will be
|
||||
ignored. The client should destroy the resource after receiving this
|
||||
event, and create a new surface if they so choose.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||
</enum>
|
||||
|
||||
<enum name="anchor" bitfield="true">
|
||||
<entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
|
||||
<entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
|
||||
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
||||
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
||||
</enum>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
|
||||
<request name="set_layer" since="2">
|
||||
<description summary="change the layer of the surface">
|
||||
Change the layer that the surface is rendered on.
|
||||
|
||||
Layer is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
83
Source/wayland/wlr-layer-shell-protocol.c
Normal file
83
Source/wayland/wlr-layer-shell-protocol.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2017 Drew DeVault
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this
|
||||
* software and its documentation for any purpose is hereby granted
|
||||
* without fee, provided that the above copyright notice appear in
|
||||
* all copies and that both that copyright notice and this permission
|
||||
* notice appear in supporting documentation, and that the name of
|
||||
* the copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface wl_output_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface xdg_popup_interface;
|
||||
extern const struct wl_interface zwlr_layer_surface_v1_interface;
|
||||
|
||||
static const struct wl_interface *wlr_layer_shell_unstable_v1_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&zwlr_layer_surface_v1_interface,
|
||||
&wl_surface_interface,
|
||||
&wl_output_interface,
|
||||
NULL,
|
||||
NULL,
|
||||
&xdg_popup_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_layer_shell_v1_requests[] = {
|
||||
{ "get_layer_surface", "no?ous", wlr_layer_shell_unstable_v1_types + 4 },
|
||||
{ "destroy", "3", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwlr_layer_shell_v1_interface = {
|
||||
"zwlr_layer_shell_v1", 3,
|
||||
2, zwlr_layer_shell_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_layer_surface_v1_requests[] = {
|
||||
{ "set_size", "uu", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
{ "set_anchor", "u", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
{ "set_exclusive_zone", "i", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
{ "set_margin", "iiii", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
{ "set_keyboard_interactivity", "u", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
{ "get_popup", "o", wlr_layer_shell_unstable_v1_types + 9 },
|
||||
{ "ack_configure", "u", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
{ "destroy", "", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
{ "set_layer", "2u", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_layer_surface_v1_events[] = {
|
||||
{ "configure", "uuu", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
{ "closed", "", wlr_layer_shell_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface zwlr_layer_surface_v1_interface = {
|
||||
"zwlr_layer_surface_v1", 3,
|
||||
9, zwlr_layer_surface_v1_requests,
|
||||
2, zwlr_layer_surface_v1_events,
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by wayland-scanner 1.17.0 */
|
||||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2008-2013 Kristian Høgsberg
|
||||
|
@ -40,7 +40,7 @@ extern const struct wl_interface xdg_positioner_interface;
|
|||
extern const struct wl_interface xdg_surface_interface;
|
||||
extern const struct wl_interface xdg_toplevel_interface;
|
||||
|
||||
static const struct wl_interface *types[] = {
|
||||
static const struct wl_interface *xdg_shell_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -65,100 +65,107 @@ static const struct wl_interface *types[] = {
|
|||
&wl_output_interface,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
&xdg_positioner_interface,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_wm_base_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "create_positioner", "n", types + 4 },
|
||||
{ "get_xdg_surface", "no", types + 5 },
|
||||
{ "pong", "u", types + 0 },
|
||||
{ "destroy", "", xdg_shell_types + 0 },
|
||||
{ "create_positioner", "n", xdg_shell_types + 4 },
|
||||
{ "get_xdg_surface", "no", xdg_shell_types + 5 },
|
||||
{ "pong", "u", xdg_shell_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_wm_base_events[] = {
|
||||
{ "ping", "u", types + 0 },
|
||||
{ "ping", "u", xdg_shell_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_wm_base_interface = {
|
||||
"xdg_wm_base", 2,
|
||||
"xdg_wm_base", 3,
|
||||
4, xdg_wm_base_requests,
|
||||
1, xdg_wm_base_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_positioner_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "set_size", "ii", types + 0 },
|
||||
{ "set_anchor_rect", "iiii", types + 0 },
|
||||
{ "set_anchor", "u", types + 0 },
|
||||
{ "set_gravity", "u", types + 0 },
|
||||
{ "set_constraint_adjustment", "u", types + 0 },
|
||||
{ "set_offset", "ii", types + 0 },
|
||||
{ "destroy", "", xdg_shell_types + 0 },
|
||||
{ "set_size", "ii", xdg_shell_types + 0 },
|
||||
{ "set_anchor_rect", "iiii", xdg_shell_types + 0 },
|
||||
{ "set_anchor", "u", xdg_shell_types + 0 },
|
||||
{ "set_gravity", "u", xdg_shell_types + 0 },
|
||||
{ "set_constraint_adjustment", "u", xdg_shell_types + 0 },
|
||||
{ "set_offset", "ii", xdg_shell_types + 0 },
|
||||
{ "set_reactive", "3", xdg_shell_types + 0 },
|
||||
{ "set_parent_size", "3ii", xdg_shell_types + 0 },
|
||||
{ "set_parent_configure", "3u", xdg_shell_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_positioner_interface = {
|
||||
"xdg_positioner", 2,
|
||||
7, xdg_positioner_requests,
|
||||
"xdg_positioner", 3,
|
||||
10, xdg_positioner_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_surface_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "get_toplevel", "n", types + 7 },
|
||||
{ "get_popup", "n?oo", types + 8 },
|
||||
{ "set_window_geometry", "iiii", types + 0 },
|
||||
{ "ack_configure", "u", types + 0 },
|
||||
{ "destroy", "", xdg_shell_types + 0 },
|
||||
{ "get_toplevel", "n", xdg_shell_types + 7 },
|
||||
{ "get_popup", "n?oo", xdg_shell_types + 8 },
|
||||
{ "set_window_geometry", "iiii", xdg_shell_types + 0 },
|
||||
{ "ack_configure", "u", xdg_shell_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_surface_events[] = {
|
||||
{ "configure", "u", types + 0 },
|
||||
{ "configure", "u", xdg_shell_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_surface_interface = {
|
||||
"xdg_surface", 2,
|
||||
"xdg_surface", 3,
|
||||
5, xdg_surface_requests,
|
||||
1, xdg_surface_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_toplevel_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "set_parent", "?o", types + 11 },
|
||||
{ "set_title", "s", types + 0 },
|
||||
{ "set_app_id", "s", types + 0 },
|
||||
{ "show_window_menu", "ouii", types + 12 },
|
||||
{ "move", "ou", types + 16 },
|
||||
{ "resize", "ouu", types + 18 },
|
||||
{ "set_max_size", "ii", types + 0 },
|
||||
{ "set_min_size", "ii", types + 0 },
|
||||
{ "set_maximized", "", types + 0 },
|
||||
{ "unset_maximized", "", types + 0 },
|
||||
{ "set_fullscreen", "?o", types + 21 },
|
||||
{ "unset_fullscreen", "", types + 0 },
|
||||
{ "set_minimized", "", types + 0 },
|
||||
{ "destroy", "", xdg_shell_types + 0 },
|
||||
{ "set_parent", "?o", xdg_shell_types + 11 },
|
||||
{ "set_title", "s", xdg_shell_types + 0 },
|
||||
{ "set_app_id", "s", xdg_shell_types + 0 },
|
||||
{ "show_window_menu", "ouii", xdg_shell_types + 12 },
|
||||
{ "move", "ou", xdg_shell_types + 16 },
|
||||
{ "resize", "ouu", xdg_shell_types + 18 },
|
||||
{ "set_max_size", "ii", xdg_shell_types + 0 },
|
||||
{ "set_min_size", "ii", xdg_shell_types + 0 },
|
||||
{ "set_maximized", "", xdg_shell_types + 0 },
|
||||
{ "unset_maximized", "", xdg_shell_types + 0 },
|
||||
{ "set_fullscreen", "?o", xdg_shell_types + 21 },
|
||||
{ "unset_fullscreen", "", xdg_shell_types + 0 },
|
||||
{ "set_minimized", "", xdg_shell_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_toplevel_events[] = {
|
||||
{ "configure", "iia", types + 0 },
|
||||
{ "close", "", types + 0 },
|
||||
{ "configure", "iia", xdg_shell_types + 0 },
|
||||
{ "close", "", xdg_shell_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_toplevel_interface = {
|
||||
"xdg_toplevel", 2,
|
||||
"xdg_toplevel", 3,
|
||||
14, xdg_toplevel_requests,
|
||||
2, xdg_toplevel_events,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_popup_requests[] = {
|
||||
{ "destroy", "", types + 0 },
|
||||
{ "grab", "ou", types + 22 },
|
||||
{ "destroy", "", xdg_shell_types + 0 },
|
||||
{ "grab", "ou", xdg_shell_types + 22 },
|
||||
{ "reposition", "3ou", xdg_shell_types + 24 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_popup_events[] = {
|
||||
{ "configure", "iiii", types + 0 },
|
||||
{ "popup_done", "", types + 0 },
|
||||
{ "configure", "iiii", xdg_shell_types + 0 },
|
||||
{ "popup_done", "", xdg_shell_types + 0 },
|
||||
{ "repositioned", "3u", xdg_shell_types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface xdg_popup_interface = {
|
||||
"xdg_popup", 2,
|
||||
2, xdg_popup_requests,
|
||||
2, xdg_popup_events,
|
||||
"xdg_popup", 3,
|
||||
3, xdg_popup_requests,
|
||||
3, xdg_popup_events,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue