~ubuntu-branches/ubuntu/natty/xfwm4/natty

« back to all changes in this revision

Viewing changes to src/cycle.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2011-01-03 20:47:16 UTC
  • mfrom: (1.1.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20110103204716-xfjjslpyp1rwyc02
Tags: 4.7.4-0ubuntu1
New upstream development release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
 
19
19
        oroborus - (c) 2001 Ken Lynch
20
 
        xfwm4    - (c) 2002-2009 Olivier Fourdan
 
20
        xfwm4    - (c) 2002-2010 Olivier Fourdan
21
21
 
22
22
 */
23
23
 
56
56
    Window wireframe;
57
57
};
58
58
 
59
 
#if 0
60
59
static gint
61
 
clientCompareApp (gconstpointer a, gconstpointer b)
 
60
clientCompareModal (gconstpointer a, gconstpointer b)
62
61
{
63
 
    return !clientSameApplication ((Client *) a, (Client *) b);
 
62
    return !clientIsModalFor ((Client *) a, (Client *) b);
64
63
}
65
 
#endif
66
64
 
67
65
static guint
68
66
clientGetCycleRange (ScreenInfo *screen_info)
94
92
{
95
93
    ScreenInfo *screen_info;
96
94
    Client *c2;
97
 
    guint range, i;
 
95
    guint range, search_range,   i;
98
96
    GList *client_list;
99
97
 
100
98
    g_return_val_if_fail (c, NULL);
106
104
 
107
105
    for (c2 = c, i = 0; c && i < screen_info->client_count; i++, c2 = c2->next)
108
106
    {
109
 
        if (!clientSelectMask (c2, NULL, range,
110
 
             screen_info->params->cycle_apps_only ? WINDOW_NORMAL : WINDOW_REGULAR_FOCUSABLE))
 
107
        search_range = range;
 
108
        /*
 
109
         *  We want to include modals even if skip pager/taskbar because
 
110
         *  modals are supposed to be focused
 
111
         */
 
112
        if (clientIsModal(c2))
 
113
        {
 
114
            search_range |= (SEARCH_INCLUDE_SKIP_TASKBAR | SEARCH_INCLUDE_SKIP_PAGER);
 
115
        }
 
116
        if (!clientSelectMask (c2, NULL, search_range, WINDOW_REGULAR_FOCUSABLE))
 
117
        {
 
118
            TRACE ("%s not in select mask", c2->name);
111
119
            continue;
112
 
#if 0
 
120
        }
113
121
        if (screen_info->params->cycle_apps_only)
114
122
        {
115
123
            /*
116
124
             *  For apps only cycling, it's a tad more complicated
117
 
             * - We want only regular windows (no dialog or anything else)
118
 
             * - We don't want a window from the same application to be
119
 
             *   in the list.
 
125
             * - We want "fake" dialogs, ie without a parent window
 
126
             * - We do not want dialogs but we want modals
 
127
             * - If a modal was added,we do not want to add
 
128
             *   its parent again
120
129
             */
121
 
            if (c2->type != WINDOW_NORMAL)
122
 
                continue;
123
 
            if (g_list_find_custom (client_list, c2, clientCompareApp))
124
 
                continue;
 
130
 
 
131
            if (c2->type & WINDOW_TYPE_DIALOG)
 
132
            {
 
133
                if (clientIsValidTransientOrModal (c2))
 
134
                {
 
135
                    if (!clientIsModal(c2))
 
136
                    {
 
137
                        TRACE ("%s is not modal", c2->name);
 
138
                        continue;
 
139
                    }
 
140
                }
 
141
            }
 
142
            else if (!(c2->type & WINDOW_NORMAL))
 
143
            {
 
144
                {
 
145
                    TRACE ("%s is not normal", c2->name);
 
146
                    continue;
 
147
                }
 
148
            }
 
149
            else
 
150
            {
 
151
                if (g_list_find_custom (client_list, c2, clientCompareModal))
 
152
                {
 
153
                    TRACE ("%s found as modal list", c2->name);
 
154
                    continue;
 
155
                }
 
156
            }
125
157
        }
126
 
#endif
 
158
 
127
159
        TRACE ("clientCycleCreateList: adding %s", c2->name);
128
160
        client_list = g_list_append (client_list, c2);
129
161
    }
292
324
    DisplayInfo *display_info;
293
325
    ClientCycleData passdata;
294
326
    GList *client_list, *selected;
295
 
    guint cycle_range;
296
327
    gboolean g1, g2;
297
328
    int key;
298
329
 
322
353
 
323
354
        return;
324
355
    }
325
 
    cycle_range = clientGetCycleRange (screen_info);
326
356
    key = myScreenGetKeyPressed (screen_info, ev);
327
357
 
328
358
    if (key == KEY_CYCLE_REVERSE_WINDOWS)