summarylogtreecommitdiffstats
path: root/yeahconsole_c.patch
blob: 982ae52a2051102d96890df73ea5dba82cd048b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--- yeahconsole.c.orig	2006-03-11 19:26:00.000000000 +0100
+++ yeahconsole.c	2009-09-19 11:43:07.000000000 +0200
@@ -48,7 +48,7 @@
 int revert_to;
 int screen;
 int opt_x, opt_width, opt_height, opt_delay, opt_bw, opt_step,
-    height, opt_restart;
+  height, opt_restart, opt_restart_hidden;
 char *opt_color;
 char *opt_term;
 KeySym opt_key;
@@ -72,7 +72,8 @@
     XEvent event;
     int hidden = 1;
     int fullscreen = 0;
-    int i, old_height;
+    int i;
+    int old_height = 0;
     Window last_focused, current_focused;
 	
     /* strip the path from argv[0] if there is one */
@@ -190,10 +191,18 @@
 	case UnmapNotify:
 	    if (event.xunmap.window == termwin) {
 		if (opt_restart) {
+                    if (opt_restart_hidden) {
+                        roll(UP);
+                        hidden = 1;
+                    }
 		    init_xterm(0);
 		    XSync(dpy, False);
-		    XSetInputFocus(dpy, termwin, RevertToPointerRoot,
-				   CurrentTime);
+                    if (opt_restart_hidden && last_focused)
+                        XSetInputFocus(dpy, last_focused,
+                                       RevertToPointerRoot, CurrentTime);
+                    else
+                        XSetInputFocus(dpy, termwin, RevertToPointerRoot,
+                                       CurrentTime);
 		} else {
 		    if (last_focused)
 			XSetInputFocus(dpy, last_focused,
@@ -264,6 +273,8 @@
     opt_step = opt ? atoi(opt) : 1;
     opt = XGetDefault(dpy, progname, "restart");
     opt_restart = opt ? atoi(opt) : 0;
+    opt = XGetDefault(dpy, progname, "restartHidden");
+    opt_restart_hidden = opt ? atoi(opt) : 0;
     opt = XGetDefault(dpy, progname, "term");
     opt_term = opt ? opt : "xterm";
     opt = XGetDefault(dpy, progname, "toggleKey");