|
Blender
V2.93
|
#include "GHOST_SystemWayland.h"#include "GHOST_Event.h"#include "GHOST_EventButton.h"#include "GHOST_EventCursor.h"#include "GHOST_EventDragnDrop.h"#include "GHOST_EventKey.h"#include "GHOST_EventWheel.h"#include "GHOST_TimerManager.h"#include "GHOST_WindowManager.h"#include "GHOST_ContextEGL.h"#include <EGL/egl.h>#include <wayland-egl.h>#include <algorithm>#include <atomic>#include <stdexcept>#include <thread>#include <unordered_map>#include <unordered_set>#include <pointer-constraints-client-protocol.h>#include <relative-pointer-client-protocol.h>#include <wayland-cursor.h>#include <xkbcommon/xkbcommon.h>#include <fcntl.h>#include <linux/input-event-codes.h>#include <sys/mman.h>#include <unistd.h>#include <cstring>Go to the source code of this file.
Classes | |
| struct | output_t |
| struct | buffer_t |
| struct | cursor_t |
| struct | data_offer_t |
| struct | data_source_t |
| struct | key_repeat_payload_t |
| struct | input_t |
| struct | display_t |
Macros | |
| #define | GXMAP(k, x, y) |
Functions | |
| static void | display_destroy (display_t *d) |
| static GHOST_TKey | xkb_map_gkey (const xkb_keysym_t &sym) |
Ghost Implementation | |
Wayland specific implementation of the GHOST_System interface. | |
| static void | set_cursor_buffer (input_t *input, wl_buffer *buffer) |
Variables | |
| static const int | default_cursor_size = 24 |
| static const std::unordered_map< GHOST_TStandardCursor, std::string > | cursors |
| static constexpr const char * | mime_text_plain = "text/plain" |
| static constexpr const char * | mime_text_utf8 = "text/plain;charset=utf-8" |
| static constexpr const char * | mime_text_uri = "text/uri-list" |
| static const std::unordered_map< std::string, GHOST_TDragnDropTypes > | mime_dnd |
| static const std::vector< std::string > | mime_preference_order |
| static const std::vector< std::string > | mime_send |
Interface Callbacks | |
These callbacks are registered for Wayland interfaces and called when an event is received from the compositor. | |
| static const zwp_relative_pointer_v1_listener | relative_pointer_listener |
| static const struct wl_data_source_listener | data_source_listener |
| static const struct wl_data_offer_listener | data_offer_listener |
| static const struct wl_data_device_listener | data_device_listener |
| const struct wl_buffer_listener | cursor_buffer_listener |
| static const struct wl_pointer_listener | pointer_listener |
| static const struct wl_keyboard_listener | keyboard_listener |
| static const struct wl_seat_listener | seat_listener |
| static const struct wl_output_listener | output_listener |
| static const struct xdg_wm_base_listener | shell_listener |
| static const struct wl_registry_listener | registry_listener |
| static void | relative_pointer_relative_motion (void *data, struct zwp_relative_pointer_v1 *, uint32_t, uint32_t, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t, wl_fixed_t) |
| static void | dnd_events (const input_t *const input, const GHOST_TEventType event) |
| static std::string | read_pipe (data_offer_t *data_offer, const std::string mime_receive) |
| static void | data_source_target (void *, struct wl_data_source *, const char *) |
| static void | data_source_send (void *data, struct wl_data_source *, const char *, int32_t fd) |
| static void | data_source_cancelled (void *, struct wl_data_source *wl_data_source) |
| static void | data_source_dnd_drop_performed (void *, struct wl_data_source *) |
| static void | data_source_dnd_finished (void *, struct wl_data_source *) |
| static void | data_source_action (void *, struct wl_data_source *, uint32_t) |
| static void | data_offer_offer (void *data, struct wl_data_offer *, const char *mime_type) |
| static void | data_offer_source_actions (void *data, struct wl_data_offer *, uint32_t source_actions) |
| static void | data_offer_action (void *data, struct wl_data_offer *, uint32_t dnd_action) |
| static void | data_device_data_offer (void *, struct wl_data_device *, struct wl_data_offer *id) |
| static void | data_device_enter (void *data, struct wl_data_device *, uint32_t serial, struct wl_surface *, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id) |
| static void | data_device_leave (void *data, struct wl_data_device *) |
| static void | data_device_motion (void *data, struct wl_data_device *, uint32_t, wl_fixed_t x, wl_fixed_t y) |
| static void | data_device_drop (void *data, struct wl_data_device *) |
| static void | data_device_selection (void *data, struct wl_data_device *, struct wl_data_offer *id) |
| static void | cursor_buffer_release (void *data, struct wl_buffer *wl_buffer) |
| static void | pointer_enter (void *data, struct wl_pointer *, uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y) |
| static void | pointer_leave (void *data, struct wl_pointer *, uint32_t, struct wl_surface *surface) |
| static void | pointer_motion (void *data, struct wl_pointer *, uint32_t, wl_fixed_t surface_x, wl_fixed_t surface_y) |
| static void | pointer_button (void *data, struct wl_pointer *, uint32_t serial, uint32_t, uint32_t button, uint32_t state) |
| static void | pointer_axis (void *data, struct wl_pointer *, uint32_t, uint32_t axis, wl_fixed_t value) |
| static void | keyboard_keymap (void *data, struct wl_keyboard *, uint32_t format, int32_t fd, uint32_t size) |
| static void | keyboard_enter (void *data, struct wl_keyboard *, uint32_t, struct wl_surface *surface, struct wl_array *) |
| static void | keyboard_leave (void *data, struct wl_keyboard *, uint32_t, struct wl_surface *surface) |
| static xkb_keysym_t | xkb_state_key_get_one_sym_without_modifiers (struct xkb_state *xkb_state, xkb_keycode_t key) |
| static void | keyboard_key (void *data, struct wl_keyboard *, uint32_t serial, uint32_t, uint32_t key, uint32_t state) |
| static void | keyboard_modifiers (void *data, struct wl_keyboard *, uint32_t, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) |
| static void | keyboard_repeat_info (void *data, struct wl_keyboard *, int32_t rate, int32_t delay) |
| static void | seat_capabilities (void *data, struct wl_seat *wl_seat, uint32_t capabilities) |
| static void | seat_name (void *data, struct wl_seat *, const char *name) |
| static void | output_geometry (void *data, struct wl_output *, int32_t, int32_t, int32_t, int32_t, int32_t, const char *make, const char *model, int32_t transform) |
| static void | output_mode (void *data, struct wl_output *, uint32_t, int32_t width, int32_t height, int32_t) |
| static void | output_done (void *, struct wl_output *) |
| static void | output_scale (void *data, struct wl_output *, int32_t factor) |
| static void | shell_ping (void *, struct xdg_wm_base *xdg_wm_base, uint32_t serial) |
| static void | global_add (void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface, uint32_t) |
| static void | global_remove (void *, struct wl_registry *, uint32_t) |
|
static |
Definition at line 787 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 600 of file GHOST_SystemWayland.cpp.
References data_offer_listener, data_offer_t::id, and id.
|
static |
Definition at line 662 of file GHOST_SystemWayland.cpp.
References GHOST_TStringArray::count, data, input_t::data_offer_dnd, GHOST_SystemWayland::display(), data_offer_t::dnd, input_t::focus_pointer, GHOST_System::getMilliSeconds(), GHOST_kDragnDropTypeFilenames, GHOST_kEventDraggingDropDone, data_offer_t::id, mime_preference_order, mime_text_plain, mime_text_uri, mime_text_utf8, pos, GHOST_System::pushEvent(), read_pipe(), size(), GHOST_TStringArray::strings, input_t::system, data_offer_t::types, data_offer_t::x, x, data_offer_t::y, and y.
|
static |
Definition at line 609 of file GHOST_SystemWayland.cpp.
References data, input_t::data_offer_dnd, data_offer_t::dnd, dnd_events(), GHOST_kEventDraggingEntered, data_offer_t::in_use, mime_preference_order, type, data_offer_t::x, x, data_offer_t::y, and y.
|
static |
Definition at line 637 of file GHOST_SystemWayland.cpp.
References data, input_t::data_offer_dnd, dnd_events(), GHOST_kEventDraggingExited, data_offer_t::id, and data_offer_t::in_use.
|
static |
Definition at line 650 of file GHOST_SystemWayland.cpp.
References data, input_t::data_offer_dnd, data_offer_t::dnd, dnd_events(), GHOST_kEventDraggingUpdated, data_offer_t::x, x, data_offer_t::y, and y.
|
static |
Definition at line 737 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 587 of file GHOST_SystemWayland.cpp.
References data.
|
static |
Definition at line 573 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 580 of file GHOST_SystemWayland.cpp.
References data.
|
static |
Notify the selected action.
This event indicates the action selected by the compositor after matching the source/destination side actions. Only one action (or none) will be offered here.
Definition at line 557 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 520 of file GHOST_SystemWayland.cpp.
|
static |
The drag-and-drop operation physically finished.
The user performed the drop action. This event does not indicate acceptance, #wl_data_source.cancelled may still be emitted afterwards if the drop destination does not accept any mime type.
Definition at line 532 of file GHOST_SystemWayland.cpp.
|
static |
The drag-and-drop operation concluded.
The drop destination finished interoperating with this data source, so the client is now free to destroy this data source and free all associated data.
Definition at line 545 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 510 of file GHOST_SystemWayland.cpp.
|
static |
A target accepts an offered mime type.
Sent when a target accepts pointer_focus or motion events. If a target does not accept any of the offered types, type is NULL.
Definition at line 503 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 157 of file GHOST_SystemWayland.cpp.
References data_source_t::buffer_out, display_t::compositor, input_t::cursor, display_t::cursor_theme, buffer_t::data, input_t::data_device, display_t::data_device_manager, input_t::data_offer_copy_paste, data_source_t::data_source, input_t::data_source, display_t::display, cursor_t::file_buffer, free(), GHOST_ITimerTask::getUserData(), data_offer_t::id, display_t::inputs, input_t::key_repeat, input_t::keyboard, display_t::os_egl_windows, display_t::os_surfaces, output, display_t::outputs, input_t::pointer, display_t::pointer_constraints, display_t::relative_pointer_manager, GHOST_System::removeTimer(), input_t::seat, display_t::shm, buffer_t::size, cursor_t::surface, input_t::system, input_t::timer, display_t::xdg_shell, input_t::xkb_context, and input_t::xkb_state.
Referenced by GHOST_SystemWayland::GHOST_SystemWayland(), and GHOST_SystemWayland::~GHOST_SystemWayland().
|
static |
Definition at line 462 of file GHOST_SystemWayland.cpp.
References input_t::data_offer_dnd, data_offer_t::dnd, input_t::focus_pointer, GHOST_System::getMilliSeconds(), mime_dnd, mime_preference_order, GHOST_System::pushEvent(), input_t::system, time, type, data_offer_t::x, and data_offer_t::y.
Referenced by data_device_enter(), data_device_leave(), and data_device_motion().
|
static |
Definition at line 1221 of file GHOST_SystemWayland.cpp.
References data_source_t::buffer_out, data, input_t::data_offer_copy_paste, input_t::data_offer_dnd, data_source_t::data_source, input_t::data_source, display_t::display, input_t::locked_pointer, output, output_listener, input_t::relative_pointer, input_t::seat, seat_listener, shell_listener, input_t::system, input_t::xkb_context, and input_t::xkb_state.
|
static |
Announce removal of global object.
Notify the client of removed global objects.
This event notifies the client that the global identified by name is no longer available. If the client bound to the global using the bind request, the client should now destroy that object.
Definition at line 1289 of file GHOST_SystemWayland.cpp.
|
static |
Enter event.
Notification that this seat's keyboard focus is on a certain surface.
Definition at line 959 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 1012 of file GHOST_SystemWayland.cpp.
References data, input_t::data_source, input_t::delay, input_t::focus_keyboard, GHOST_System::getMilliSeconds(), GHOST_ITimerTask::getUserData(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kEventUnknown, GHOST_System::installTimer(), key_repeat_payload_t::key, key_repeat_payload_t::key_data, input_t::key_repeat, GHOST_System::pushEvent(), input_t::rate, GHOST_System::removeTimer(), data_source_t::source_serial, state, key_repeat_payload_t::system, input_t::system, blender::compositor::task, input_t::timer, GHOST_TEventKeyData::utf8_buf, key_repeat_payload_t::window, xkb_map_gkey(), input_t::xkb_state, and xkb_state_key_get_one_sym_without_modifiers().
|
static |
Definition at line 923 of file GHOST_SystemWayland.cpp.
References data, size(), input_t::xkb_context, and input_t::xkb_state.
|
static |
Leave event.
Notification that this seat's keyboard focus is no longer on a certain surface.
Definition at line 976 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 1091 of file GHOST_SystemWayland.cpp.
References data.
|
static |
Definition at line 1108 of file GHOST_SystemWayland.cpp.
|
static |
Sent all information about output.
This event is sent after all other properties have been sent after binding to the output object and after any other property changes done after that. This allows changes to the output properties to be seen as atomic, even if they happen via multiple events.
Definition at line 1196 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 1159 of file GHOST_SystemWayland.cpp.
References data, make(), output, and transform().
Referenced by compute_geometry().
|
static |
Definition at line 1200 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 899 of file GHOST_SystemWayland.cpp.
References data, input_t::focus_pointer, GHOST_System::getMilliSeconds(), GHOST_System::pushEvent(), and input_t::system.
|
static |
Definition at line 860 of file GHOST_SystemWayland.cpp.
References input_t::buttons, data, input_t::data_source, input_t::focus_pointer, GHOST_System::getMilliSeconds(), GHOST_kButtonMaskLeft, GHOST_kButtonMaskMiddle, GHOST_kButtonMaskRight, GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventUnknown, GHOST_TABLET_DATA_NONE, GHOST_System::pushEvent(), GHOST_Buttons::set(), data_source_t::source_serial, state, and input_t::system.
|
static |
Definition at line 799 of file GHOST_SystemWayland.cpp.
References data, input_t::focus_pointer, GHOST_System::getMilliSeconds(), GHOST_kEventCursorMove, GHOST_TABLET_DATA_NONE, input_t::pointer_serial, GHOST_System::pushEvent(), surface, input_t::system, input_t::x, and input_t::y.
|
static |
Definition at line 824 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 834 of file GHOST_SystemWayland.cpp.
References data, input_t::focus_pointer, GHOST_System::getMilliSeconds(), GHOST_kEventCursorMove, GHOST_TABLET_DATA_NONE, GHOST_System::pushEvent(), input_t::system, input_t::x, and input_t::y.
|
static |
Definition at line 478 of file GHOST_SystemWayland.cpp.
References buffer, data, data_offer_t::id, data_offer_t::in_use, and len.
Referenced by data_device_drop().
|
static |
Definition at line 432 of file GHOST_SystemWayland.cpp.
References data, input_t::focus_pointer, GHOST_System::getMilliSeconds(), GHOST_kEventCursorMove, GHOST_TABLET_DATA_NONE, GHOST_System::pushEvent(), input_t::system, input_t::x, and input_t::y.
|
static |
Definition at line 1128 of file GHOST_SystemWayland.cpp.
References cursor_t::buffer, GHOST_SystemWayland::compositor(), input_t::cursor, data, cursor_t::file_buffer, input_t::keyboard, keyboard_listener, input_t::pointer, pointer_listener, cursor_t::surface, input_t::system, and cursor_t::visible.
|
static |
Definition at line 1149 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 1582 of file GHOST_SystemWayland.cpp.
References buffer, input_t::cursor, cursor_t::image, input_t::pointer, input_t::pointer_serial, cursor_t::surface, and cursor_t::visible.
Referenced by GHOST_SystemWayland::setCursorShape(), GHOST_SystemWayland::setCursorVisibility(), and GHOST_SystemWayland::setCustomCursorShape().
|
static |
Definition at line 1212 of file GHOST_SystemWayland.cpp.
|
static |
Definition at line 256 of file GHOST_SystemWayland.cpp.
References GHOST_kKeyAccentGrave, GHOST_kKeyApp, GHOST_kKeyBackslash, GHOST_kKeyBackSpace, GHOST_kKeyCapsLock, GHOST_kKeyClear, GHOST_kKeyComma, GHOST_kKeyDelete, GHOST_kKeyDownArrow, GHOST_kKeyDownPage, GHOST_kKeyEnd, GHOST_kKeyEnter, GHOST_kKeyEqual, GHOST_kKeyEsc, GHOST_kKeyF1, GHOST_kKeyHome, GHOST_kKeyInsert, GHOST_kKeyLeftAlt, GHOST_kKeyLeftArrow, GHOST_kKeyLeftBracket, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyLinefeed, GHOST_kKeyMediaFirst, GHOST_kKeyMediaLast, GHOST_kKeyMediaPlay, GHOST_kKeyMediaStop, GHOST_kKeyMinus, GHOST_kKeyNumLock, GHOST_kKeyNumpad0, GHOST_kKeyNumpadAsterisk, GHOST_kKeyNumpadEnter, GHOST_kKeyNumpadMinus, GHOST_kKeyNumpadPeriod, GHOST_kKeyNumpadPlus, GHOST_kKeyNumpadSlash, GHOST_kKeyOS, GHOST_kKeyPause, GHOST_kKeyPeriod, GHOST_kKeyPlus, GHOST_kKeyPrintScreen, GHOST_kKeyQuote, GHOST_kKeyRightAlt, GHOST_kKeyRightArrow, GHOST_kKeyRightBracket, GHOST_kKeyRightControl, GHOST_kKeyRightShift, GHOST_kKeyScrollLock, GHOST_kKeySemicolon, GHOST_kKeySlash, GHOST_kKeySpace, GHOST_kKeyTab, GHOST_kKeyUnknown, GHOST_kKeyUpArrow, GHOST_kKeyUpPage, GHOST_PRINT, GXMAP, and hex.
Referenced by keyboard_key().
|
static |
A version of #xkb_state_key_get_one_sym which returns the key without any modifiers pressed. Needed because GHOST_TKey uses these values as key-codes.
Definition at line 990 of file GHOST_SystemWayland.cpp.
Referenced by keyboard_key().
| const struct wl_buffer_listener cursor_buffer_listener |
Definition at line 787 of file GHOST_SystemWayland.cpp.
Referenced by GHOST_SystemWayland::setCustomCursorShape().
|
static |
Definition at line 359 of file GHOST_SystemWayland.cpp.
Referenced by getImageCursor(), GHOST_SystemWayland::hasCursorShape(), and GHOST_SystemWayland::setCursorShape().
|
static |
Definition at line 737 of file GHOST_SystemWayland.cpp.
Referenced by GHOST_SystemWayland::GHOST_SystemWayland().
|
static |
Definition at line 587 of file GHOST_SystemWayland.cpp.
Referenced by data_device_data_offer().
|
static |
Definition at line 557 of file GHOST_SystemWayland.cpp.
Referenced by GHOST_SystemWayland::putClipboard().
|
static |
Definition at line 357 of file GHOST_SystemWayland.cpp.
Referenced by GHOST_SystemWayland::GHOST_SystemWayland().
|
static |
Definition at line 1108 of file GHOST_SystemWayland.cpp.
Referenced by seat_capabilities().
|
static |
Definition at line 404 of file GHOST_SystemWayland.cpp.
Referenced by dnd_events().
|
static |
Definition at line 410 of file GHOST_SystemWayland.cpp.
Referenced by data_device_drop(), data_device_enter(), and dnd_events().
|
static |
Definition at line 416 of file GHOST_SystemWayland.cpp.
Referenced by GHOST_SystemWayland::putClipboard().
|
staticconstexpr |
Definition at line 400 of file GHOST_SystemWayland.cpp.
Referenced by data_device_drop().
|
staticconstexpr |
Definition at line 402 of file GHOST_SystemWayland.cpp.
Referenced by data_device_drop().
|
staticconstexpr |
Definition at line 401 of file GHOST_SystemWayland.cpp.
Referenced by data_device_drop().
|
static |
Definition at line 1200 of file GHOST_SystemWayland.cpp.
Referenced by global_add().
|
static |
Definition at line 899 of file GHOST_SystemWayland.cpp.
Referenced by seat_capabilities().
|
static |
Definition at line 1289 of file GHOST_SystemWayland.cpp.
Referenced by GHOST_SystemWayland::GHOST_SystemWayland().
|
static |
Definition at line 458 of file GHOST_SystemWayland.cpp.
Referenced by GHOST_SystemWayland::setCursorGrab().
|
static |
Definition at line 1149 of file GHOST_SystemWayland.cpp.
Referenced by global_add().
|
static |
Definition at line 1212 of file GHOST_SystemWayland.cpp.
Referenced by global_add().