mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-14 06:59:43 -05:00
Merge branch 'master' into output-layout-adjacent
This commit is contained in:
commit
d2c7defa10
35 changed files with 2703 additions and 237 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include <wlr/types/wlr_wl_shell.h>
|
||||
#include <wlr/types/wlr_xcursor_manager.h>
|
||||
#include <wlr/types/wlr_xdg_shell_v6.h>
|
||||
#include <wlr/types/wlr_xdg_shell.h>
|
||||
#include "rootston/config.h"
|
||||
#include "rootston/output.h"
|
||||
#include "rootston/view.h"
|
||||
|
|
@ -34,6 +35,7 @@ struct roots_desktop {
|
|||
struct wlr_compositor *compositor;
|
||||
struct wlr_wl_shell *wl_shell;
|
||||
struct wlr_xdg_shell_v6 *xdg_shell_v6;
|
||||
struct wlr_xdg_shell *xdg_shell;
|
||||
struct wlr_gamma_control_manager *gamma_control_manager;
|
||||
struct wlr_screenshooter *screenshooter;
|
||||
struct wlr_server_decoration_manager *server_decoration_manager;
|
||||
|
|
@ -43,6 +45,7 @@ struct roots_desktop {
|
|||
struct wl_listener new_output;
|
||||
struct wl_listener layout_change;
|
||||
struct wl_listener xdg_shell_v6_surface;
|
||||
struct wl_listener xdg_shell_surface;
|
||||
struct wl_listener wl_shell_surface;
|
||||
struct wl_listener decoration_new;
|
||||
|
||||
|
|
@ -72,6 +75,7 @@ void view_update_position(struct roots_view *view, double x, double y);
|
|||
void view_update_size(struct roots_view *view, uint32_t width, uint32_t height);
|
||||
|
||||
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
|
||||
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
|
||||
void handle_wl_shell_surface(struct wl_listener *listener, void *data);
|
||||
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_surface.h>
|
||||
#include <wlr/types/wlr_xdg_shell_v6.h>
|
||||
#include <wlr/types/wlr_xdg_shell.h>
|
||||
|
||||
struct roots_wl_shell_surface {
|
||||
struct roots_view *view;
|
||||
|
|
@ -36,6 +37,21 @@ struct roots_xdg_surface_v6 {
|
|||
uint32_t pending_move_resize_configure_serial;
|
||||
};
|
||||
|
||||
struct roots_xdg_surface {
|
||||
struct roots_view *view;
|
||||
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener new_popup;
|
||||
struct wl_listener request_move;
|
||||
struct wl_listener request_resize;
|
||||
struct wl_listener request_maximize;
|
||||
struct wl_listener request_fullscreen;
|
||||
|
||||
struct wl_listener surface_commit;
|
||||
|
||||
uint32_t pending_move_resize_configure_serial;
|
||||
};
|
||||
|
||||
struct roots_xwayland_surface {
|
||||
struct roots_view *view;
|
||||
|
||||
|
|
@ -54,6 +70,7 @@ struct roots_xwayland_surface {
|
|||
enum roots_view_type {
|
||||
ROOTS_WL_SHELL_VIEW,
|
||||
ROOTS_XDG_SHELL_V6_VIEW,
|
||||
ROOTS_XDG_SHELL_VIEW,
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
ROOTS_XWAYLAND_VIEW,
|
||||
#endif
|
||||
|
|
@ -90,6 +107,7 @@ struct roots_view {
|
|||
union {
|
||||
struct wlr_wl_shell_surface *wl_shell_surface;
|
||||
struct wlr_xdg_surface_v6 *xdg_surface_v6;
|
||||
struct wlr_xdg_surface *xdg_surface;
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
struct wlr_xwayland_surface *xwayland_surface;
|
||||
#endif
|
||||
|
|
@ -97,6 +115,7 @@ struct roots_view {
|
|||
union {
|
||||
struct roots_wl_shell_surface *roots_wl_shell_surface;
|
||||
struct roots_xdg_surface_v6 *roots_xdg_surface_v6;
|
||||
struct roots_xdg_surface *roots_xdg_surface;
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
struct roots_xwayland_surface *roots_xwayland_surface;
|
||||
#endif
|
||||
|
|
@ -154,6 +173,13 @@ struct roots_xdg_popup_v6 {
|
|||
struct wl_listener new_popup;
|
||||
};
|
||||
|
||||
struct roots_xdg_popup {
|
||||
struct roots_view_child view_child;
|
||||
struct wlr_xdg_popup *wlr_popup;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener new_popup;
|
||||
};
|
||||
|
||||
void view_get_box(const struct roots_view *view, struct wlr_box *box);
|
||||
void view_activate(struct roots_view *view, bool active);
|
||||
void view_move(struct roots_view *view, double x, double y);
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ void wlr_output_set_gamma(struct wlr_output *output,
|
|||
uint32_t wlr_output_get_gamma_size(struct wlr_output *output);
|
||||
void wlr_output_set_fullscreen_surface(struct wlr_output *output,
|
||||
struct wlr_surface *surface);
|
||||
struct wlr_output *wlr_output_from_resource(struct wl_resource *resource);
|
||||
|
||||
|
||||
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
#ifndef WLR_TYPES_WLR_REGION_H
|
||||
#define WLR_TYPES_WLR_REGION_H
|
||||
|
||||
#include <pixman.h>
|
||||
|
||||
struct wl_resource;
|
||||
|
||||
/*
|
||||
* Implements the given resource as region.
|
||||
* Sets the associated pixman_region32_t as userdata.
|
||||
*/
|
||||
void wlr_region_create(struct wl_client *client, struct wl_resource *res,
|
||||
uint32_t id);
|
||||
uint32_t id);
|
||||
|
||||
pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -530,4 +530,6 @@ bool wlr_seat_touch_has_grab(struct wlr_seat *seat);
|
|||
*/
|
||||
bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial);
|
||||
|
||||
struct wlr_seat_client *wlr_seat_client_from_resource(struct wl_resource *resource);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -164,4 +164,6 @@ void wlr_surface_set_role_committed(struct wlr_surface *surface,
|
|||
void (*role_committed)(struct wlr_surface *surface, void *role_data),
|
||||
void *role_data);
|
||||
|
||||
struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
232
include/wlr/types/wlr_xdg_shell.h
Normal file
232
include/wlr/types/wlr_xdg_shell.h
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
#ifndef WLR_TYPES_WLR_XDG_SHELL_H
|
||||
#define WLR_TYPES_WLR_XDG_SHELL_H
|
||||
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_seat.h>
|
||||
#include <wayland-server.h>
|
||||
|
||||
struct wlr_xdg_shell {
|
||||
struct wl_global *wl_global;
|
||||
struct wl_list clients;
|
||||
struct wl_list popup_grabs;
|
||||
uint32_t ping_timeout;
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal new_surface;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_xdg_client {
|
||||
struct wlr_xdg_shell *shell;
|
||||
struct wl_resource *resource;
|
||||
struct wl_client *client;
|
||||
struct wl_list surfaces;
|
||||
|
||||
struct wl_list link; // wlr_xdg_shell::clients
|
||||
|
||||
uint32_t ping_serial;
|
||||
struct wl_event_source *ping_timer;
|
||||
};
|
||||
|
||||
struct wlr_xdg_popup {
|
||||
struct wlr_xdg_surface *base;
|
||||
struct wl_list link;
|
||||
|
||||
struct wl_resource *resource;
|
||||
bool committed;
|
||||
struct wlr_xdg_surface *parent;
|
||||
struct wlr_seat *seat;
|
||||
struct wlr_box geometry;
|
||||
|
||||
struct wl_list grab_link; // wlr_xdg_popup_grab::popups
|
||||
};
|
||||
|
||||
// each seat gets a popup grab
|
||||
struct wlr_xdg_popup_grab {
|
||||
struct wl_client *client;
|
||||
struct wlr_seat_pointer_grab pointer_grab;
|
||||
struct wlr_seat_keyboard_grab keyboard_grab;
|
||||
struct wlr_seat *seat;
|
||||
struct wl_list popups;
|
||||
struct wl_list link; // wlr_xdg_shell::popup_grabs
|
||||
};
|
||||
|
||||
enum wlr_xdg_surface_role {
|
||||
WLR_XDG_SURFACE_ROLE_NONE,
|
||||
WLR_XDG_SURFACE_ROLE_TOPLEVEL,
|
||||
WLR_XDG_SURFACE_ROLE_POPUP,
|
||||
};
|
||||
|
||||
struct wlr_xdg_toplevel_state {
|
||||
bool maximized;
|
||||
bool fullscreen;
|
||||
bool resizing;
|
||||
bool activated;
|
||||
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
|
||||
uint32_t max_width;
|
||||
uint32_t max_height;
|
||||
|
||||
uint32_t min_width;
|
||||
uint32_t min_height;
|
||||
};
|
||||
|
||||
struct wlr_xdg_toplevel {
|
||||
struct wl_resource *resource;
|
||||
struct wlr_xdg_surface *base;
|
||||
struct wlr_xdg_surface *parent;
|
||||
bool added;
|
||||
struct wlr_xdg_toplevel_state next; // client protocol requests
|
||||
struct wlr_xdg_toplevel_state pending; // user configure requests
|
||||
struct wlr_xdg_toplevel_state current;
|
||||
};
|
||||
|
||||
struct wlr_xdg_surface_configure {
|
||||
struct wl_list link; // wlr_xdg_surface::configure_list
|
||||
uint32_t serial;
|
||||
struct wlr_xdg_toplevel_state state;
|
||||
};
|
||||
|
||||
struct wlr_xdg_surface {
|
||||
struct wlr_xdg_client *client;
|
||||
struct wl_resource *resource;
|
||||
struct wlr_surface *surface;
|
||||
struct wl_list link; // wlr_xdg_client::surfaces
|
||||
enum wlr_xdg_surface_role role;
|
||||
|
||||
union {
|
||||
struct wlr_xdg_toplevel *toplevel_state;
|
||||
struct wlr_xdg_popup *popup_state;
|
||||
};
|
||||
|
||||
struct wl_list popups; // wlr_xdg_popup::link
|
||||
|
||||
bool configured;
|
||||
bool added;
|
||||
uint32_t configure_serial;
|
||||
struct wl_event_source *configure_idle;
|
||||
uint32_t configure_next_serial;
|
||||
struct wl_list configure_list;
|
||||
|
||||
char *title;
|
||||
char *app_id;
|
||||
|
||||
bool has_next_geometry;
|
||||
struct wlr_box *next_geometry;
|
||||
struct wlr_box *geometry;
|
||||
|
||||
struct wl_listener surface_destroy_listener;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
struct wl_signal ping_timeout;
|
||||
struct wl_signal new_popup;
|
||||
|
||||
struct wl_signal request_maximize;
|
||||
struct wl_signal request_fullscreen;
|
||||
struct wl_signal request_minimize;
|
||||
struct wl_signal request_move;
|
||||
struct wl_signal request_resize;
|
||||
struct wl_signal request_show_window_menu;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_xdg_toplevel_move_event {
|
||||
struct wlr_xdg_surface *surface;
|
||||
struct wlr_seat_client *seat;
|
||||
uint32_t serial;
|
||||
};
|
||||
|
||||
struct wlr_xdg_toplevel_resize_event {
|
||||
struct wlr_xdg_surface *surface;
|
||||
struct wlr_seat_client *seat;
|
||||
uint32_t serial;
|
||||
uint32_t edges;
|
||||
};
|
||||
|
||||
struct wlr_xdg_toplevel_set_fullscreen_event {
|
||||
struct wlr_xdg_surface *surface;
|
||||
bool fullscreen;
|
||||
struct wlr_output *output;
|
||||
};
|
||||
|
||||
struct wlr_xdg_toplevel_show_window_menu_event {
|
||||
struct wlr_xdg_surface *surface;
|
||||
struct wlr_seat_client *seat;
|
||||
uint32_t serial;
|
||||
uint32_t x, y;
|
||||
};
|
||||
|
||||
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display);
|
||||
void wlr_xdg_shell_destroy(struct wlr_xdg_shell *xdg_shell);
|
||||
|
||||
/**
|
||||
* Send a ping to the surface. If the surface does not respond in a reasonable
|
||||
* amount of time, the ping_timeout event will be emitted.
|
||||
*/
|
||||
void wlr_xdg_surface_ping(struct wlr_xdg_surface *surface);
|
||||
|
||||
/**
|
||||
* Request that this toplevel surface be the given size. Returns the associated
|
||||
* configure serial.
|
||||
*/
|
||||
uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface,
|
||||
uint32_t width, uint32_t height);
|
||||
|
||||
/**
|
||||
* Request that this toplevel surface show itself in an activated or deactivated
|
||||
* state. Returns the associated configure serial.
|
||||
*/
|
||||
uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
|
||||
bool activated);
|
||||
|
||||
/**
|
||||
* Request that this toplevel surface consider itself maximized or not
|
||||
* maximized. Returns the associated configure serial.
|
||||
*/
|
||||
uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
|
||||
bool maximized);
|
||||
|
||||
/**
|
||||
* Request that this toplevel surface consider itself fullscreen or not
|
||||
* fullscreen. Returns the associated configure serial.
|
||||
*/
|
||||
uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
|
||||
bool fullscreen);
|
||||
|
||||
/**
|
||||
* Request that this toplevel surface consider itself to be resizing or not
|
||||
* resizing. Returns the associated configure serial.
|
||||
*/
|
||||
uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
|
||||
bool resizing);
|
||||
|
||||
/**
|
||||
* Request that this toplevel surface closes.
|
||||
*/
|
||||
void wlr_xdg_toplevel_send_close(struct wlr_xdg_surface *surface);
|
||||
|
||||
/**
|
||||
* Compute the popup position in surface-local coordinates.
|
||||
*/
|
||||
void wlr_xdg_surface_popup_get_position(struct wlr_xdg_surface *surface,
|
||||
double *popup_sx, double *popup_sy);
|
||||
|
||||
/**
|
||||
* Find a popup within this surface at the surface-local coordinates. Returns
|
||||
* the popup and coordinates in the topmost surface coordinate system or NULL if
|
||||
* no popup is found at that location.
|
||||
*/
|
||||
struct wlr_xdg_surface *wlr_xdg_surface_popup_at(
|
||||
struct wlr_xdg_surface *surface, double sx, double sy,
|
||||
double *popup_sx, double *popup_sy);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue