mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-03 09:01:45 -05:00 
			
		
		
		
	add unclutter
This commit is contained in:
		
							parent
							
								
									94a3a47128
								
							
						
					
					
						commit
						7bdacfe99c
					
				
					 2 changed files with 41 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -126,6 +126,8 @@ LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
 | 
			
		|||
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
 | 
			
		||||
static const double accel_speed = -0.5;
 | 
			
		||||
 | 
			
		||||
static const int cursor_timeout = 2;
 | 
			
		||||
 | 
			
		||||
/* separate variables for trackpad */
 | 
			
		||||
static const enum libinput_config_accel_profile accel_profile_trackpad = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
 | 
			
		||||
static const double accel_speed_trackpad = -0.0;
 | 
			
		||||
| 
						 | 
				
			
			@ -136,7 +138,6 @@ LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
 | 
			
		|||
*/
 | 
			
		||||
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
 | 
			
		||||
 | 
			
		||||
static const int cursor_timeout = 2;
 | 
			
		||||
 | 
			
		||||
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
 | 
			
		||||
#define MODKEY WLR_MODIFIER_LOGO
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										38
									
								
								dwl.c
									
										
									
									
									
								
							
							
						
						
									
										38
									
								
								dwl.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -309,6 +309,8 @@ static void focusmon(const Arg *arg);
 | 
			
		|||
static void focusstack(const Arg *arg);
 | 
			
		||||
static Client *focustop(Monitor *m, int onlytiled);
 | 
			
		||||
static void fullscreennotify(struct wl_listener *listener, void *data);
 | 
			
		||||
static void restorecursor(void);
 | 
			
		||||
static int hidecursor(void *data);
 | 
			
		||||
static void handlesig(int signo);
 | 
			
		||||
static void hidebehindmonocle(Monitor *m);
 | 
			
		||||
static void incnmaster(const Arg *arg);
 | 
			
		||||
| 
						 | 
				
			
			@ -419,6 +421,8 @@ static int active_confine_requires_warp;
 | 
			
		|||
 | 
			
		||||
static struct wlr_cursor *cursor;
 | 
			
		||||
static struct wlr_xcursor_manager *cursor_mgr;
 | 
			
		||||
static struct wl_event_source *hide_source;
 | 
			
		||||
static bool cursor_hidden = false;
 | 
			
		||||
 | 
			
		||||
static struct wlr_session_lock_manager_v1 *session_lock_mgr;
 | 
			
		||||
static struct wlr_scene_rect *locked_bg;
 | 
			
		||||
| 
						 | 
				
			
			@ -624,6 +628,9 @@ axisnotify(struct wl_listener *listener, void *data)
 | 
			
		|||
	 * for example when you move the scroll wheel. */
 | 
			
		||||
	struct wlr_pointer_axis_event *event = data;
 | 
			
		||||
	wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
 | 
			
		||||
	if (cursor_hidden)
 | 
			
		||||
		wlr_cursor_unset_image(cursor);
 | 
			
		||||
 | 
			
		||||
	/* 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. */
 | 
			
		||||
| 
						 | 
				
			
			@ -642,6 +649,7 @@ buttonpress(struct wl_listener *listener, void *data)
 | 
			
		|||
	const Button *b;
 | 
			
		||||
 | 
			
		||||
	wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
 | 
			
		||||
	// handlecursoractivity(false);
 | 
			
		||||
 | 
			
		||||
	switch (event->state) {
 | 
			
		||||
	case WLR_BUTTON_PRESSED:
 | 
			
		||||
| 
						 | 
				
			
			@ -1852,6 +1860,25 @@ hidebehindmonocle(Monitor *m)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
restorecursor(void)
 | 
			
		||||
{
 | 
			
		||||
	wl_event_source_timer_update(hide_source, cursor_timeout * 1000);
 | 
			
		||||
 | 
			
		||||
	if (cursor_hidden) {
 | 
			
		||||
		wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
 | 
			
		||||
		cursor_hidden = false;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
hidecursor(void *data)
 | 
			
		||||
{
 | 
			
		||||
	wlr_cursor_unset_image(cursor);
 | 
			
		||||
	cursor_hidden = true;
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
incnmaster(const Arg *arg)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -1960,6 +1987,8 @@ keypress(struct wl_listener *listener, void *data)
 | 
			
		|||
	uint32_t mods = wlr_keyboard_get_modifiers(kb->wlr_keyboard);
 | 
			
		||||
 | 
			
		||||
	wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
 | 
			
		||||
	if (cursor_hidden)
 | 
			
		||||
		wlr_cursor_unset_image(cursor);
 | 
			
		||||
 | 
			
		||||
	kblayoutnotify(kb, 0);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2232,6 +2261,7 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
 | 
			
		|||
		wlr_cursor_move(cursor, device, dx, dy);
 | 
			
		||||
 | 
			
		||||
		wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
 | 
			
		||||
		restorecursor();
 | 
			
		||||
 | 
			
		||||
		/* Update selmon (even while dragging a window) */
 | 
			
		||||
		if (sloppyfocus)
 | 
			
		||||
| 
						 | 
				
			
			@ -2408,6 +2438,9 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
 | 
			
		|||
	/* Let the client know that the mouse cursor has entered one
 | 
			
		||||
	 * of its surfaces, and make keyboard focus follow if desired.
 | 
			
		||||
	 * wlroots makes this a no-op if surface is already focused */
 | 
			
		||||
	/* Don't show the cursor when calling motionnotify(0) to restore pointer
 | 
			
		||||
	 * focus. */
 | 
			
		||||
	if (!cursor_hidden)
 | 
			
		||||
		wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
 | 
			
		||||
	wlr_seat_pointer_notify_motion(seat, time, sx, sy);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2601,6 +2634,8 @@ run(char *startup_cmd)
 | 
			
		|||
	wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y);
 | 
			
		||||
	wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
 | 
			
		||||
 | 
			
		||||
	wl_event_source_timer_update(hide_source, cursor_timeout * 1000);
 | 
			
		||||
 | 
			
		||||
	/* Run the Wayland event loop. This does not return until you exit the
 | 
			
		||||
	 * compositor. Starting the backend rigged up all of the necessary event
 | 
			
		||||
	 * loop configuration to listen to libinput events, DRM events, generate
 | 
			
		||||
| 
						 | 
				
			
			@ -2900,6 +2935,9 @@ setup(void)
 | 
			
		|||
	xdg_decoration_mgr = wlr_xdg_decoration_manager_v1_create(dpy);
 | 
			
		||||
	LISTEN_STATIC(&xdg_decoration_mgr->events.new_toplevel_decoration, createdecoration);
 | 
			
		||||
 | 
			
		||||
	hide_source = wl_event_loop_add_timer(wl_display_get_event_loop(dpy),
 | 
			
		||||
			hidecursor, cursor);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Creates a cursor, which is a wlroots utility for tracking the cursor
 | 
			
		||||
	 * image shown on screen.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue