mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	libinput: support <dragLock>sticky<dragLock> and enable it by default
It is recommended by libinput: https://lists.freedesktop.org/archives/wayland-devel/2024-November/043860.html
This commit is contained in:
		
							parent
							
								
									cc84cee75b
								
							
						
					
					
						commit
						22d319cce8
					
				
					 5 changed files with 26 additions and 6 deletions
				
			
		| 
						 | 
					@ -958,7 +958,7 @@ extending outward from the snapped edge.
 | 
				
			||||||
    <tap>yes</tap>
 | 
					    <tap>yes</tap>
 | 
				
			||||||
    <tapButtonMap></tapButtonMap>
 | 
					    <tapButtonMap></tapButtonMap>
 | 
				
			||||||
    <tapAndDrag></tapAndDrag>
 | 
					    <tapAndDrag></tapAndDrag>
 | 
				
			||||||
    <dragLock></dragLock>
 | 
					    <dragLock>sticky</dragLock>
 | 
				
			||||||
    <middleEmulation></middleEmulation>
 | 
					    <middleEmulation></middleEmulation>
 | 
				
			||||||
    <disableWhileTyping></disableWhileTyping>
 | 
					    <disableWhileTyping></disableWhileTyping>
 | 
				
			||||||
    <clickMethod></clickMethod>
 | 
					    <clickMethod></clickMethod>
 | 
				
			||||||
| 
						 | 
					@ -1027,9 +1027,11 @@ extending outward from the snapped edge.
 | 
				
			||||||
	Enable or disable tap-and-drag for this category. Tap-and-drag processes
 | 
						Enable or disable tap-and-drag for this category. Tap-and-drag processes
 | 
				
			||||||
	a tap immediately followed by a finger down as the start of a drag.
 | 
						a tap immediately followed by a finger down as the start of a drag.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*<libinput><device><dragLock>* [yes|no]
 | 
					*<libinput><device><dragLock>* [yes|no|sticky]
 | 
				
			||||||
	Enable or disable drag lock for this category. Drag lock ignores a
 | 
						Enable or disable drag lock for this category. Drag lock ignores a temporary
 | 
				
			||||||
	momentary release of a finger during tap-and-dragging.
 | 
						release of a finger during tap-and-dragging. Both *yes* and *sticky* enable
 | 
				
			||||||
 | 
						drag lock, but if *yes* is set, the drag lock expires after a timeout.
 | 
				
			||||||
 | 
						Default is *sticky*.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*<libinput><device><middleEmulation>* [yes|no]
 | 
					*<libinput><device><middleEmulation>* [yes|no]
 | 
				
			||||||
	Enable or disable middle button emulation for this category. Middle
 | 
						Enable or disable middle button emulation for this category. Middle
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -632,7 +632,7 @@
 | 
				
			||||||
      <tap>yes</tap>
 | 
					      <tap>yes</tap>
 | 
				
			||||||
      <tapButtonMap></tapButtonMap>
 | 
					      <tapButtonMap></tapButtonMap>
 | 
				
			||||||
      <tapAndDrag></tapAndDrag>
 | 
					      <tapAndDrag></tapAndDrag>
 | 
				
			||||||
      <dragLock></dragLock>
 | 
					      <dragLock>sticky</dragLock>
 | 
				
			||||||
      <middleEmulation></middleEmulation>
 | 
					      <middleEmulation></middleEmulation>
 | 
				
			||||||
      <disableWhileTyping></disableWhileTyping>
 | 
					      <disableWhileTyping></disableWhileTyping>
 | 
				
			||||||
      <clickMethod></clickMethod>
 | 
					      <clickMethod></clickMethod>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,6 +110,10 @@ conf_data.set10('HAVE_RSVG', have_rsvg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
conf_data.set10('HAVE_LIBSFDO', have_libsfdo)
 | 
					conf_data.set10('HAVE_LIBSFDO', have_libsfdo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foreach sym : ['LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY']
 | 
				
			||||||
 | 
						conf_data.set10('HAVE_' + sym, cc.has_header_symbol('libinput.h', sym, dependencies: input))
 | 
				
			||||||
 | 
					endforeach
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if get_option('static_analyzer').enabled()
 | 
					if get_option('static_analyzer').enabled()
 | 
				
			||||||
  add_project_arguments(['-fanalyzer'], language: 'c')
 | 
					  add_project_arguments(['-fanalyzer'], language: 'c')
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
// SPDX-License-Identifier: GPL-2.0-only
 | 
					// SPDX-License-Identifier: GPL-2.0-only
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <strings.h>
 | 
					#include <strings.h>
 | 
				
			||||||
 | 
					#include "config.h"
 | 
				
			||||||
#include "common/mem.h"
 | 
					#include "common/mem.h"
 | 
				
			||||||
#include "common/list.h"
 | 
					#include "common/list.h"
 | 
				
			||||||
#include "common/string-helpers.h"
 | 
					#include "common/string-helpers.h"
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,11 @@ libinput_category_init(struct libinput_category *l)
 | 
				
			||||||
	l->tap = LIBINPUT_CONFIG_TAP_ENABLED;
 | 
						l->tap = LIBINPUT_CONFIG_TAP_ENABLED;
 | 
				
			||||||
	l->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
 | 
						l->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
 | 
				
			||||||
	l->tap_and_drag = -1;
 | 
						l->tap_and_drag = -1;
 | 
				
			||||||
 | 
					#if HAVE_LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
 | 
				
			||||||
 | 
						l->drag_lock = LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
	l->drag_lock = -1;
 | 
						l->drag_lock = -1;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	l->accel_profile = -1;
 | 
						l->accel_profile = -1;
 | 
				
			||||||
	l->middle_emu = -1;
 | 
						l->middle_emu = -1;
 | 
				
			||||||
	l->dwt = -1;
 | 
						l->dwt = -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -771,6 +771,16 @@ fill_libinput_category(char *nodename, char *content, struct parser_state *state
 | 
				
			||||||
			? LIBINPUT_CONFIG_DRAG_ENABLED
 | 
								? LIBINPUT_CONFIG_DRAG_ENABLED
 | 
				
			||||||
			: LIBINPUT_CONFIG_DRAG_DISABLED;
 | 
								: LIBINPUT_CONFIG_DRAG_DISABLED;
 | 
				
			||||||
	} else if (!strcasecmp(nodename, "dragLock")) {
 | 
						} else if (!strcasecmp(nodename, "dragLock")) {
 | 
				
			||||||
 | 
							if (!strcasecmp(content, "sticky")) {
 | 
				
			||||||
 | 
					#if HAVE_LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
 | 
				
			||||||
 | 
								state->current_libinput_category->drag_lock =
 | 
				
			||||||
 | 
									LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
								wlr_log(WLR_ERROR, "<dragLock>sticky</dragLock> is"
 | 
				
			||||||
 | 
									" only supported in libinput >= 1.27");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		int ret = parse_bool(content, -1);
 | 
							int ret = parse_bool(content, -1);
 | 
				
			||||||
		if (ret < 0) {
 | 
							if (ret < 0) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue