/* * Feynman -- Wayland compositor for GNU Emacs * * Copyright (c) 2022 Sameer Rahmani * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 2. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef FEYNMAN_COMPOSITOR_H #define FEYNMAN_COMPOSITOR_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include enum feynman_cursor_mode { FEYNMAN_CURSOR_PASSTHROUGH, FEYNMAN_CURSOR_MOVE, FEYNMAN_CURSOR_RESIZE, }; // This struct holds the state of the WM struct feynman_server { struct wl_display *wl_display; struct wlr_backend *backend; struct wlr_renderer *renderer; struct wlr_allocator *allocator; struct wlr_scene *scene; struct wlr_xdg_shell *xdg_shell; struct wl_listener new_xdg_surface; struct wl_list views; struct wlr_cursor *cursor; struct wlr_xcursor_manager *cursor_mgr; struct wl_listener cursor_motion; struct wl_listener cursor_motion_absolute; struct wl_listener cursor_button; struct wl_listener cursor_axis; struct wl_listener cursor_frame; struct wlr_seat *seat; struct wl_listener new_input; struct wl_listener request_cursor; struct wl_listener request_set_selection; struct wl_list keyboards; enum feynman_cursor_mode cursor_mode; struct feynman_view *grabbed_view; double grab_x, grab_y; struct wlr_box grab_geobox; uint32_t resize_edges; struct wlr_output_layout *output_layout; struct wl_list outputs; struct wl_listener new_output; char log_file[PATH_MAX]; pthread_t server_thread_id; }; struct feynman_output { struct wl_list link; struct feynman_server *server; struct wlr_output *wlr_output; struct wl_listener frame; }; struct feynman_view { struct wl_list link; struct feynman_server *server; struct wlr_xdg_surface *xdg_surface; struct wlr_scene_node *scene_node; struct wl_listener map; struct wl_listener unmap; struct wl_listener destroy; struct wl_listener request_move; struct wl_listener request_resize; int x, y; }; struct feynman_keyboard { struct wl_list link; struct feynman_server *server; struct wlr_input_device *device; struct wl_listener modifiers; struct wl_listener key; }; int init_feynman_server (struct feynman_server *server); void start_feynman (struct feynman_server *server); void stop_feynman (struct feynman_server *server); #endif