Do not evaluate return value gdk_window_get_device_position(), move if clause to the proper place.