mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-03 09:01:45 -05:00 
			
		
		
		
	style in buttonpress
This commit is contained in:
		
							parent
							
								
									288f6397fa
								
							
						
					
					
						commit
						2f21445761
					
				
					 1 changed files with 18 additions and 19 deletions
				
			
		
							
								
								
									
										17
									
								
								dwl.c
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								dwl.c
									
										
									
									
									
								
							| 
						 | 
					@ -237,14 +237,16 @@ buttonpress(struct wl_listener *listener, void *data)
 | 
				
			||||||
	/* Notify the client with pointer focus that a button press has occurred */
 | 
						/* Notify the client with pointer focus that a button press has occurred */
 | 
				
			||||||
	wlr_seat_pointer_notify_button(seat,
 | 
						wlr_seat_pointer_notify_button(seat,
 | 
				
			||||||
			event->time_msec, event->button, event->state);
 | 
								event->time_msec, event->button, event->state);
 | 
				
			||||||
	double sx, sy;
 | 
					 | 
				
			||||||
	struct wlr_surface *surface;
 | 
					 | 
				
			||||||
	Client *c = xytoclient(cursor->x, cursor->y, &surface, &sx, &sy);
 | 
					 | 
				
			||||||
	if (event->state == WLR_BUTTON_RELEASED) {
 | 
						if (event->state == WLR_BUTTON_RELEASED) {
 | 
				
			||||||
		/* If you released any buttons, we exit interactive move/resize mode. */
 | 
							/* If you released any buttons, we exit interactive move/resize mode. */
 | 
				
			||||||
		cursor_mode = CurNormal;
 | 
							cursor_mode = CurNormal;
 | 
				
			||||||
	} else {
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Change focus if the button was _pressed_ over a client */
 | 
						/* Change focus if the button was _pressed_ over a client */
 | 
				
			||||||
 | 
						double sx, sy;
 | 
				
			||||||
 | 
						struct wlr_surface *surface;
 | 
				
			||||||
 | 
						Client *c = xytoclient(cursor->x, cursor->y, &surface, &sx, &sy);
 | 
				
			||||||
	if (c) {
 | 
						if (c) {
 | 
				
			||||||
		focus(c, surface);
 | 
							focus(c, surface);
 | 
				
			||||||
		raiseclient(c);
 | 
							raiseclient(c);
 | 
				
			||||||
| 
						 | 
					@ -252,15 +254,12 @@ buttonpress(struct wl_listener *listener, void *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
 | 
						struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
 | 
				
			||||||
	uint32_t mods = wlr_keyboard_get_modifiers(keyboard);
 | 
						uint32_t mods = wlr_keyboard_get_modifiers(keyboard);
 | 
				
			||||||
		for (int i = 0; i < LENGTH(buttons); i++) {
 | 
						for (int i = 0; i < LENGTH(buttons); i++)
 | 
				
			||||||
		if (event->button == buttons[i].button &&
 | 
							if (event->button == buttons[i].button &&
 | 
				
			||||||
				CLEANMASK(mods) == CLEANMASK(buttons[i].mod) &&
 | 
									CLEANMASK(mods) == CLEANMASK(buttons[i].mod) &&
 | 
				
			||||||
					buttons[i].func) {
 | 
									buttons[i].func)
 | 
				
			||||||
			buttons[i].func(&buttons[i].arg);
 | 
								buttons[i].func(&buttons[i].arg);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
createkeyboard(struct wlr_input_device *device)
 | 
					createkeyboard(struct wlr_input_device *device)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue