mirror of
				https://codeberg.org/dwl/dwl-patches.git
				synced 2025-10-30 19:44:21 +00:00 
			
		
		
		
	Added scroll-factor patch
This commit is contained in:
		
							parent
							
								
									f19182bd0f
								
							
						
					
					
						commit
						7d3e875d88
					
				
							
								
								
									
										9
									
								
								patches/scroll-factor/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								patches/scroll-factor/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | ### Description | ||||||
|  | This patch adds scroll factor to dwl. The settings can be found in the trackpad section of the config. This allows user to control the sensitivity of 2-finger touchpad scrolling. | ||||||
|  | 
 | ||||||
|  | ### Download | ||||||
|  | - [git branch](https://codeberg.org/singul4ri7y/dwl/src/branch/scroll-factor) | ||||||
|  | - [2024-07-12](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/scroll-factor/scroll-factor.patch) | ||||||
|  | 
 | ||||||
|  | ### Authors | ||||||
|  | - [singul4ri7y](https://codeberg.org/singul4ri7y) | ||||||
							
								
								
									
										54
									
								
								patches/scroll-factor/scroll-factor.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								patches/scroll-factor/scroll-factor.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,54 @@ | |||||||
|  | From 3e765d49976685a8772bd3e12a8c5546868a97f7 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: SD Asif Hossein <s.dah.ingularity47@gmail.com> | ||||||
|  | Date: Fri, 12 Jul 2024 14:28:06 +0600 | ||||||
|  | Subject: [PATCH] Added scroll-factor patch | ||||||
|  | 
 | ||||||
|  | ---
 | ||||||
|  |  config.def.h |  3 +++ | ||||||
|  |  dwl.c        | 11 +++++++++-- | ||||||
|  |  2 files changed, 12 insertions(+), 2 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/config.def.h b/config.def.h
 | ||||||
|  | index 22d2171..83c4b87 100644
 | ||||||
|  | --- a/config.def.h
 | ||||||
|  | +++ b/config.def.h
 | ||||||
|  | @@ -71,6 +71,9 @@ 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; | ||||||
|  | +/* Scroll sensitivity */
 | ||||||
|  | +static const double scroll_factor = 1.0f;
 | ||||||
|  | +
 | ||||||
|  |  /* You can choose between: | ||||||
|  |  LIBINPUT_CONFIG_SCROLL_NO_SCROLL | ||||||
|  |  LIBINPUT_CONFIG_SCROLL_2FG | ||||||
|  | diff --git a/dwl.c b/dwl.c
 | ||||||
|  | index dc0437e..7e8d50d 100644
 | ||||||
|  | --- a/dwl.c
 | ||||||
|  | +++ b/dwl.c
 | ||||||
|  | @@ -581,13 +581,20 @@ axisnotify(struct wl_listener *listener, void *data)
 | ||||||
|  |  	/* This event is forwarded by the cursor when a pointer emits an axis event, | ||||||
|  |  	 * for example when you move the scroll wheel. */ | ||||||
|  |  	struct wlr_pointer_axis_event *event = data; | ||||||
|  | +	double delta = event->delta;
 | ||||||
|  | +	int32_t delta_disc = event->delta_discrete;
 | ||||||
|  | +	if(event->source == WLR_AXIS_SOURCE_FINGER) {
 | ||||||
|  | +		delta *= scroll_factor;
 | ||||||
|  | +		delta_disc = (int32_t)round(scroll_factor * delta_disc);
 | ||||||
|  | +	}
 | ||||||
|  | +
 | ||||||
|  |  	wlr_idle_notifier_v1_notify_activity(idle_notifier, seat); | ||||||
|  |  	/* TODO: allow usage of scroll whell for mousebindings, it can be implemented | ||||||
|  |  	 * checking the event's orientation and the delta of the event */ | ||||||
|  |  	/* Notify the client with pointer focus of the axis event. */ | ||||||
|  |  	wlr_seat_pointer_notify_axis(seat, | ||||||
|  | -			event->time_msec, event->orientation, event->delta,
 | ||||||
|  | -			event->delta_discrete, event->source);
 | ||||||
|  | +			event->time_msec, event->orientation, delta,
 | ||||||
|  | +			delta_disc, event->source);
 | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  void | ||||||
|  | -- 
 | ||||||
|  | 2.45.2 | ||||||
|  | 
 | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 SD Asif Hossein
						SD Asif Hossein