コード例 #1
0
void INTERNAL_init_cursor(void)
{
    unsigned int hot_x, hot_y;
    int i;

    if (hcursorHand)
	return;
    hMouseHook = NULL;
    init_store_cursor();
    
    for (i = 0; i < G_MAXWINDOW; i++) {
	mswin_draw_cursor_func[i] = mswin_default_cursor_func;
	WI[i].pixcopymode = FALSE;
    }
    hot_x = 8;
    hot_y = 12;
    hcursorHand = CreateCursor(_hInst, hot_x, hot_y, hand32_width,
			       hand32_height, hand32_bits, handm32_bits);
    hot_x = 16;
    hot_y = 16;
    hcursorUpdown = CreateCursor(_hInst, hot_x, hot_y, updown32_width,
             updown32_height, updown32_bits, updownmask32_bits);
}
コード例 #2
0
void INTERNAL_init_cursor(GC gc_pixmap)
{
    unsigned long valuemask = 0;
    XGCValues values;
    Cursor cursor;
    Pixmap hand, handmask;
    Pixmap updown, updownmask;
    unsigned long fg, bg;
    unsigned int width, height; 
    unsigned int hot_x, hot_y, hot2_x, hot2_y;
    int i;
    Colormap cmap;
    XColor black, white;

    init_store_cursor();

    for (i=0;i<G_MAXWINDOW;i++) 
        INTERNAL_reset_cursor(i);
    gc_pix = gc_pixmap;
    gc_crosshair= XCreateGC(INTERNAL_display,INTERNAL_rootwin,valuemask,&values);
    valuemask = GCLineStyle | GCLineWidth | GCCapStyle  | GCJoinStyle;
    XGetGCValues(INTERNAL_display,gc_pix,valuemask,&values);
    XSetLineAttributes(INTERNAL_display,
                       gc_pix,
                       0,
                       values.line_style,
                       values.cap_style,
                       values.join_style);
    XSetLineAttributes(INTERNAL_display,
                       gc_crosshair,
                       0,
                       values.line_style,
                       values.cap_style,
                       values.join_style);
    XSetFunction(INTERNAL_display, gc_crosshair, GXxor);
    XSetForeground(INTERNAL_display, gc_crosshair, 
              WhitePixel(INTERNAL_display, INTERNAL_screen) ^ 
              BlackPixel(INTERNAL_display, INTERNAL_screen));

    cur_cross = XCreateFontCursor(INTERNAL_display, XC_crosshair);
    cur_wait  = XCreateFontCursor(INTERNAL_display, XC_watch);
    XQueryBestCursor(INTERNAL_display, INTERNAL_rootwin, 32, 32, &width, &height);

    fg = 1;
    bg = 0;
    if (width >= 32 && height >= 32) {
        hand = XCreatePixmapFromBitmapData(INTERNAL_display, INTERNAL_rootwin,
               (char*)hand32_bits, hand32_width, hand32_height, fg, bg, 1); 
        handmask = XCreatePixmapFromBitmapData(INTERNAL_display, INTERNAL_rootwin,
               (char*)handm32_bits, handm32_width, handm32_height, fg, bg, 1);
        hot_x = 8;
        hot_y = 12;
        updown = XCreatePixmapFromBitmapData(INTERNAL_display, INTERNAL_rootwin,
               (char*)updown32_bits, updown32_width, updown32_height, fg, bg, 1); 
        updownmask = XCreatePixmapFromBitmapData(INTERNAL_display, INTERNAL_rootwin,
               (char*)updownmask32_bits, updownmask32_width, updownmask32_height, fg, bg, 1);
        hot2_x = 16;
        hot2_y = 16;
    }
    else { 
        hand = XCreatePixmapFromBitmapData(INTERNAL_display, INTERNAL_rootwin,
               (char*)hand_bits, hand_width, hand_height, fg, bg, 1); 
        handmask = XCreatePixmapFromBitmapData(INTERNAL_display, INTERNAL_rootwin,
               (char*)handmask_bits, handmask_width, handmask_height, fg, bg, 1);
        hot_x = 4;
        hot_y = 6;
        updown = XCreatePixmapFromBitmapData(INTERNAL_display, INTERNAL_rootwin,
               (char*)updown_bits, updown_width, updown_height, fg, bg, 1); 
        updownmask = XCreatePixmapFromBitmapData(INTERNAL_display, INTERNAL_rootwin,
               (char*)updownmask_bits, updownmask_width, updownmask_height, fg, bg, 1);
        hot2_x = 8;
        hot2_y = 8;
    }
    cmap    = DefaultColormap(INTERNAL_display,INTERNAL_screen);
    XParseColor(INTERNAL_display, cmap, "black", &black);
    XAllocColor(INTERNAL_display, cmap, &black);
    XParseColor(INTERNAL_display, cmap, "white", &white);
    XAllocColor(INTERNAL_display, cmap, &white);
 
    cur_hand = XCreatePixmapCursor(INTERNAL_display, hand, handmask, 
           &black, &white, hot_x, hot_y);
    cur_updown = XCreatePixmapCursor(INTERNAL_display, updown, updownmask, 
           &black, &white, hot2_x, hot2_y);

    XFreePixmap(INTERNAL_display, hand);
    XFreePixmap(INTERNAL_display, handmask);
}