Hi Ruben,
there are several troubles with your code.

inv_is_floating is a function. You must call it this way:
Code:
if ( inv_is_floating() )
{...



Anyway looking into inventory.c I saw that the floating icon is created after the event call so it will never be true.

You set slot_was_clicked as the function called when a slot is clicked so you can be totally sure that the mouse is over the clicked slot when the event is called. It is not possible to find the mouse out of the inventory panel when you click over a slot.

Same happens with the mouse buttons. You can be totally sure that the mouse left button is pressed when the slot click event is called (unless enable_mouse is set to 2).

Hope it helps wink