Wayland: Fix primary selections not working with the river compositor
Fixes #6785
This commit is contained in:
parent
2aa37de6ff
commit
61429c73c7
4 changed files with 13 additions and 25 deletions
|
|
@ -94,6 +94,8 @@ Detailed list of changes
|
|||
|
||||
- ssh kitten: Fix a regression that broken :kbd:`ctrl+space` mapping in zsh (:iss:`6780`)
|
||||
|
||||
- Wayland: Fix primary selections not working with the river compositor (:iss:`6785`)
|
||||
|
||||
|
||||
0.30.1 [2023-10-05]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
|||
6
glfw/wl_init.c
vendored
6
glfw/wl_init.c
vendored
|
|
@ -99,7 +99,7 @@ static void pointerHandleEnter(void* data UNUSED,
|
|||
return;
|
||||
}
|
||||
window->wl.decorations.focus = focus;
|
||||
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial;
|
||||
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial; _glfw.wl.pointer_serial = serial;
|
||||
_glfw.wl.pointerFocus = window;
|
||||
|
||||
window->wl.hovered = true;
|
||||
|
|
@ -311,7 +311,7 @@ static void pointerHandleButton(void* data UNUSED,
|
|||
if (window->wl.decorations.focus != CENTRAL_WINDOW)
|
||||
return;
|
||||
|
||||
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial;
|
||||
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial; _glfw.wl.pointer_serial = serial;
|
||||
|
||||
/* Makes left, right and middle 0, 1 and 2. Overall order follows evdev
|
||||
* codes. */
|
||||
|
|
@ -463,7 +463,7 @@ static void keyboardHandleEnter(void* data UNUSED,
|
|||
return;
|
||||
}
|
||||
|
||||
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial;
|
||||
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial; _glfw.wl.keyboard_enter_serial = serial;
|
||||
_glfw.wl.keyboardFocusId = window->id;
|
||||
_glfwInputWindowFocus(window, true);
|
||||
uint32_t* key;
|
||||
|
|
|
|||
2
glfw/wl_platform.h
vendored
2
glfw/wl_platform.h
vendored
|
|
@ -292,7 +292,7 @@ typedef struct _GLFWlibraryWayland
|
|||
|
||||
struct wl_surface* cursorSurface;
|
||||
GLFWCursorShape cursorPreviousShape;
|
||||
uint32_t serial, input_serial;
|
||||
uint32_t serial, input_serial, pointer_serial, keyboard_enter_serial;
|
||||
|
||||
int32_t keyboardRepeatRate;
|
||||
monotonic_t keyboardRepeatDelay;
|
||||
|
|
|
|||
28
glfw/wl_window.c
vendored
28
glfw/wl_window.c
vendored
|
|
@ -1942,22 +1942,6 @@ static const struct zwp_primary_selection_device_v1_listener primary_selection_d
|
|||
};
|
||||
|
||||
|
||||
static void
|
||||
clipboard_copy_callback_done(void *data, struct wl_callback *callback, uint32_t serial) {
|
||||
if (_glfw.wl.dataDevice && data == (void*)_glfw.wl.dataSourceForClipboard) {
|
||||
wl_data_device_set_selection(_glfw.wl.dataDevice, data, serial);
|
||||
}
|
||||
wl_callback_destroy(callback);
|
||||
}
|
||||
|
||||
static void
|
||||
primary_selection_copy_callback_done(void *data, struct wl_callback *callback, uint32_t serial) {
|
||||
if (_glfw.wl.primarySelectionDevice && data == (void*)_glfw.wl.dataSourceForPrimarySelection) {
|
||||
zwp_primary_selection_device_v1_set_selection(_glfw.wl.primarySelectionDevice, data, serial);
|
||||
}
|
||||
wl_callback_destroy(callback);
|
||||
}
|
||||
|
||||
void _glfwSetupWaylandDataDevice(void) {
|
||||
_glfw.wl.dataDevice = wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager, _glfw.wl.seat);
|
||||
if (_glfw.wl.dataDevice) wl_data_device_add_listener(_glfw.wl.dataDevice, &data_device_listener, NULL);
|
||||
|
|
@ -2049,13 +2033,15 @@ _glfwPlatformSetClipboard(GLFWClipboardType t) {
|
|||
}
|
||||
f(data_source, cd->mime_types[i]);
|
||||
}
|
||||
struct wl_callback *callback = wl_display_sync(_glfw.wl.display);
|
||||
if (t == GLFW_CLIPBOARD) {
|
||||
static const struct wl_callback_listener clipboard_copy_callback_listener = {.done = clipboard_copy_callback_done};
|
||||
wl_callback_add_listener(callback, &clipboard_copy_callback_listener, _glfw.wl.dataSourceForClipboard);
|
||||
// According to the Wayland spec only the application that has keyboard focus can set the clipboard.
|
||||
// Hurray for the Wayland nanny state!
|
||||
wl_data_device_set_selection(_glfw.wl.dataDevice, _glfw.wl.dataSourceForClipboard, _glfw.wl.keyboard_enter_serial);
|
||||
} else {
|
||||
static const struct wl_callback_listener primary_selection_copy_callback_listener = {.done = primary_selection_copy_callback_done};
|
||||
wl_callback_add_listener(callback, &primary_selection_copy_callback_listener, _glfw.wl.dataSourceForPrimarySelection);
|
||||
// According to the Wayland spec we can only set the primary selection in response to a pointer button event
|
||||
// Hurray for the Wayland nanny state!
|
||||
zwp_primary_selection_device_v1_set_selection(
|
||||
_glfw.wl.primarySelectionDevice, _glfw.wl.dataSourceForPrimarySelection, _glfw.wl.input_serial);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue