Giter Site home page Giter Site logo

Comments (3)

lucasgruss avatar lucasgruss commented on June 26, 2024 2

Hi,
First of all thanks for writing this package !
As for sending fake mouse clicks, a discussion can be found here. While this could be a possible solution, I believe it might be simpler to advise the function mouse-drag-region before the call with (setq exwm-input-line-mode-passthrough nil) then advise with (setq exwm-input-line-mode-passthrough t) after it.

What is your opinion on the issue ?
I'll try to give it a go and send a pull request if I manage to fix it

from exwm-firefox-evil.

lucasgruss avatar lucasgruss commented on June 26, 2024 2

Hi,
it's been a little while but I managed to find a hack around this issue, but it involves EXWM itself and not EXWM-firefox, so I would not consider this issue fixed.

In exwm-input.el, changing the definition of exwm-input--on-ButtonPress-line-mode to :

(defun exwm-input--on-ButtonPress-line-mode (buffer button-event)
  "Handle button events in line mode.
BUFFER is the `exwm-mode' buffer the event was generated
on. BUTTON-EVENT is the X event converted into an Emacs event.

The return value is used as event_mode to release the original
button event."
  (with-current-buffer buffer
    (let ((read-event (exwm-input--mimic-read-event button-event)))
      (exwm--log "%s" read-event)
      (if (and read-event
               (exwm-input--event-passthrough-p read-event))
          ;; The event should be forwarded to emacs
          (progn
            (exwm-input--cache-event read-event)
            (exwm-input--unread-event button-event)

            xcb:Allow:ReplayPointer)
        ;; The event should be replayed
        xcb:Allow:ReplayPointer))))

does the trick. So xcb:Allow:SyncPointer was swapped with xcb:Allow:ReplayPointer in the (if case then else).

Pros :

  • quick fix
  • mouse works perfectly (no need to handle button release)

Cons :

  • necessary to modify EXWM itself
  • echo area still shows "mouse-drag-region must be bound to an event with parameters"
  • it removes the possibility to pass mouse click to emacs

I will try to improve the solution or even submit an issue to the exwm folks when I have a little more free time.

from exwm-firefox-evil.

walseb avatar walseb commented on June 26, 2024 1

Yeah that sounds like a better solution but does mouse-drag-region block until the user is done dragging? If so simply wrapping it inside a unwind-protect should work. Otherwise you would have to run the exwm-input-line-mode-passthrough setters after a start-drag and a end-drag event, which is risky because what if end-drag never happens? For example if keyboard-quit is fired while dragging or any other reason why the end event was never sent to emacs. Then the user would have (setq exwm-input-line-mode-passthrough t) in normal mode which is very confusing. I guess I just don't know how the mouse functions work in emacs, but feel free to submit a PR so I can take a look

from exwm-firefox-evil.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.