update primaryselection patch for main dwl

This commit is contained in:
nullsystem 2025-11-19 22:41:14 +00:00
parent 973df560ec
commit 5493b6dd94
3 changed files with 69 additions and 17 deletions

View File

@ -3,7 +3,8 @@ Adds a config option to disable/enable primary selection (middle-click paste).
### Download ### Download
- [git branch](https://codeberg.org/nullsystem/dwl/src/branch/main_primaryselection) - [git branch](https://codeberg.org/nullsystem/dwl/src/branch/main_primaryselection)
- [2024-04-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/primaryselection/primaryselection.patch) - [2025-11-19](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/primaryselection/primaryselection.patch)
- [2024-04-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/primaryselection/primaryselection-2024-04-06.patch)
### Authors ### Authors
- [nullsystem](https://codeberg.org/nullsystem) - [nullsystem](https://codeberg.org/nullsystem)

View File

@ -0,0 +1,50 @@
From 4fc77fde2f6015564544e029f9905fc1678fcb59 Mon Sep 17 00:00:00 2001
From: nullsystem <nullsystem.aongp@slmail.me>
Date: Sat, 6 Apr 2024 14:19:44 +0100
Subject: [PATCH] primaryselection - disable/enable primary selection
* Just simply adds a config to disable/enable primary selection
---
config.def.h | 1 +
dwl.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 8847e58..057e1c3 100644
--- a/config.def.h
+++ b/config.def.h
@@ -66,6 +66,7 @@ static const int natural_scrolling = 0;
static const int disable_while_typing = 1;
static const int left_handed = 0;
static const int middle_button_emulation = 0;
+static const int enable_primary_selection = 0;
/* You can choose between:
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
LIBINPUT_CONFIG_SCROLL_2FG
diff --git a/dwl.c b/dwl.c
index bf763df..7e8d8f2 100644
--- a/dwl.c
+++ b/dwl.c
@@ -2339,7 +2339,8 @@ setup(void)
wlr_export_dmabuf_manager_v1_create(dpy);
wlr_screencopy_manager_v1_create(dpy);
wlr_data_control_manager_v1_create(dpy);
- wlr_primary_selection_v1_device_manager_create(dpy);
+ if (enable_primary_selection)
+ wlr_primary_selection_v1_device_manager_create(dpy);
wlr_viewporter_create(dpy);
wlr_single_pixel_buffer_manager_v1_create(dpy);
wlr_fractional_scale_manager_v1_create(dpy, 1);
@@ -2449,7 +2450,8 @@ setup(void)
seat = wlr_seat_create(dpy, "seat0");
LISTEN_STATIC(&seat->events.request_set_cursor, setcursor);
LISTEN_STATIC(&seat->events.request_set_selection, setsel);
- LISTEN_STATIC(&seat->events.request_set_primary_selection, setpsel);
+ if (enable_primary_selection)
+ LISTEN_STATIC(&seat->events.request_set_primary_selection, setpsel);
LISTEN_STATIC(&seat->events.request_start_drag, requeststartdrag);
LISTEN_STATIC(&seat->events.start_drag, startdrag);
--
2.44.0

View File

@ -1,19 +1,20 @@
From 4fc77fde2f6015564544e029f9905fc1678fcb59 Mon Sep 17 00:00:00 2001 From 57d50147a2ffd91e6c10c12162dd4a55c451485c Mon Sep 17 00:00:00 2001
From: nullsystem <nullsystem.aongp@slmail.me> From: nullsystem <nullsystem@noreply.codeberg.org>
Date: Sat, 6 Apr 2024 14:19:44 +0100 Date: Wed, 19 Nov 2025 22:35:24 +0000
Subject: [PATCH] primaryselection - disable/enable primary selection Subject: [PATCH] [PATCH] primaryselection - disable/enable primary selection
* Just simply adds a config to disable/enable primary selection * Just simply adds a config to disable/enable primary selection
* 2025-11-19 update
--- ---
config.def.h | 1 + config.def.h | 1 +
dwl.c | 6 ++++-- dwl.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-) 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 8847e58..057e1c3 100644 index 95c2afa..1d143db 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -66,6 +66,7 @@ static const int natural_scrolling = 0; @@ -71,6 +71,7 @@ static const int natural_scrolling = 0;
static const int disable_while_typing = 1; static const int disable_while_typing = 1;
static const int left_handed = 0; static const int left_handed = 0;
static const int middle_button_emulation = 0; static const int middle_button_emulation = 0;
@ -22,10 +23,10 @@ index 8847e58..057e1c3 100644
LIBINPUT_CONFIG_SCROLL_NO_SCROLL LIBINPUT_CONFIG_SCROLL_NO_SCROLL
LIBINPUT_CONFIG_SCROLL_2FG LIBINPUT_CONFIG_SCROLL_2FG
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index bf763df..7e8d8f2 100644 index 12f441e..3a026b4 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -2339,7 +2339,8 @@ setup(void) @@ -2517,7 +2517,8 @@ setup(void)
wlr_export_dmabuf_manager_v1_create(dpy); wlr_export_dmabuf_manager_v1_create(dpy);
wlr_screencopy_manager_v1_create(dpy); wlr_screencopy_manager_v1_create(dpy);
wlr_data_control_manager_v1_create(dpy); wlr_data_control_manager_v1_create(dpy);
@ -35,16 +36,16 @@ index bf763df..7e8d8f2 100644
wlr_viewporter_create(dpy); wlr_viewporter_create(dpy);
wlr_single_pixel_buffer_manager_v1_create(dpy); wlr_single_pixel_buffer_manager_v1_create(dpy);
wlr_fractional_scale_manager_v1_create(dpy, 1); wlr_fractional_scale_manager_v1_create(dpy, 1);
@@ -2449,7 +2450,8 @@ setup(void) @@ -2634,7 +2635,8 @@ setup(void)
seat = wlr_seat_create(dpy, "seat0"); seat = wlr_seat_create(dpy, "seat0");
LISTEN_STATIC(&seat->events.request_set_cursor, setcursor); wl_signal_add(&seat->events.request_set_cursor, &request_cursor);
LISTEN_STATIC(&seat->events.request_set_selection, setsel); wl_signal_add(&seat->events.request_set_selection, &request_set_sel);
- LISTEN_STATIC(&seat->events.request_set_primary_selection, setpsel); - wl_signal_add(&seat->events.request_set_primary_selection, &request_set_psel);
+ if (enable_primary_selection) + if (enable_primary_selection)
+ LISTEN_STATIC(&seat->events.request_set_primary_selection, setpsel); + wl_signal_add(&seat->events.request_set_primary_selection, &request_set_psel);
LISTEN_STATIC(&seat->events.request_start_drag, requeststartdrag); wl_signal_add(&seat->events.request_start_drag, &request_start_drag);
LISTEN_STATIC(&seat->events.start_drag, startdrag); wl_signal_add(&seat->events.start_drag, &start_drag);
-- --
2.44.0 2.52.0