Skip to content

Track what type of data offer is being provided and validate requests.#4935

Open
robert-ancell wants to merge 1 commit into
mainfrom
data-offer-type
Open

Track what type of data offer is being provided and validate requests.#4935
robert-ancell wants to merge 1 commit into
mainfrom
data-offer-type

Conversation

@robert-ancell
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 8, 2026 00:32
@robert-ancell
Copy link
Copy Markdown
Contributor Author

Came out of review of #4893

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens Wayland wl_data_offer request validation in Mir’s Wayland frontend by tracking whether an offer represents drag-and-drop (DnD) vs. selection, and rejecting DnD-only requests on selection offers.

Changes:

  • Introduce an OfferType and plumb it into WlDataDevice::Offer.
  • Validate finish() and set_actions() so they are only accepted for DnD offers (otherwise raise a protocol error).
  • Update offer creation sites to correctly mark offers as selection vs dnd.

Comment on lines +101 to +105
if (type != OfferType::dnd) {
throw mw::ProtocolError(
resource,
Error::invalid_offer,
"finish is only valid for drag and drop offers");

private:
friend mf::WlDataDevice;
OfferType type;
Comment on lines +138 to 142
mf::WlDataDevice::Offer::Offer(OfferType type, WlDataDevice* device, std::shared_ptr<ms::DataExchangeSource> const& source) :
mw::DataOffer(*device),
type{type},
device{device},
source{source}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants