Fix scratchpad_show : actually test that the window is in the scratchpad actually test that it was a scratchpad_show without criteria
Patch status: superseded
Patch by Philippe Virouleau
To apply this patch, use:
curl http://cr.i3wm.org/patch/114/raw.patch | git am
b/src/scratchpad.c
| 15 |
@@ -93,7 +93,7 @@ void scratchpad_show(Con *con) {
|
| 16 |
Con *walk_con; |
| 17 |
Con *focused_ws = con_get_workspace(focused); |
| 18 |
TAILQ_FOREACH(walk_con, &(focused_ws->floating_head), floating_windows) {
|
| 19 |
- if ((floating = con_inside_floating(walk_con)) && |
| 20 |
+ if (!con && (floating = con_inside_floating(walk_con)) && |
| 21 |
floating->scratchpad_state != SCRATCHPAD_NONE && |
| 22 |
floating != con_inside_floating(focused)) {
|
| 23 |
DLOG("Found an unfocused scratchpad window on this workspace\n");
|
| 24 |
@@ -112,7 +112,7 @@ void scratchpad_show(Con *con) {
|
| 25 |
focused_ws = con_get_workspace(focused); |
| 26 |
TAILQ_FOREACH(walk_con, &all_cons, all_cons) {
|
| 27 |
Con *walk_ws = con_get_workspace(walk_con); |
| 28 |
- if (walk_ws && |
| 29 |
+ if (!con && walk_ws && |
| 30 |
!con_is_internal(walk_ws) && focused_ws != walk_ws && |
| 31 |
(floating = con_inside_floating(walk_con)) && |
| 32 |
floating->scratchpad_state != SCRATCHPAD_NONE) {
|
| 33 |
@@ -134,6 +134,13 @@ void scratchpad_show(Con *con) {
|
| 34 |
return; |
| 35 |
} |
| 36 |
|
| 37 |
+ /* If this was 'scratchpad show' with criteria, we check if the window |
| 38 |
+ * is actually in the scratchpad */ |
| 39 |
+ if (con && con->parent->scratchpad_state == SCRATCHPAD_NONE) {
|
| 40 |
+ DLOG("Window is not in the scratchpad, doing nothing.\n");
|
| 41 |
+ return; |
| 42 |
+ } |
| 43 |
+ |
| 44 |
/* If this was 'scratchpad show' with criteria, we check if it matches a |
| 45 |
* currently visible scratchpad window and hide it. */ |
| 46 |
Con *active = con_get_workspace(focused); |