Some little fixes (mostly formatting) for bapt’s patch

This commit is contained in:
Michael Stapelberg 2009-07-22 00:16:16 +02:00
parent 3e262913e8
commit 9db8535b4c
1 changed files with 36 additions and 25 deletions

View File

@ -845,32 +845,39 @@ static char **append_argument(char **original, char *argument) {
return result; return result;
} }
/* /*
* switch to next or previous existing workspace * Switch to next or previous existing workspace
*
*/ */
static void next_previous_workspace(xcb_connection_t *conn, int direction) { static void next_previous_workspace(xcb_connection_t *conn, int direction) {
Workspace *t_ws; Workspace *t_ws;
int i; int i;
if (direction == 'n') { if (direction == 'n') {
/* If we are on the last workspace, we cannot go any further */
if (c_ws->num == 9) if (c_ws->num == 9)
return; return;
for (i = c_ws->num + 1; i <= 9; i++) { for (i = c_ws->num + 1; i <= 9; i++) {
t_ws = &(workspaces[i]); t_ws = &(workspaces[i]);
if (t_ws->screen != NULL) break; if (t_ws->screen != NULL)
break;
} }
} else if (direction == 'p') { } else if (direction == 'p') {
if (c_ws->num == 0) if (c_ws->num == 0)
return; return;
for (i = c_ws->num - 1; i >= 0 ; i--) { for (i = c_ws->num - 1; i >= 0 ; i--) {
t_ws = &(workspaces[i]); t_ws = &(workspaces[i]);
if (t_ws->screen != NULL) break; if (t_ws->screen != NULL)
break;
} }
} }
if (t_ws->screen != NULL) if (t_ws->screen != NULL)
show_workspace(conn, i+1); show_workspace(conn, i+1);
} }
/* /*
* Parses a command, see file CMDMODE for more information * Parses a command, see file CMDMODE for more information
* *
@ -1007,14 +1014,18 @@ void parse_command(xcb_connection_t *conn, const char *command) {
return; return;
} }
/* Is it 'n' for next workspace (nw) */
/* Is it 'n' or 'p' for next/previous workspace? (nw) */
if (command[0] == 'n' && command[1] == 'w') { if (command[0] == 'n' && command[1] == 'w') {
next_previous_workspace(conn, command[0]); next_previous_workspace(conn, command[0]);
return;
} }
if (command[0] == 'p' && command[1] == 'w') { if (command[0] == 'p' && command[1] == 'w') {
next_previous_workspace(conn, command[0]); next_previous_workspace(conn, command[0]);
return;
} }
/* Its a normal <cmd> */ /* Its a normal <cmd> */
char *rest = NULL; char *rest = NULL;
enum { ACTION_FOCUS, ACTION_MOVE, ACTION_SNAP } action = ACTION_FOCUS; enum { ACTION_FOCUS, ACTION_MOVE, ACTION_SNAP } action = ACTION_FOCUS;