~ubuntu-branches/ubuntu/precise/xfwm4/precise-proposed

« back to all changes in this revision

Viewing changes to src/workspaces.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2006-12-22 18:37:36 UTC
  • mto: (3.1.2 lenny) (1.1.22 upstream)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20061222183736-yoju2r97heo29ya1
Tags: upstream-4.3.99.2svn+r24167
ImportĀ upstreamĀ versionĀ 4.3.99.2svn+r24167

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*      $Id: workspaces.c 23767 2006-11-06 22:03:38Z olivier $
 
1
/*      $Id: workspaces.c 24099 2006-12-13 22:01:17Z olivier $
2
2
 
3
3
        This program is free software; you can redistribute it and/or modify
4
4
        it under the terms of the GNU General Public License as published by
23
23
#include <config.h>
24
24
#endif
25
25
 
 
26
#include <X11/X.h>
26
27
#include <X11/Xlib.h>
27
28
#include <X11/Xutil.h>
28
29
#include <X11/Xmd.h>
 
30
 
29
31
#include <glib.h>
30
32
#include <gdk/gdk.h>
31
33
#include <gtk/gtk.h>
174
176
 
175
177
/* returns TRUE if the workspace was changed, FALSE otherwise */
176
178
gboolean
177
 
workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c)
 
179
workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c, Time timestamp)
178
180
{
179
181
    int row, col, newrow, newcol, previous_ws, n;
180
182
 
181
 
    workspaceGetPosition(screen_info, screen_info->current_ws, &row, &col);
182
 
    newrow = modify_with_wrap(row, rowmod, screen_info->desktop_layout.rows, screen_info->params->wrap_layout);
183
 
    newcol = modify_with_wrap(col, colmod, screen_info->desktop_layout.cols, screen_info->params->wrap_layout);
184
 
    n = workspaceGetNumber(screen_info, newrow, newcol);
 
183
    workspaceGetPosition (screen_info, screen_info->current_ws, &row, &col);
 
184
    newrow = modify_with_wrap (row, rowmod, screen_info->desktop_layout.rows, screen_info->params->wrap_layout);
 
185
    newcol = modify_with_wrap (col, colmod, screen_info->desktop_layout.cols, screen_info->params->wrap_layout);
 
186
    n = workspaceGetNumber (screen_info, newrow, newcol);
185
187
 
186
188
    if (n == screen_info->current_ws)
187
189
    {
191
193
    previous_ws = screen_info->current_ws;
192
194
    if ((n >= 0) && (n < screen_info->workspace_count))
193
195
    {
194
 
        workspaceSwitch(screen_info, n, c, TRUE);
 
196
        workspaceSwitch (screen_info, n, c, TRUE, timestamp);
195
197
    }
196
198
    else if (screen_info->params->wrap_layout)
197
199
    {
218
220
                return FALSE;
219
221
            }
220
222
 
221
 
            n = workspaceGetNumber(screen_info, newrow, newcol);
 
223
            n = workspaceGetNumber (screen_info, newrow, newcol);
222
224
        }
223
 
        workspaceSwitch(screen_info, n, c, TRUE);
 
225
        workspaceSwitch (screen_info, n, c, TRUE, timestamp);
224
226
    }
225
227
 
226
228
    return (screen_info->current_ws != previous_ws);
227
229
}
228
230
 
229
231
void
230
 
workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean update_focus)
 
232
workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean update_focus, Time timestamp)
231
233
{
232
234
    DisplayInfo *display_info;
233
235
    Client *c, *new_focus;
268
270
        return;
269
271
    }
270
272
 
271
 
    myScreenGrabPointer (screen_info, EnterWindowMask, None, myDisplayGetCurrentTime (display_info));
 
273
    myScreenGrabPointer (screen_info, EnterWindowMask, None, timestamp);
272
274
 
273
275
    screen_info->previous_ws = screen_info->current_ws;
274
276
    screen_info->current_ws = new_ws;
325
327
            if (c == previous)
326
328
            {
327
329
                FLAG_SET (previous->xfwm_flags, XFWM_FLAG_FOCUS);
328
 
                clientSetFocus (screen_info, NULL, myDisplayGetCurrentTime (display_info), FOCUS_IGNORE_MODAL);
 
330
                clientSetFocus (screen_info, NULL, timestamp, FOCUS_IGNORE_MODAL);
329
331
            }
330
332
            if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE) && !FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
331
333
            {
344
346
        
345
347
        if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
346
348
        {
347
 
            if ((!new_focus) && (c == previous) && (c->type & WINDOW_REGULAR_FOCUSABLE))
 
349
            if ((!new_focus) && (c == previous) && clientSelectMask (c, 0, WINDOW_REGULAR_FOCUSABLE))
348
350
            {
349
351
                new_focus = c;
350
352
            }
381
383
    {
382
384
        if (new_focus)
383
385
        {
384
 
            clientSetFocus (screen_info, new_focus, myDisplayGetCurrentTime (display_info), NO_FOCUS_FLAG);
 
386
            clientSetFocus (screen_info, new_focus, timestamp, NO_FOCUS_FLAG);
385
387
        }
386
388
        else
387
389
        {
388
 
            clientFocusTop (screen_info, WIN_LAYER_NORMAL);
 
390
            clientFocusTop (screen_info, WIN_LAYER_NORMAL, timestamp);
389
391
        }
390
392
    }
391
393
 
392
 
    myScreenUngrabPointer (screen_info, myDisplayGetCurrentTime (display_info));
 
394
    myScreenUngrabPointer (screen_info, timestamp);
393
395
}
394
396
 
395
397
void
436
438
    }
437
439
    if (screen_info->current_ws > count - 1)
438
440
    {
439
 
        workspaceSwitch (screen_info, count - 1, NULL, TRUE);
 
441
        workspaceSwitch (screen_info, count - 1, NULL, TRUE, myDisplayGetCurrentTime (display_info));
440
442
    }
441
443
    setNetWorkarea (display_info, screen_info->xroot, screen_info->workspace_count,
442
444
                    screen_info->width, screen_info->height, screen_info->margins);
443
445
    /* Recompute the layout based on the (changed) number of desktops */
444
 
    getDesktopLayout(display_info, screen_info->xroot, screen_info->workspace_count,
 
446
    getDesktopLayout (display_info, screen_info->xroot, screen_info->workspace_count,
445
447
                     &screen_info->desktop_layout);
446
448
}
447
449