<commit_before>#include "cursor.h"

#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "view.h"
#include "server.h"

static void wc_process_motion(struct wc_server* server, struct wc_cursor* cursor) {
	// TODO Only do this if no client underneath pointer
	if (!cursor->image || strcmp(cursor->image, "left_ptr") != 0) {
		cursor->image = "left_ptr";
		wlr_xcursor_manager_set_cursor_image(server->xcursor_mgr, "left_ptr",
				cursor->wlr_cursor);
	}
	// TODO Process entering and other things
}

static void wc_cursor_motion(struct wl_listener* listener, void* data) {
	struct wc_cursor *cursor = wl_container_of(listener, cursor, motion);
	struct wlr_event_pointer_motion *event = data;
	wlr_cursor_move(cursor->wlr_cursor, event->device,
			event->delta_x, event->delta_y);
	wc_process_motion(cursor->server, cursor);
}

static void wc_cursor_motion_absolute(struct wl_listener* listener, void* data) {
	struct wc_cursor *cursor = wl_container_of(listener, cursor,
			motion_absolute);
	struct wlr_event_pointer_motion_absolute *event = data;
	wlr_cursor_warp_absolute(cursor->wlr_cursor, event->device, event->x, event->y);
	wc_process_motion(cursor->server, cursor);
}

static void wc_cursor_button(struct wl_listener* listener, void* data) {<commit_msg>Only update cursor if not above a view<commit_after>#include "cursor.h"

#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "view.h"
#include "server.h"

static void wc_process_motion(struct wc_server* server, uint32_t time) {
	// TODO Do things depending on move or resize mode
	struct wlr_seat* seat = server->seat;
	struct wc_cursor* cursor = server->cursor;
	double sx, sy;
	struct wc_view* view = wc_view_at(server,
			cursor->wlr_cursor->x, cursor->wlr_cursor->y, &sx, &sy);
	bool cursor_image_different = !cursor->image || strcmp(cursor->image, "left_ptr") != 0;
	if (!view && cursor_image_different) {
		cursor->image = "left_ptr";
		wlr_xcursor_manager_set_cursor_image(server->xcursor_mgr, "left_ptr",
				cursor->wlr_cursor);
	}
	if (view) {
		bool focused_changed = seat->pointer_state.focused_surface != view->xdg_surface->surface;
		wlr_seat_pointer_notify_enter(seat, view->xdg_surface->surface, sx, sy);
		if (!focused_changed) {
			wlr_seat_pointer_notify_motion(seat, time, sx, sy);
		}
	} else {
		wlr_seat_pointer_clear_focus(seat);
	}
}

static void wc_cursor_motion(struct wl_listener* listener, void* data) {
	struct wc_cursor *cursor = wl_container_of(listener, cursor, motion);
	struct wlr_event_pointer_motion *event = data;
	wlr_cursor_move(cursor->wlr_cursor, event->device,
			event->delta_x, event->delta_y);
	wc_process_motion(cursor->server, event->time_msec);
}

static void wc_cursor_motion_absolute(struct wl_listener* listener, void* data) {
	struct wc_cursor *cursor = wl_container_of(listener, cursor,
			motion_absolute);
	struct wlr_event_pointer_motion_absolute *event = data;
	wlr_cursor_warp_absolute(cursor->wlr_cursor, event->device, event->x, event->y);
	wc_process_motion(cursor->server, event->time_msec);
}

static void wc_cursor_button(struct wl_listener* listener, void* data) {
{'fraction_non_alphanumeric': 0.12288, 'fraction_numerical': 0.00128, 'mean_word_length': 6.219399538106235, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5067963', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1106, 'n_words': 237}