dr460nf1r3 / firedragon-browser

A Floorp fork with custom branding and opinionated settings 🐉 (mirrored from GitLab)
https://firedragon.garudalinux.org
Mozilla Public License 2.0
282 stars 15 forks source link

[BUG] Side-effect Enabling middle click paste #97

Open alkaris2 opened 3 months ago

alkaris2 commented 3 months ago

The feature in FireDragon here that lets you "Enable middle click paste" has an unfortunate side-effect, at least on Linux, but when this setting is toggled on, it causes Selected and highlighted text focus to be stolen by FireDragon away from other applications. While this is working as intended, it needs to be resolved so that FireDragon doesn't just constantly steal focus, because it causes a lot of problems when trying to select text in a word document or some other, only for FireDragon indirectly interfering with them when it comes to selecting text to highlight under your cursor.

To check what was stealing X selection I used this code to find it pointed to FireDragon as the culprit,

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>

int main() {
  printf("%#lx\n", XGetSelectionOwner (XOpenDisplay(0), XA_PRIMARY));
  return 0;
}
Compile with:
gcc xsteal.c -lX11

after compiling the above I did;

ps -fp "$(xdotool getwindowpid "$(./a.out)")"

which prints out the PID and process to find who had XGetSelectionOwner

After disabling "Enable middle click paste", this behavior no longer happens. If possible, to avoid this issue when this is enabled, when you try use the built-in XGetSelectionOwner use native selection defaults. Some Linux desktops have middle click paste enabled by default, and so you should only just try to read available buffers if they're enabled on the system.