コード例 #1
0
ファイル: focus.c プロジェクト: iglosiggio/xfwm4
void
clientUpdateFocus (ScreenInfo *screen_info, Client * c, unsigned short flags)
{
    Client *c2;
    gboolean restacked;

    TRACE ("entering");

    c2 = ((client_focus != c) ? client_focus : NULL);
    if ((c) && !clientAcceptFocus (c))
    {
        TRACE ("SKIP_FOCUS set for client \"%s\" (0x%lx)", c->name, c->window);
        pending_focus = NULL;
        return;
    }

    if ((c) && (c == client_focus) && !(flags & FOCUS_FORCE))
    {
        TRACE ("client \"%s\" (0x%lx) is already focused, ignoring request", c->name, c->window);
        pending_focus = NULL;
        return;
    }

    client_focus = c;
    if (c2)
    {
        clientSetNetState (c2);
        clientAdjustFullscreenLayer (c2, FALSE);
        frameQueueDraw (c2, FALSE);
        clientUpdateOpacity (c2);
    }
    if (c)
    {
        user_focus = c;
        clientInstallColormaps (c);
        if (flags & FOCUS_SORT)
        {
            clientSortRing(c);
        }
        if (FLAG_TEST(c->flags, CLIENT_FLAG_DEMANDS_ATTENTION))
        {
            TRACE ("un-setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
            FLAG_UNSET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
        }
        clientSetNetState (c);
        restacked = clientAdjustFullscreenLayer (c, TRUE);

        if (!restacked && screen_info->params->click_to_focus)
        {
            clientRaise (c, None);
            clientSetLastRaise (c);
        }
        frameQueueDraw (c, FALSE);
        clientUpdateOpacity (c);
    }
    clientSetNetActiveWindow (screen_info, c, 0);
    pending_focus = NULL;
}
コード例 #2
0
ファイル: focus.c プロジェクト: canatella/xfwm4
static void
clientFocusNone (ScreenInfo *screen_info, Client *previous, guint32 timestamp)
{
    TRACE ("setting focus to none");

    pending_focus = NULL;

    if (previous)
    {
        frameQueueDraw (previous, FALSE);
        if (previous->screen_info != screen_info)
        {
            clientSetNetActiveWindow (previous->screen_info, NULL, timestamp);
        }
    }
    clientSetNetActiveWindow (screen_info, NULL, timestamp);
    XSetInputFocus (myScreenGetXDisplay (screen_info), screen_info->xfwm4_win, RevertToPointerRoot, timestamp);
}