2012-05-21 23:52:02 +04:00
|
|
|
/*
|
|
|
|
* Copyright © 2012 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and
|
|
|
|
* its documentation for any purpose is hereby granted without fee, provided
|
|
|
|
* that the above copyright notice appear in all copies and that both that
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
* documentation, and that the name of the copyright holders not be used in
|
|
|
|
* advertising or publicity pertaining to distribution of the software
|
|
|
|
* without specific, written prior permission. The copyright holders make
|
|
|
|
* no representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
|
|
|
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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>
|
|
|
|
|
2013-12-04 04:38:15 +04:00
|
|
|
#include "compositor.h"
|
2012-05-21 23:52:02 +04:00
|
|
|
|
2013-09-05 08:12:26 +04:00
|
|
|
#define SEND_EVENT_MASK (0x80)
|
|
|
|
#define EVENT_TYPE(event) ((event)->response_type & ~SEND_EVENT_MASK)
|
|
|
|
|
2012-05-21 23:52:02 +04:00
|
|
|
struct weston_xserver {
|
|
|
|
struct wl_display *wl_display;
|
|
|
|
struct wl_event_loop *loop;
|
|
|
|
struct wl_event_source *sigchld_source;
|
|
|
|
int abstract_fd;
|
|
|
|
struct wl_event_source *abstract_source;
|
|
|
|
int unix_fd;
|
|
|
|
struct wl_event_source *unix_source;
|
2014-03-18 09:33:29 +04:00
|
|
|
int wm_fd;
|
2012-05-21 23:52:02 +04:00
|
|
|
int display;
|
2014-03-18 09:33:29 +04:00
|
|
|
struct wl_event_source *sigusr1_source;
|
2012-05-21 23:52:02 +04:00
|
|
|
struct weston_process process;
|
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wl_client *client;
|
|
|
|
struct weston_compositor *compositor;
|
|
|
|
struct weston_wm *wm;
|
|
|
|
struct wl_listener destroy_listener;
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
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;
|
2013-06-12 22:43:21 +04:00
|
|
|
struct wl_listener transform_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;
|
|
|
|
|
2013-09-05 08:12:26 +04:00
|
|
|
xcb_window_t dnd_window;
|
|
|
|
xcb_window_t dnd_owner;
|
|
|
|
|
2012-05-21 23:52:02 +04:00
|
|
|
struct {
|
|
|
|
xcb_atom_t wm_protocols;
|
2013-08-31 11:12:25 +04:00
|
|
|
xcb_atom_t wm_normal_hints;
|
2012-05-21 23:52:02 +04:00
|
|
|
xcb_atom_t wm_take_focus;
|
|
|
|
xcb_atom_t wm_delete_window;
|
2012-05-30 20:15:44 +04:00
|
|
|
xcb_atom_t wm_state;
|
2012-06-04 19:00:40 +04:00
|
|
|
xcb_atom_t wm_s0;
|
2012-09-27 18:48:37 +04:00
|
|
|
xcb_atom_t wm_client_machine;
|
2013-08-22 09:14:58 +04:00
|
|
|
xcb_atom_t net_wm_cm_s0;
|
2012-05-21 23:52:02 +04:00
|
|
|
xcb_atom_t net_wm_name;
|
2012-09-27 18:48:37 +04:00
|
|
|
xcb_atom_t net_wm_pid;
|
2012-05-21 23:52:02 +04:00
|
|
|
xcb_atom_t net_wm_icon;
|
|
|
|
xcb_atom_t net_wm_state;
|
2015-01-29 20:06:49 +03:00
|
|
|
xcb_atom_t net_wm_state_maximized_vert;
|
|
|
|
xcb_atom_t net_wm_state_maximized_horz;
|
2012-05-21 23:52:02 +04:00
|
|
|
xcb_atom_t net_wm_state_fullscreen;
|
|
|
|
xcb_atom_t net_wm_user_time;
|
|
|
|
xcb_atom_t net_wm_icon_name;
|
2014-12-13 19:06:34 +03:00
|
|
|
xcb_atom_t net_wm_desktop;
|
2012-05-21 23:52:02 +04:00
|
|
|
xcb_atom_t net_wm_window_type;
|
|
|
|
xcb_atom_t net_wm_window_type_desktop;
|
|
|
|
xcb_atom_t net_wm_window_type_dock;
|
|
|
|
xcb_atom_t net_wm_window_type_toolbar;
|
|
|
|
xcb_atom_t net_wm_window_type_menu;
|
|
|
|
xcb_atom_t net_wm_window_type_utility;
|
|
|
|
xcb_atom_t net_wm_window_type_splash;
|
|
|
|
xcb_atom_t net_wm_window_type_dialog;
|
|
|
|
xcb_atom_t net_wm_window_type_dropdown;
|
|
|
|
xcb_atom_t net_wm_window_type_popup;
|
|
|
|
xcb_atom_t net_wm_window_type_tooltip;
|
|
|
|
xcb_atom_t net_wm_window_type_notification;
|
|
|
|
xcb_atom_t net_wm_window_type_combo;
|
|
|
|
xcb_atom_t net_wm_window_type_dnd;
|
|
|
|
xcb_atom_t net_wm_window_type_normal;
|
|
|
|
xcb_atom_t net_wm_moveresize;
|
|
|
|
xcb_atom_t net_supporting_wm_check;
|
|
|
|
xcb_atom_t net_supported;
|
|
|
|
xcb_atom_t motif_wm_hints;
|
|
|
|
xcb_atom_t clipboard;
|
2012-06-04 18:11:45 +04:00
|
|
|
xcb_atom_t clipboard_manager;
|
2012-05-21 23:52:02 +04:00
|
|
|
xcb_atom_t targets;
|
|
|
|
xcb_atom_t utf8_string;
|
|
|
|
xcb_atom_t wl_selection;
|
|
|
|
xcb_atom_t incr;
|
|
|
|
xcb_atom_t timestamp;
|
|
|
|
xcb_atom_t multiple;
|
|
|
|
xcb_atom_t compound_text;
|
|
|
|
xcb_atom_t text;
|
|
|
|
xcb_atom_t string;
|
|
|
|
xcb_atom_t text_plain_utf8;
|
|
|
|
xcb_atom_t text_plain;
|
2013-09-05 08:12:26 +04:00
|
|
|
xcb_atom_t xdnd_selection;
|
|
|
|
xcb_atom_t xdnd_aware;
|
|
|
|
xcb_atom_t xdnd_enter;
|
|
|
|
xcb_atom_t xdnd_leave;
|
|
|
|
xcb_atom_t xdnd_drop;
|
|
|
|
xcb_atom_t xdnd_status;
|
|
|
|
xcb_atom_t xdnd_finished;
|
|
|
|
xcb_atom_t xdnd_type_list;
|
|
|
|
xcb_atom_t xdnd_action_copy;
|
2014-03-18 09:33:29 +04:00
|
|
|
xcb_atom_t wl_surface_id;
|
2012-05-21 23:52:02 +04:00
|
|
|
} atom;
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
dump_property(struct weston_wm *wm, xcb_atom_t property,
|
|
|
|
xcb_get_property_reply_t *reply);
|
|
|
|
|
|
|
|
const char *
|
|
|
|
get_atom_name(xcb_connection_t *c, xcb_atom_t atom);
|
|
|
|
|
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);
|