Skip to content

Extending the wayfire-shell-unstable-v2 protocol#3019

Open
marcusbritanicus wants to merge 2 commits into
WayfireWM:masterfrom
marcus-wayfire:master
Open

Extending the wayfire-shell-unstable-v2 protocol#3019
marcusbritanicus wants to merge 2 commits into
WayfireWM:masterfrom
marcus-wayfire:master

Conversation

@marcusbritanicus
Copy link
Copy Markdown
Contributor

@marcusbritanicus marcusbritanicus commented Apr 30, 2026

  • Added create_positioned_hotspot request to zwf_output_v2 interface.
  • Added create_custom_hotspot request to zwf_output_v2 interface.
  • Added proximity_changed event to zwf_hotspot_v2 interface.
  • All hotspots (edge, corner, positioned) will now get proximity_changed signals

- Added create_positioned_hotspot request to zwf_output_v2 interface.
- Added proximity_changed event to zwf_hotspot_v2 interface.
- All hotspots (edge, corner, positioned) will now get proximity_changed
  signals
- Replaced create_positioned_hotspot(...) with
  create_custom_hotspot(...)
Copy link
Copy Markdown
Member

@ammen99 ammen99 left a comment

Choose a reason for hiding this comment

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

lgtm overall, a few things I noticed, I trust you have tested this :)

whenever the input pointer moves within the hotspot area.

Proximity indicates the current distance in pixels from the input pointer
to the trigger point of the hotspot:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I find this wording a bit confusing, is there a 'trigger point of the hotspot'? I thought hotspots can be rectangles.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, hotspots can be rectangles. I tried to write a general explanation, which was way too confusing. In case of the rectangle, there are simply 2(l+b) trigger points along the perimeter of the rectangle. So, in the rectangular case, the point on the perimeter closest to the mouse is the "trigger point".

I agree that it can be a bit misleading. If you have a better wording, I am happy to incorporate it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Proximity is defined as the length of the shortest segment connecting the input pointer to the boundary of the hotspot rectangle or something like it?

wf::geometry_t calculate_trigger_geometry(uint32_t edge_mask)
{
wf::geometry_t output_geom = this->output->get_layout_geometry();
int edge_count = 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks quite inefficient, can't we replace it by __builtin_popcount? We already use these types of functions in other places.


void send_proximity_if_needed(const wf::point_t& cursor)
{
if (wl_resource_get_version(hotspot_resource) < 2)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

there should be a macro defined as the version in which proximity was defined (in the protocol header created by wayland-scanner).


uint32_t calculate_proximity(const wf::point_t& cursor) const
{
const auto& rect = trigger;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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