summaryrefslogtreecommitdiffstats
path: root/dwl-patches/patches/primaryselection/primaryselection.patch
blob: ab6bb64f6ec2894613bbdb86b54cf0144ad471b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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