Update to i3-4.1.2

This commit is contained in:
dcoppa 2012-02-21 14:05:39 +00:00
parent b027dd16a8
commit 5e23fa0217
21 changed files with 193 additions and 746 deletions

View File

@ -1,9 +1,8 @@
# $OpenBSD: Makefile,v 1.25 2012/01/25 10:29:30 dcoppa Exp $
# $OpenBSD: Makefile,v 1.26 2012/02/21 14:05:39 dcoppa Exp $
COMMENT = improved dynamic tiling window manager
DISTNAME = i3-4.1.1
REVISION = 2
DISTNAME = i3-4.1.2
CATEGORIES = x11
EXTRACT_SUFX = .tar.bz2

View File

@ -1,5 +1,5 @@
MD5 (i3-4.1.1.tar.bz2) = JbwpNJtlAAorCvwGVagANQ==
RMD160 (i3-4.1.1.tar.bz2) = 6EBzf6CCO7uAeAfspyyTN8FHD/4=
SHA1 (i3-4.1.1.tar.bz2) = eckZt83iSv5bfLXrTJbzUDyRQvM=
SHA256 (i3-4.1.1.tar.bz2) = vQFZ4PLuT+KGRGTKC4rheojFRcsGAaPmOo1d51RYfBo=
SIZE (i3-4.1.1.tar.bz2) = 563305
MD5 (i3-4.1.2.tar.bz2) = DoHDgfm/Pr8VWqo5TnGDTw==
RMD160 (i3-4.1.2.tar.bz2) = lg4OXcB3Hu1XrzYeVq5p7ooKjw8=
SHA1 (i3-4.1.2.tar.bz2) = H2gYU588WBBQKvL6dAPfRENhGlM=
SHA256 (i3-4.1.2.tar.bz2) = EuUb80y/quAPtUyY111texgrCIg81RW/8E1UTRQdTEA=
SIZE (i3-4.1.2.tar.bz2) = 562976

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-common_mk,v 1.7 2011/12/27 09:05:17 dcoppa Exp $
$OpenBSD: patch-common_mk,v 1.8 2012/02/21 14:05:39 dcoppa Exp $
--- common.mk.orig Sat Dec 24 16:25:15 2011
+++ common.mk Tue Dec 27 09:50:07 2011
@@ -1,90 +1,28 @@
@ -19,8 +19,8 @@ $OpenBSD: patch-common_mk,v 1.7 2011/12/27 09:05:17 dcoppa Exp $
+ SYSCONFDIR=/etc
endif
# The escaping is absurd, but we need to escape for shell, sed, make, define
GIT_VERSION:="4.1.1 (2011-12-24, branch \\\"master\\\")"
VERSION:=4.1.1
GIT_VERSION:="4.1.2 (2012-01-27, branch \\\"release-4.1.2\\\")"
VERSION:=4.1.2
-ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1)
-$(error "pkg-config was not found")

View File

