diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-10-17 14:55:15 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2010-10-18 10:40:51 +0200 |
commit | d08b8120d64cf39035b59b8a8f34319d3b65b47e (patch) | |
tree | 785322c57f6c80aa58a0ed64ffe02f2fc8b36823 /client/x11 | |
parent | 421ddb7422d676c5bd15f1434203aa6f3b8dc170 (diff) | |
download | spice-d08b8120d64cf39035b59b8a8f34319d3b65b47e.tar.gz spice-d08b8120d64cf39035b59b8a8f34319d3b65b47e.tar.xz spice-d08b8120d64cf39035b59b8a8f34319d3b65b47e.zip |
spicec-x11: Fix window management under KDE
There were 2 issues with window management under KDE
1) When an app does its own focus management like we do, kwin expects
an explicit raise for the app to get to the top, so we did have focus,
but would have other windows (partially) covering the client window
-> do a raise after setting focus to ourselves
2) When switching from fullscreen <-> window, we unmap and remap our
window, then set focus to ourselves. kwin thinks this means we're trying
to steal the focus without the user asking for it. This patch makes us
set the _NET_WM_USER_TIME property on our window, this helps kwin's
focus stealing code to see that we are really not stealing the focus,
just responding to a user event.
Diffstat (limited to 'client/x11')
-rw-r--r-- | client/x11/red_window.cpp | 12 | ||||
-rw-r--r-- | client/x11/red_window_p.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp index 8f6535b9..7cdf684e 100644 --- a/client/x11/red_window.cpp +++ b/client/x11/red_window.cpp @@ -801,6 +801,10 @@ void RedWindow_p::win_proc(XEvent& event) } case KeyPress: red_window->handle_key_press_event(*red_window, &event.xkey); + red_window->last_event_time = event.xkey.time; + XChangeProperty(x_display, red_window->_win, wm_user_time, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&event.xkey.time, 1); break; case KeyRelease: { RedKey key = to_red_key_code(event.xkey.keycode); @@ -829,6 +833,10 @@ void RedWindow_p::win_proc(XEvent& event) break; } red_window->get_listener().on_mouse_button_press(button, state); + red_window->last_event_time = event.xkey.time; + XChangeProperty(x_display, red_window->_win, wm_user_time, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&event.xbutton.time, 1); break; } case ButtonRelease: { @@ -1526,6 +1534,8 @@ void RedWindow::show(int screen_id) XDeleteProperty(x_display, _win, wm_state); wait_parent = true; } + XChangeProperty(x_display, _win, wm_user_time, XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)&last_event_time, 1); XMapWindow(x_display, _win); move_to_current_desktop(); _expect_parent = wait_parent; @@ -1664,6 +1674,8 @@ void RedWindow::activate() { //todo: use _NET_ACTIVE_WINDOW XSetInputFocus(x_display, _win, RevertToParent, CurrentTime); + /* kwin won't raise on focus */ + XRaiseWindow(x_display, _win); } void RedWindow::minimize() diff --git a/client/x11/red_window_p.h b/client/x11/red_window_p.h index 8f14d4e7..4ad5451a 100644 --- a/client/x11/red_window_p.h +++ b/client/x11/red_window_p.h @@ -82,6 +82,7 @@ protected: RedWindow *_red_window; int _width; int _height; + Time last_event_time; }; #endif |