~ubuntu-branches/ubuntu/precise/xfwm4/precise-updates

« back to all changes in this revision

Viewing changes to src/workspaces.c

  • Committer: Bazaar Package Importer
  • Author(s): Jérôme Guelfucci, Jérôme Guelfucci, Lionel Le Folgoc
  • Date: 2009-01-30 18:28:59 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20090130182859-1tci3n1f1hhppvc2
Tags: 4.5.99.1-0ubuntu1
[ Jérôme Guelfucci ]
* Merge with Debian Xfce UNRELEASED, remaining Ubuntu changes:
  - debian/xfwm4.1: update bug reporting address (LP instead of Debian BTS).

[ Lionel Le Folgoc ]
* debian/control: use our Vcs-* fields.
* Bugs fixed by this new release:
  - "User interface of focused application is covered by another application's
    new window in Xfce" (LP: #250101)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*      $Id: workspaces.c 28362 2008-10-22 19:58:39Z olivier $
 
1
/*      $Id$
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
12
12
 
13
13
        You should have received a copy of the GNU General Public License
14
14
        along with this program; if not, write to the Free Software
15
 
        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
15
        Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston,
 
16
        MA 02110-1301, USA.
 
17
 
16
18
 
17
19
        oroborus - (c) 2001 Ken Lynch
18
 
        xfwm4    - (c) 2002-2006 Olivier Fourdan
 
20
        xfwm4    - (c) 2002-2009 Olivier Fourdan
19
21
 
20
22
 */
21
23
 
22
24
#ifdef HAVE_CONFIG_H
23
 
#include <config.h>
 
25
#include "config.h"
24
26
#endif
25
27
 
26
28
#include <X11/X.h>
180
182
{
181
183
    int row, col, newrow, newcol, previous_ws, n;
182
184
 
 
185
    g_return_val_if_fail (screen_info != NULL, FALSE);
 
186
 
 
187
    TRACE ("entering workspaceMove");
 
188
 
183
189
    workspaceGetPosition (screen_info, screen_info->current_ws, &row, &col);
184
190
    newrow = modify_with_wrap (row, rowmod, screen_info->desktop_layout.rows, screen_info->params->wrap_layout);
185
191
    newcol = modify_with_wrap (col, colmod, screen_info->desktop_layout.cols, screen_info->params->wrap_layout);
241
247
    unsigned int mask;
242
248
    unsigned long data[1];
243
249
 
 
250
    g_return_if_fail (screen_info != NULL);
 
251
 
244
252
    TRACE ("entering workspaceSwitch");
245
253
 
246
254
    display_info = screen_info->display_info;
270
278
        return;
271
279
    }
272
280
 
273
 
    myScreenGrabPointer (screen_info, EnterWindowMask, None, timestamp);
274
 
 
275
281
    screen_info->previous_ws = screen_info->current_ws;
276
282
    screen_info->current_ws = new_ws;
277
283
 
321
327
    for (index = screen_info->windows_stack; index; index = g_list_next (index))
322
328
    {
323
329
        c = (Client *) index->data;
324
 
        
 
330
 
325
331
        if (c->win_workspace != new_ws)
326
332
        {
327
333
            if (c == previous)
333
339
            {
334
340
                if (!clientIsTransientOrModal (c) || !clientTransientOrModalHasAncestor (c, new_ws))
335
341
                {
336
 
                    clientHide (c, new_ws, FALSE);
 
342
                    clientWithdraw (c, new_ws, FALSE);
337
343
                }
338
344
            }
339
345
        }
343
349
    for (index = g_list_last(screen_info->windows_stack); index; index = g_list_previous (index))
344
350
    {
345
351
        c = (Client *) index->data;
346
 
        
 
352
 
347
353
        if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
348
354
        {
349
355
            if ((!new_focus) && (c == previous) && clientSelectMask (c, 0, WINDOW_REGULAR_FOCUSABLE))
397
403
            clientFocusTop (screen_info, WIN_LAYER_NORMAL, timestamp);
398
404
        }
399
405
    }
400
 
 
401
 
    myScreenUngrabPointer (screen_info);
402
406
}
403
407
 
404
408
void
405
409
workspaceSetNames (ScreenInfo * screen_info, gchar **names, int items)
406
410
{
 
411
    g_return_if_fail (screen_info != NULL);
 
412
    g_return_if_fail (names != NULL);
 
413
 
 
414
    TRACE ("entering workspaceSetNames");
 
415
 
407
416
    if (screen_info->workspace_names)
408
417
    {
409
418
        g_strfreev (screen_info->workspace_names);
420
429
    Client *c;
421
430
    int i;
422
431
 
 
432
    g_return_if_fail (screen_info != NULL);
 
433
 
423
434
    TRACE ("entering workspaceSetCount");
424
435
 
425
436
    if (count < 1)
455
466
}
456
467
 
457
468
void
 
469
workspaceInsert (ScreenInfo * screen_info, int index)
 
470
{
 
471
    Client *c;
 
472
    int i, count;
 
473
 
 
474
    g_return_if_fail (screen_info != NULL);
 
475
 
 
476
    TRACE ("entering workspaceInsert");
 
477
 
 
478
    count = screen_info->workspace_count;
 
479
    workspaceSetCount(screen_info, count + 1);
 
480
 
 
481
    if ((index < 0) || (index > count))
 
482
    {
 
483
        return;
 
484
    }
 
485
 
 
486
    for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
 
487
    {
 
488
        if (c->win_workspace >= index)
 
489
        {
 
490
            clientSetWorkspace (c, c->win_workspace + 1, TRUE);
 
491
        }
 
492
    }
 
493
}
 
494
 
 
495
void
 
496
workspaceDelete (ScreenInfo * screen_info, int index)
 
497
{
 
498
    Client *c;
 
499
    int i, count;
 
500
 
 
501
    g_return_if_fail (screen_info != NULL);
 
502
 
 
503
    TRACE ("entering workspaceDelete");
 
504
 
 
505
    count = screen_info->workspace_count;
 
506
    if ((index < 0) || (index > count))
 
507
    {
 
508
        return;
 
509
    }
 
510
 
 
511
    for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
 
512
    {
 
513
        if (c->win_workspace > index)
 
514
        {
 
515
            clientSetWorkspace (c, c->win_workspace - 1, TRUE);
 
516
        }
 
517
    }
 
518
 
 
519
    workspaceSetCount(screen_info, count - 1);
 
520
}
 
521
 
 
522
void
458
523
workspaceUpdateArea (ScreenInfo *screen_info)
459
524
{
460
525
    DisplayInfo *display_info;