Skip to content

Commit c034afd

Browse files
committed
added readme and safeguard in desktop_del
1 parent fff1582 commit c034afd

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
virgo
22
=====
33

4-
Virtual Desktop for Windows
4+
Virtual Desktop Manager for Windows
5+
6+
Hotkeys:
7+
8+
ALT + 1..4 -> changes to desktop 1..4
9+
CTRL + 1..4 -> moves active window to desktop 1..4
10+
ALT + CTRL + SHIFT + Q -> exits the program
11+
12+
build with
13+
14+
$ make

virgo.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ static void desktop_add(desktop_t *desk, HWND hwnd)
4747

4848
static void desktop_del(desktop_t *desk, HWND hwnd)
4949
{
50-
int i, o = 0;
50+
int i, o = -1;
5151
for(i = 0; i < desk->wincount; i++) {
5252
if(desk->windows[i] == hwnd) {
5353
o = i;
5454
break;
5555
}
5656
}
57+
if(o == -1) {
58+
return;
59+
}
5760
for(i = o; i < (desk->wincount - 1); i++) {
5861
desk->windows[i] = desk->windows[i + 1];
5962
}

0 commit comments

Comments
 (0)