Fix problems with Java apps (backported from upstream git)

This commit is contained in:
dcoppa 2011-04-07 08:58:10 +00:00
parent c096b26bb7
commit b07640a4d2
10 changed files with 162 additions and 1 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.12 2011/03/14 12:55:18 dcoppa Exp $
# $OpenBSD: Makefile,v 1.13 2011/04/07 08:58:10 dcoppa Exp $
COMMENT = improved dynamic tiling window manager
DISTNAME = i3-3.e-bf2
PKGNAME = i3-3.5.2
REVISION = 0
CATEGORIES = x11

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-include_client_h,v 1.1 2011/04/07 08:58:10 dcoppa Exp $
--- include/client.h.orig Wed Jan 19 21:26:37 2011
+++ include/client.h Wed Apr 6 12:53:48 2011
@@ -32,6 +32,12 @@ void client_remove_from_container(xcb_connection_t *co
void client_warp_pointer_into(xcb_connection_t *conn, Client *client);
/**
+ * Returns true if the client supports the given protocol atom (like WM_DELETE_WINDOW)
+ *
+ */
+bool client_supports_protocol(xcb_connection_t *conn, Client *client, xcb_atom_t atom);
+
+/**
* Kills the given window using WM_DELETE_WINDOW or xcb_kill_window
*
*/

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-include_data_h,v 1.1 2011/04/07 08:58:10 dcoppa Exp $
--- include/data.h.orig Wed Jan 19 21:26:37 2011
+++ include/data.h Wed Apr 6 12:53:48 2011
@@ -444,6 +444,9 @@ struct Client {
* one. Therefore, this flag is set when reparenting. */
bool awaiting_useless_unmap;
+ /* Whether the client needs WM_TAKE_FOCUS */
+ bool needs_take_focus;
+
/* XCB contexts */
xcb_window_t frame; /**< Our window: The frame around the
* client */

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-include_i3_h,v 1.1 2011/04/07 08:58:10 dcoppa Exp $
--- include/i3.h.orig Wed Jan 19 21:26:37 2011
+++ include/i3.h Wed Apr 6 12:48:34 2011
@@ -21,7 +21,7 @@
#ifndef _I3_H
#define _I3_H
-#define NUM_ATOMS 21
+#define NUM_ATOMS 22
extern xcb_connection_t *global_conn;
extern xcb_key_symbols_t *keysyms;

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-include_util_h,v 1.3 2011/04/07 08:58:10 dcoppa Exp $
--- include/util.h.orig Wed Jan 19 21:26:37 2011
+++ include/util.h Wed Apr 6 12:48:34 2011
@@ -127,6 +127,12 @@ Client *get_last_focused_client(xcb_connection_t *conn
Client *exclude);
/**
+ * Sends WM_TAKE_FOCUS to the client
+ *
+ */
+void take_focus(xcb_connection_t *conn, Client *client);
+
+/**
* Sets the given client as focused by updating the data structures correctly,
* updating the X input focus and finally re-decorating both windows (to
* signalize the user the new focus situation)

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-include_xcb_h,v 1.1 2011/04/07 08:58:10 dcoppa Exp $
--- include/xcb.h.orig Wed Jan 19 21:26:37 2011
+++ include/xcb.h Wed Apr 6 12:48:34 2011
@@ -64,7 +64,8 @@ enum { _NET_SUPPORTED = 0,
WM_CLIENT_LEADER,
_NET_CURRENT_DESKTOP,
_NET_ACTIVE_WINDOW,
- _NET_WORKAREA
+ _NET_WORKAREA,
+ WM_TAKE_FOCUS
};
extern unsigned int xcb_numlock_mask;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_client_c,v 1.1 2011/04/07 08:58:10 dcoppa Exp $
--- src/client.c.orig Wed Jan 19 21:26:37 2011
+++ src/client.c Wed Apr 6 12:53:48 2011
@@ -69,7 +69,7 @@ void client_warp_pointer_into(xcb_connection_t *conn,
* Returns true if the client supports the given protocol atom (like WM_DELETE_WINDOW)
*
*/
-static bool client_supports_protocol(xcb_connection_t *conn, Client *client, xcb_atom_t atom) {
+bool client_supports_protocol(xcb_connection_t *conn, Client *client, xcb_atom_t atom) {
xcb_get_property_cookie_t cookie;
xcb_get_wm_protocols_reply_t protocols;
bool result = false;

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-src_mainx_c,v 1.4 2011/04/07 08:58:10 dcoppa Exp $
--- src/mainx.c.orig Wed Jan 19 21:26:37 2011
+++ src/mainx.c Wed Apr 6 12:48:34 2011
@@ -326,6 +326,7 @@ int main(int argc, char *argv[], char *env[]) {
REQUEST_ATOM(_NET_CURRENT_DESKTOP);
REQUEST_ATOM(_NET_ACTIVE_WINDOW);
REQUEST_ATOM(_NET_WORKAREA);
+ REQUEST_ATOM(WM_TAKE_FOCUS);
/* TODO: this has to be more beautiful somewhen */
int major, minor, error;
@@ -491,6 +492,7 @@ int main(int argc, char *argv[], char *env[]) {
GET_ATOM(_NET_CURRENT_DESKTOP);
GET_ATOM(_NET_ACTIVE_WINDOW);
GET_ATOM(_NET_WORKAREA);
+ GET_ATOM(WM_TAKE_FOCUS);
xcb_property_set_handler(&prophs, atoms[_NET_WM_WINDOW_TYPE], UINT_MAX, handle_window_type, NULL);
/* TODO: In order to comply with EWMH, we have to watch _NET_WM_STRUT_PARTIAL */

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-src_manage_c,v 1.3 2011/04/07 08:58:10 dcoppa Exp $
--- src/manage.c.orig Wed Jan 19 21:26:37 2011
+++ src/manage.c Wed Apr 6 13:44:57 2011
@@ -477,6 +477,7 @@ void reparent_window(xcb_connection_t *conn, xcb_windo
redecorate_window(conn, new);
}
+ new->needs_take_focus = client_supports_protocol(conn, new, atoms[WM_TAKE_FOCUS]);
new->initialized = true;
/* Check if the window already got the fullscreen hint set */
@@ -512,6 +513,8 @@ map:
}
if (new->container == CUR_CELL || client_is_floating(new)) {
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, new->child, XCB_CURRENT_TIME);
+ if (new->needs_take_focus)
+ take_focus(conn, new);
ewmh_update_active_window(new->child);
}
}

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-src_util_c,v 1.4 2011/04/07 08:58:10 dcoppa Exp $
--- src/util.c.orig Wed Apr 6 12:52:10 2011
+++ src/util.c Wed Apr 6 12:53:48 2011
@@ -222,7 +222,26 @@ Client *get_last_focused_client(xcb_connection_t *conn
return NULL;
}
+/*
+ * Sends WM_TAKE_FOCUS to the client
+ *
+ */
+void take_focus(xcb_connection_t *conn, Client *client) {
+ xcb_client_message_event_t ev;
+ memset(&ev, 0, sizeof(xcb_client_message_event_t));
+
+ ev.response_type = XCB_CLIENT_MESSAGE;
+ ev.window = client->child;
+ ev.type = atoms[WM_PROTOCOLS];
+ ev.format = 32;
+ ev.data.data32[0] = atoms[WM_TAKE_FOCUS];
+ ev.data.data32[1] = XCB_CURRENT_TIME;
+
+ DLOG("Sending WM_TAKE_FOCUS to the client\n");
+ xcb_send_event(conn, false, client->child, XCB_EVENT_MASK_NO_EVENT, (char*)&ev);
+}
+
/*
* Sets the given client as focused by updating the data structures correctly,
* updating the X input focus and finally re-decorating both windows (to signalize
@@ -261,6 +280,8 @@ void set_focus(xcb_connection_t *conn, Client *client,
CLIENT_LOG(client);
/* Set focus to the entered window, and flush xcb buffer immediately */
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, client->child, XCB_CURRENT_TIME);
+ if (client->needs_take_focus)
+ take_focus(conn, client);
ewmh_update_active_window(client->child);
//xcb_warp_pointer(conn, XCB_NONE, client->child, 0, 0, 0, 0, 10, 10);