~ubuntu-branches/ubuntu/maverick/xorg-server/maverick-security

« back to all changes in this revision

Viewing changes to mi/micmap.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2010-08-05 11:25:14 UTC
  • mfrom: (1.1.35 upstream) (0.1.14 experimental)
  • Revision ID: james.westby@ubuntu.com-20100805112514-q4efdgj3nblevos2
Tags: 2:1.8.99.905-1ubuntu1
* Merge from (unreleased) Debian experimental.  Remaining Ubuntu changes:
  - rules, control:
    + Disable SELinux, libaudit-dev is not in main yet (LP 406226).
      Drop libaudit-dev from build-deps.
  - rules: Enable xcsecurity (LP 247537).
  - local/xvfb-run*: Add correct docs about error codes (LP 328205)
  - rules: Add --with-extra-module-dir to support GL alternatives.
  - control: Xvfb depends on xauth, x11-xkb-utils. (LP 500102)
  - rules, local/64-xorg-xkb.rules: Don't use keyboard-configuration
    until it's available.
  - control: Update some versioned Breaks for Ubuntu versions.
  - debian/patches:
    + 100_rethrow_signals.patch:
      When aborting, re-raise signals for apport
    + 109_fix-swcursor-crash.patch:
      Avoid dereferencing null pointer while reloading cursors during
      resume. (LP 371405)
    + 111_armel-drv-fallbacks.patch:
      Add support for armel driver fallbacks.
    + 121_only_switch_vt_when_active.diff:
      Add a check to prevent the X server from changing the VT when killing
      GDM from the console.
    + 122_xext_fix_card32_overflow_in_xauth.patch:
      Fix server crash when “xauth generate” is called with large timeout.
    + 157_check_null_modes.patch, 162_null_crtc_in_rotation.patch,
      166_nullptr_xinerama_keyrepeat.patch, 167_nullptr_xisbread.patch
      169_mipointer_nullptr_checks.patch,
      172_cwgetbackingpicture_nullptr_check.patch:
      Fix various segfaults in xserver by checking pointers for NULL
      values before dereferencing them.
    + 165_man_xorg_conf_no_device_ident.patch
      Correct man page
    + 168_glibc_trace_to_stderr.patch:
      Report abort traces to stderr instead of terminal
    + 184_virtual_devices_autodetect.patch:
      Use vesa for qemu device, which is not supported by cirrus
    + 187_edid_quirk_hp_nc8430.patch:
      Quirk for another LPL monitor (LP 380009)
    + 188_default_primary_to_first_busid.patch:
      Pick the first device and carry on (LP 459512)
    + 189_xserver_1.5.0_bg_none_root.patch:
      Create a root window with no background.
    + 190_cache-xkbcomp_output_for_fast_start_up.patch:
      Cache keyboard settings.
    + 191-Xorg-add-an-extra-module-path.patch:
      Add support for the alternatives module path.
    + 197_xvfb-randr.patch:
      Adds xrandr support to xvfb. (LP 516123)
    + 198_nohwaccess.patch:
      Adds a -nohwaccess argument to make X not access the hardware
      ports directly.
    + 200_randr-null.patch:
      Clarify a pointer initialization.
* Update changelog entries for 1.8.1.902-1 which became 1.8.99.904-1
* Drop 196_xvfbscreeninit-handling.patch: it's semantically empty, and now 
  doesn't apply.  Merge remaining #include change into 197_xvfb-randr.patch