@ -1,54 +1,98 @@
$OpenBSD: patch-i3-config-wizard_main_c,v 1.2 2011/12/01 16:00:01 dcoppa Exp $
$OpenBSD: patch-i3-config-wizard_main_c,v 1.3 2012/02/21 14:05:39 dcoppa Exp $
getline() is a GNU extension
Bugfix: for systems without getline, fall back to fgetln
(upstream git commit 891831be3a751ce7700099e3de5048ab50a2867b)
--- i3-config-wizard/main.c.orig Fri Nov 11 23:41:20 2011
+++ i3-config-wizard/main.c Wed Nov 30 15:44:09 2011
@@ -296,6 +296,47 @@ static void finish() {
Bugfix: fix a memory leak
(upstream git commit b3e3ecf722abc6540a5a975a4e643c7d207d356f)
Bugfix: keep the indentation of config.keycodes
(upstream git commit 4f148501736d9b58c6ba113af2df82e1c7e3decb)
--- i3-config-wizard/main.c.orig Tue Feb 21 14:26:26 2012
+++ i3-config-wizard/main.c Tue Feb 21 14:32:20 2012
@@ -8,6 +8,19 @@
* keysyms.
*
*/
+#if defined(__FreeBSD__)
+#include <sys/param.h>
+#endif
+
+/* For systems without getline, fall back to fgetln */
+#if defined(__APPLE__) || (defined(__FreeBSD__) && __FreeBSD_version < 800000) || defined(__OpenBSD__)
+#define USE_FGETLN
+#elif defined(__FreeBSD__)
+/* Defining this macro before including stdio.h is necessary in order to have
+ * a prototype for getline in FreeBSD. */
+#define _WITH_GETLINE
+#endif
+
#include <ev.h>
#include <stdio.h>
#include <sys/types.h>
@@ -280,10 +293,11 @@ static void finish() {
FILE *ks_config = fopen(config_path, "w");
if (ks_config == NULL)
err(1, "Could not open output config file \"%s\"", config_path);
+ free(config_path);
char *line = NULL;
size_t len = 0;
-#if !defined(__APPLE__)
+#ifndef USE_FGETLN
ssize_t read;
#endif
bool head_of_file = true;
@@ -296,10 +310,16 @@ static void finish() {
fputs("# this file and re-run i3-config-wizard(1).\n", ks_config);
fputs("#\n", ks_config);
+#if defined(__OpenBSD__)
+
+ssize_t
+getline(char ** __restrict buf, size_t * __restrict buflen,
+ FILE * __restrict fp)
+{
+ size_t bytes, newlen;
+ char *newbuf, *p;
+
+ if (buf == NULL || buflen == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (*buf == NULL)
+ *buflen = 0;
+
+ bytes = 0;
+ do {
+ if (feof(fp))
+ break;
+ if (*buf == NULL || bytes != 0) {
+ newlen = *buflen + BUFSIZ;
+ newbuf = realloc(*buf, newlen);
+ if (newbuf == NULL)
+ return -1;
+ *buf = newbuf;
+ *buflen = newlen;
+ }
+ p = *buf + bytes;
+ memset(p, 0, BUFSIZ);
+ if (fgets(p, BUFSIZ, fp) == NULL)
+ break;
+ bytes += strlen(p);
+ } while (bytes == 0 || *(*buf + (bytes - 1)) != '\n');
+ if (bytes == 0)
+ return -1;
+ return bytes;
+}
+
-#if defined(__APPLE__)
- while ((line = fgetln(kc_config, &len)) != NULL) {
+#ifdef USE_FGETLN
+ char *buf = NULL;
+ while ((buf = fgetln(kc_config, &len)) != NULL) {
+ /* fgetln does not return null-terminated strings */
+ FREE(line);
+ sasprintf(&line, "%.*s", len, buf);
#else
- while ((read = getline(&line, &len, kc_config)) != -1) {
+ size_t linecap = 0;
+ while ((read = getline(&line, &linecap, kc_config)) != -1) {
+ len = strlen(line);
#endif
/* skip the warning block at the beginning of the input file */
if (head_of_file &&
@@ -310,8 +330,10 @@ static void finish() {
/* Skip leading whitespace */
char *walk = line;
- while (isspace(*walk) && walk < (line + len))
+ while (isspace(*walk) && walk < (line + len)) {
+ /* Pre-output the skipped whitespaces to keep proper indentation */
walk++;
+ }
/* Set the modifier the user chose */
if (strncmp(walk, "set $mod ", strlen("set $mod ")) == 0) {
@@ -324,7 +346,7 @@ static void finish() {
/* Check for 'bindcode'. If its not a bindcode line, we
* just copy it to the output file */
if (strncmp(walk, "bindcode", strlen("bindcode")) != 0) {
- fputs(line, ks_config);
+ fputs(walk, ks_config);
continue;
}
char *result = rewrite_binding(walk);
@@ -336,7 +358,10 @@ static void finish() {
fflush(ks_config);
fsync(fileno(ks_config));
+#ifndef USE_FGETLN
free(line);
+#endif
+
#if defined(__APPLE__)
while ((line = fgetln(kc_config, &len)) != NULL) {
#else
fclose(kc_config);
fclose(ks_config);

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-include_data_h,v 1.3 2012/01/20 15:53:18 dcoppa Exp $
Bugfix: respect WM_HINTS.input for WM_TAKE_FOCUS clients. This fixes
problems with some Qt apps
(upstream git commit 2d14ced024416e2074b57290bf7dade7d08899e5)
--- include/data.h.orig Sat Dec 24 16:25:08 2011
+++ include/data.h Fri Jan 20 14:29:55 2012
@@ -293,6 +293,10 @@ struct Window {
/** Whether the application needs to receive WM_TAKE_FOCUS */
bool needs_take_focus;
+ /** Whether this window accepts focus. We store this inverted so that the
+ * default will be 'accepts focus'. */
+ bool doesnt_accept_focus;
+
/** Whether the window says it is a dock window */
enum { W_NODOCK = 0, W_DOCK_TOP = 1, W_DOCK_BOTTOM = 2 } dock;

View File

@ -1,20 +0,0 @@
$OpenBSD: patch-include_ewmh_h,v 1.3 2012/01/25 10:29:30 dcoppa Exp $
Bugfix: setup the _NET_SUPPORTING_WM_CHECK atom in a standards-compliant
way. This makes chrome (and probably other apps, too) receive changes
of the _NET_ACTIVE_WINDOW and thus show its bookmark dialog properly
(upstream git commit 4f26d6f2a1a0efb7fa15999f9cc00d8673220e97)
--- include/ewmh.h.orig Sat Dec 24 16:25:08 2011
+++ include/ewmh.h Mon Jan 23 09:51:06 2012
@@ -40,4 +40,10 @@ void ewmh_update_active_window(xcb_window_t window);
*/
void ewmh_update_client_list_stacking(xcb_window_t *stack, int num_windows);
+/**
+ * Set up the EWMH hints on the root window.
+ *
+ */
+void ewmh_setup_hints();
+
#endif

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-include_floating_h,v 1.1 2012/01/25 10:29:30 dcoppa Exp $
Bugfix: fix coordinates when the rect of an output changes
(upstream git commit 077d2433a7186550ee349284b1849ec2048af69c)
--- include/floating.h.orig Sat Dec 24 16:25:08 2011
+++ include/floating.h Mon Jan 23 10:27:21 2012
@@ -146,4 +146,11 @@ void drag_pointer(Con *con, const xcb_button_press_eve
*/
void floating_reposition(Con *con, Rect newrect);
+/**
+ * Fixes the coordinates of the floating window whenever the window gets
+ * reassigned to a different output (or when the output's rect changes).
+ *
+ */
+void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect);
+
#endif

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-include_window_h,v 1.1 2012/01/20 15:53:18 dcoppa Exp $
Bugfix: respect WM_HINTS.input for WM_TAKE_FOCUS clients. This fixes
problems with some Qt apps
(upstream git commit 2d14ced024416e2074b57290bf7dade7d08899e5)
--- include/window.h.orig Sat Dec 24 16:25:08 2011
+++ include/window.h Fri Jan 20 14:29:55 2012
@@ -57,4 +57,10 @@ void window_update_strut_partial(i3Window *win, xcb_ge
*/
void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt);
+/**
+ * Updates the WM_HINTS (we only care about the input focus handling part).
+ *
+ */
+void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop);
+
#endif

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-include_xcb_compat_h,v 1.2 2012/01/20 20:16:32 dcoppa Exp $
Fix xcb_compat.h to make i3 compile with older xcb versions
(upstream git commit 07e495d2d0a2e6d7cf18f96d5584abd8b1e5dd56)
--- include/xcb_compat.h.orig Fri Jan 20 15:10:01 2012
+++ include/xcb_compat.h Fri Jan 20 15:10:52 2012
@@ -27,6 +27,7 @@
#define XCB_ICCCM_SIZE_HINT_BASE_SIZE XCB_SIZE_HINT_BASE_SIZE
#define XCB_ICCCM_SIZE_HINT_P_ASPECT XCB_SIZE_HINT_P_ASPECT
#define xcb_icccm_wm_hints_t xcb_wm_hints_t
+#define xcb_icccm_get_wm_hints xcb_get_wm_hints
#define xcb_icccm_get_wm_hints_from_reply xcb_get_wm_hints_from_reply
#define xcb_icccm_get_wm_hints_reply xcb_get_wm_hints_reply
#define xcb_icccm_get_wm_hints_unchecked xcb_get_wm_hints_unchecked

View File

@ -1,15 +1,15 @@
$OpenBSD: patch-man_i3-migrate-config-to-v4_1,v 1.3 2011/12/27 09:05:17 dcoppa Exp $
$OpenBSD: patch-man_i3-migrate-config-to-v4_1,v 1.4 2012/02/21 14:05:39 dcoppa Exp $
fix fatal error
--- man/i3-migrate-config-to-v4.1.orig Tue Dec 27 09:32:57 2011
+++ man/i3-migrate-config-to-v4.1 Tue Dec 27 09:33:26 2011
--- man/i3-migrate-config-to-v4.1.orig Fri Jan 27 20:24:23 2012
+++ man/i3-migrate-config-to-v4.1 Tue Feb 21 14:00:57 2012
@@ -7,7 +7,7 @@
.\" Source: i3 4.1.1
.\" Source: i3 4.1.2
.\" Language: English
.\"
-.TH "I3\-MIGRATE\-CONFIG\" "1" "12/24/2011" "i3 4\&.1\&.1" "i3 Manual"
+.TH "I3\-MIGRATE\-CONFIG" "1" "12/24/2011" "i3 4\&.1\&.1" "i3 Manual"
-.TH "I3\-MIGRATE\-CONFIG\" "1" "01/27/2012" "i3 4\&.1\&.2" "i3 Manual"
+.TH "I3\-MIGRATE\-CONFIG" "1" "01/27/2012" "i3 4\&.1\&.2" "i3 Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-src_click_c,v 1.6 2012/02/21 14:05:39 dcoppa Exp $
Bugfix: highlight i3bar workspace when changing output with mouse
(upstream git commit 51e6e489927f93e265f3258b309d2e23d07b65ad)
--- src/click.c.orig Tue Feb 21 14:13:05 2012
+++ src/click.c Tue Feb 21 14:13:48 2012
@@ -199,12 +199,18 @@ static int route_click(Con *con, xcb_button_press_even
goto done;
}
- /* 2: focus this con */
+ /* 2: focus this con. If the workspace is on another output we need to
+ * do a workspace_show in order for i3bar (and others) to notice the
+ * change in workspace. */
+ Con *ws = con_get_workspace(con);
+ Con *focused_workspace = con_get_workspace(focused);
+
+ if (ws != focused_workspace)
+ workspace_show(ws);
con_focus(con);
/* 3: For floating containers, we also want to raise them on click.
* We will skip handling events on floating cons in fullscreen mode */
- Con *ws = con_get_workspace(con);
Con *fs = (ws ? con_get_fullscreen_con(ws, CF_OUTPUT) : NULL);
if (floatingcon != NULL && fs == NULL) {
floating_raise_con(floatingcon);

View File

@ -1,76 +0,0 @@
$OpenBSD: patch-src_con_c,v 1.6 2012/01/25 10:29:30 dcoppa Exp $
Bugfix: fix coordinates when the rect of an output changes
(upstream git commit 077d2433a7186550ee349284b1849ec2048af69c)
Bugfix: don't lose focus on fullscreen windows when another window
gets moved to that workspace
(upstream git commit f78caf8c5815ae7a66de9e4b734546fd740cc19d)
Bugfix: open new windows in the correct place when assignments match
(upstream git commit d4238c778a199ad88ebe8540904d98f81f110621)
--- src/con.c.orig Mon Jan 23 09:50:24 2012
+++ src/con.c Mon Jan 23 09:51:06 2012
@@ -613,20 +613,7 @@ void con_move_to_workspace(Con *con, Con *workspace, b
/* Take the relative coordinates of the current output, then add them
* to the coordinate space of the correct output */
if (fix_coordinates && con->type == CT_FLOATING_CON) {
- DLOG("Floating window, fixing coordinates\n");
- /* First we get the x/y coordinates relative to the x/y coordinates
- * of the output on which the window is on */
- uint32_t rel_x = (con->rect.x - source_output->rect.x);
- uint32_t rel_y = (con->rect.y - source_output->rect.y);
- /* Then we calculate a fraction, for example 0.63 for a window
- * which is at y = 1212 of a 1920 px high output */
- double fraction_x = ((double)rel_x / source_output->rect.width);
- double fraction_y = ((double)rel_y / source_output->rect.height);
- DLOG("rel_x = %d, rel_y = %d, fraction_x = %f, fraction_y = %f, output->w = %d, output->h = %d\n",
- rel_x, rel_y, fraction_x, fraction_y, source_output->rect.width, source_output->rect.height);
- con->rect.x = dest_output->rect.x + (fraction_x * dest_output->rect.width);
- con->rect.y = dest_output->rect.y + (fraction_y * dest_output->rect.height);
- DLOG("Resulting coordinates: x = %d, y = %d\n", con->rect.x, con->rect.y);
+ floating_fix_coordinates(con, &(source_output->rect), &(dest_output->rect));
} else DLOG("Not fixing coordinates, fix_coordinates flag = %d\n", fix_coordinates);
/* If moving to a visible workspace, call show so it can be considered
@@ -656,8 +643,10 @@ void con_move_to_workspace(Con *con, Con *workspace, b
con_fix_percent(next);
/* 7: focus the con on the target workspace (the X focus is only updated by
- * calling tree_render(), so for the "real" focus this is a no-op). */
- con_focus(con_descend_focused(con));
+ * calling tree_render(), so for the "real" focus this is a no-op).
+ * We don't focus when there is a fullscreen con on that workspace. */
+ if (con_get_fullscreen_con(workspace, CF_OUTPUT) == NULL)
+ con_focus(con_descend_focused(con));
/* 8: when moving to a visible workspace on a different output, we keep the
* con focused. Otherwise, we leave the focus on the current workspace as we
@@ -806,7 +795,7 @@ Con *con_get_next(Con *con, char way, orientation_t or
*/
Con *con_descend_focused(Con *con) {
Con *next = con;
- while (!TAILQ_EMPTY(&(next->focus_head)))
+ while (next != focused && !TAILQ_EMPTY(&(next->focus_head)))
next = TAILQ_FIRST(&(next->focus_head));
return next;
}
@@ -823,6 +812,8 @@ Con *con_descend_tiling_focused(Con *con) {
Con *next = con;
Con *before;
Con *child;
+ if (next == focused)
+ return next;
do {
before = next;
TAILQ_FOREACH(child, &(next->focus_head), focused) {
@@ -832,7 +823,7 @@ Con *con_descend_tiling_focused(Con *con) {
next = child;
break;
}
- } while (before != next);
+ } while (before != next && next != focused);
return next;
}

View File

@ -1,51 +0,0 @@
$OpenBSD: patch-src_ewmh_c,v 1.1 2012/01/25 10:29:30 dcoppa Exp $
Bugfix: setup the _NET_SUPPORTING_WM_CHECK atom in a standards-compliant
way. This makes chrome (and probably other apps, too) receive changes
of the _NET_ACTIVE_WINDOW and thus show its bookmark dialog properly
(upstream git commit 4f26d6f2a1a0efb7fa15999f9cc00d8673220e97)
--- src/ewmh.c.orig Sat Dec 24 16:25:08 2011
+++ src/ewmh.c Mon Jan 23 10:27:22 2012
@@ -126,3 +126,41 @@ void ewmh_update_client_list_stacking(xcb_window_t *st
num_windows,
stack);
}
+
+/*
+ * Set up the EWMH hints on the root window.
+ *
+ */
+void ewmh_setup_hints() {
+ xcb_atom_t supported_atoms[] = {
+#define xmacro(atom) A_ ## atom,
+#include "atoms.xmacro"
+#undef xmacro
+ };
+
+ /* Set up the window manager's name. According to EWMH, section "Root Window
+ * Properties", to indicate that an EWMH-compliant window manager is
+ * present, a child window has to be created (and kept alive as long as the
+ * window manager is running) which has the _NET_SUPPORTING_WM_CHECK and
+ * _NET_WM_ATOMS. */
+ xcb_window_t child_window = xcb_generate_id(conn);
+ xcb_create_window(
+ conn,
+ XCB_COPY_FROM_PARENT, /* depth */
+ child_window, /* window id */
+ root, /* parent */
+ 0, 0, 1, 1, /* dimensions (x, y, w, h) */
+ 0, /* border */
+ XCB_WINDOW_CLASS_INPUT_ONLY, /* window class */
+ XCB_COPY_FROM_PARENT, /* visual */
+ 0,
+ NULL);
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, child_window, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &child_window);
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, child_window, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &child_window);
+
+ /* I'm not entirely sure if we need to keep _NET_WM_NAME on root. */
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");
+
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32, 16, supported_atoms);
+}

View File

@ -1,88 +1,20 @@
$OpenBSD: patch-src_floating_c,v 1.8 2012/01/25 10:29:30 dcoppa Exp $
$OpenBSD: patch-src_floating_c,v 1.9 2012/02/21 14:05:39 dcoppa Exp $
Fix assignments of floating windows to (yet) unused workspaces
(upstream git commit 96c491a4885bf33802e1be883dbf5fe24bece650)
Bugfix: obey workspace_layout when re-inserting floating containers
(upstream git commit 4f98bbf5ffc18a7b53c5545ce403e4667d75a703)
Bugfix: position floating windows exactly where their geometry
specified
(upstream git commit cb4c9b9d27a095047a5ac22ae75f6ee17475ba18)
Bugfix: fix coordinates when the rect of an output changes
(upstream git commit 077d2433a7186550ee349284b1849ec2048af69c)
--- src/floating.c.orig Mon Jan 23 09:50:24 2012
+++ src/floating.c Mon Jan 23 09:51:06 2012
@@ -82,9 +82,17 @@ void floating_enable(Con *con, bool automatic) {
* otherwise. */
Con *ws = con_get_workspace(con);
nc->parent = ws;
+ nc->orientation = NO_ORIENTATION;
+ nc->type = CT_FLOATING_CON;
+ /* We insert nc already, even though its rect is not yet calculated. This
+ * is necessary because otherwise the workspace might be empty (and get
+ * closed in tree_close()) even though it's not. */
+ TAILQ_INSERT_TAIL(&(ws->floating_head), nc, floating_windows);
+ TAILQ_INSERT_TAIL(&(ws->focus_head), nc, focused);
--- src/floating.c.orig Fri Jan 27 20:24:09 2012
+++ src/floating.c Tue Feb 21 14:24:56 2012
@@ -238,10 +238,9 @@ void floating_disable(Con *con, bool automatic) {
/* con_fix_percent will adjust the percent value */
con->percent = 0.0;
/* check if the parent container is empty and close it if so */
- if ((con->parent->type == CT_CON || con->parent->type == CT_FLOATING_CON) && con_num_children(con->parent) == 0) {
+ if ((con->parent->type == CT_CON || con->parent->type == CT_FLOATING_CON) &&
+ con_num_children(con->parent) == 0) {
DLOG("Old container empty after setting this child to floating, closing\n");
tree_close(con->parent, DONT_KILL_WINDOW, false, false);
}
@@ -158,10 +166,6 @@ void floating_enable(Con *con, bool automatic) {
}
DLOG("Floating rect: (%d, %d) with %d x %d\n", nc->rect.x, nc->rect.y, nc->rect.width, nc->rect.height);
- nc->orientation = NO_ORIENTATION;
- nc->type = CT_FLOATING_CON;
- TAILQ_INSERT_TAIL(&(ws->floating_head), nc, floating_windows);
- TAILQ_INSERT_TAIL(&(ws->focus_head), nc, focused);
/* 3: attach the child to the new parent container */
con->parent = nc;
@@ -172,6 +176,14 @@ void floating_enable(Con *con, bool automatic) {
if (automatic)
con->border_style = config.default_floating_border;
+ /* 5: Subtract the deco_height in order to make the floating window appear
+ * at precisely the position it specified in its original geometry (which
+ * is what applications might remember). */
+ deco_height = (con->border_style == BS_NORMAL ? config.font.height + 5 : 0);
+ nc->rect.y -= deco_height;
- TAILQ_INSERT_TAIL(&(con->parent->nodes_head), con, nodes);
- TAILQ_INSERT_TAIL(&(con->parent->focus_head), con, focused);
-
con->floating = FLOATING_USER_OFF;
+
+ DLOG("Corrected y = %d (deco_height = %d)\n", nc->rect.y, deco_height);
+
TAILQ_INSERT_TAIL(&(nc->nodes_head), con, nodes);
TAILQ_INSERT_TAIL(&(nc->focus_head), con, focused);
+ con_attach(con, con->parent, false);
@@ -537,6 +549,28 @@ void floating_reposition(Con *con, Rect newrect) {
floating_maybe_reassign_ws(con);
tree_render();
+}
+
+/*
+ * Fixes the coordinates of the floating window whenever the window gets
+ * reassigned to a different output (or when the output's rect changes).
+ *
+ */
+void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect) {
+ DLOG("Fixing coordinates of floating window %p\n", con);
+ /* First we get the x/y coordinates relative to the x/y coordinates
+ * of the output on which the window is on */
+ uint32_t rel_x = (con->rect.x - old_rect->x);
+ uint32_t rel_y = (con->rect.y - old_rect->y);
+ /* Then we calculate a fraction, for example 0.63 for a window
+ * which is at y = 1212 of a 1920 px high output */
+ double fraction_x = ((double)rel_x / old_rect->width);
+ double fraction_y = ((double)rel_y / old_rect->height);
+ DLOG("rel_x = %d, rel_y = %d, fraction_x = %f, fraction_y = %f, output->w = %d, output->h = %d\n",
+ rel_x, rel_y, fraction_x, fraction_y, old_rect->width, old_rect->height);
+ con->rect.x = new_rect->x + (fraction_x * new_rect->width);
+ con->rect.y = new_rect->y + (fraction_y * new_rect->height);
+ DLOG("Resulting coordinates: x = %d, y = %d\n", con->rect.x, con->rect.y);
}
#if 0
con_fix_percent(con->parent);
// TODO: dont influence focus handling when Con was not focused before.

View File

@ -1,202 +0,0 @@
$OpenBSD: patch-src_handlers_c,v 1.7 2012/01/25 10:29:30 dcoppa Exp $
Bugfix: respect WM_HINTS.input for WM_TAKE_FOCUS clients. This fixes
problems with some Qt apps
(upstream git commit 2d14ced024416e2074b57290bf7dade7d08899e5)
Bugfix: only ignore EnterNotify events after UnmapNotifies from
managed windows. This fixes some focus follows mouse problems
(upstream git commit 47fd15649ad63f3becef8870276e51c6214300fc)
Bugfix: force a new sequence number after UnmapNotify. This fixes
the problem where legitimate EnterNotify arrived with the same
sequence as the UnmapNotify and was ignored
(upstream git commit 7a4d8ed6ed67c4d0d958458f58e4db1598c9cd75)
--- src/handlers.c.orig Mon Jan 23 09:50:24 2012
+++ src/handlers.c Mon Jan 23 09:51:06 2012
@@ -457,23 +457,9 @@ static int handle_screen_change(xcb_generic_event_t *e
* now, so we better clean up before.
*
*/
-static int handle_unmap_notify_event(xcb_unmap_notify_event_t *event) {
- /* If the client (as opposed to i3) destroyed or unmapped a window, an
- * EnterNotify event will follow (indistinguishable from an EnterNotify
- * event caused by moving your mouse), causing i3 to set focus to whichever
- * window is now visible.
- *
- * In a complex stacked or tabbed layout (take two v-split containers in a
- * tabbed container), when the bottom window in tab2 is closed, the bottom
- * window of tab1 is visible instead. X11 will thus send an EnterNotify
- * event for the bottom window of tab1, while the focus should be set to
- * the remaining window of tab2.
- *
- * Therefore, we ignore all EnterNotify events which have the same sequence
- * as an UnmapNotify event. */
- add_ignore_event(event->sequence, XCB_ENTER_NOTIFY);
-
+static void handle_unmap_notify_event(xcb_unmap_notify_event_t *event) {
DLOG("UnmapNotify for 0x%08x (received from 0x%08x), serial %d\n", event->window, event->event, event->sequence);
+ xcb_get_input_focus_cookie_t cookie;
Con *con = con_by_window_id(event->window);
if (con == NULL) {
/* This could also be an UnmapNotify for the frame. We need to
@@ -481,63 +467,52 @@ static int handle_unmap_notify_event(xcb_unmap_notify_
con = con_by_frame_id(event->window);
if (con == NULL) {
LOG("Not a managed window, ignoring UnmapNotify event\n");
- return 1;
+ return;
}
+
if (con->ignore_unmap > 0)
con->ignore_unmap--;
+ /* See the end of this function. */
+ cookie = xcb_get_input_focus(conn);
DLOG("ignore_unmap = %d for frame of container %p\n", con->ignore_unmap, con);
- return 1;
+ goto ignore_end;
}
+ /* See the end of this function. */
+ cookie = xcb_get_input_focus(conn);
+
if (con->ignore_unmap > 0) {
DLOG("ignore_unmap = %d, dec\n", con->ignore_unmap);
con->ignore_unmap--;
- return 1;
+ goto ignore_end;
}
tree_close(con, DONT_KILL_WINDOW, false, false);
tree_render();
x_push_changes(croot);
- return 1;
-#if 0
- if (client == NULL) {
- DLOG("not a managed window. Ignoring.\n");
+ignore_end:
+ /* If the client (as opposed to i3) destroyed or unmapped a window, an
+ * EnterNotify event will follow (indistinguishable from an EnterNotify
+ * event caused by moving your mouse), causing i3 to set focus to whichever
+ * window is now visible.
+ *
+ * In a complex stacked or tabbed layout (take two v-split containers in a
+ * tabbed container), when the bottom window in tab2 is closed, the bottom
+ * window of tab1 is visible instead. X11 will thus send an EnterNotify
+ * event for the bottom window of tab1, while the focus should be set to
+ * the remaining window of tab2.
+ *
+ * Therefore, we ignore all EnterNotify events which have the same sequence
+ * as an UnmapNotify event. */
+ add_ignore_event(event->sequence, XCB_ENTER_NOTIFY);
- /* This was most likely the destroyed frame of a client which is
- * currently being unmapped, so we add this sequence (again!) to
- * the ignore list (enter_notify events will get sent for both,
- * the child and its frame). */
- add_ignore_event(event->sequence);
-
- return 0;
- }
-#endif
-
-
-#if 0
- /* Lets see how many clients there are left on the workspace to delete it if its empty */
- bool workspace_empty = SLIST_EMPTY(&(client->workspace->focus_stack));
- bool workspace_focused = (c_ws == client->workspace);
- Client *to_focus = (!workspace_empty ? SLIST_FIRST(&(client->workspace->focus_stack)) : NULL);
-
- /* If this workspace is currently visible, we dont delete it */
- if (workspace_is_visible(client->workspace))
- workspace_empty = false;
-
- if (workspace_empty) {
- client->workspace->output = NULL;
- ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"empty\"}");
- }
-
- /* Remove the urgency flag if set */
- client->urgent = false;
- workspace_update_urgent_flag(client->workspace);
-
- render_layout(conn);
-#endif
-
- return 1;
+ /* Since we just ignored the sequence of this UnmapNotify, we want to make
+ * sure that following events use a different sequence. When putting xterm
+ * into fullscreen and moving the pointer to a different window, without
+ * using GetInputFocus, subsequent (legitimate) EnterNotify events arrived
+ * with the same sequence and thus were ignored (see ticket #609). */
+ free(xcb_get_input_focus_reply(conn, cookie, NULL));
}
/*
@@ -549,7 +524,7 @@ static int handle_unmap_notify_event(xcb_unmap_notify_
* important fields in the event data structure).
*
*/
-static int handle_destroy_notify_event(xcb_destroy_notify_event_t *event) {
+static void handle_destroy_notify_event(xcb_destroy_notify_event_t *event) {
DLOG("destroy notify for 0x%08x, 0x%08x\n", event->event, event->window);
xcb_unmap_notify_event_t unmap;
@@ -557,7 +532,7 @@ static int handle_destroy_notify_event(xcb_destroy_not
unmap.event = event->event;
unmap.window = event->window;
- return handle_unmap_notify_event(&unmap);
+ handle_unmap_notify_event(&unmap);
}
/*
@@ -855,18 +830,16 @@ static bool handle_hints(void *data, xcb_connection_t
xcb_icccm_wm_hints_t hints;
- if (reply != NULL) {
- if (!xcb_icccm_get_wm_hints_from_reply(&hints, reply))
+ if (reply == NULL)
+ if (!(reply = xcb_get_property_reply(conn, xcb_icccm_get_wm_hints(conn, window), NULL)))
return false;
- } else {
- if (!xcb_icccm_get_wm_hints_reply(conn, xcb_icccm_get_wm_hints_unchecked(conn, con->window->id), &hints, NULL))
- return false;
- }
+ if (!xcb_icccm_get_wm_hints_from_reply(&hints, reply))
+ return false;
+
if (!con->urgent && focused == con) {
DLOG("Ignoring urgency flag for current client\n");
- FREE(reply);
- return true;
+ goto end;
}
/* Update the flag on the client directly */
@@ -882,17 +855,10 @@ static bool handle_hints(void *data, xcb_connection_t
tree_render();
-#if 0
- /* If the workspace this client is on is not visible, we need to redraw
- * the workspace bar */
- if (!workspace_is_visible(client->workspace)) {
- Output *output = client->workspace->output;
- render_workspace(conn, output, output->current_workspace);
- xcb_flush(conn);
- }
-#endif
-
- FREE(reply);
+end:
+ if (con->window)
+ window_update_hints(con->window, reply);
+ else free(reply);
return true;
}

View File

@ -1,27 +0,0 @@
$OpenBSD: patch-src_main_c,v 1.1 2012/01/25 10:29:30 dcoppa Exp $
Bugfix: setup the _NET_SUPPORTING_WM_CHECK atom in a standards-compliant
way. This makes chrome (and probably other apps, too) receive changes
of the _NET_ACTIVE_WINDOW and thus show its bookmark dialog properly
(upstream git commit 4f26d6f2a1a0efb7fa15999f9cc00d8673220e97)
--- src/main.c.orig Sat Dec 24 16:25:08 2011
+++ src/main.c Wed Jan 25 09:27:25 2012
@@ -544,16 +544,7 @@ int main(int argc, char *argv[]) {
property_handlers_init();
- /* Set up the atoms we support */
- xcb_atom_t supported_atoms[] = {
-#define xmacro(atom) A_ ## atom,
-#include "atoms.xmacro"
-#undef xmacro
- };
- xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32, 16, supported_atoms);
- /* Set up the window managers name */
- xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &root);
- xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");
+ ewmh_setup_hints();
keysyms = xcb_key_symbols_alloc(conn);

View File

@ -1,33 +0,0 @@
$OpenBSD: patch-src_manage_c,v 1.5 2012/01/20 15:53:18 dcoppa Exp $
Bugfix: respect WM_HINTS.input for WM_TAKE_FOCUS clients. This fixes
problems with some Qt apps
(upstream git commit 2d14ced024416e2074b57290bf7dade7d08899e5)
--- src/manage.c.orig Sat Dec 24 16:25:08 2011
+++ src/manage.c Fri Jan 20 14:29:55 2012
@@ -80,7 +80,7 @@ void manage_window(xcb_window_t window, xcb_get_window
xcb_get_property_cookie_t wm_type_cookie, strut_cookie, state_cookie,
utf8_title_cookie, title_cookie,
class_cookie, leader_cookie, transient_cookie,
- role_cookie, startup_id_cookie;
+ role_cookie, startup_id_cookie, wm_hints_cookie;
geomc = xcb_get_geometry(conn, d);
@@ -142,6 +142,7 @@ void manage_window(xcb_window_t window, xcb_get_window
class_cookie = GET_PROPERTY(XCB_ATOM_WM_CLASS, 128);
role_cookie = GET_PROPERTY(A_WM_WINDOW_ROLE, 128);
startup_id_cookie = GET_PROPERTY(A__NET_STARTUP_ID, 512);
+ wm_hints_cookie = xcb_icccm_get_wm_hints(conn, window);
/* TODO: also get wm_normal_hints here. implement after we got rid of xcb-event */
DLOG("Managing window 0x%08x\n", window);
@@ -169,6 +170,7 @@ void manage_window(xcb_window_t window, xcb_get_window
window_update_transient_for(cwindow, xcb_get_property_reply(conn, transient_cookie, NULL));
window_update_strut_partial(cwindow, xcb_get_property_reply(conn, strut_cookie, NULL));
window_update_role(cwindow, xcb_get_property_reply(conn, role_cookie, NULL), true);
+ window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL));
xcb_get_property_reply_t *startup_id_reply;
startup_id_reply = xcb_get_property_reply(conn, startup_id_cookie, NULL);

View File

@ -1,22 +1,28 @@
$OpenBSD: patch-src_randr_c,v 1.6 2012/01/25 10:29:30 dcoppa Exp $
$OpenBSD: patch-src_randr_c,v 1.7 2012/02/21 14:05:39 dcoppa Exp $
Bugfix: fix coordinates when the rect of an output changes
(upstream git commit 077d2433a7186550ee349284b1849ec2048af69c)
Bugfix: fix coords of floating containers when the output is disabled
(upstream git commit 55525015cc6b1a2e41fdaf85e9f03301dd7bd63b)
--- src/randr.c.orig Sat Dec 24 16:25:08 2011
+++ src/randr.c Mon Jan 23 09:51:06 2012
@@ -522,6 +522,14 @@ static void output_change_mode(xcb_connection_t *conn,
/* Point content to the container of the workspaces */
content = output_get_content(output->con);
--- src/randr.c.orig Tue Feb 21 14:04:58 2012
+++ src/randr.c Tue Feb 21 14:08:43 2012
@@ -754,7 +754,8 @@ void randr_query_outputs() {
DLOG("next = %p\n", next);
}
+ /* Fix the position of all floating windows on this output.
+ * The 'rect' of each workspace will be updated in src/render.c. */
+ TAILQ_FOREACH(workspace, &(content->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(workspace->floating_head), floating_windows) {
+ floating_fix_coordinates(child, &(workspace->rect), &(output->con->rect));
+ }
+ }
+
/* If default_orientation is NO_ORIENTATION, we change the orientation of
* the workspaces and their childs depending on output resolution. This is
* only done for workspaces with maximum one child. */
- /* 2: iterate through workspaces and re-assign them */
+ /* 2: iterate through workspaces and re-assign them, fixing the coordinates
+ * of floating containers as we go */
Con *current;
Con *old_content = output_get_content(output->con);
while (!TAILQ_EMPTY(&(old_content->nodes_head))) {
@@ -763,6 +764,10 @@ void randr_query_outputs() {
con_detach(current);
DLOG("Re-attaching current = %p / %s\n", current, current->name);
con_attach(current, first_content, false);
+ DLOG("Fixing the coordinates of floating containers\n");
+ Con *floating_con;
+ TAILQ_FOREACH(floating_con, &(current->floating_head), floating_windows)
+ floating_fix_coordinates(floating_con, &(old_content->rect), &(first_content->rect));
DLOG("Done, next\n");
}
DLOG("re-attached all workspaces\n");

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-src_tree_c,v 1.3 2012/02/21 14:05:39 dcoppa Exp $
Bugfix: properly split when the current container is alone within
a stacked/tabbed container
(upstream git commit 0fc459892e381469a8b967c3895c33eda6c87b48)
--- src/tree.c.orig Tue Feb 21 14:11:04 2012
+++ src/tree.c Tue Feb 21 14:11:49 2012
@@ -291,7 +291,8 @@ void tree_split(Con *con, orientation_t orientation) {
/* if we are in a container whose parent contains only one
* child (its split functionality is unused so far), we just change the
* orientation (more intuitive than splitting again) */
- if (con_num_children(parent) == 1) {
+ if (con_num_children(parent) == 1 &&
+ parent->layout == L_DEFAULT) {
parent->orientation = orientation;
DLOG("Just changing orientation of existing container\n");
return;

View File

@ -1,37 +0,0 @@
$OpenBSD: patch-src_window_c,v 1.1 2012/01/20 15:53:18 dcoppa Exp $
Bugfix: respect WM_HINTS.input for WM_TAKE_FOCUS clients. This fixes
problems with some Qt apps
(upstream git commit 2d14ced024416e2074b57290bf7dade7d08899e5)
--- src/window.c.orig Sat Dec 24 16:25:08 2011
+++ src/window.c Fri Jan 20 14:29:55 2012
@@ -251,3 +251,28 @@ void window_update_role(i3Window *win, xcb_get_propert
free(prop);
}
+
+/*
+ * Updates the WM_HINTS (we only care about the input focus handling part).
+ *
+ */
+void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop) {
+ if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
+ DLOG("WM_HINTS not set.\n");
+ FREE(prop);
+ return;
+ }
+
+ xcb_icccm_wm_hints_t hints;
+
+ if (!xcb_icccm_get_wm_hints_from_reply(&hints, prop)) {
+ DLOG("Could not get WM_HINTS\n");
+ free(prop);
+ return;
+ }
+
+ win->doesnt_accept_focus = !hints.input;
+ LOG("WM_HINTS.input changed to \"%d\"\n", hints.input);
+
+ free(prop);
+}

View File

@ -1,62 +0,0 @@
$OpenBSD: patch-src_x_c,v 1.3 2012/01/20 15:53:18 dcoppa Exp $
Bugfix: either use SetInputFocus *or* send WM_TAKE_FOCUS, not both.
This fixes problems with Oracle/OpenJDK JRE 7.0
(upstream git commit 21a2971b2442ab0881cf79553cc6b65bbb44afa7)
Bugfix: respect WM_HINTS.input for WM_TAKE_FOCUS clients. This fixes
problems with some Qt apps
(upstream git commit 2d14ced024416e2074b57290bf7dade7d08899e5)
--- src/x.c.orig Sat Dec 24 16:25:08 2011
+++ src/x.c Fri Jan 20 14:29:56 2012
@@ -849,26 +849,34 @@ void x_push_changes(Con *con) {
/* Invalidate focused_id to correctly focus new windows with the same ID */
focused_id = XCB_NONE;
} else {
- DLOG("Updating focus (focused: %p / %s)\n", focused, focused->name);
- /* We remove XCB_EVENT_MASK_FOCUS_CHANGE from the event mask to get
- * no focus change events for our own focus changes. We only want
- * these generated by the clients. */
- if (focused->window != NULL) {
- values[0] = CHILD_EVENT_MASK & ~(XCB_EVENT_MASK_FOCUS_CHANGE);
- xcb_change_window_attributes(conn, focused->window->id, XCB_CW_EVENT_MASK, values);
- }
- xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, to_focus, XCB_CURRENT_TIME);
- if (focused->window != NULL) {
- values[0] = CHILD_EVENT_MASK;
- xcb_change_window_attributes(conn, focused->window->id, XCB_CW_EVENT_MASK, values);
- }
-
+ bool set_focus = true;
if (focused->window != NULL &&
focused->window->needs_take_focus) {
+ DLOG("Updating focus by sending WM_TAKE_FOCUS to window 0x%08x (focused: %p / %s)\n",
+ to_focus, focused, focused->name);
send_take_focus(to_focus);
+ set_focus = !focused->window->doesnt_accept_focus;
+ DLOG("set_focus = %d\n", set_focus);
}
- ewmh_update_active_window(to_focus);
+ if (set_focus) {
+ DLOG("Updating focus (focused: %p / %s)\n", focused, focused->name);
+ /* We remove XCB_EVENT_MASK_FOCUS_CHANGE from the event mask to get
+ * no focus change events for our own focus changes. We only want
+ * these generated by the clients. */
+ if (focused->window != NULL) {
+ values[0] = CHILD_EVENT_MASK & ~(XCB_EVENT_MASK_FOCUS_CHANGE);
+ xcb_change_window_attributes(conn, focused->window->id, XCB_CW_EVENT_MASK, values);
+ }
+ xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, to_focus, XCB_CURRENT_TIME);
+ if (focused->window != NULL) {
+ values[0] = CHILD_EVENT_MASK;
+ xcb_change_window_attributes(conn, focused->window->id, XCB_CW_EVENT_MASK, values);
+ }
+
+ ewmh_update_active_window(to_focus);
+ }
+
focused_id = to_focus;
}
}