mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	swaybar: separate input code to new file
This commit is contained in:
		
							parent
							
								
									d88b7a63f4
								
							
						
					
					
						commit
						499150a91b
					
				
					 7 changed files with 340 additions and 316 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
#ifndef _SWAYBAR_BAR_H
 | 
			
		||||
#define _SWAYBAR_BAR_H
 | 
			
		||||
#include <wayland-client.h>
 | 
			
		||||
#include "input.h"
 | 
			
		||||
#include "pool-buffer.h"
 | 
			
		||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
 | 
			
		||||
#include "xdg-output-unstable-v1-client-protocol.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -10,42 +11,6 @@ struct swaybar_output;
 | 
			
		|||
struct swaybar_workspace;
 | 
			
		||||
struct loop;
 | 
			
		||||
 | 
			
		||||
struct swaybar_pointer {
 | 
			
		||||
	struct wl_pointer *pointer;
 | 
			
		||||
	struct wl_cursor_theme *cursor_theme;
 | 
			
		||||
	struct wl_cursor_image *cursor_image;
 | 
			
		||||
	struct wl_surface *cursor_surface;
 | 
			
		||||
	struct swaybar_output *current;
 | 
			
		||||
	int x, y;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum x11_button {
 | 
			
		||||
	NONE,
 | 
			
		||||
	LEFT,
 | 
			
		||||
	MIDDLE,
 | 
			
		||||
	RIGHT,
 | 
			
		||||
	SCROLL_UP,
 | 
			
		||||
	SCROLL_DOWN,
 | 
			
		||||
	SCROLL_LEFT,
 | 
			
		||||
	SCROLL_RIGHT,
 | 
			
		||||
	BACK,
 | 
			
		||||
	FORWARD,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum hotspot_event_handling {
 | 
			
		||||
	HOTSPOT_IGNORE,
 | 
			
		||||
	HOTSPOT_PROCESS,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct swaybar_hotspot {
 | 
			
		||||
	struct wl_list link; // swaybar_output::hotspots
 | 
			
		||||
	int x, y, width, height;
 | 
			
		||||
	enum hotspot_event_handling (*callback)(struct swaybar_output *output,
 | 
			
		||||
			int x, int y, enum x11_button button, void *data);
 | 
			
		||||
	void (*destroy)(void *data);
 | 
			
		||||
	void *data;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct swaybar {
 | 
			
		||||
	char *id;
 | 
			
		||||
	char *mode;
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +90,6 @@ void bar_teardown(struct swaybar *bar);
 | 
			
		|||
 * Returns true if the bar is now visible, otherwise false.
 | 
			
		||||
 */
 | 
			
		||||
bool determine_bar_visibility(struct swaybar *bar, bool moving_layer);
 | 
			
		||||
void free_hotspots(struct wl_list *list);
 | 
			
		||||
void free_workspaces(struct wl_list *list);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
#ifndef _SWAYBAR_I3BAR_H
 | 
			
		||||
#define _SWAYBAR_I3BAR_H
 | 
			
		||||
 | 
			
		||||
#include "bar.h"
 | 
			
		||||
#include "input.h"
 | 
			
		||||
#include "status_line.h"
 | 
			
		||||
 | 
			
		||||
struct i3bar_block {
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,5 @@ void i3bar_block_unref(struct i3bar_block *block);
 | 
			
		|||
bool i3bar_handle_readable(struct status_line *status);
 | 
			
		||||
enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
 | 
			
		||||
		struct i3bar_block *block, int x, int y, enum x11_button button);
 | 
			
		||||
enum x11_button wl_button_to_x11_button(uint32_t button);
 | 
			
		||||
enum x11_button wl_axis_to_x11_button(uint32_t axis, wl_fixed_t value);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										49
									
								
								include/swaybar/input.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								include/swaybar/input.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
#ifndef _SWAYBAR_INPUT_H
 | 
			
		||||
#define _SWAYBAR_INPUT_H
 | 
			
		||||
 | 
			
		||||
#include <wayland-client.h>
 | 
			
		||||
#include "list.h"
 | 
			
		||||
 | 
			
		||||
struct swaybar_output;
 | 
			
		||||
 | 
			
		||||
struct swaybar_pointer {
 | 
			
		||||
	struct wl_pointer *pointer;
 | 
			
		||||
	struct wl_cursor_theme *cursor_theme;
 | 
			
		||||
	struct wl_cursor_image *cursor_image;
 | 
			
		||||
	struct wl_surface *cursor_surface;
 | 
			
		||||
	struct swaybar_output *current;
 | 
			
		||||
	int x, y;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum x11_button {
 | 
			
		||||
	NONE,
 | 
			
		||||
	LEFT,
 | 
			
		||||
	MIDDLE,
 | 
			
		||||
	RIGHT,
 | 
			
		||||
	SCROLL_UP,
 | 
			
		||||
	SCROLL_DOWN,
 | 
			
		||||
	SCROLL_LEFT,
 | 
			
		||||
	SCROLL_RIGHT,
 | 
			
		||||
	BACK,
 | 
			
		||||
	FORWARD,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum hotspot_event_handling {
 | 
			
		||||
	HOTSPOT_IGNORE,
 | 
			
		||||
	HOTSPOT_PROCESS,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct swaybar_hotspot {
 | 
			
		||||
	struct wl_list link; // swaybar_output::hotspots
 | 
			
		||||
	int x, y, width, height;
 | 
			
		||||
	enum hotspot_event_handling (*callback)(struct swaybar_output *output,
 | 
			
		||||
			int x, int y, enum x11_button button, void *data);
 | 
			
		||||
	void (*destroy)(void *data);
 | 
			
		||||
	void *data;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern const struct wl_seat_listener seat_listener;
 | 
			
		||||
 | 
			
		||||
void free_hotspots(struct wl_list *list);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue