diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-04 15:33:20 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-04 15:33:20 +0300 |
commit | cdd718dbb242f614a8d8588c4996e7159ba737ea (patch) | |
tree | 0e37483082614fe0c98e4fa8bc0d318a77009911 /intern | |
parent | 28e0cc424da8fb0b2cc0a58396d2fbb6e9d7be15 (diff) |
GHOST/Wayland: improve logging for drag & drop
Log the response for dropping events to simplify troubleshooting
drag & drop failure.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index ebb52bf08cb..5eea90015b1 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -1197,8 +1197,6 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat input_t *input = static_cast<input_t *>(data); std::lock_guard lock{input->data_offer_dnd_mutex}; - CLOG_INFO(LOG, 2, "drop"); - data_offer_t *data_offer = input->data_offer_dnd; const std::string mime_receive = *std::find_first_of(mime_preference_order.begin(), @@ -1206,6 +1204,8 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat data_offer->types.begin(), data_offer->types.end()); + CLOG_INFO(LOG, 2, "drop mime_recieve=%s", mime_receive.c_str()); + auto read_uris_fn = [](input_t *const input, data_offer_t *data_offer, wl_surface *surface, @@ -1214,6 +1214,9 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat const std::string data = read_pipe(data_offer, mime_receive, nullptr); + CLOG_INFO( + LOG, 2, "drop_read_uris mime_receive=%s, data=%s", mime_receive.c_str(), data.c_str()); + wl_data_offer_finish(data_offer->id); wl_data_offer_destroy(data_offer->id); @@ -1240,6 +1243,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat break; } uris.push_back(data.substr(start, end - start)); + CLOG_INFO(LOG, 2, "drop_read_uris pos=%zu, text_uri=\"%s\"", start, uris.back().c_str()); } GHOST_TStringArray *flist = static_cast<GHOST_TStringArray *>( @@ -1251,6 +1255,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat memcpy(flist->strings[i], uris[i].data(), uris[i].size() + 1); } + CLOG_INFO(LOG, 2, "drop_read_uris_fn file_count=%d", flist->count); const wl_fixed_t scale = win->scale(); system->pushEvent(new GHOST_EventDragnDrop(system->getMilliSeconds(), GHOST_kEventDraggingDropDone, @@ -1263,12 +1268,13 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat else if (ELEM(mime_receive, mime_text_plain, mime_text_utf8)) { /* TODO: enable use of internal functions 'txt_insert_buf' and * 'text_update_edited' to behave like dropped text was pasted. */ + CLOG_INFO(LOG, 2, "drop_read_uris_fn (text_plain, text_utf8), unhandled!"); } wl_display_roundtrip(system->display()); }; /* Pass in `input->focus_dnd` instead of accessing it from `input` since the leave callback - * (#data_device_leave) will clear the value once this function starts. */ + * (#data_device_handle_leave) will clear the value once this function starts. */ std::thread read_thread(read_uris_fn, input, data_offer, input->focus_dnd, mime_receive); read_thread.detach(); } |