diff options
| author | Karoly Lorentey | 2007-04-22 12:42:47 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2007-04-22 12:42:47 +0000 |
| commit | 9d0799072a0d09bc14a99eaf372b262d1ba61399 (patch) | |
| tree | 76acd4ae0559776a5ec27fbd5c25598285ec71d1 /src/macterm.c | |
| parent | e18c709364b095ea0be8ecabe458ac9a642a252f (diff) | |
| parent | a20becf321f023c6dc1831595712576d64e2ef4b (diff) | |
| download | emacs-9d0799072a0d09bc14a99eaf372b262d1ba61399.tar.gz emacs-9d0799072a0d09bc14a99eaf372b262d1ba61399.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-674
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-675
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-676
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-677
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-678
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-679
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-680
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-681
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-682
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-683
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-684
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-685
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-686
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-687
Release ERC 5.2.
* emacs@sv.gnu.org/emacs--devo--0--patch-688
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-689
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-690
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-691
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-692
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-693
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-694
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-695
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-696
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-697
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-698
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-699
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-700
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-701
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-209
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-210
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-211
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-212
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-213
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-214
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-215
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-601
Diffstat (limited to 'src/macterm.c')
| -rw-r--r-- | src/macterm.c | 197 |
1 files changed, 134 insertions, 63 deletions
diff --git a/src/macterm.c b/src/macterm.c index f26c06680bc..316e61cc537 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -52,6 +52,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 52 | #include <LowMem.h> | 52 | #include <LowMem.h> |
| 53 | #include <Controls.h> | 53 | #include <Controls.h> |
| 54 | #include <Windows.h> | 54 | #include <Windows.h> |
| 55 | #include <Displays.h> | ||
| 55 | #if defined (__MRC__) || (__MSL__ >= 0x6000) | 56 | #if defined (__MRC__) || (__MSL__ >= 0x6000) |
| 56 | #include <ControlDefinitions.h> | 57 | #include <ControlDefinitions.h> |
| 57 | #endif | 58 | #endif |
| @@ -7172,11 +7173,14 @@ create_text_encoding_info_alist () | |||
| 7172 | Lisp_Object existing_info; | 7173 | Lisp_Object existing_info; |
| 7173 | 7174 | ||
| 7174 | if (!(CONSP (charset_info) | 7175 | if (!(CONSP (charset_info) |
| 7175 | && STRINGP (charset = XCAR (charset_info)) | 7176 | && (charset = XCAR (charset_info), |
| 7177 | STRINGP (charset)) | ||
| 7176 | && CONSP (XCDR (charset_info)) | 7178 | && CONSP (XCDR (charset_info)) |
| 7177 | && INTEGERP (text_encoding = XCAR (XCDR (charset_info))) | 7179 | && (text_encoding = XCAR (XCDR (charset_info)), |
| 7180 | INTEGERP (text_encoding)) | ||
| 7178 | && CONSP (XCDR (XCDR (charset_info))) | 7181 | && CONSP (XCDR (XCDR (charset_info))) |
| 7179 | && SYMBOLP (coding_system = XCAR (XCDR (XCDR (charset_info)))))) | 7182 | && (coding_system = XCAR (XCDR (XCDR (charset_info))), |
| 7183 | SYMBOLP (coding_system)))) | ||
| 7180 | continue; | 7184 | continue; |
| 7181 | 7185 | ||
| 7182 | existing_info = assq_no_quit (text_encoding, result); | 7186 | existing_info = assq_no_quit (text_encoding, result); |
| @@ -8866,6 +8870,9 @@ int mac_pass_control_to_system; | |||
| 8866 | Carbon/Apple event handlers. */ | 8870 | Carbon/Apple event handlers. */ |
| 8867 | static struct input_event *read_socket_inev = NULL; | 8871 | static struct input_event *read_socket_inev = NULL; |
| 8868 | 8872 | ||
| 8873 | /* Whether or not the screen configuration has changed. */ | ||
| 8874 | static int mac_screen_config_changed = 0; | ||
| 8875 | |||
| 8869 | Point saved_menu_event_location; | 8876 | Point saved_menu_event_location; |
| 8870 | 8877 | ||
| 8871 | /* Apple Events */ | 8878 | /* Apple Events */ |
| @@ -10396,6 +10403,87 @@ remove_window_handler (window) | |||
| 10396 | } | 10403 | } |
| 10397 | 10404 | ||
| 10398 | 10405 | ||
| 10406 | static pascal void | ||
| 10407 | mac_handle_dm_notification (event) | ||
| 10408 | AppleEvent *event; | ||
| 10409 | { | ||
| 10410 | mac_screen_config_changed = 1; | ||
| 10411 | } | ||
| 10412 | |||
| 10413 | static OSErr | ||
| 10414 | init_dm_notification_handler () | ||
| 10415 | { | ||
| 10416 | OSErr err; | ||
| 10417 | static DMNotificationUPP handle_dm_notificationUPP = NULL; | ||
| 10418 | ProcessSerialNumber psn; | ||
| 10419 | |||
| 10420 | if (handle_dm_notificationUPP == NULL) | ||
| 10421 | handle_dm_notificationUPP = | ||
| 10422 | NewDMNotificationUPP (mac_handle_dm_notification); | ||
| 10423 | |||
| 10424 | err = GetCurrentProcess (&psn); | ||
| 10425 | if (err == noErr) | ||
| 10426 | err = DMRegisterNotifyProc (handle_dm_notificationUPP, &psn); | ||
| 10427 | |||
| 10428 | return err; | ||
| 10429 | } | ||
| 10430 | |||
| 10431 | static void | ||
| 10432 | mac_get_screen_info (dpyinfo) | ||
| 10433 | struct mac_display_info *dpyinfo; | ||
| 10434 | { | ||
| 10435 | #ifdef MAC_OSX | ||
| 10436 | /* HasDepth returns true if it is possible to have a 32 bit display, | ||
| 10437 | but this may not be what is actually used. Mac OSX can do better. */ | ||
| 10438 | dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1; | ||
| 10439 | dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay); | ||
| 10440 | { | ||
| 10441 | CGDisplayErr err; | ||
| 10442 | CGDisplayCount ndisps; | ||
| 10443 | CGDirectDisplayID *displays; | ||
| 10444 | |||
| 10445 | err = CGGetActiveDisplayList (0, NULL, &ndisps); | ||
| 10446 | if (err == noErr) | ||
| 10447 | { | ||
| 10448 | displays = alloca (sizeof (CGDirectDisplayID) * ndisps); | ||
| 10449 | err = CGGetActiveDisplayList (ndisps, displays, &ndisps); | ||
| 10450 | } | ||
| 10451 | if (err == noErr) | ||
| 10452 | { | ||
| 10453 | CGRect bounds = CGRectZero; | ||
| 10454 | |||
| 10455 | while (ndisps-- > 0) | ||
| 10456 | bounds = CGRectUnion (bounds, CGDisplayBounds (displays[ndisps])); | ||
| 10457 | dpyinfo->height = CGRectGetHeight (bounds); | ||
| 10458 | dpyinfo->width = CGRectGetWidth (bounds); | ||
| 10459 | } | ||
| 10460 | else | ||
| 10461 | { | ||
| 10462 | dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay); | ||
| 10463 | dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay); | ||
| 10464 | } | ||
| 10465 | } | ||
| 10466 | #else /* !MAC_OSX */ | ||
| 10467 | { | ||
| 10468 | GDHandle gdh = GetMainDevice (); | ||
| 10469 | Rect rect = (**gdh).gdRect; | ||
| 10470 | |||
| 10471 | dpyinfo->color_p = TestDeviceAttribute (gdh, gdDevType); | ||
| 10472 | for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1) | ||
| 10473 | if (HasDepth (gdh, dpyinfo->n_planes, gdDevType, dpyinfo->color_p)) | ||
| 10474 | break; | ||
| 10475 | |||
| 10476 | for (gdh = DMGetFirstScreenDevice (dmOnlyActiveDisplays); gdh; | ||
| 10477 | gdh = DMGetNextScreenDevice (gdh, dmOnlyActiveDisplays)) | ||
| 10478 | UnionRect (&rect, &(**gdh).gdRect, &rect); | ||
| 10479 | |||
| 10480 | dpyinfo->height = rect.bottom - rect.top; | ||
| 10481 | dpyinfo->width = rect.right - rect.left; | ||
| 10482 | } | ||
| 10483 | #endif /* !MAC_OSX */ | ||
| 10484 | } | ||
| 10485 | |||
| 10486 | |||
| 10399 | #if __profile__ | 10487 | #if __profile__ |
| 10400 | void | 10488 | void |
| 10401 | profiler_exit_proc () | 10489 | profiler_exit_proc () |
| @@ -10453,6 +10541,8 @@ main (void) | |||
| 10453 | 10541 | ||
| 10454 | init_apple_event_handler (); | 10542 | init_apple_event_handler (); |
| 10455 | 10543 | ||
| 10544 | init_dm_notification_handler (); | ||
| 10545 | |||
| 10456 | { | 10546 | { |
| 10457 | char **argv; | 10547 | char **argv; |
| 10458 | int argc = 0; | 10548 | int argc = 0; |
| @@ -10530,8 +10620,7 @@ mac_post_mouse_moved_event () | |||
| 10530 | { | 10620 | { |
| 10531 | Point mouse_pos; | 10621 | Point mouse_pos; |
| 10532 | 10622 | ||
| 10533 | GetMouse (&mouse_pos); | 10623 | GetGlobalMouse (&mouse_pos); |
| 10534 | LocalToGlobal (&mouse_pos); | ||
| 10535 | err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint, | 10624 | err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint, |
| 10536 | sizeof (Point), &mouse_pos); | 10625 | sizeof (Point), &mouse_pos); |
| 10537 | } | 10626 | } |
| @@ -11375,6 +11464,12 @@ XTread_socket (sd, expected, hold_quit) | |||
| 11375 | pending_autoraise_frame = 0; | 11464 | pending_autoraise_frame = 0; |
| 11376 | } | 11465 | } |
| 11377 | 11466 | ||
| 11467 | if (mac_screen_config_changed) | ||
| 11468 | { | ||
| 11469 | mac_get_screen_info (dpyinfo); | ||
| 11470 | mac_screen_config_changed = 0; | ||
| 11471 | } | ||
| 11472 | |||
| 11378 | #if !USE_CARBON_EVENTS | 11473 | #if !USE_CARBON_EVENTS |
| 11379 | /* Check which frames are still visible. We do this here because | 11474 | /* Check which frames are still visible. We do this here because |
| 11380 | there doesn't seem to be any direct notification from the Window | 11475 | there doesn't seem to be any direct notification from the Window |
| @@ -11509,62 +11604,7 @@ make_mac_terminal_frame (struct frame *f) | |||
| 11509 | Initialization | 11604 | Initialization |
| 11510 | ***********************************************************************/ | 11605 | ***********************************************************************/ |
| 11511 | 11606 | ||
| 11512 | int mac_initialized = 0; | 11607 | static int mac_initialized = 0; |
| 11513 | |||
| 11514 | void | ||
| 11515 | mac_initialize_display_info () | ||
| 11516 | { | ||
| 11517 | struct mac_display_info *dpyinfo = &one_mac_display_info; | ||
| 11518 | |||
| 11519 | bzero (dpyinfo, sizeof (*dpyinfo)); | ||
| 11520 | |||
| 11521 | #ifdef MAC_OSX | ||
| 11522 | dpyinfo->mac_id_name | ||
| 11523 | = (char *) xmalloc (SCHARS (Vinvocation_name) | ||
| 11524 | + SCHARS (Vsystem_name) | ||
| 11525 | + 2); | ||
| 11526 | sprintf (dpyinfo->mac_id_name, "%s@%s", | ||
| 11527 | SDATA (Vinvocation_name), SDATA (Vsystem_name)); | ||
| 11528 | #else | ||
| 11529 | dpyinfo->mac_id_name = (char *) xmalloc (strlen ("Mac Display") + 1); | ||
| 11530 | strcpy (dpyinfo->mac_id_name, "Mac Display"); | ||
| 11531 | #endif | ||
| 11532 | |||
| 11533 | dpyinfo->reference_count = 0; | ||
| 11534 | dpyinfo->resx = 72.0; | ||
| 11535 | dpyinfo->resy = 72.0; | ||
| 11536 | #ifdef MAC_OSX | ||
| 11537 | /* HasDepth returns true if it is possible to have a 32 bit display, | ||
| 11538 | but this may not be what is actually used. Mac OSX can do better. */ | ||
| 11539 | dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1; | ||
| 11540 | dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay); | ||
| 11541 | dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay); | ||
| 11542 | dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay); | ||
| 11543 | #else | ||
| 11544 | { | ||
| 11545 | GDHandle main_device_handle = LMGetMainDevice(); | ||
| 11546 | |||
| 11547 | dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType); | ||
| 11548 | for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1) | ||
| 11549 | if (HasDepth (main_device_handle, dpyinfo->n_planes, | ||
| 11550 | gdDevType, dpyinfo->color_p)) | ||
| 11551 | break; | ||
| 11552 | dpyinfo->height = (**main_device_handle).gdRect.bottom; | ||
| 11553 | dpyinfo->width = (**main_device_handle).gdRect.right; | ||
| 11554 | } | ||
| 11555 | #endif | ||
| 11556 | dpyinfo->grabbed = 0; | ||
| 11557 | dpyinfo->root_window = NULL; | ||
| 11558 | dpyinfo->image_cache = make_image_cache (); | ||
| 11559 | |||
| 11560 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | ||
| 11561 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | ||
| 11562 | dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; | ||
| 11563 | dpyinfo->mouse_face_window = Qnil; | ||
| 11564 | dpyinfo->mouse_face_overlay = Qnil; | ||
| 11565 | dpyinfo->mouse_face_hidden = 0; | ||
| 11566 | } | ||
| 11567 | |||
| 11568 | 11608 | ||
| 11569 | static XrmDatabase | 11609 | static XrmDatabase |
| 11570 | mac_make_rdb (xrm_option) | 11610 | mac_make_rdb (xrm_option) |
| @@ -11598,9 +11638,37 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 11598 | if (x_display_list) | 11638 | if (x_display_list) |
| 11599 | error ("Sorry, this version can only handle one display"); | 11639 | error ("Sorry, this version can only handle one display"); |
| 11600 | 11640 | ||
| 11601 | mac_initialize_display_info (); | ||
| 11602 | |||
| 11603 | dpyinfo = &one_mac_display_info; | 11641 | dpyinfo = &one_mac_display_info; |
| 11642 | bzero (dpyinfo, sizeof (*dpyinfo)); | ||
| 11643 | |||
| 11644 | #ifdef MAC_OSX | ||
| 11645 | dpyinfo->mac_id_name | ||
| 11646 | = (char *) xmalloc (SCHARS (Vinvocation_name) | ||
| 11647 | + SCHARS (Vsystem_name) | ||
| 11648 | + 2); | ||
| 11649 | sprintf (dpyinfo->mac_id_name, "%s@%s", | ||
| 11650 | SDATA (Vinvocation_name), SDATA (Vsystem_name)); | ||
| 11651 | #else | ||
| 11652 | dpyinfo->mac_id_name = (char *) xmalloc (strlen ("Mac Display") + 1); | ||
| 11653 | strcpy (dpyinfo->mac_id_name, "Mac Display"); | ||
| 11654 | #endif | ||
| 11655 | |||
| 11656 | dpyinfo->reference_count = 0; | ||
| 11657 | dpyinfo->resx = 72.0; | ||
| 11658 | dpyinfo->resy = 72.0; | ||
| 11659 | |||
| 11660 | mac_get_screen_info (dpyinfo); | ||
| 11661 | |||
| 11662 | dpyinfo->grabbed = 0; | ||
| 11663 | dpyinfo->root_window = NULL; | ||
| 11664 | dpyinfo->image_cache = make_image_cache (); | ||
| 11665 | |||
| 11666 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | ||
| 11667 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | ||
| 11668 | dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; | ||
| 11669 | dpyinfo->mouse_face_window = Qnil; | ||
| 11670 | dpyinfo->mouse_face_overlay = Qnil; | ||
| 11671 | dpyinfo->mouse_face_hidden = 0; | ||
| 11604 | 11672 | ||
| 11605 | dpyinfo->xrdb = mac_make_rdb (xrm_option); | 11673 | dpyinfo->xrdb = mac_make_rdb (xrm_option); |
| 11606 | 11674 | ||
| @@ -11618,6 +11686,7 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 11618 | 11686 | ||
| 11619 | return dpyinfo; | 11687 | return dpyinfo; |
| 11620 | } | 11688 | } |
| 11689 | |||
| 11621 | /* Get rid of display DPYINFO, assuming all frames are already gone. */ | 11690 | /* Get rid of display DPYINFO, assuming all frames are already gone. */ |
| 11622 | 11691 | ||
| 11623 | void | 11692 | void |
| @@ -11838,6 +11907,8 @@ mac_initialize () | |||
| 11838 | 11907 | ||
| 11839 | init_apple_event_handler (); | 11908 | init_apple_event_handler (); |
| 11840 | 11909 | ||
| 11910 | init_dm_notification_handler (); | ||
| 11911 | |||
| 11841 | if (!inhibit_window_system) | 11912 | if (!inhibit_window_system) |
| 11842 | { | 11913 | { |
| 11843 | static const ProcessSerialNumber psn = {0, kCurrentProcess}; | 11914 | static const ProcessSerialNumber psn = {0, kCurrentProcess}; |