mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	
						commit
						4885a6c423
					
				
					 8 changed files with 16 additions and 16 deletions
				
			
		| 
						 | 
					@ -342,7 +342,7 @@ char *cmdsep(char **stringp, const char *delim) {
 | 
				
			||||||
	char *head = *stringp + strspn(*stringp, delim);
 | 
						char *head = *stringp + strspn(*stringp, delim);
 | 
				
			||||||
	// Find end token
 | 
						// Find end token
 | 
				
			||||||
	char *tail = *stringp += strcspn(*stringp, delim);
 | 
						char *tail = *stringp += strcspn(*stringp, delim);
 | 
				
			||||||
	// Set stringp to begining of next token
 | 
						// Set stringp to beginning of next token
 | 
				
			||||||
	*stringp += strspn(*stringp, delim);
 | 
						*stringp += strspn(*stringp, delim);
 | 
				
			||||||
	// Set stringp to null if last token
 | 
						// Set stringp to null if last token
 | 
				
			||||||
	if (!**stringp) *stringp = NULL;
 | 
						if (!**stringp) *stringp = NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@ enum ipc_command_type {
 | 
				
			||||||
	IPC_GET_BAR_CONFIG = 6,
 | 
						IPC_GET_BAR_CONFIG = 6,
 | 
				
			||||||
	IPC_GET_VERSION = 7,
 | 
						IPC_GET_VERSION = 7,
 | 
				
			||||||
	IPC_GET_INPUTS = 8,
 | 
						IPC_GET_INPUTS = 8,
 | 
				
			||||||
	// Events send from sway to clients. Events have the higest bits set.
 | 
						// Events send from sway to clients. Events have the highest bits set.
 | 
				
			||||||
	IPC_EVENT_WORKSPACE = (1 << (31 - 0)),
 | 
						IPC_EVENT_WORKSPACE = (1 << (31 - 0)),
 | 
				
			||||||
	IPC_EVENT_OUTPUT = (1 << (31 - 1)),
 | 
						IPC_EVENT_OUTPUT = (1 << (31 - 1)),
 | 
				
			||||||
	IPC_EVENT_MODE = (1 << (31 - 2)),
 | 
						IPC_EVENT_MODE = (1 << (31 - 2)),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -758,7 +758,7 @@ static struct cmd_results *cmd_mode(int argc, char **argv) {
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Create mode if it doesnt exist
 | 
						// Create mode if it doesn't exist
 | 
				
			||||||
	if (!mode && mode_make) {
 | 
						if (!mode && mode_make) {
 | 
				
			||||||
		mode = malloc(sizeof*mode);
 | 
							mode = malloc(sizeof*mode);
 | 
				
			||||||
		mode->name = strdup(mode_name);
 | 
							mode->name = strdup(mode_name);
 | 
				
			||||||
| 
						 | 
					@ -1917,7 +1917,7 @@ static struct cmd_results *_do_split(int argc, char **argv, int layout) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	swayc_t *focused = get_focused_container(&root_container);
 | 
						swayc_t *focused = get_focused_container(&root_container);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Case of floating window, dont split
 | 
						// Case of floating window, don't split
 | 
				
			||||||
	if (focused->is_floating) {
 | 
						if (focused->is_floating) {
 | 
				
			||||||
		return cmd_results_new(CMD_SUCCESS, NULL, NULL);
 | 
							return cmd_results_new(CMD_SUCCESS, NULL, NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -2164,7 +2164,7 @@ static struct cmd_results *cmd_workspace(int argc, char **argv) {
 | 
				
			||||||
			sway_log(L_DEBUG, "Assigning workspace %s to output %s", argv[0], argv[2]);
 | 
								sway_log(L_DEBUG, "Assigning workspace %s to output %s", argv[0], argv[2]);
 | 
				
			||||||
			list_add(config->workspace_outputs, wso);
 | 
								list_add(config->workspace_outputs, wso);
 | 
				
			||||||
			if (!config->reading) {
 | 
								if (!config->reading) {
 | 
				
			||||||
				// TODO: Move workspace to output. (dont do so when reloading)
 | 
									// TODO: Move workspace to output. (don't do so when reloading)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -146,7 +146,7 @@ swayc_t *new_output(wlc_handle handle) {
 | 
				
			||||||
		ws_name = workspace_next_name(output->name);
 | 
							ws_name = workspace_next_name(output->name);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// create and initilize default workspace
 | 
						// create and initialize default workspace
 | 
				
			||||||
	swayc_t *ws = new_workspace(output, ws_name);
 | 
						swayc_t *ws = new_workspace(output, ws_name);
 | 
				
			||||||
	ws->is_focused = true;
 | 
						ws->is_focused = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,7 +24,7 @@ static void update_focus(swayc_t *c) {
 | 
				
			||||||
		parent->focused = c;
 | 
							parent->focused = c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		switch (c->type) {
 | 
							switch (c->type) {
 | 
				
			||||||
		// Shouldnt happen
 | 
							// Shouldn't happen
 | 
				
			||||||
		case C_ROOT: return;
 | 
							case C_ROOT: return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Case where output changes
 | 
							// Case where output changes
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -166,7 +166,7 @@ static void handle_output_resolution_change(wlc_handle output, const struct wlc_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_output_focused(wlc_handle output, bool focus) {
 | 
					static void handle_output_focused(wlc_handle output, bool focus) {
 | 
				
			||||||
	swayc_t *c = swayc_by_handle(output);
 | 
						swayc_t *c = swayc_by_handle(output);
 | 
				
			||||||
	// if for some reason this output doesnt exist, create it.
 | 
						// if for some reason this output doesn't exist, create it.
 | 
				
			||||||
	if (!c) {
 | 
						if (!c) {
 | 
				
			||||||
		handle_output_created(output);
 | 
							handle_output_created(output);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -217,7 +217,7 @@ static bool handle_view_created(wlc_handle handle) {
 | 
				
			||||||
		wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true);
 | 
							wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Dmenu keeps viewfocus, but others with this flag dont, for now simulate
 | 
						// Dmenu keeps viewfocus, but others with this flag don't, for now simulate
 | 
				
			||||||
	// dmenu
 | 
						// dmenu
 | 
				
			||||||
	case WLC_BIT_OVERRIDE_REDIRECT:
 | 
						case WLC_BIT_OVERRIDE_REDIRECT:
 | 
				
			||||||
// 		locked_view_focus = true;
 | 
					// 		locked_view_focus = true;
 | 
				
			||||||
| 
						 | 
					@ -288,7 +288,7 @@ static void handle_view_destroyed(wlc_handle handle) {
 | 
				
			||||||
	case WLC_BIT_POPUP:
 | 
						case WLC_BIT_POPUP:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	// DMENU has this flag, and takes view_focus, but other things with this
 | 
						// DMENU has this flag, and takes view_focus, but other things with this
 | 
				
			||||||
	// flag dont
 | 
						// flag don't
 | 
				
			||||||
	case WLC_BIT_OVERRIDE_REDIRECT:
 | 
						case WLC_BIT_OVERRIDE_REDIRECT:
 | 
				
			||||||
// 		locked_view_focus = false;
 | 
					// 		locked_view_focus = false;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					@ -651,7 +651,7 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
 | 
				
			||||||
	// get focused window and check if to change focus on mouse click
 | 
						// get focused window and check if to change focus on mouse click
 | 
				
			||||||
	swayc_t *focused = get_focused_container(&root_container);
 | 
						swayc_t *focused = get_focused_container(&root_container);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// dont change focus or mode if fullscreen
 | 
						// don't change focus or mode if fullscreen
 | 
				
			||||||
	if (swayc_is_fullscreen(focused)) {
 | 
						if (swayc_is_fullscreen(focused)) {
 | 
				
			||||||
		return EVENT_PASSTHROUGH;
 | 
							return EVENT_PASSTHROUGH;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ void press_key(uint32_t key_sym, uint32_t key_code) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Check if key exists
 | 
						// Check if key exists
 | 
				
			||||||
	if (!check_key(key_sym, key_code)) {
 | 
						if (!check_key(key_sym, key_code)) {
 | 
				
			||||||
		// Check that we dont exceed buffer length
 | 
							// Check that we don't exceed buffer length
 | 
				
			||||||
		int insert = find_key(0, 0, true);
 | 
							int insert = find_key(0, 0, true);
 | 
				
			||||||
		if (insert < KEY_STATE_MAX_LENGTH) {
 | 
							if (insert < KEY_STATE_MAX_LENGTH) {
 | 
				
			||||||
			key_state_array[insert].key_sym = key_sym;
 | 
								key_state_array[insert].key_sym = key_sym;
 | 
				
			||||||
| 
						 | 
					@ -249,7 +249,7 @@ static void pointer_mode_set_dragging(void) {
 | 
				
			||||||
		pointer_state.mode = M_DRAGGING | M_FLOATING;
 | 
							pointer_state.mode = M_DRAGGING | M_FLOATING;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		pointer_state.mode = M_DRAGGING | M_TILING;
 | 
							pointer_state.mode = M_DRAGGING | M_TILING;
 | 
				
			||||||
		// unset mode if we cant drag tile
 | 
							// unset mode if we can't drag tile
 | 
				
			||||||
		if (initial.ptr->parent->type == C_WORKSPACE &&
 | 
							if (initial.ptr->parent->type == C_WORKSPACE &&
 | 
				
			||||||
				initial.ptr->parent->children->length == 1) {
 | 
									initial.ptr->parent->children->length == 1) {
 | 
				
			||||||
			pointer_state.mode = 0;
 | 
								pointer_state.mode = 0;
 | 
				
			||||||
| 
						 | 
					@ -317,7 +317,7 @@ void pointer_mode_set(uint32_t button, bool condition) {
 | 
				
			||||||
		switch (button) {
 | 
							switch (button) {
 | 
				
			||||||
		// Start left-click mode
 | 
							// Start left-click mode
 | 
				
			||||||
		case M_LEFT_CLICK:
 | 
							case M_LEFT_CLICK:
 | 
				
			||||||
			// if button release dont do anything
 | 
								// if button release don't do anything
 | 
				
			||||||
			if (pointer_state.left.held) {
 | 
								if (pointer_state.left.held) {
 | 
				
			||||||
				if (config->dragging_key == M_LEFT_CLICK) {
 | 
									if (config->dragging_key == M_LEFT_CLICK) {
 | 
				
			||||||
					pointer_mode_set_dragging();
 | 
										pointer_mode_set_dragging();
 | 
				
			||||||
| 
						 | 
					@ -329,7 +329,7 @@ void pointer_mode_set(uint32_t button, bool condition) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Start right-click mode
 | 
							// Start right-click mode
 | 
				
			||||||
		case M_RIGHT_CLICK:
 | 
							case M_RIGHT_CLICK:
 | 
				
			||||||
			// if button release dont do anyhting
 | 
								// if button release don't do anyhting
 | 
				
			||||||
			if (pointer_state.right.held) {
 | 
								if (pointer_state.right.held) {
 | 
				
			||||||
				if (config->dragging_key == M_RIGHT_CLICK) {
 | 
									if (config->dragging_key == M_RIGHT_CLICK) {
 | 
				
			||||||
					pointer_mode_set_dragging();
 | 
										pointer_mode_set_dragging();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -204,7 +204,7 @@ void swap_container(swayc_t *a, swayc_t *b) {
 | 
				
			||||||
	if (a_parent->focused == a) {
 | 
						if (a_parent->focused == a) {
 | 
				
			||||||
		a_parent->focused = b;
 | 
							a_parent->focused = b;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// dont want to double switch
 | 
						// don't want to double switch
 | 
				
			||||||
	if (b_parent->focused == b && a_parent != b_parent) {
 | 
						if (b_parent->focused == b && a_parent != b_parent) {
 | 
				
			||||||
		b_parent->focused = a;
 | 
							b_parent->focused = a;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue