~ubuntu-branches/ubuntu/precise/virtualbox/precise-updates

« back to all changes in this revision

Viewing changes to src/VBox/RDP/client/ewmhints.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-07-04 13:02:31 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110704130231-l843es6wqhx614n7
Tags: 4.0.10-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Add the Modaliases control field manually for maximum backportability.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
   Support functions for Extended Window Manager Hints,
5
5
   http://www.freedesktop.org/wiki/Standards_2fwm_2dspec
6
6
 
7
 
   Copyright 2005 Peter Astrand <astrand@cendio.se> for Cendio AB
 
7
   Copyright 2005-2011 Peter Astrand <astrand@cendio.se> for Cendio AB
8
8
   Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB
9
 
   
10
 
   This program is free software; you can redistribute it and/or modify
 
9
 
 
10
   This program is free software: you can redistribute it and/or modify
11
11
   it under the terms of the GNU General Public License as published by
12
 
   the Free Software Foundation; either version 2 of the License, or
 
12
   the Free Software Foundation, either version 3 of the License, or
13
13
   (at your option) any later version.
14
 
   
 
14
 
15
15
   This program is distributed in the hope that it will be useful,
16
16
   but WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
18
   GNU General Public License for more details.
19
 
   
 
19
 
20
20
   You should have received a copy of the GNU General Public License
21
 
   along with this program; if not, write to the Free Software
22
 
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
21
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
22
*/
24
23
 
25
24
/*
144
143
        int current_desktop;
145
144
        unsigned long nitems_return;
146
145
        unsigned char *prop_return;
147
 
        uint32 *return_words;
 
146
        long *return_words;
148
147
        const uint32 net_workarea_x_offset = 0;
149
148
        const uint32 net_workarea_y_offset = 1;
150
149
        const uint32 net_workarea_width_offset = 2;
167
166
        if (current_desktop < 0)
168
167
                return -1;
169
168
 
170
 
        return_words = (uint32 *) prop_return;
 
169
        return_words = (long *) prop_return;
171
170
 
172
171
        *x = return_words[current_desktop * 4 + net_workarea_x_offset];
173
172
        *y = return_words[current_desktop * 4 + net_workarea_y_offset];
441
440
{
442
441
        unsigned long nitems, i;
443
442
        unsigned char *props;
444
 
        uint32 *cur_set, *new_set;
445
 
        uint32 *icon;
 
443
        unsigned long *cur_set, *new_set;
 
444
        unsigned long *icon;
446
445
 
447
446
        cur_set = NULL;
448
447
        new_set = NULL;
449
448
 
450
449
        if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) >= 0)
451
450
        {
452
 
                cur_set = (uint32 *) props;
 
451
                cur_set = (unsigned long *) props;
453
452
 
454
453
                for (i = 0; i < nitems;)
455
454
                {
463
462
                        icon = cur_set + i;
464
463
                else
465
464
                {
466
 
                        new_set = xmalloc((nitems + width * height + 2) * 4);
467
 
                        memcpy(new_set, cur_set, nitems * 4);
 
465
                        new_set = xmalloc((nitems + width * height + 2) * sizeof(unsigned long));
 
466
                        memcpy(new_set, cur_set, nitems * sizeof(unsigned long));
468
467
                        icon = new_set + nitems;
469
468
                        nitems += width * height + 2;
470
469
                }
471
470
        }
472
471
        else
473
472
        {
474
 
                new_set = xmalloc((width * height + 2) * 4);
 
473
                new_set = xmalloc((width * height + 2) * sizeof(unsigned long));
475
474
                icon = new_set;
476
475
                nitems = width * height + 2;
477
476
        }
503
502
{
504
503
        unsigned long nitems, i, icon_size;
505
504
        unsigned char *props;
506
 
        uint32 *cur_set, *new_set;
 
505
        unsigned long *cur_set, *new_set;
507
506
 
508
507
        cur_set = NULL;
509
508
        new_set = NULL;
511
510
        if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) < 0)
512
511
                return;
513
512
 
514
 
        cur_set = (uint32 *) props;
 
513
        cur_set = (unsigned long *) props;
515
514
 
516
515
        for (i = 0; i < nitems;)
517
516
        {
525
524
                goto out;
526
525
 
527
526
        icon_size = width * height + 2;
528
 
        new_set = xmalloc((nitems - icon_size) * 4);
 
527
        new_set = xmalloc((nitems - icon_size) * sizeof(unsigned long));
529
528
 
530
529
        if (i != 0)
531
 
                memcpy(new_set, cur_set, i * 4);
 
530
                memcpy(new_set, cur_set, i * sizeof(unsigned long));
532
531
        if (i != nitems - icon_size)
533
 
                memcpy(new_set + i * 4, cur_set + i * 4 + icon_size, nitems - icon_size);
 
532
                memcpy(new_set + i, cur_set + i + icon_size,
 
533
                       (nitems - (i + icon_size)) * sizeof(unsigned long));
534
534
 
535
535
        nitems -= icon_size;
536
536