mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
foreign-toplevel: create generic abstraction
This commit is contained in:
parent
5e1f91c9d1
commit
2a825008c6
15 changed files with 463 additions and 196 deletions
61
include/foreign-toplevel-internal.h
Normal file
61
include/foreign-toplevel-internal.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_FOREIGN_TOPLEVEL_INTERNAL_H
|
||||
#define LABWC_FOREIGN_TOPLEVEL_INTERNAL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include "foreign-toplevel.h"
|
||||
|
||||
struct foreign_toplevel {
|
||||
struct view *view;
|
||||
|
||||
/* *-toplevel implementations */
|
||||
struct wlr_foreign_toplevel {
|
||||
struct wlr_foreign_toplevel_handle_v1 *handle;
|
||||
|
||||
/* Client side events */
|
||||
struct {
|
||||
struct wl_listener request_maximize;
|
||||
struct wl_listener request_minimize;
|
||||
struct wl_listener request_fullscreen;
|
||||
struct wl_listener request_activate;
|
||||
struct wl_listener request_close;
|
||||
struct wl_listener handle_destroy;
|
||||
} on;
|
||||
|
||||
/* Compositor side state updates */
|
||||
struct {
|
||||
struct wl_listener new_app_id;
|
||||
struct wl_listener new_title;
|
||||
struct wl_listener new_outputs;
|
||||
struct wl_listener maximized;
|
||||
struct wl_listener minimized;
|
||||
struct wl_listener fullscreened;
|
||||
struct wl_listener activated;
|
||||
} on_view;
|
||||
|
||||
/* Internal signals */
|
||||
struct {
|
||||
struct wl_listener toplevel_parent;
|
||||
struct wl_listener toplevel_destroy;
|
||||
} on_foreign_toplevel;
|
||||
|
||||
} wlr_toplevel;
|
||||
|
||||
/* TODO: add struct xdg_x11_mapped_toplevel at some point */
|
||||
|
||||
struct {
|
||||
struct wl_signal toplevel_parent; /* struct view *parent */
|
||||
struct wl_signal toplevel_destroy;
|
||||
} events;
|
||||
};
|
||||
|
||||
void wlr_foreign_toplevel_init(struct foreign_toplevel *toplevel);
|
||||
|
||||
void foreign_request_minimize(struct foreign_toplevel *toplevel, bool minimized);
|
||||
void foreign_request_maximize(struct foreign_toplevel *toplevel, enum view_axis axis);
|
||||
void foreign_request_fullscreen(struct foreign_toplevel *toplevel, bool fullscreen);
|
||||
void foreign_request_activate(struct foreign_toplevel *toplevel);
|
||||
void foreign_request_close(struct foreign_toplevel *toplevel);
|
||||
|
||||
#endif /* LABWC_FOREIGN_TOPLEVEL_INTERNAL_H */
|
||||
13
include/foreign-toplevel.h
Normal file
13
include/foreign-toplevel.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_FOREIGN_TOPLEVEL_H
|
||||
#define LABWC_FOREIGN_TOPLEVEL_H
|
||||
|
||||
struct view;
|
||||
struct foreign_toplevel;
|
||||
|
||||
struct foreign_toplevel *foreign_toplevel_create(struct view *view);
|
||||
void foreign_toplevel_set_parent(struct foreign_toplevel *toplevel,
|
||||
struct foreign_toplevel *parent);
|
||||
void foreign_toplevel_destroy(struct foreign_toplevel *toplevel);
|
||||
|
||||
#endif /* LABWC_FOREIGN_TOPLEVEL_H */
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
#include <wlr/types/wlr_buffer.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
|
|
@ -419,9 +418,6 @@ struct constraint {
|
|||
void xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup);
|
||||
void xdg_shell_init(struct server *server);
|
||||
|
||||
void foreign_toplevel_handle_create(struct view *view);
|
||||
void foreign_toplevel_update_outputs(struct view *view);
|
||||
|
||||
/*
|
||||
* desktop.c routines deal with a collection of views
|
||||
*
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ enum window_type {
|
|||
|
||||
struct view;
|
||||
struct wlr_surface;
|
||||
struct foreign_toplevel;
|
||||
|
||||
/* Common to struct view and struct xwayland_unmanaged */
|
||||
struct mappable {
|
||||
|
|
@ -265,16 +266,6 @@ struct view {
|
|||
struct multi_rect *rect;
|
||||
} resize_outlines;
|
||||
|
||||
struct foreign_toplevel {
|
||||
struct wlr_foreign_toplevel_handle_v1 *handle;
|
||||
struct wl_listener maximize;
|
||||
struct wl_listener minimize;
|
||||
struct wl_listener fullscreen;
|
||||
struct wl_listener activate;
|
||||
struct wl_listener close;
|
||||
struct wl_listener destroy;
|
||||
} toplevel;
|
||||
|
||||
struct mappable mappable;
|
||||
|
||||
struct wl_listener destroy;
|
||||
|
|
@ -287,6 +278,8 @@ struct view {
|
|||
struct wl_listener request_fullscreen;
|
||||
struct wl_listener set_title;
|
||||
|
||||
struct foreign_toplevel *foreign_toplevel;
|
||||
|
||||
struct {
|
||||
struct wl_signal new_app_id;
|
||||
struct wl_signal new_title;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue