Skip to content

Commit 01a78c0

Browse files
authored
Create view.h
1 parent 59217e3 commit 01a78c0

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

source-code/view.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#ifndef VIEW_H
2+
#define VIEW_H
3+
4+
#include <wayland-server-core.h>
5+
#include <wlr/types/wlr_foreign_toplevel_manager_v1.h>
6+
#include <wlr/types/wlr_scene.h>
7+
#include <wlr/types/wlr_surface.h>
8+
9+
struct gf_server;
10+
11+
enum gf_view_type {
12+
GAMEFRAME_XDG_SHELL_VIEW,
13+
GAMEFRAME_XWAYLAND_VIEW,
14+
};
15+
16+
struct gf_view_impl {
17+
char *(*get_title)(struct gf_view *view);
18+
void (*get_geometry)(struct gf_view *view, int *width, int *height);
19+
bool (*is_primary)(struct gf_view *view);
20+
bool (*is_transient_for)(struct gf_view *child, struct gf_view *parent);
21+
void (*activate)(struct gf_view *view, bool activate);
22+
void (*maximize)(struct gf_view *view, int width, int height);
23+
void (*destroy)(struct gf_view *view);
24+
void (*close)(struct gf_view *view);
25+
};
26+
27+
struct gf_view {
28+
struct gf_server *server;
29+
enum gf_view_type type;
30+
const struct gf_view_impl *impl;
31+
struct wlr_surface *wlr_surface;
32+
struct wlr_scene_tree *scene_tree;
33+
int lx, ly;
34+
struct wl_list link;
35+
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel_handle;
36+
struct wl_listener request_activate;
37+
struct wl_listener request_close;
38+
};
39+
40+
void view_init(struct gf_view *view, struct gf_server *server, enum gf_view_type type, const struct gf_view_impl *impl);
41+
void view_destroy(struct gf_view *view);
42+
void view_map(struct gf_view *view, struct wlr_surface *surface);
43+
void view_unmap(struct gf_view *view);
44+
void view_position(struct gf_view *view);
45+
void view_position_all(struct gf_server *server);
46+
char *view_get_title(struct gf_view *view);
47+
bool view_is_primary(struct gf_view *view);
48+
bool view_is_transient_for(struct gf_view *child, struct gf_view *parent);
49+
void view_activate(struct gf_view *view, bool activate);
50+
struct gf_view *view_from_wlr_surface(struct wlr_surface *surface);
51+
52+
#endif /* VIEW_H */

0 commit comments

Comments
 (0)