Merge branch 'fix-wsnum'
This commit is contained in:
commit
8287a94292
|
@ -23,6 +23,7 @@
|
|||
#include <err.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_aux.h>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "all.h"
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "all.h"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*
|
||||
*/
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <xcb/randr.h>
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
#include <ev.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include "all.h"
|
||||
|
||||
static int xkb_event_base;
|
||||
|
|
17
src/randr.c
17
src/randr.c
|
@ -392,12 +392,24 @@ void init_ws_for_output(Output *output, Con *content) {
|
|||
GREP_FIRST(current, output_get_content(out), !strcasecmp(child->name, ws->name));
|
||||
|
||||
exists = (current != NULL);
|
||||
if (!exists)
|
||||
if (!exists) {
|
||||
/* Set ->num to the number of the workspace, if the name actually
|
||||
* is a number or starts with a number */
|
||||
long parsed_num = strtol(ws->name, NULL, 10);
|
||||
if (parsed_num == LONG_MIN ||
|
||||
parsed_num == LONG_MAX ||
|
||||
parsed_num <= 0)
|
||||
ws->num = -1;
|
||||
else ws->num = parsed_num;
|
||||
LOG("Used number %d for workspace with name %s\n", ws->num, ws->name);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
/* get the next unused workspace number */
|
||||
DLOG("Getting next unused workspace\n");
|
||||
DLOG("Getting next unused workspace by number\n");
|
||||
int c = 0;
|
||||
while (exists) {
|
||||
c++;
|
||||
|
@ -413,6 +425,7 @@ void init_ws_for_output(Output *output, Con *content) {
|
|||
DLOG("result for ws %s / %d: exists = %d\n", ws->name, c, exists);
|
||||
}
|
||||
ws->num = c;
|
||||
}
|
||||
con_attach(ws, content, false);
|
||||
|
||||
asprintf(&name, "[i3 con] workspace %s", ws->name);
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
* workspace.c: Functions for modifying workspaces
|
||||
*
|
||||
*/
|
||||
#include <limits.h>
|
||||
|
||||
#include "all.h"
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue