xf86Cursors.c revision 4642e01f
1/* 2 * Copyright © 2007 Keith Packard 3 * 4 * Permission to use, copy, modify, distribute, and sell this software and its 5 * documentation for any purpose is hereby granted without fee, provided that 6 * the above copyright notice appear in all copies and that both that copyright 7 * notice and this permission notice appear in supporting documentation, and 8 * that the name of the copyright holders not be used in advertising or 9 * publicity pertaining to distribution of the software without specific, 10 * written prior permission. The copyright holders make no representations 11 * about the suitability of this software for any purpose. It is provided "as 12 * is" without express or implied warranty. 13 * 14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 20 * OF THIS SOFTWARE. 21 */ 22 23#ifdef HAVE_XORG_CONFIG_H 24#include <xorg-config.h> 25#else 26#ifdef HAVE_CONFIG_H 27#include <config.h> 28#endif 29#endif 30 31#include <stddef.h> 32#include <string.h> 33#include <stdio.h> 34 35#include "xf86.h" 36#include "xf86DDC.h" 37#include "xf86Crtc.h" 38#include "xf86Modes.h" 39#include "xf86RandR12.h" 40#include "xf86CursorPriv.h" 41#include "X11/extensions/render.h" 42#define DPMS_SERVER 43#include "X11/extensions/dpms.h" 44#include "X11/Xatom.h" 45#ifdef RENDER 46#include "picturestr.h" 47#endif 48#include "cursorstr.h" 49#include "inputstr.h" 50 51/* 52 * Given a screen coordinate, rotate back to a cursor source coordinate 53 */ 54static void 55xf86_crtc_rotate_coord (Rotation rotation, 56 int width, 57 int height, 58 int x_dst, 59 int y_dst, 60 int *x_src, 61 int *y_src) 62{ 63 int t; 64 65 switch (rotation & 0xf) { 66 case RR_Rotate_0: 67 break; 68 case RR_Rotate_90: 69 t = x_dst; 70 x_dst = height - y_dst - 1; 71 y_dst = t; 72 break; 73 case RR_Rotate_180: 74 x_dst = width - x_dst - 1; 75 y_dst = height - y_dst - 1; 76 break; 77 case RR_Rotate_270: 78 t = x_dst; 79 x_dst = y_dst; 80 y_dst = width - t - 1; 81 break; 82 } 83 if (rotation & RR_Reflect_X) 84 x_dst = width - x_dst - 1; 85 if (rotation & RR_Reflect_Y) 86 y_dst = height - y_dst - 1; 87 *x_src = x_dst; 88 *y_src = y_dst; 89} 90 91/* 92 * Given a cursor source coordinate, rotate to a screen coordinate 93 */ 94static void 95xf86_crtc_rotate_coord_back (Rotation rotation, 96 int width, 97 int height, 98 int x_dst, 99 int y_dst, 100 int *x_src, 101 int *y_src) 102{ 103 int t; 104 105 if (rotation & RR_Reflect_X) 106 x_dst = width - x_dst - 1; 107 if (rotation & RR_Reflect_Y) 108 y_dst = height - y_dst - 1; 109 110 switch (rotation & 0xf) { 111 case RR_Rotate_0: 112 break; 113 case RR_Rotate_90: 114 t = x_dst; 115 x_dst = y_dst; 116 y_dst = width - t - 1; 117 break; 118 case RR_Rotate_180: 119 x_dst = width - x_dst - 1; 120 y_dst = height - y_dst - 1; 121 break; 122 case RR_Rotate_270: 123 t = x_dst; 124 x_dst = height - y_dst - 1; 125 y_dst = t; 126 break; 127 } 128 *x_src = x_dst; 129 *y_src = y_dst; 130} 131 132/* 133 * Convert an x coordinate to a position within the cursor bitmap 134 */ 135static int 136cursor_bitpos (int flags, int x, Bool mask) 137{ 138 if (flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK) 139 mask = !mask; 140 if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) 141 x = (x & ~3) | (3 - (x & 3)); 142 if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) == 143 (X_BYTE_ORDER == X_BIG_ENDIAN)) 144 x = (x & ~7) | (7 - (x & 7)); 145 if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1) 146 x = (x << 1) + mask; 147 else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8) 148 x = ((x & ~7) << 1) | (mask << 3) | (x & 7); 149 else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16) 150 x = ((x & ~15) << 1) | (mask << 4) | (x & 15); 151 else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32) 152 x = ((x & ~31) << 1) | (mask << 5) | (x & 31); 153 else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64) 154 x = ((x & ~63) << 1) | (mask << 6) | (x & 63); 155 return x; 156} 157 158/* 159 * Fetch one bit from a cursor bitmap 160 */ 161static CARD8 162get_bit (CARD8 *image, int stride, int flags, int x, int y, Bool mask) 163{ 164 x = cursor_bitpos (flags, x, mask); 165 image += y * stride; 166 return (image[(x >> 3)] >> (x & 7)) & 1; 167} 168 169/* 170 * Set one bit in a cursor bitmap 171 */ 172static void 173set_bit (CARD8 *image, int stride, int flags, int x, int y, Bool mask) 174{ 175 x = cursor_bitpos (flags, x, mask); 176 image += y * stride; 177 image[(x >> 3)] |= 1 << (x & 7); 178} 179 180/* 181 * Load a two color cursor into a driver that supports only ARGB cursors 182 */ 183static void 184xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src) 185{ 186 ScrnInfoPtr scrn = crtc->scrn; 187 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 188 xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; 189 CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image; 190 int x, y; 191 int xin, yin; 192 int stride = cursor_info->MaxWidth >> 2; 193 int flags = cursor_info->Flags; 194 CARD32 bits; 195 196#ifdef ARGB_CURSOR 197 crtc->cursor_argb = FALSE; 198#endif 199 200 for (y = 0; y < cursor_info->MaxHeight; y++) 201 for (x = 0; x < cursor_info->MaxWidth; x++) 202 { 203 xf86_crtc_rotate_coord (crtc->rotation, 204 cursor_info->MaxWidth, 205 cursor_info->MaxHeight, 206 x, y, &xin, &yin); 207 if (get_bit (src, stride, flags, xin, yin, TRUE) == 208 ((flags & HARDWARE_CURSOR_INVERT_MASK) == 0)) 209 { 210 if (get_bit (src, stride, flags, xin, yin, FALSE)) 211 bits = xf86_config->cursor_fg; 212 else 213 bits = xf86_config->cursor_bg; 214 } 215 else 216 bits = 0; 217 cursor_image[y * cursor_info->MaxWidth + x] = bits; 218 } 219 crtc->funcs->load_cursor_argb (crtc, cursor_image); 220} 221 222/* 223 * Set the colors for a two-color cursor (ignore for ARGB cursors) 224 */ 225static void 226xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg) 227{ 228 ScreenPtr screen = scrn->pScreen; 229 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 230 CursorPtr cursor = xf86_config->cursor; 231 int c; 232 CARD8 *bits = cursor ? 233#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) 234 dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen)) 235#else 236 cursor->devPriv[screen->myNum] 237#endif 238 : NULL; 239 240 /* Save ARGB versions of these colors */ 241 xf86_config->cursor_fg = (CARD32) fg | 0xff000000; 242 xf86_config->cursor_bg = (CARD32) bg | 0xff000000; 243 244 for (c = 0; c < xf86_config->num_crtc; c++) 245 { 246 xf86CrtcPtr crtc = xf86_config->crtc[c]; 247 248 if (crtc->enabled && !crtc->cursor_argb) 249 { 250 if (crtc->funcs->load_cursor_image) 251 crtc->funcs->set_cursor_colors (crtc, bg, fg); 252 else if (bits) 253 xf86_crtc_convert_cursor_to_argb (crtc, bits); 254 } 255 } 256} 257 258static void 259xf86_crtc_hide_cursor (xf86CrtcPtr crtc) 260{ 261 if (crtc->cursor_shown) 262 { 263 crtc->funcs->hide_cursor (crtc); 264 crtc->cursor_shown = FALSE; 265 } 266} 267 268_X_EXPORT void 269xf86_hide_cursors (ScrnInfoPtr scrn) 270{ 271 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 272 int c; 273 274 xf86_config->cursor_on = FALSE; 275 for (c = 0; c < xf86_config->num_crtc; c++) 276 { 277 xf86CrtcPtr crtc = xf86_config->crtc[c]; 278 279 if (crtc->enabled) 280 xf86_crtc_hide_cursor (crtc); 281 } 282} 283 284static void 285xf86_crtc_show_cursor (xf86CrtcPtr crtc) 286{ 287 if (!crtc->cursor_shown && crtc->cursor_in_range) 288 { 289 crtc->funcs->show_cursor (crtc); 290 crtc->cursor_shown = TRUE; 291 } 292} 293 294_X_EXPORT void 295xf86_show_cursors (ScrnInfoPtr scrn) 296{ 297 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 298 int c; 299 300 xf86_config->cursor_on = TRUE; 301 for (c = 0; c < xf86_config->num_crtc; c++) 302 { 303 xf86CrtcPtr crtc = xf86_config->crtc[c]; 304 305 if (crtc->enabled) 306 xf86_crtc_show_cursor (crtc); 307 } 308} 309 310static void 311xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) 312{ 313 ScrnInfoPtr scrn = crtc->scrn; 314 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 315 xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; 316 DisplayModePtr mode = &crtc->mode; 317 Bool in_range; 318 int dx, dy; 319 320 /* 321 * Transform position of cursor on screen 322 */ 323 if (crtc->transform_in_use) 324 { 325 ScreenPtr screen = scrn->pScreen; 326 xf86CursorScreenPtr ScreenPriv = 327 (xf86CursorScreenPtr)dixLookupPrivate(&screen->devPrivates, 328 xf86CursorScreenKey); 329 struct pict_f_vector v; 330 331 v.v[0] = x + ScreenPriv->HotX; v.v[1] = y + ScreenPriv->HotY; v.v[2] = 1; 332 pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v); 333 x = floor (v.v[0] + 0.5); 334 y = floor (v.v[1] + 0.5); 335 /* 336 * Transform position of cursor upper left corner 337 */ 338 xf86_crtc_rotate_coord_back (crtc->rotation, 339 cursor_info->MaxWidth, 340 cursor_info->MaxHeight, 341 ScreenPriv->HotX, ScreenPriv->HotY, &dx, &dy); 342 x -= dx; 343 y -= dy; 344 } 345 else 346 { 347 x -= crtc->x; 348 y -= crtc->y; 349 } 350 351 /* 352 * Disable the cursor when it is outside the viewport 353 */ 354 in_range = TRUE; 355 if (x >= mode->HDisplay || y >= mode->VDisplay || 356 x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight) 357 { 358 in_range = FALSE; 359 x = 0; 360 y = 0; 361 } 362 363 crtc->cursor_in_range = in_range; 364 365 if (in_range) 366 { 367 crtc->funcs->set_cursor_position (crtc, x, y); 368 xf86_crtc_show_cursor (crtc); 369 } 370 else 371 xf86_crtc_hide_cursor (crtc); 372} 373 374static void 375xf86_set_cursor_position (ScrnInfoPtr scrn, int x, int y) 376{ 377 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 378 int c; 379 380 /* undo what xf86HWCurs did to the coordinates */ 381 x += scrn->frameX0; 382 y += scrn->frameY0; 383 for (c = 0; c < xf86_config->num_crtc; c++) 384 { 385 xf86CrtcPtr crtc = xf86_config->crtc[c]; 386 387 if (crtc->enabled) 388 xf86_crtc_set_cursor_position (crtc, x, y); 389 } 390} 391 392/* 393 * Load a two-color cursor into a crtc, performing rotation as needed 394 */ 395static void 396xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src) 397{ 398 ScrnInfoPtr scrn = crtc->scrn; 399 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 400 xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; 401 CARD8 *cursor_image; 402 403#ifdef ARGB_CURSOR 404 crtc->cursor_argb = FALSE; 405#endif 406 407 if (crtc->rotation == RR_Rotate_0) 408 cursor_image = src; 409 else 410 { 411 int x, y; 412 int xin, yin; 413 int stride = cursor_info->MaxWidth >> 2; 414 int flags = cursor_info->Flags; 415 416 cursor_image = xf86_config->cursor_image; 417 memset(cursor_image, 0, cursor_info->MaxHeight * stride); 418 419 for (y = 0; y < cursor_info->MaxHeight; y++) 420 for (x = 0; x < cursor_info->MaxWidth; x++) 421 { 422 xf86_crtc_rotate_coord (crtc->rotation, 423 cursor_info->MaxWidth, 424 cursor_info->MaxHeight, 425 x, y, &xin, &yin); 426 if (get_bit(src, stride, flags, xin, yin, FALSE)) 427 set_bit(cursor_image, stride, flags, x, y, FALSE); 428 if (get_bit(src, stride, flags, xin, yin, TRUE)) 429 set_bit(cursor_image, stride, flags, x, y, TRUE); 430 } 431 } 432 crtc->funcs->load_cursor_image (crtc, cursor_image); 433} 434 435/* 436 * Load a cursor image into all active CRTCs 437 */ 438static void 439xf86_load_cursor_image (ScrnInfoPtr scrn, unsigned char *src) 440{ 441 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 442 int c; 443 444 for (c = 0; c < xf86_config->num_crtc; c++) 445 { 446 xf86CrtcPtr crtc = xf86_config->crtc[c]; 447 448 if (crtc->enabled) 449 { 450 if (crtc->funcs->load_cursor_image) 451 xf86_crtc_load_cursor_image (crtc, src); 452 else if (crtc->funcs->load_cursor_argb) 453 xf86_crtc_convert_cursor_to_argb (crtc, src); 454 } 455 } 456} 457 458static Bool 459xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor) 460{ 461 ScrnInfoPtr scrn = xf86Screens[screen->myNum]; 462 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 463 xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; 464 465 if (xf86_config->cursor) 466 FreeCursor (xf86_config->cursor, None); 467 xf86_config->cursor = cursor; 468 ++cursor->refcnt; 469 470 if (cursor->bits->width > cursor_info->MaxWidth || 471 cursor->bits->height> cursor_info->MaxHeight) 472 return FALSE; 473 474 return TRUE; 475} 476 477static Bool 478xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor) 479{ 480 ScrnInfoPtr scrn = xf86Screens[screen->myNum]; 481 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 482 xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; 483 484 if (xf86_config->cursor) 485 FreeCursor (xf86_config->cursor, None); 486 xf86_config->cursor = cursor; 487 ++cursor->refcnt; 488 489 /* Make sure ARGB support is available */ 490 if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0) 491 return FALSE; 492 493 if (cursor->bits->width > cursor_info->MaxWidth || 494 cursor->bits->height> cursor_info->MaxHeight) 495 return FALSE; 496 497 return TRUE; 498} 499 500static void 501xf86_crtc_load_cursor_argb (xf86CrtcPtr crtc, CursorPtr cursor) 502{ 503 ScrnInfoPtr scrn = crtc->scrn; 504 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 505 xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; 506 CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image; 507 CARD32 *cursor_source = (CARD32 *) cursor->bits->argb; 508 int x, y; 509 int xin, yin; 510 CARD32 bits; 511 int source_width = cursor->bits->width; 512 int source_height = cursor->bits->height; 513 int image_width = cursor_info->MaxWidth; 514 int image_height = cursor_info->MaxHeight; 515 516 for (y = 0; y < image_height; y++) 517 for (x = 0; x < image_width; x++) 518 { 519 xf86_crtc_rotate_coord (crtc->rotation, image_width, image_height, 520 x, y, &xin, &yin); 521 if (xin < source_width && yin < source_height) 522 bits = cursor_source[yin * source_width + xin]; 523 else 524 bits = 0; 525 cursor_image[y * image_width + x] = bits; 526 } 527 528 crtc->funcs->load_cursor_argb (crtc, cursor_image); 529} 530 531static void 532xf86_load_cursor_argb (ScrnInfoPtr scrn, CursorPtr cursor) 533{ 534 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 535 int c; 536 537 for (c = 0; c < xf86_config->num_crtc; c++) 538 { 539 xf86CrtcPtr crtc = xf86_config->crtc[c]; 540 541 if (crtc->enabled) 542 xf86_crtc_load_cursor_argb (crtc, cursor); 543 } 544} 545 546_X_EXPORT Bool 547xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags) 548{ 549 ScrnInfoPtr scrn = xf86Screens[screen->myNum]; 550 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 551 xf86CursorInfoPtr cursor_info; 552 553 cursor_info = xf86CreateCursorInfoRec(); 554 if (!cursor_info) 555 return FALSE; 556 557 xf86_config->cursor_image = xalloc (max_width * max_height * 4); 558 559 if (!xf86_config->cursor_image) 560 { 561 xf86DestroyCursorInfoRec (cursor_info); 562 return FALSE; 563 } 564 565 xf86_config->cursor_info = cursor_info; 566 567 cursor_info->MaxWidth = max_width; 568 cursor_info->MaxHeight = max_height; 569 cursor_info->Flags = flags; 570 571 cursor_info->SetCursorColors = xf86_set_cursor_colors; 572 cursor_info->SetCursorPosition = xf86_set_cursor_position; 573 cursor_info->LoadCursorImage = xf86_load_cursor_image; 574 cursor_info->HideCursor = xf86_hide_cursors; 575 cursor_info->ShowCursor = xf86_show_cursors; 576 cursor_info->UseHWCursor = xf86_use_hw_cursor; 577#ifdef ARGB_CURSOR 578 if (flags & HARDWARE_CURSOR_ARGB) 579 { 580 cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb; 581 cursor_info->LoadCursorARGB = xf86_load_cursor_argb; 582 } 583#endif 584 585 xf86_config->cursor = NULL; 586 xf86_hide_cursors (scrn); 587 588 return xf86InitCursor (screen, cursor_info); 589} 590 591/** 592 * Called when anything on the screen is reconfigured. 593 * 594 * Reloads cursor images as needed, then adjusts cursor positions 595 */ 596 597_X_EXPORT void 598xf86_reload_cursors (ScreenPtr screen) 599{ 600 ScrnInfoPtr scrn; 601 xf86CrtcConfigPtr xf86_config; 602 xf86CursorInfoPtr cursor_info; 603 CursorPtr cursor; 604 int x, y; 605 xf86CursorScreenPtr cursor_screen_priv; 606 607 /* initial mode setting will not have set a screen yet. 608 May be called before the devices are initialised. 609 */ 610 if (!screen || !inputInfo.pointer) 611 return; 612 cursor_screen_priv = dixLookupPrivate(&screen->devPrivates, 613 xf86CursorScreenKey); 614 /* return if HW cursor is inactive, to avoid displaying two cursors */ 615 if (!cursor_screen_priv->isUp) 616 return; 617 618 scrn = xf86Screens[screen->myNum]; 619 xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 620 621 /* make sure the cursor code has been initialized */ 622 cursor_info = xf86_config->cursor_info; 623 if (!cursor_info) 624 return; 625 626 cursor = xf86_config->cursor; 627 GetSpritePosition (inputInfo.pointer, &x, &y); 628 if (!(cursor_info->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) 629 (*cursor_info->HideCursor)(scrn); 630 631 if (cursor) 632 { 633#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) 634 void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen)); 635#else 636 void *src = cursor->devPriv[screen->myNum]; 637#endif 638#ifdef ARGB_CURSOR 639 if (cursor->bits->argb && cursor_info->LoadCursorARGB) 640 (*cursor_info->LoadCursorARGB) (scrn, cursor); 641 else if (src) 642#endif 643 (*cursor_info->LoadCursorImage)(cursor_info->pScrn, src); 644 645 (*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y); 646 } 647} 648 649/** 650 * Clean up CRTC-based cursor code 651 */ 652_X_EXPORT void 653xf86_cursors_fini (ScreenPtr screen) 654{ 655 ScrnInfoPtr scrn = xf86Screens[screen->myNum]; 656 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); 657 658 if (xf86_config->cursor_info) 659 { 660 xf86DestroyCursorInfoRec (xf86_config->cursor_info); 661 xf86_config->cursor_info = NULL; 662 } 663 if (xf86_config->cursor_image) 664 { 665 xfree (xf86_config->cursor_image); 666 xf86_config->cursor_image = NULL; 667 } 668 if (xf86_config->cursor) 669 { 670 FreeCursor (xf86_config->cursor, None); 671 xf86_config->cursor = NULL; 672 } 673} 674