wayland: Minor code-style cleanups

This commit is contained in:
Frank Praznik 2024-08-13 09:51:10 -04:00
parent 01c42f1399
commit 76b35ae76f
No known key found for this signature in database

View file

@ -2049,8 +2049,7 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_
} }
/* SDL only supports "copy" style drag and drop */ /* SDL only supports "copy" style drag and drop */
if (data_device->has_mime_file == SDL_TRUE || if (data_device->has_mime_file || data_device->has_mime_text) {
data_device->has_mime_text == SDL_TRUE) {
dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
} else { } else {
/* drag_mime is NULL this will decline the offer */ /* drag_mime is NULL this will decline the offer */
@ -2126,9 +2125,7 @@ static void data_device_handle_motion(void *data, struct wl_data_device *wl_data
{ {
SDL_WaylandDataDevice *data_device = data; SDL_WaylandDataDevice *data_device = data;
if (data_device->drag_offer && data_device->dnd_window && if (data_device->drag_offer && data_device->dnd_window && (data_device->has_mime_file || data_device->has_mime_text)) {
(data_device->has_mime_file == SDL_TRUE ||
data_device->has_mime_text == SDL_TRUE)) {
const float dx = (float)wl_fixed_to_double(x); const float dx = (float)wl_fixed_to_double(x);
const float dy = (float)wl_fixed_to_double(y); const float dy = (float)wl_fixed_to_double(y);
@ -2153,9 +2150,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
{ {
SDL_WaylandDataDevice *data_device = data; SDL_WaylandDataDevice *data_device = data;
if (data_device->drag_offer && data_device->dnd_window && if (data_device->drag_offer && data_device->dnd_window && (data_device->has_mime_file || data_device->has_mime_text)) {
(data_device->has_mime_file == SDL_TRUE ||
data_device->has_mime_text == SDL_TRUE)) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x in window %d serial %d\n", ". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x in window %d serial %d\n",
WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer), WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer),
@ -2192,8 +2187,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
* non paths that are not visible to the application * non paths that are not visible to the application
*/ */
if (!drop_handled) { if (!drop_handled) {
const char *mime_type = (data_device->has_mime_file ? FILE_MIME : const char *mime_type = data_device->has_mime_file ? FILE_MIME : (data_device->has_mime_text ? TEXT_MIME : "");
(data_device->has_mime_text ? TEXT_MIME : ""));
void *buffer = Wayland_data_offer_receive(data_device->drag_offer, void *buffer = Wayland_data_offer_receive(data_device->drag_offer,
mime_type, &length); mime_type, &length);
if (data_device->has_mime_file) { if (data_device->has_mime_file) {
@ -2235,8 +2229,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
} }
} }
if (drop_handled && wl_data_offer_get_version(data_device->drag_offer->offer) >= if (drop_handled && wl_data_offer_get_version(data_device->drag_offer->offer) >= WL_DATA_OFFER_FINISH_SINCE_VERSION) {
WL_DATA_OFFER_FINISH_SINCE_VERSION) {
wl_data_offer_finish(data_device->drag_offer->offer); wl_data_offer_finish(data_device->drag_offer->offer);
} }
} else { } else {