0

Consider the following rules:

  • I have a drawin of let's say width=200, height=200.
  • Inside of this drawin I have an element which has width=10 height=10
  • I want to be able to click ("button::press") and drag ("mouse::move") this element.
  • When I release ("button::release) the mouse button, I want the element to no longer be dragged when I move the mouse.

With these rules in mind, I do the following:

  1. I click on the element.
  2. I drag the mouse to somewhere out of the drawin.
  3. I release the click button.
  4. I move my mouse back into the drawin.
  5. The element still moves, because no "button::release" event was emitted on the drawin. Also, If I move my mouse quickly enough outside the drawin, the element will NOT be on the edge of the drawin.

The expected result would be that the element would be dragged to the edge of the drawin for as long as I hold down the mouse button, and that the element would stop being dragged when I release the mouse button, wherever it may be on the screen.

My solution was that whenever I have some element which can be click-and-dragged, listen to "mouse::move" and "button::release" signals emitted by the global mouse object, and go from there. The problem is that the global mouse object does NOT emit these signals.

How can I fix this problem?

  • You can't listen to mouse::move events on the global mouse object in AwesomeWM. You'll need to create a custom widget that emits these events. – Mohamed Elgazar Oct 16 '22 at 11:33

0 Answers0