Merge branch 'fix-focus-assign'

This commit is contained in:
Michael Stapelberg 2011-08-27 13:03:17 +02:00
commit 05d10fdb2c
2 changed files with 23 additions and 2 deletions

View File

@ -17,7 +17,7 @@
extern xcb_connection_t *conn; extern xcb_connection_t *conn;
void floating_enable(Con *con, bool automatic) { void floating_enable(Con *con, bool automatic) {
bool set_focus = true; bool set_focus = (con == focused);
if (con_is_floating(con)) { if (con_is_floating(con)) {
LOG("Container is already in floating mode, not doing anything.\n"); LOG("Container is already in floating mode, not doing anything.\n");
@ -170,7 +170,6 @@ void floating_enable(Con *con, bool automatic) {
render_con(nc, false); render_con(nc, false);
render_con(con, false); render_con(con, false);
// TODO: dont influence focus handling when Con was not focused before.
if (set_focus) if (set_focus)
con_focus(con); con_focus(con);

View File

@ -62,6 +62,28 @@ $window->map;
sleep 0.25; sleep 0.25;
ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
ok(get_ws($tmp)->{focused}, 'current workspace still focused');
#####################################################################
# the same test, but with a floating window
#####################################################################
$window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace'); ok(@{get_ws_content($tmp)} == 0, 'special window not on current workspace');
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws'); ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
ok(get_ws($tmp)->{focused}, 'current workspace still focused'); ok(get_ws($tmp)->{focused}, 'current workspace still focused');