* New upstream version will start correctly when no outputs are connected,
  as long as the video driver can dynamically resize the framebuffer
  (true for all KMS drivers) (LP: #337889)
* New upstream version fixes crash on non-admin logout with KDE (LP: #569879)
* Refresh 111_armel-drv-fallbacks.patch to fix the build on armel

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "globals.h"
41
41
#include "micmap.h"
42
42
 
43
 
ColormapPtr miInstalledMaps[MAXSCREENS];
 
43
DevPrivateKeyRec micmapScrPrivateKeyRec;
44
44
 
45
45
int
46
46
miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
47
47
{
48
 
    if (miInstalledMaps[pScreen->myNum]) {
49
 
        *pmaps = miInstalledMaps[pScreen->myNum]->mid;
50
 
        return (1);
 
48
    if (GetInstalledmiColormap(pScreen)) {
 
49
        *pmaps = GetInstalledmiColormap(pScreen)->mid;
 
50
        return 1;
51
51
    }
52
52
    return 0;
53
53
}
55
55
void
56
56
miInstallColormap(ColormapPtr pmap)
57
57
{
58
 
    int index = pmap->pScreen->myNum;
59
 
    ColormapPtr oldpmap = miInstalledMaps[index];
 
58
    ColormapPtr oldpmap = GetInstalledmiColormap(pmap->pScreen);
60
59
 
61
60
    if(pmap != oldpmap)
62
61
    {
65
64
        if(oldpmap != (ColormapPtr)None)
66
65
            WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
67
66
        /* Install pmap */
68
 
        miInstalledMaps[index] = pmap;
 
67
        SetInstalledmiColormap(pmap->pScreen, pmap);
69
68
        WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
70
69
 
71
70
    }
74
73
void
75
74
miUninstallColormap(ColormapPtr pmap)
76
75
{
77
 
    int index = pmap->pScreen->myNum;
78
 
    ColormapPtr curpmap = miInstalledMaps[index];
 
76
    ColormapPtr curpmap = GetInstalledmiColormap(pmap->pScreen);
79
77
 
80
78
    if(pmap == curpmap)
81
79
    {
301
299
    ColormapPtr cmap;
302
300
    int alloctype;
303
301
    
 
302
    if (!dixRegisterPrivateKey(&micmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
 
303
        return FALSE;
 
304
 
304
305
    for (pVisual = pScreen->visuals;
305
306
         pVisual->vid != pScreen->rootVisual;
306
307
         pVisual++)
381
382
 
382
383
    while ((v = miVisuals)) {
383
384
        miVisuals = v->next;
384
 
        xfree(v);
 
385
        free(v);
385
386
    }
386
387
}
387
388
 
394
395
    miVisualsPtr   new, *prev, v;
395
396
    int             count;
396
397
 
397
 
    new = xalloc (sizeof *new);
 
398
    new = malloc(sizeof *new);
398
399
    if (!new)
399
400
        return FALSE;
400
401
    if (!redMask || !greenMask || !blueMask)
535
536
        ndepth++;
536
537
        nvisual += visuals->count;
537
538
    }
538
 
    depth = xalloc (ndepth * sizeof (DepthRec));
539
 
    visual = xalloc (nvisual * sizeof (VisualRec));
540
 
    preferredCVCs = xalloc(ndepth * sizeof(int));
 
539
    depth = malloc(ndepth * sizeof (DepthRec));
 
540
    visual = malloc(nvisual * sizeof (VisualRec));
 
541
    preferredCVCs = malloc(ndepth * sizeof(int));
541
542
    if (!depth || !visual || !preferredCVCs)
542
543
    {
543
 
        xfree (depth);
544
 
        xfree (visual);
545
 
        xfree (preferredCVCs);
 
544
        free(depth);
 
545
        free(visual);
 
546
        free(preferredCVCs);
546
547
        return FALSE;
547
548
    }
548
549
    *depthp = depth;
561
562
        vid = NULL;
562
563
        if (nvtype)
563
564
        {
564
 
            vid = xalloc (nvtype * sizeof (VisualID));
 
565
            vid = malloc(nvtype * sizeof (VisualID));
565
566
            if (!vid) {
566
 
                xfree(preferredCVCs);
 
567
                free(preferredCVCs);
567
568
                return FALSE;
568
569
            }
569
570
        }
605
606
            vid++;
606
607
            visual++;
607
608
        }
608
 
        xfree (visuals);
 
609
        free(visuals);
609
610
    }
610
611
    miVisuals = NULL;
611
612
    visual = *visualp;
661
662
    }
662
663
    *rootDepthp = depth[i].depth;
663
664
    *defaultVisp = depth[i].vids[j];
664
 
    xfree(preferredCVCs);
 
665
    free(preferredCVCs);
665
666
 
666
667
    return TRUE;
667
668
}