~ubuntu-branches/ubuntu/edgy/xbill/edgy

« back to all changes in this revision

Viewing changes to MCursor.cc

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Bridgett
  • Date: 2001-06-24 22:44:40 UTC
  • Revision ID: james.westby@ubuntu.com-20010624224440-r8kbgt5ae7q1230g
Tags: upstream-2.0
ImportĀ upstreamĀ versionĀ 2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "MCursor.h"
 
2
#include "objects.h"
 
3
 
 
4
void MCursor::load(const char *name, int masked) {
 
5
        static char *dir = strdup(
 
6
                access(XBILL_HOME "pixmaps/logo.xpm", R_OK) ? "" : XBILL_HOME);
 
7
        Pixmap bitmap, mask;
 
8
        int i, xh, yh;
 
9
        unsigned width, height;
 
10
        char file[255];
 
11
        char mfile[255];
 
12
        sprintf (file, "%sbitmaps/%s.xbm", dir, name);
 
13
        i = XReadBitmapFile (ui.display, ui.rootwindow, file,
 
14
                &width, &height, &bitmap, &xh, &yh);
 
15
        if (i == BitmapOpenFailed) {
 
16
                printf ("cannot open %s\n", file);
 
17
                exit(1);
 
18
        }
 
19
        if (masked == SEP_MASK) {
 
20
                sprintf (mfile, "%sbitmaps/%s_mask.xbm", dir, name);
 
21
                i = XReadBitmapFile (ui.display, ui.rootwindow,
 
22
                        mfile, &width, &height, &mask, &xh, &yh);
 
23
        }
 
24
        else
 
25
                mask = bitmap;
 
26
        if (i == BitmapOpenFailed) {
 
27
                printf ("cannot open %s\n", file);
 
28
                exit(1);
 
29
        }
 
30
        cursor = XCreatePixmapCursor(ui.display, bitmap, mask,
 
31
                &ui.black, &ui.white, width/2, height/2);
 
32
}
 
33