firefox/mozilla-1504689.patch

172 lines
5.8 KiB
Diff
Raw Normal View History

2018-11-05 14:38:29 +00:00
changeset: 444459:f76b5c265806
tag: tip
parent: 444456:d2963b5a2897
user: Martin Stransky <stransky@redhat.com>
date: Mon Nov 05 15:26:26 2018 +0100
summary: Bug 1504689 - [Wayland/Clipboard] Don't delete clipboard wl_data_offer after keyboard focus out, r=jhorak
diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
--- a/widget/gtk/nsClipboardWayland.cpp
+++ b/widget/gtk/nsClipboardWayland.cpp
@@ -520,25 +520,16 @@ nsRetrievalContextWayland::AddDragAndDro
nsWaylandDragContext*
nsRetrievalContextWayland::GetDragContext(void)
{
return mDragContext;
}
void
-nsRetrievalContextWayland::ClearClipboardDataOffers(void)
-{
- if (mClipboardOffer)
- mClipboardOffer = nullptr;
- if (mPrimaryOffer)
- mPrimaryOffer = nullptr;
-}
-
-void
nsRetrievalContextWayland::ClearDragAndDropDataOffer(void)
{
mDragContext = nullptr;
}
// We have a new fresh data content.
// We should attach listeners to it and save for further use.
static void
@@ -711,91 +702,16 @@ gtk_primary_selection_device_listener pr
};
bool
nsRetrievalContextWayland::HasSelectionSupport(void)
{
return mPrimarySelectionDataDeviceManager != nullptr;
}
-static void
-keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
- uint32_t format, int fd, uint32_t size)
-{
-}
-
-static void
-keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
- uint32_t serial, struct wl_surface *surface,
- struct wl_array *keys)
-{
-}
-
-static void
-keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
- uint32_t serial, struct wl_surface *surface)
-{
- // We lost focus so our clipboard data are outdated
- nsRetrievalContextWayland *context =
- static_cast<nsRetrievalContextWayland*>(data);
-
- context->ClearClipboardDataOffers();
-}
-
-static void
-keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
- uint32_t serial, uint32_t time, uint32_t key,
- uint32_t state)
-{
-}
-
-static void
-keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
- uint32_t serial, uint32_t mods_depressed,
- uint32_t mods_latched, uint32_t mods_locked,
- uint32_t group)
-{
-}
-
-static const struct wl_keyboard_listener keyboard_listener = {
- keyboard_handle_keymap,
- keyboard_handle_enter,
- keyboard_handle_leave,
- keyboard_handle_key,
- keyboard_handle_modifiers,
-};
-
-void
-nsRetrievalContextWayland::ConfigureKeyboard(wl_seat_capability caps)
-{
- // ConfigureKeyboard() is called when wl_seat configuration is changed.
- // We look for the keyboard only, get it when is't available and release it
- // when it's lost (we don't have focus for instance).
- if (caps & WL_SEAT_CAPABILITY_KEYBOARD) {
- mKeyboard = wl_seat_get_keyboard(mSeat);
- wl_keyboard_add_listener(mKeyboard, &keyboard_listener, this);
- } else if (mKeyboard && !(caps & WL_SEAT_CAPABILITY_KEYBOARD)) {
- wl_keyboard_destroy(mKeyboard);
- mKeyboard = nullptr;
- }
-}
-
-static void
-seat_handle_capabilities(void *data, struct wl_seat *seat,
- unsigned int caps)
-{
- nsRetrievalContextWayland *context =
- static_cast<nsRetrievalContextWayland*>(data);
- context->ConfigureKeyboard((wl_seat_capability)caps);
-}
-
-static const struct wl_seat_listener seat_listener = {
- seat_handle_capabilities,
-};
-
void
nsRetrievalContextWayland::InitDataDeviceManager(wl_registry *registry,
uint32_t id,
uint32_t version)
{
int data_device_manager_version = MIN (version, 3);
mDataDeviceManager = (wl_data_device_manager *)wl_registry_bind(registry, id,
&wl_data_device_manager_interface, data_device_manager_version);
@@ -811,17 +727,16 @@ nsRetrievalContextWayland::InitPrimarySe
}
void
nsRetrievalContextWayland::InitSeat(wl_registry *registry,
uint32_t id, uint32_t version,
void *data)
{
mSeat = (wl_seat*)wl_registry_bind(registry, id, &wl_seat_interface, 1);
- wl_seat_add_listener(mSeat, &seat_listener, data);
}
static void
gdk_registry_handle_global(void *data,
struct wl_registry *registry,
uint32_t id,
const char *interface,
uint32_t version)
diff --git a/widget/gtk/nsClipboardWayland.h b/widget/gtk/nsClipboardWayland.h
--- a/widget/gtk/nsClipboardWayland.h
+++ b/widget/gtk/nsClipboardWayland.h
@@ -120,20 +120,18 @@ public:
void RegisterNewDataOffer(wl_data_offer *aWaylandDataOffer);
void RegisterNewDataOffer(gtk_primary_selection_offer *aPrimaryDataOffer);
void SetClipboardDataOffer(wl_data_offer *aWaylandDataOffer);
void SetPrimaryDataOffer(gtk_primary_selection_offer *aPrimaryDataOffer);
void AddDragAndDropDataOffer(wl_data_offer *aWaylandDataOffer);
nsWaylandDragContext* GetDragContext();
- void ClearClipboardDataOffers();
void ClearDragAndDropDataOffer();
- void ConfigureKeyboard(wl_seat_capability caps);
void TransferFastTrackClipboard(int aClipboardRequestNumber,
GtkSelectionData *aSelectionData);
void InitDataDeviceManager(wl_registry *registry, uint32_t id, uint32_t version);
void InitPrimarySelectionDataDeviceManager(wl_registry *registry, uint32_t id);
void InitSeat(wl_registry *registry, uint32_t id, uint32_t version, void *data);
virtual ~nsRetrievalContextWayland() override;