diff options
author | Sam Spilsbury <sam.spilsbury@canonical.com> | 2010-12-03 15:54:54 +0800 |
---|---|---|
committer | Sam Spilsbury <sam.spilsbury@canonical.com> | 2010-12-03 15:54:54 +0800 |
commit | 48cf7aacfe5864780f61e75530c52a2951f9335f (patch) | |
tree | 2ead0ec2b8da0f6cb166aed1fe7aea44b743bd5e /src | |
parent | 1084f0be5c200d46ad3b4358a477963d31040736 (diff) | |
download | unity-window-decorator-48cf7aacfe5864780f61e75530c52a2951f9335f.tar.gz unity-window-decorator-48cf7aacfe5864780f61e75530c52a2951f9335f.tar.bz2 |
Revert "Ensure that we can change the input focus, even if we requested a client to take focus and it failed to do it before it was unmapped"
This reverts commit 1084f0be5c200d46ad3b4358a477963d31040736.
Danny suggested a better way to do this from a commit to 0.8
Diffstat (limited to 'src')
-rw-r--r-- | src/event.cpp | 18 | ||||
-rw-r--r-- | src/privatescreen.h | 5 | ||||
-rw-r--r-- | src/screen.cpp | 28 | ||||
-rw-r--r-- | src/window.cpp | 16 |
4 files changed, 15 insertions, 52 deletions
diff --git a/src/event.cpp b/src/event.cpp index 5e214cb..6acf04f 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -1095,23 +1095,7 @@ CompScreen::handleEvent (XEvent *event) w->unmap (); if (!w->shaded () && !w->priv->pendingMaps) - { - /* It is possible that we requested for this window to - * have focus and it was unmapped before it responded - * to that request (eg XSetInputFocus) - if that is - * the case then we need to set the active window to - * the one being unmapped so that we can properly - * transfer focus away - */ - - if (priv->requestedFocusWindow == w->id ()) - { - priv->activeWindow = priv->requestedFocusWindow; - priv->requestedFocusWindow = 0; - } - w->moveInputFocusToOtherWindow (); - } } break; case ReparentNotify: @@ -1676,8 +1660,6 @@ CompScreen::handleEvent (XEvent *event) state &= ~CompWindowStateDemandsAttentionMask; w->changeState (state); - - priv->requestedFocusWindow = None; } } else diff --git a/src/privatescreen.h b/src/privatescreen.h index 7505549..fe19cff 100644 --- a/src/privatescreen.h +++ b/src/privatescreen.h @@ -333,13 +333,8 @@ class PrivateScreen : public CoreOptions { unsigned int lastPing; CompTimer pingTimer; - /* The window that last receieved a FocusIn and was - * also valid */ Window activeWindow; - /* The last window we sent a WM_TAKE_FOCUS to */ - Window requestedFocusWindow; - Window below; char displayString[256]; diff --git a/src/screen.cpp b/src/screen.cpp index 1befb7d..2a5fd74 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -3332,33 +3332,6 @@ CompScreen::toolkitAction (Atom toolkitAction, StructureNotifyMask, &ev); } -bool -CompScreen::requestFocus (CompWindow *w) -{ - if (w->protocols () & CompWindowProtocolTakeFocusMask) - { - XEvent ev; - - ev.type = ClientMessage; - ev.xclient.window = w->id (); - ev.xclient.message_type = Atoms::wmProtocols; - ev.xclient.format = 32; - ev.xclient.data.l[0] = Atoms::wmTakeFocus; - ev.xclient.data.l[1] = screen->getCurrentTime (); - ev.xclient.data.l[2] = 0; - ev.xclient.data.l[3] = 0; - ev.xclient.data.l[4] = 0; - - XSendEvent (screen->dpy (), w->id (), false, NoEventMask, &ev); - - priv->requestedFocusWindow = w->id (); - - return true; - } - - return false; -} - void CompScreen::runCommand (CompString command) { @@ -4575,7 +4548,6 @@ PrivateScreen::PrivateScreen (CompScreen *screen) : valueMap (), screenInfo (0), activeWindow (0), - requestedFocusWindow (0), below (None), autoRaiseTimer (), autoRaiseWindow (0), diff --git a/src/window.cpp b/src/window.cpp index ccfc86c..e9b3260 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1920,7 +1920,21 @@ CompWindow::moveInputFocusTo () if (priv->protocols & CompWindowProtocolTakeFocusMask) { - setFocus |= screen->requestFocus (this); + XEvent ev; + + ev.type = ClientMessage; + ev.xclient.window = priv->id; + ev.xclient.message_type = Atoms::wmProtocols; + ev.xclient.format = 32; + ev.xclient.data.l[0] = Atoms::wmTakeFocus; + ev.xclient.data.l[1] = s->getCurrentTime (); + ev.xclient.data.l[2] = 0; + ev.xclient.data.l[3] = 0; + ev.xclient.data.l[4] = 0; + + XSendEvent (s->dpy (), priv->id, false, NoEventMask, &ev); + + setFocus = true; } if (!setFocus && !modalTransient) |