Mercurial > emacs
comparison src/macfns.c @ 60621:c30bb367650a
(Qhyper, Qsuper, Qmeta, Qalt, Qctrl, Qcontrol, Qshift): Remove unused
variables.
(syms_of_macfns): Don't initialize them. Likewise for
Qface_set_after_frame_default. Defvar and initialize
Vx_window_horizontal_drag_shape.
(x_set_mouse_color): Change mouse pointer shape.
(mac_window) [!MAC_OSX]: Create root control.
(mac_window): Remove initializations of mouse pointer shapes.
(hourglass_started): New function (from xfns.c).
(start_hourglass, cancel_hourglass): Put function body in #ifdef
MAC_OSX.
(show_hourglass) [TARGET_API_MAC_CARBON]: Create progress
indicator for each non-tooltip frame if needed, and show it.
(hide_hourglass) [TARGET_API_MAC_CARBON]: Hide progress indicators.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Wed, 16 Mar 2005 03:26:37 +0000 |
parents | bd59e53ab8e8 |
children | 9497994ad6fc |
comparison
equal
deleted
inserted
replaced
60620:ffb5c0421a14 | 60621:c30bb367650a |
---|---|
147 /*&&& symbols declared here &&&*/ | 147 /*&&& symbols declared here &&&*/ |
148 Lisp_Object Qnone; | 148 Lisp_Object Qnone; |
149 Lisp_Object Qsuppress_icon; | 149 Lisp_Object Qsuppress_icon; |
150 Lisp_Object Qundefined_color; | 150 Lisp_Object Qundefined_color; |
151 Lisp_Object Qcancel_timer; | 151 Lisp_Object Qcancel_timer; |
152 Lisp_Object Qhyper; | |
153 Lisp_Object Qsuper; | |
154 Lisp_Object Qmeta; | |
155 Lisp_Object Qalt; | |
156 Lisp_Object Qctrl; | |
157 Lisp_Object Qcontrol; | |
158 Lisp_Object Qshift; | |
159 | 152 |
160 extern Lisp_Object Vwindow_system_version; | 153 extern Lisp_Object Vwindow_system_version; |
161 | 154 |
162 #if 0 /* Use xstricmp instead. */ | 155 #if 0 /* Use xstricmp instead. */ |
163 /* compare two strings ignoring case */ | 156 /* compare two strings ignoring case */ |
1451 void | 1444 void |
1452 x_set_mouse_color (f, arg, oldval) | 1445 x_set_mouse_color (f, arg, oldval) |
1453 struct frame *f; | 1446 struct frame *f; |
1454 Lisp_Object arg, oldval; | 1447 Lisp_Object arg, oldval; |
1455 { | 1448 { |
1449 struct x_output *x = f->output_data.x; | |
1450 Display *dpy = FRAME_MAC_DISPLAY (f); | |
1456 Cursor cursor, nontext_cursor, mode_cursor, hand_cursor; | 1451 Cursor cursor, nontext_cursor, mode_cursor, hand_cursor; |
1457 int count; | 1452 Cursor hourglass_cursor, horizontal_drag_cursor; |
1458 int mask_color; | 1453 unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
1459 | 1454 unsigned long mask_color = x->background_pixel; |
1460 if (!EQ (Qnil, arg)) | |
1461 f->output_data.mac->mouse_pixel | |
1462 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | |
1463 mask_color = FRAME_BACKGROUND_PIXEL (f); | |
1464 | 1455 |
1465 /* Don't let pointers be invisible. */ | 1456 /* Don't let pointers be invisible. */ |
1466 if (mask_color == f->output_data.mac->mouse_pixel | 1457 if (mask_color == pixel) |
1467 && mask_color == FRAME_BACKGROUND_PIXEL (f)) | 1458 pixel = x->foreground_pixel; |
1468 f->output_data.mac->mouse_pixel = FRAME_FOREGROUND_PIXEL (f); | 1459 |
1469 | 1460 f->output_data.mac->mouse_pixel = pixel; |
1470 #if 0 /* MAC_TODO : cursor changes */ | 1461 |
1471 BLOCK_INPUT; | 1462 if (!NILP (Vx_pointer_shape)) |
1472 | |
1473 /* It's not okay to crash if the user selects a screwy cursor. */ | |
1474 count = x_catch_errors (FRAME_W32_DISPLAY (f)); | |
1475 | |
1476 if (!EQ (Qnil, Vx_pointer_shape)) | |
1477 { | 1463 { |
1478 CHECK_NUMBER (Vx_pointer_shape); | 1464 CHECK_NUMBER (Vx_pointer_shape); |
1479 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape)); | 1465 cursor = XINT (Vx_pointer_shape); |
1480 } | 1466 } |
1481 else | 1467 else |
1482 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm); | 1468 cursor = kThemeIBeamCursor; |
1483 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s"); | 1469 |
1484 | 1470 if (!NILP (Vx_nontext_pointer_shape)) |
1485 if (!EQ (Qnil, Vx_nontext_pointer_shape)) | |
1486 { | 1471 { |
1487 CHECK_NUMBER (Vx_nontext_pointer_shape); | 1472 CHECK_NUMBER (Vx_nontext_pointer_shape); |
1488 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), | 1473 nontext_cursor = XINT (Vx_nontext_pointer_shape); |
1489 XINT (Vx_nontext_pointer_shape)); | |
1490 } | 1474 } |
1491 else | 1475 else |
1492 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_left_ptr); | 1476 nontext_cursor = kThemeArrowCursor; |
1493 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); | 1477 |
1494 | 1478 if (!NILP (Vx_hourglass_pointer_shape)) |
1495 if (!EQ (Qnil, Vx_hourglass_pointer_shape)) | |
1496 { | 1479 { |
1497 CHECK_NUMBER (Vx_hourglass_pointer_shape); | 1480 CHECK_NUMBER (Vx_hourglass_pointer_shape); |
1498 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), | 1481 hourglass_cursor = XINT (Vx_hourglass_pointer_shape); |
1499 XINT (Vx_hourglass_pointer_shape)); | |
1500 } | 1482 } |
1501 else | 1483 else |
1502 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch); | 1484 hourglass_cursor = kThemeWatchCursor; |
1503 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s"); | 1485 |
1504 | 1486 if (!NILP (Vx_mode_pointer_shape)) |
1505 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); | |
1506 if (!EQ (Qnil, Vx_mode_pointer_shape)) | |
1507 { | 1487 { |
1508 CHECK_NUMBER (Vx_mode_pointer_shape); | 1488 CHECK_NUMBER (Vx_mode_pointer_shape); |
1509 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), | 1489 mode_cursor = XINT (Vx_mode_pointer_shape); |
1510 XINT (Vx_mode_pointer_shape)); | |
1511 } | 1490 } |
1512 else | 1491 else |
1513 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm); | 1492 mode_cursor = kThemeArrowCursor; |
1514 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s"); | 1493 |
1515 | 1494 if (!NILP (Vx_sensitive_text_pointer_shape)) |
1516 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape)) | |
1517 { | 1495 { |
1518 CHECK_NUMBER (Vx_sensitive_text_pointer_shape); | 1496 CHECK_NUMBER (Vx_sensitive_text_pointer_shape); |
1519 hand_cursor | 1497 hand_cursor = XINT (Vx_sensitive_text_pointer_shape); |
1520 = XCreateFontCursor (FRAME_W32_DISPLAY (f), | |
1521 XINT (Vx_sensitive_text_pointer_shape)); | |
1522 } | 1498 } |
1523 else | 1499 else |
1524 hand_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair); | 1500 hand_cursor = kThemePointingHandCursor; |
1525 | 1501 |
1526 if (!NILP (Vx_window_horizontal_drag_shape)) | 1502 if (!NILP (Vx_window_horizontal_drag_shape)) |
1527 { | 1503 { |
1528 CHECK_NUMBER (Vx_window_horizontal_drag_shape); | 1504 CHECK_NUMBER (Vx_window_horizontal_drag_shape); |
1529 horizontal_drag_cursor | 1505 horizontal_drag_cursor = XINT (Vx_window_horizontal_drag_shape); |
1530 = XCreateFontCursor (FRAME_W32_DISPLAY (f), | |
1531 XINT (Vx_window_horizontal_drag_shape)); | |
1532 } | 1506 } |
1533 else | 1507 else |
1534 horizontal_drag_cursor | 1508 horizontal_drag_cursor = kThemeResizeLeftRightCursor; |
1535 = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_sb_h_double_arrow); | 1509 |
1536 | 1510 #if 0 /* MAC_TODO: cursor color changes */ |
1537 /* Check and report errors with the above calls. */ | |
1538 x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s"); | |
1539 x_uncatch_errors (FRAME_W32_DISPLAY (f), count); | |
1540 | |
1541 { | 1511 { |
1542 XColor fore_color, back_color; | 1512 XColor fore_color, back_color; |
1543 | 1513 |
1544 fore_color.pixel = f->output_data.w32->mouse_pixel; | 1514 fore_color.pixel = f->output_data.mac->mouse_pixel; |
1515 x_query_color (f, &fore_color); | |
1545 back_color.pixel = mask_color; | 1516 back_color.pixel = mask_color; |
1546 XQueryColor (FRAME_W32_DISPLAY (f), | 1517 x_query_color (f, &back_color); |
1547 DefaultColormap (FRAME_W32_DISPLAY (f), | 1518 |
1548 DefaultScreen (FRAME_W32_DISPLAY (f))), | 1519 XRecolorCursor (dpy, cursor, &fore_color, &back_color); |
1549 &fore_color); | 1520 XRecolorCursor (dpy, nontext_cursor, &fore_color, &back_color); |
1550 XQueryColor (FRAME_W32_DISPLAY (f), | 1521 XRecolorCursor (dpy, mode_cursor, &fore_color, &back_color); |
1551 DefaultColormap (FRAME_W32_DISPLAY (f), | 1522 XRecolorCursor (dpy, hand_cursor, &fore_color, &back_color); |
1552 DefaultScreen (FRAME_W32_DISPLAY (f))), | 1523 XRecolorCursor (dpy, hourglass_cursor, &fore_color, &back_color); |
1553 &back_color); | 1524 XRecolorCursor (dpy, horizontal_drag_cursor, &fore_color, &back_color); |
1554 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor, | |
1555 &fore_color, &back_color); | |
1556 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor, | |
1557 &fore_color, &back_color); | |
1558 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor, | |
1559 &fore_color, &back_color); | |
1560 XRecolorCursor (FRAME_W32_DISPLAY (f), hand_cursor, | |
1561 &fore_color, &back_color); | |
1562 XRecolorCursor (FRAME_W32_DISPLAY (f), hourglass_cursor, | |
1563 &fore_color, &back_color); | |
1564 } | 1525 } |
1565 | 1526 #endif |
1566 if (FRAME_W32_WINDOW (f) != 0) | 1527 |
1567 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor); | 1528 BLOCK_INPUT; |
1568 | 1529 |
1569 if (cursor != f->output_data.w32->text_cursor && f->output_data.w32->text_cursor != 0) | 1530 rif->define_frame_cursor (f, cursor); |
1570 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->text_cursor); | 1531 |
1571 f->output_data.w32->text_cursor = cursor; | 1532 f->output_data.mac->text_cursor = cursor; |
1572 | 1533 f->output_data.mac->nontext_cursor = nontext_cursor; |
1573 if (nontext_cursor != f->output_data.w32->nontext_cursor | 1534 f->output_data.mac->hourglass_cursor = hourglass_cursor; |
1574 && f->output_data.w32->nontext_cursor != 0) | 1535 f->output_data.mac->modeline_cursor = mode_cursor; |
1575 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->nontext_cursor); | 1536 f->output_data.mac->hand_cursor = hand_cursor; |
1576 f->output_data.w32->nontext_cursor = nontext_cursor; | 1537 f->output_data.mac->horizontal_drag_cursor = horizontal_drag_cursor; |
1577 | 1538 |
1578 if (hourglass_cursor != f->output_data.w32->hourglass_cursor | |
1579 && f->output_data.w32->hourglass_cursor != 0) | |
1580 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->hourglass_cursor); | |
1581 f->output_data.w32->hourglass_cursor = hourglass_cursor; | |
1582 | |
1583 if (mode_cursor != f->output_data.w32->modeline_cursor | |
1584 && f->output_data.w32->modeline_cursor != 0) | |
1585 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor); | |
1586 f->output_data.w32->modeline_cursor = mode_cursor; | |
1587 | |
1588 if (hand_cursor != f->output_data.w32->hand_cursor | |
1589 && f->output_data.w32->hand_cursor != 0) | |
1590 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->hand_cursor); | |
1591 f->output_data.w32->hand_cursor = hand_cursor; | |
1592 | |
1593 XFlush (FRAME_W32_DISPLAY (f)); | |
1594 UNBLOCK_INPUT; | 1539 UNBLOCK_INPUT; |
1595 | 1540 |
1596 update_face_from_frame_parameter (f, Qmouse_color, arg); | 1541 update_face_from_frame_parameter (f, Qmouse_color, arg); |
1597 #endif /* MAC_TODO */ | |
1598 } | 1542 } |
1599 | 1543 |
1600 void | 1544 void |
1601 x_set_cursor_color (f, arg, oldval) | 1545 x_set_cursor_color (f, arg, oldval) |
1602 struct frame *f; | 1546 struct frame *f; |
2325 (WindowPtr) -1, 1, (long) f->output_data.mac); | 2269 (WindowPtr) -1, 1, (long) f->output_data.mac); |
2326 #endif | 2270 #endif |
2327 /* so that update events can find this mac_output struct */ | 2271 /* so that update events can find this mac_output struct */ |
2328 f->output_data.mac->mFP = f; /* point back to emacs frame */ | 2272 f->output_data.mac->mFP = f; /* point back to emacs frame */ |
2329 | 2273 |
2274 #ifndef MAC_OSX | |
2275 if (FRAME_MAC_WINDOW (f)) | |
2276 { | |
2277 ControlRef root_control; | |
2278 | |
2279 if (CreateRootControl (FRAME_MAC_WINDOW (f), &root_control) != noErr) | |
2280 { | |
2281 DisposeWindow (FRAME_MAC_WINDOW (f)); | |
2282 FRAME_MAC_WINDOW (f) = NULL; | |
2283 } | |
2284 } | |
2285 #endif | |
2330 if (FRAME_MAC_WINDOW (f)) | 2286 if (FRAME_MAC_WINDOW (f)) |
2331 XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), | 2287 XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), |
2332 FRAME_BACKGROUND_PIXEL (f)); | 2288 FRAME_BACKGROUND_PIXEL (f)); |
2333 | 2289 |
2334 validate_x_resource_name (); | 2290 validate_x_resource_name (); |
2773 x_default_parameter (f, parms, Qfullscreen, Qnil, | 2729 x_default_parameter (f, parms, Qfullscreen, Qnil, |
2774 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); | 2730 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); |
2775 | 2731 |
2776 f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window; | 2732 f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window; |
2777 | 2733 |
2778 #if TARGET_API_MAC_CARBON | |
2779 f->output_data.mac->text_cursor = kThemeIBeamCursor; | |
2780 f->output_data.mac->nontext_cursor = kThemeArrowCursor; | |
2781 f->output_data.mac->modeline_cursor = kThemeArrowCursor; | |
2782 f->output_data.mac->hand_cursor = kThemePointingHandCursor; | |
2783 f->output_data.mac->hourglass_cursor = kThemeWatchCursor; | |
2784 f->output_data.mac->horizontal_drag_cursor = kThemeResizeLeftRightCursor; | |
2785 #else | |
2786 f->output_data.mac->text_cursor = GetCursor (iBeamCursor); | |
2787 f->output_data.mac->nontext_cursor = &arrow_cursor; | |
2788 f->output_data.mac->modeline_cursor = &arrow_cursor; | |
2789 f->output_data.mac->hand_cursor = &arrow_cursor; | |
2790 f->output_data.mac->hourglass_cursor = GetCursor (watchCursor); | |
2791 f->output_data.mac->horizontal_drag_cursor = &arrow_cursor; | |
2792 #endif | |
2793 | |
2794 /* Compute the size of the window. */ | 2734 /* Compute the size of the window. */ |
2795 window_prompting = x_figure_window_size (f, parms, 1); | 2735 window_prompting = x_figure_window_size (f, parms, 1); |
2796 | 2736 |
2797 tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); | 2737 tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); |
2798 f->no_split = minibuffer_only || EQ (tem, Qt); | 2738 f->no_split = minibuffer_only || EQ (tem, Qt); |
3473 } | 3413 } |
3474 | 3414 |
3475 | 3415 |
3476 | 3416 |
3477 /*********************************************************************** | 3417 /*********************************************************************** |
3478 Hourglass cursor | 3418 Busy cursor |
3479 ***********************************************************************/ | 3419 ***********************************************************************/ |
3480 | 3420 |
3481 /* If non-null, an asynchronous timer that, when it expires, displays | 3421 /* If non-null, an asynchronous timer that, when it expires, displays |
3482 an hourglass cursor on all frames. */ | 3422 an hourglass cursor on all frames. */ |
3483 | 3423 |
3499 /* Function prototypes. */ | 3439 /* Function prototypes. */ |
3500 | 3440 |
3501 static void show_hourglass P_ ((struct atimer *)); | 3441 static void show_hourglass P_ ((struct atimer *)); |
3502 static void hide_hourglass P_ ((void)); | 3442 static void hide_hourglass P_ ((void)); |
3503 | 3443 |
3444 /* Return non-zero if houglass timer has been started or hourglass is shown. */ | |
3445 | |
3446 int | |
3447 hourglass_started () | |
3448 { | |
3449 return hourglass_shown_p || hourglass_atimer != NULL; | |
3450 } | |
3451 | |
3504 | 3452 |
3505 /* Cancel a currently active hourglass timer, and start a new one. */ | 3453 /* Cancel a currently active hourglass timer, and start a new one. */ |
3506 | 3454 |
3507 void | 3455 void |
3508 start_hourglass () | 3456 start_hourglass () |
3509 { | 3457 { |
3510 #if 0 /* MAC_TODO: cursor shape changes. */ | 3458 #ifdef MAC_OSX |
3511 EMACS_TIME delay; | 3459 EMACS_TIME delay; |
3512 int secs, usecs = 0; | 3460 int secs, usecs = 0; |
3513 | 3461 |
3514 cancel_hourglass (); | 3462 cancel_hourglass (); |
3515 | 3463 |
3528 secs = DEFAULT_HOURGLASS_DELAY; | 3476 secs = DEFAULT_HOURGLASS_DELAY; |
3529 | 3477 |
3530 EMACS_SET_SECS_USECS (delay, secs, usecs); | 3478 EMACS_SET_SECS_USECS (delay, secs, usecs); |
3531 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, | 3479 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, |
3532 show_hourglass, NULL); | 3480 show_hourglass, NULL); |
3533 #endif /* MAC_TODO */ | 3481 #endif /* MAC_OSX */ |
3534 } | 3482 } |
3535 | 3483 |
3536 | 3484 |
3537 /* Cancel the hourglass cursor timer if active, hide an hourglass | 3485 /* Cancel the hourglass cursor timer if active, hide a busy cursor if |
3538 cursor if shown. */ | 3486 shown. */ |
3539 | 3487 |
3540 void | 3488 void |
3541 cancel_hourglass () | 3489 cancel_hourglass () |
3542 { | 3490 { |
3491 #ifdef MAC_OSX | |
3543 if (hourglass_atimer) | 3492 if (hourglass_atimer) |
3544 { | 3493 { |
3545 cancel_atimer (hourglass_atimer); | 3494 cancel_atimer (hourglass_atimer); |
3546 hourglass_atimer = NULL; | 3495 hourglass_atimer = NULL; |
3547 } | 3496 } |
3548 | 3497 |
3549 if (hourglass_shown_p) | 3498 if (hourglass_shown_p) |
3550 hide_hourglass (); | 3499 hide_hourglass (); |
3500 #endif /* MAC_OSX */ | |
3551 } | 3501 } |
3552 | 3502 |
3553 | 3503 |
3554 /* Timer function of hourglass_atimer. TIMER is equal to | 3504 /* Timer function of hourglass_atimer. TIMER is equal to |
3555 hourglass_atimer. | 3505 hourglass_atimer. |
3556 | 3506 |
3557 Display an hourglass cursor on all frames by mapping the frames' | 3507 On Mac, busy status is shown by the progress indicator (chasing |
3558 hourglass_window. Set the hourglass_p flag in the frames' | 3508 arrows) at the upper-right corner of each frame instead of the |
3559 output_data.x structure to indicate that an hourglass cursor is | 3509 hourglass pointer. */ |
3560 shown on the frames. */ | |
3561 | 3510 |
3562 static void | 3511 static void |
3563 show_hourglass (timer) | 3512 show_hourglass (timer) |
3564 struct atimer *timer; | 3513 struct atimer *timer; |
3565 { | 3514 { |
3566 #if 0 /* MAC_TODO: cursor shape changes. */ | 3515 #if TARGET_API_MAC_CARBON |
3567 /* The timer implementation will cancel this timer automatically | 3516 /* The timer implementation will cancel this timer automatically |
3568 after this function has run. Set hourglass_atimer to null | 3517 after this function has run. Set hourglass_atimer to null |
3569 so that we know the timer doesn't have to be canceled. */ | 3518 so that we know the timer doesn't have to be canceled. */ |
3570 hourglass_atimer = NULL; | 3519 hourglass_atimer = NULL; |
3571 | 3520 |
3574 Lisp_Object rest, frame; | 3523 Lisp_Object rest, frame; |
3575 | 3524 |
3576 BLOCK_INPUT; | 3525 BLOCK_INPUT; |
3577 | 3526 |
3578 FOR_EACH_FRAME (rest, frame) | 3527 FOR_EACH_FRAME (rest, frame) |
3579 if (FRAME_W32_P (XFRAME (frame))) | 3528 { |
3580 { | 3529 struct frame *f = XFRAME (frame); |
3581 struct frame *f = XFRAME (frame); | 3530 |
3582 | 3531 if (FRAME_LIVE_P (f) && FRAME_MAC_P (f) |
3583 f->output_data.w32->hourglass_p = 1; | 3532 && FRAME_MAC_WINDOW (f) != tip_window) |
3584 | 3533 { |
3585 if (!f->output_data.w32->hourglass_window) | 3534 if (!f->output_data.mac->hourglass_control) |
3586 { | 3535 { |
3587 unsigned long mask = CWCursor; | 3536 Window w = FRAME_MAC_WINDOW (f); |
3588 XSetWindowAttributes attrs; | 3537 Rect r; |
3589 | 3538 ControlRef c; |
3590 attrs.cursor = f->output_data.w32->hourglass_cursor; | 3539 |
3591 | 3540 GetWindowPortBounds (w, &r); |
3592 f->output_data.w32->hourglass_window | 3541 r.left = r.right - HOURGLASS_WIDTH; |
3593 = XCreateWindow (FRAME_X_DISPLAY (f), | 3542 r.bottom = r.top + HOURGLASS_HEIGHT; |
3594 FRAME_OUTER_WINDOW (f), | 3543 if (CreateChasingArrowsControl (w, &r, &c) == noErr) |
3595 0, 0, 32000, 32000, 0, 0, | 3544 f->output_data.mac->hourglass_control = c; |
3596 InputOnly, | 3545 } |
3597 CopyFromParent, | 3546 |
3598 mask, &attrs); | 3547 if (f->output_data.mac->hourglass_control) |
3599 } | 3548 ShowControl (f->output_data.mac->hourglass_control); |
3600 | 3549 } |
3601 XMapRaised (FRAME_X_DISPLAY (f), | 3550 } |
3602 f->output_data.w32->hourglass_window); | |
3603 XFlush (FRAME_X_DISPLAY (f)); | |
3604 } | |
3605 | 3551 |
3606 hourglass_shown_p = 1; | 3552 hourglass_shown_p = 1; |
3607 UNBLOCK_INPUT; | 3553 UNBLOCK_INPUT; |
3608 } | 3554 } |
3609 #endif /* MAC_TODO */ | 3555 #endif /* TARGET_API_MAC_CARBON */ |
3610 } | 3556 } |
3611 | 3557 |
3612 | 3558 |
3613 /* Hide the hourglass cursor on all frames, if it is currently shown. */ | 3559 /* Hide the progress indicators on all frames, if it is currently |
3560 shown. */ | |
3614 | 3561 |
3615 static void | 3562 static void |
3616 hide_hourglass () | 3563 hide_hourglass () |
3617 { | 3564 { |
3618 #if 0 /* MAC_TODO: cursor shape changes. */ | 3565 #if TARGET_API_MAC_CARBON |
3619 if (hourglass_shown_p) | 3566 if (hourglass_shown_p) |
3620 { | 3567 { |
3621 Lisp_Object rest, frame; | 3568 Lisp_Object rest, frame; |
3622 | 3569 |
3623 BLOCK_INPUT; | 3570 BLOCK_INPUT; |
3624 FOR_EACH_FRAME (rest, frame) | 3571 FOR_EACH_FRAME (rest, frame) |
3625 { | 3572 { |
3626 struct frame *f = XFRAME (frame); | 3573 struct frame *f = XFRAME (frame); |
3627 | 3574 |
3628 if (FRAME_W32_P (f) | 3575 if (FRAME_MAC_P (f) |
3629 /* Watch out for newly created frames. */ | 3576 /* Watch out for newly created frames. */ |
3630 && f->output_data.x->hourglass_window) | 3577 && f->output_data.mac->hourglass_control) |
3631 { | 3578 HideControl (f->output_data.mac->hourglass_control); |
3632 XUnmapWindow (FRAME_X_DISPLAY (f), | |
3633 f->output_data.x->hourglass_window); | |
3634 /* Sync here because XTread_socket looks at the | |
3635 hourglass_p flag that is reset to zero below. */ | |
3636 XSync (FRAME_X_DISPLAY (f), False); | |
3637 f->output_data.x->hourglass_p = 0; | |
3638 } | |
3639 } | 3579 } |
3640 | 3580 |
3641 hourglass_shown_p = 0; | 3581 hourglass_shown_p = 0; |
3642 UNBLOCK_INPUT; | 3582 UNBLOCK_INPUT; |
3643 } | 3583 } |
3644 #endif /* MAC_TODO */ | 3584 #endif /* TARGET_API_MAC_CARBON */ |
3645 } | 3585 } |
3646 | 3586 |
3647 | 3587 |
3648 | 3588 |
3649 /*********************************************************************** | 3589 /*********************************************************************** |
4485 | 4425 |
4486 /*********************************************************************** | 4426 /*********************************************************************** |
4487 Initialization | 4427 Initialization |
4488 ***********************************************************************/ | 4428 ***********************************************************************/ |
4489 | 4429 |
4490 /* Keep this list in the same order as frame_parms in frame.c. | 4430 /* Keep this list in the same order as frame_parms in frame.c. |
4491 Use 0 for unsupported frame parameters. */ | 4431 Use 0 for unsupported frame parameters. */ |
4492 | 4432 |
4493 frame_parm_handler mac_frame_parm_handlers[] = | 4433 frame_parm_handler mac_frame_parm_handlers[] = |
4494 { | 4434 { |
4495 x_set_autoraise, | 4435 x_set_autoraise, |
4543 staticpro (&Qsuppress_icon); | 4483 staticpro (&Qsuppress_icon); |
4544 Qundefined_color = intern ("undefined-color"); | 4484 Qundefined_color = intern ("undefined-color"); |
4545 staticpro (&Qundefined_color); | 4485 staticpro (&Qundefined_color); |
4546 Qcancel_timer = intern ("cancel-timer"); | 4486 Qcancel_timer = intern ("cancel-timer"); |
4547 staticpro (&Qcancel_timer); | 4487 staticpro (&Qcancel_timer); |
4548 | |
4549 Qhyper = intern ("hyper"); | |
4550 staticpro (&Qhyper); | |
4551 Qsuper = intern ("super"); | |
4552 staticpro (&Qsuper); | |
4553 Qmeta = intern ("meta"); | |
4554 staticpro (&Qmeta); | |
4555 Qalt = intern ("alt"); | |
4556 staticpro (&Qalt); | |
4557 Qctrl = intern ("ctrl"); | |
4558 staticpro (&Qctrl); | |
4559 Qcontrol = intern ("control"); | |
4560 staticpro (&Qcontrol); | |
4561 Qshift = intern ("shift"); | |
4562 staticpro (&Qshift); | |
4563 /* This is the end of symbol initialization. */ | 4488 /* This is the end of symbol initialization. */ |
4564 | 4489 |
4565 /* Text property `display' should be nonsticky by default. */ | 4490 /* Text property `display' should be nonsticky by default. */ |
4566 Vtext_property_default_nonsticky | 4491 Vtext_property_default_nonsticky |
4567 = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky); | 4492 = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky); |
4568 | 4493 |
4569 Qface_set_after_frame_default = intern ("face-set-after-frame-default"); | |
4570 staticpro (&Qface_set_after_frame_default); | |
4571 | 4494 |
4572 Fput (Qundefined_color, Qerror_conditions, | 4495 Fput (Qundefined_color, Qerror_conditions, |
4573 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | 4496 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); |
4574 Fput (Qundefined_color, Qerror_message, | 4497 Fput (Qundefined_color, Qerror_message, |
4575 build_string ("Undefined color")); | 4498 build_string ("Undefined color")); |
4576 | 4499 |
4577 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape, | 4500 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape, |
4578 doc: /* The shape of the pointer when over text. | 4501 doc: /* The shape of the pointer when over text. |
4579 Changing the value does not affect existing frames | 4502 Changing the value does not affect existing frames |
4580 unless you set the mouse color. */); | 4503 unless you set the mouse color. */); |
4581 Vx_pointer_shape = Qnil; | 4504 Vx_pointer_shape = Qnil; |
4582 | 4505 |
4506 #if 0 /* This doesn't really do anything. */ | |
4507 DEFVAR_LISP ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape, | |
4508 doc: /* The shape of the pointer when not over text. | |
4509 This variable takes effect when you create a new frame | |
4510 or when you set the mouse color. */); | |
4511 #endif | |
4583 Vx_nontext_pointer_shape = Qnil; | 4512 Vx_nontext_pointer_shape = Qnil; |
4584 | 4513 |
4585 Vx_mode_pointer_shape = Qnil; | |
4586 | |
4587 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape, | 4514 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape, |
4588 doc: /* The shape of the pointer when Emacs is hourglass. | 4515 doc: /* The shape of the pointer when Emacs is busy. |
4589 This variable takes effect when you create a new frame | 4516 This variable takes effect when you create a new frame |
4590 or when you set the mouse color. */); | 4517 or when you set the mouse color. */); |
4591 Vx_hourglass_pointer_shape = Qnil; | 4518 Vx_hourglass_pointer_shape = Qnil; |
4592 | 4519 |
4593 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, | 4520 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, |
4594 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); | 4521 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); |
4595 display_hourglass_p = 1; | 4522 display_hourglass_p = 1; |
4596 | 4523 |
4597 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, | 4524 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, |
4598 doc: /* *Seconds to wait before displaying an hourglass pointer. | 4525 doc: /* *Seconds to wait before displaying an hourglass pointer. |
4599 Value must be an integer or float. */); | 4526 Value must be an integer or float. */); |
4600 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); | 4527 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); |
4601 | 4528 |
4529 #if 0 /* This doesn't really do anything. */ | |
4530 DEFVAR_LISP ("x-mode-pointer-shape", &Vx_mode_pointer_shape, | |
4531 doc: /* The shape of the pointer when over the mode line. | |
4532 This variable takes effect when you create a new frame | |
4533 or when you set the mouse color. */); | |
4534 #endif | |
4535 Vx_mode_pointer_shape = Qnil; | |
4536 | |
4602 DEFVAR_LISP ("x-sensitive-text-pointer-shape", | 4537 DEFVAR_LISP ("x-sensitive-text-pointer-shape", |
4603 &Vx_sensitive_text_pointer_shape, | 4538 &Vx_sensitive_text_pointer_shape, |
4604 doc: /* The shape of the pointer when over mouse-sensitive text. | 4539 doc: /* The shape of the pointer when over mouse-sensitive text. |
4605 This variable takes effect when you create a new frame | 4540 This variable takes effect when you create a new frame |
4606 or when you set the mouse color. */); | 4541 or when you set the mouse color. */); |
4607 Vx_sensitive_text_pointer_shape = Qnil; | 4542 Vx_sensitive_text_pointer_shape = Qnil; |
4608 | 4543 |
4544 DEFVAR_LISP ("x-window-horizontal-drag-cursor", | |
4545 &Vx_window_horizontal_drag_shape, | |
4546 doc: /* Pointer shape to use for indicating a window can be dragged horizontally. | |
4547 This variable takes effect when you create a new frame | |
4548 or when you set the mouse color. */); | |
4549 Vx_window_horizontal_drag_shape = Qnil; | |
4550 | |
4609 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, | 4551 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, |
4610 doc: /* A string indicating the foreground color of the cursor box. */); | 4552 doc: /* A string indicating the foreground color of the cursor box. */); |
4611 Vx_cursor_fore_pixel = Qnil; | 4553 Vx_cursor_fore_pixel = Qnil; |
4612 | 4554 |
4613 DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size, | 4555 DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size, |
4614 doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS). | 4556 doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS). |
4615 Text larger than this is clipped. */); | 4557 Text larger than this is clipped. */); |
4616 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); | 4558 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); |
4617 | 4559 |
4618 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, | 4560 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, |
4619 doc: /* Non-nil if no window manager is in use. | 4561 doc: /* Non-nil if no window manager is in use. |
4620 Emacs doesn't try to figure this out; this is always nil | 4562 Emacs doesn't try to figure this out; this is always nil |
4621 unless you set it to something else. */); | 4563 unless you set it to something else. */); |
4622 /* We don't have any way to find this out, so set it to nil | 4564 /* We don't have any way to find this out, so set it to nil |
4623 and maybe the user would like to set it to t. */ | 4565 and maybe the user would like to set it to t. */ |
4624 Vx_no_window_manager = Qnil; | 4566 Vx_no_window_manager = Qnil; |
4625 | 4567 |
4626 DEFVAR_LISP ("x-pixel-size-width-font-regexp", | 4568 DEFVAR_LISP ("x-pixel-size-width-font-regexp", |
4627 &Vx_pixel_size_width_font_regexp, | 4569 &Vx_pixel_size_width_font_regexp, |
4628 doc: /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. | 4570 doc: /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. |
4629 | 4571 |
4630 Since Emacs gets width of a font matching with this regexp from | 4572 Since Emacs gets width of a font matching with this regexp from |
4631 PIXEL_SIZE field of the name, font finding mechanism gets faster for | 4573 PIXEL_SIZE field of the name, font finding mechanism gets faster for |
4632 such a font. This is especially effective for such large fonts as | 4574 such a font. This is especially effective for such large fonts as |
4633 Chinese, Japanese, and Korean. */); | 4575 Chinese, Japanese, and Korean. */); |