2012-05-21 23:52:02 +04:00
|
|
|
/*
|
|
|
|
* Copyright © 2012 Intel Corporation
|
|
|
|
*
|
2015-06-12 02:22:34 +03:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
2012-05-21 23:52:02 +04:00
|
|
|
*
|
2015-06-12 02:22:34 +03:00
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial
|
|
|
|
* portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2012-05-21 23:52:02 +04:00
|
|
|
*/
|
|
|
|
|
2017-10-12 14:18:13 +03:00
|
|
|
#include <stdio.h>
|
2012-05-21 23:52:02 +04:00
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <xcb/xcb.h>
|
|
|
|
#include <xcb/xfixes.h>
|
2013-10-12 03:48:19 +04:00
|
|
|
#include <xcb/composite.h>
|
2012-05-21 23:52:02 +04:00
|
|
|
#include <cairo/cairo-xcb.h>
|
|
|
|
|
2019-03-28 17:28:47 +03:00
|
|
|
#include <libweston/libweston.h>
|
2019-04-04 15:52:47 +03:00
|
|
|
#include <libweston/xwayland-api.h>
|
2019-06-21 22:49:18 +03:00
|
|
|
#include <libweston/weston-log.h>
|
2021-07-27 12:55:58 +03:00
|
|
|
#include "shared/xcb-xwayland.h"
|
2013-09-05 08:12:26 +04:00
|
|
|
|
2012-05-21 23:52:02 +04:00
|
|
|
struct weston_xserver {
|
|
|
|
struct wl_display *wl_display;
|
|
|
|
struct wl_event_loop *loop;
|
|
|
|
int abstract_fd;
|
|
|
|
struct wl_event_source *abstract_source;
|
|
|
|
int unix_fd;
|
|
|
|
struct wl_event_source *unix_source;
|
|
|
|
int display;
|
|
|
|
struct wl_client *client;
|
2023-05-01 21:09:42 +03:00
|
|
|
struct wl_listener client_destroy_listener;
|
2012-05-21 23:52:02 +04:00
|
|
|
struct weston_compositor *compositor;
|
2023-05-01 20:57:33 +03:00
|
|
|
struct wl_listener compositor_destroy_listener;
|
2023-05-01 21:09:42 +03:00
|
|
|
struct weston_wm *wm;
|
2016-06-29 12:54:27 +03:00
|
|
|
weston_xwayland_spawn_xserver_func_t spawn_func;
|
|
|
|
void *user_data;
|
2017-10-12 14:18:14 +03:00
|
|
|
|
2019-04-17 13:05:38 +03:00
|
|
|
struct weston_log_scope *wm_debug;
|
2012-05-21 23:52:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct weston_wm {
|
|
|
|
xcb_connection_t *conn;
|
|
|
|
const xcb_query_extension_reply_t *xfixes;
|
|
|
|
struct wl_event_source *source;
|
|
|
|
xcb_screen_t *screen;
|
|
|
|
struct hash_table *window_hash;
|
|
|
|
struct weston_xserver *server;
|
2022-10-25 23:11:48 +03:00
|
|
|
struct wl_global *xwayland_shell_global;
|
2012-05-21 23:52:02 +04:00
|
|
|
xcb_window_t wm_window;
|
|
|
|
struct weston_wm_window *focus_window;
|
|
|
|
struct theme *theme;
|
2012-07-16 20:09:19 +04:00
|
|
|
xcb_cursor_t *cursors;
|
|
|
|
int last_cursor;
|
2012-07-16 19:57:08 +04:00
|
|
|
xcb_render_pictforminfo_t format_rgb, format_rgba;
|
2013-05-02 21:43:24 +04:00
|
|
|
xcb_visualid_t visual_id;
|
|
|
|
xcb_colormap_t colormap;
|
2014-03-18 09:33:29 +04:00
|
|
|
struct wl_listener create_surface_listener;
|
2012-05-22 00:48:05 +04:00
|
|
|
struct wl_listener activate_listener;
|
2012-09-27 18:48:37 +04:00
|
|
|
struct wl_listener kill_listener;
|
2014-03-18 09:33:29 +04:00
|
|
|
struct wl_list unpaired_window_list;
|
2012-05-21 23:52:02 +04:00
|
|
|
|
|
|
|
xcb_window_t selection_window;
|
2012-06-01 08:08:12 +04:00
|
|
|
xcb_window_t selection_owner;
|
2012-05-21 23:52:02 +04:00
|
|
|
int incr;
|
|
|
|
int data_source_fd;
|
|
|
|
struct wl_event_source *property_source;
|
|
|
|
xcb_get_property_reply_t *property_reply;
|
|
|
|
int property_start;
|
|
|
|
struct wl_array source_data;
|
|
|
|
xcb_selection_request_event_t selection_request;
|
|
|
|
xcb_atom_t selection_target;
|
|
|
|
xcb_timestamp_t selection_timestamp;
|
|
|
|
int selection_property_set;
|
|
|
|
int flush_property_on_delete;
|
|
|
|
struct wl_listener selection_listener;
|
2022-08-12 18:55:01 +03:00
|
|
|
struct wl_listener seat_create_listener;
|
|
|
|
struct wl_listener seat_destroy_listener;
|
2012-05-21 23:52:02 +04:00
|
|
|
|
2013-09-05 08:12:26 +04:00
|
|
|
xcb_window_t dnd_window;
|
|
|
|
xcb_window_t dnd_owner;
|
|
|
|
|
2022-10-25 23:11:48 +03:00
|
|
|
struct wl_list unpaired_surface_list;
|
|
|
|
bool shell_bound;
|
|
|
|
|
2021-07-27 12:55:58 +03:00
|
|
|
struct atom_x11 atom;
|
2012-05-21 23:52:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2017-10-12 14:18:13 +03:00
|
|
|
dump_property(FILE *fp, struct weston_wm *wm, xcb_atom_t property,
|
2012-05-21 23:52:02 +04:00
|
|
|
xcb_get_property_reply_t *reply);
|
|
|
|
|
2012-06-03 17:18:06 +04:00
|
|
|
void
|
|
|
|
weston_wm_selection_init(struct weston_wm *wm);
|
2012-05-21 23:52:02 +04:00
|
|
|
int
|
|
|
|
weston_wm_handle_selection_event(struct weston_wm *wm,
|
|
|
|
xcb_generic_event_t *event);
|
|
|
|
|
2012-05-22 00:48:05 +04:00
|
|
|
struct weston_wm *
|
2014-03-18 09:33:29 +04:00
|
|
|
weston_wm_create(struct weston_xserver *wxs, int fd);
|
2012-05-22 00:48:05 +04:00
|
|
|
void
|
|
|
|
weston_wm_destroy(struct weston_wm *wm);
|
|
|
|
|
2012-08-10 18:06:59 +04:00
|
|
|
struct weston_seat *
|
|
|
|
weston_wm_pick_seat(struct weston_wm *wm);
|
2013-09-05 08:12:26 +04:00
|
|
|
|
|
|
|
int
|
|
|
|
weston_wm_handle_dnd_event(struct weston_wm *wm,
|
|
|
|
xcb_generic_event_t *event);
|
|
|
|
void
|
|
|
|
weston_wm_dnd_init(struct weston_wm *wm);
|