796 |
&src_r, &dest_r, srcCopy, 0); |
&src_r, &dest_r, srcCopy, 0); |
797 |
#endif /* not TARGET_API_MAC_CARBON */ |
#endif /* not TARGET_API_MAC_CARBON */ |
798 |
UnlockPixels (GetGWorldPixMap (src)); |
UnlockPixels (GetGWorldPixMap (src)); |
799 |
|
|
800 |
|
RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); |
801 |
} |
} |
802 |
|
|
803 |
|
|
836 |
#endif /* not TARGET_API_MAC_CARBON */ |
#endif /* not TARGET_API_MAC_CARBON */ |
837 |
UnlockPixels (GetGWorldPixMap (mask)); |
UnlockPixels (GetGWorldPixMap (mask)); |
838 |
UnlockPixels (GetGWorldPixMap (src)); |
UnlockPixels (GetGWorldPixMap (src)); |
839 |
|
|
840 |
|
RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); |
841 |
} |
} |
842 |
|
|
843 |
|
|
5650 |
|
|
5651 |
/* Change of visibility. */ |
/* Change of visibility. */ |
5652 |
|
|
5653 |
|
static void |
5654 |
|
mac_handle_visibility_change (f) |
5655 |
|
struct frame *f; |
5656 |
|
{ |
5657 |
|
WindowPtr wp = FRAME_MAC_WINDOW (f); |
5658 |
|
int visible = 0, iconified = 0; |
5659 |
|
struct input_event buf; |
5660 |
|
|
5661 |
|
if (IsWindowVisible (wp)) |
5662 |
|
if (IsWindowCollapsed (wp)) |
5663 |
|
iconified = 1; |
5664 |
|
else |
5665 |
|
visible = 1; |
5666 |
|
|
5667 |
|
if (!f->async_visible && visible) |
5668 |
|
{ |
5669 |
|
if (f->iconified) |
5670 |
|
{ |
5671 |
|
/* wait_reading_process_output will notice this and update |
5672 |
|
the frame's display structures. If we were made |
5673 |
|
invisible, we should not set garbaged, because that stops |
5674 |
|
redrawing on Update events. */ |
5675 |
|
SET_FRAME_GARBAGED (f); |
5676 |
|
|
5677 |
|
EVENT_INIT (buf); |
5678 |
|
buf.kind = DEICONIFY_EVENT; |
5679 |
|
XSETFRAME (buf.frame_or_window, f); |
5680 |
|
kbd_buffer_store_event (&buf); |
5681 |
|
} |
5682 |
|
else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list))) |
5683 |
|
/* Force a redisplay sooner or later to update the |
5684 |
|
frame titles in case this is the second frame. */ |
5685 |
|
record_asynch_buffer_change (); |
5686 |
|
} |
5687 |
|
else if (f->async_visible && !visible) |
5688 |
|
if (iconified) |
5689 |
|
{ |
5690 |
|
EVENT_INIT (buf); |
5691 |
|
buf.kind = ICONIFY_EVENT; |
5692 |
|
XSETFRAME (buf.frame_or_window, f); |
5693 |
|
kbd_buffer_store_event (&buf); |
5694 |
|
} |
5695 |
|
|
5696 |
|
f->async_visible = visible; |
5697 |
|
f->async_iconified = iconified; |
5698 |
|
} |
5699 |
|
|
5700 |
/* This tries to wait until the frame is really visible. |
/* This tries to wait until the frame is really visible. |
5701 |
However, if the window manager asks the user where to position |
However, if the window manager asks the user where to position |
5702 |
the frame, this will return before the user finishes doing that. |
the frame, this will return before the user finishes doing that. |
5721 |
before the window gets really visible. */ |
before the window gets really visible. */ |
5722 |
if (! FRAME_ICONIFIED_P (f) |
if (! FRAME_ICONIFIED_P (f) |
5723 |
&& ! f->output_data.mac->asked_for_visible) |
&& ! f->output_data.mac->asked_for_visible) |
|
x_set_offset (f, f->left_pos, f->top_pos, 0); |
|
|
|
|
|
f->output_data.mac->asked_for_visible = 1; |
|
|
|
|
5724 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
5725 |
if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition))) |
if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition))) |
5726 |
{ |
{ |
5727 |
struct frame *sf = SELECTED_FRAME (); |
struct frame *sf = SELECTED_FRAME (); |
5728 |
if (!FRAME_MAC_P (sf)) |
if (!FRAME_MAC_P (sf)) |
5729 |
RepositionWindow (FRAME_MAC_WINDOW (f), NULL, |
RepositionWindow (FRAME_MAC_WINDOW (f), NULL, |
5730 |
kWindowCenterOnMainScreen); |
kWindowCenterOnMainScreen); |
5731 |
else |
else |
5732 |
RepositionWindow (FRAME_MAC_WINDOW (f), |
RepositionWindow (FRAME_MAC_WINDOW (f), |
5733 |
FRAME_MAC_WINDOW (sf), |
FRAME_MAC_WINDOW (sf), |
5734 |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
5735 |
kWindowCascadeStartAtParentWindowScreen |
kWindowCascadeStartAtParentWindowScreen |
5736 |
#else |
#else |
5737 |
kWindowCascadeOnParentWindowScreen |
kWindowCascadeOnParentWindowScreen |
5738 |
#endif |
#endif |
5739 |
); |
); |
5740 |
x_real_positions (f, &f->left_pos, &f->top_pos); |
x_real_positions (f, &f->left_pos, &f->top_pos); |
5741 |
} |
} |
5742 |
|
else |
5743 |
#endif |
#endif |
5744 |
|
x_set_offset (f, f->left_pos, f->top_pos, 0); |
5745 |
|
|
5746 |
|
f->output_data.mac->asked_for_visible = 1; |
5747 |
|
|
5748 |
|
SelectWindow (FRAME_MAC_WINDOW (f)); |
5749 |
|
CollapseWindow (FRAME_MAC_WINDOW (f), false); |
5750 |
ShowWindow (FRAME_MAC_WINDOW (f)); |
ShowWindow (FRAME_MAC_WINDOW (f)); |
5751 |
} |
} |
5752 |
|
|
5805 |
x_make_frame_invisible (f) |
x_make_frame_invisible (f) |
5806 |
struct frame *f; |
struct frame *f; |
5807 |
{ |
{ |
5808 |
|
/* A deactivate event does not occur when the last visible frame is |
5809 |
|
made invisible. So if we clear the highlight here, it will not |
5810 |
|
be rehighlighted when it is made visible. */ |
5811 |
|
#if 0 |
5812 |
/* Don't keep the highlight on an invisible frame. */ |
/* Don't keep the highlight on an invisible frame. */ |
5813 |
if (FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame == f) |
if (FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame == f) |
5814 |
FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame = 0; |
FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame = 0; |
5815 |
|
#endif |
5816 |
|
|
5817 |
BLOCK_INPUT; |
BLOCK_INPUT; |
5818 |
|
|
5825 |
|
|
5826 |
HideWindow (FRAME_MAC_WINDOW (f)); |
HideWindow (FRAME_MAC_WINDOW (f)); |
5827 |
|
|
|
/* We can't distinguish this from iconification |
|
|
just by the event that we get from the server. |
|
|
So we can't win using the usual strategy of letting |
|
|
FRAME_SAMPLE_VISIBILITY set this. So do it by hand, |
|
|
and synchronize with the server to make sure we agree. */ |
|
|
f->visible = 0; |
|
|
FRAME_ICONIFIED_P (f) = 0; |
|
|
f->async_visible = 0; |
|
|
f->async_iconified = 0; |
|
|
|
|
5828 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
5829 |
|
|
5830 |
|
#if !USE_CARBON_EVENTS |
5831 |
|
mac_handle_visibility_change (f); |
5832 |
|
#endif |
5833 |
} |
} |
5834 |
|
|
5835 |
/* Change window state from mapped to iconified. */ |
/* Change window state from mapped to iconified. */ |
5838 |
x_iconify_frame (f) |
x_iconify_frame (f) |
5839 |
struct frame *f; |
struct frame *f; |
5840 |
{ |
{ |
5841 |
|
OSErr err; |
5842 |
|
|
5843 |
|
/* A deactivate event does not occur when the last visible frame is |
5844 |
|
iconified. So if we clear the highlight here, it will not be |
5845 |
|
rehighlighted when it is deiconified. */ |
5846 |
|
#if 0 |
5847 |
/* Don't keep the highlight on an invisible frame. */ |
/* Don't keep the highlight on an invisible frame. */ |
5848 |
if (FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame == f) |
if (FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame == f) |
5849 |
FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame = 0; |
FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame = 0; |
5850 |
|
#endif |
5851 |
|
|
|
#if 0 |
|
|
/* Review: Since window is still visible in dock, still allow updates? */ |
|
5852 |
if (f->async_iconified) |
if (f->async_iconified) |
5853 |
return; |
return; |
|
#endif |
|
5854 |
|
|
5855 |
BLOCK_INPUT; |
BLOCK_INPUT; |
5856 |
|
|
5857 |
CollapseWindow (FRAME_MAC_WINDOW (f), true); |
FRAME_SAMPLE_VISIBILITY (f); |
5858 |
|
|
5859 |
|
if (! FRAME_VISIBLE_P (f)) |
5860 |
|
ShowWindow (FRAME_MAC_WINDOW (f)); |
5861 |
|
|
5862 |
|
err = CollapseWindow (FRAME_MAC_WINDOW (f), true); |
5863 |
|
|
5864 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
5865 |
|
|
5866 |
|
if (err != noErr) |
5867 |
|
error ("Can't notify window manager of iconification"); |
5868 |
|
|
5869 |
|
#if !USE_CARBON_EVENTS |
5870 |
|
mac_handle_visibility_change (f); |
5871 |
|
#endif |
5872 |
} |
} |
5873 |
|
|
5874 |
|
|
7257 |
|
|
7258 |
/* Set global flag fonts_changed_p to non-zero if the font loaded |
/* Set global flag fonts_changed_p to non-zero if the font loaded |
7259 |
has a character with a smaller width than any other character |
has a character with a smaller width than any other character |
7260 |
before, or if the font loaded has a smalle>r height than any |
before, or if the font loaded has a smaller height than any |
7261 |
other font loaded before. If this happens, it will make a |
other font loaded before. If this happens, it will make a |
7262 |
glyph matrix reallocation necessary. */ |
glyph matrix reallocation necessary. */ |
7263 |
fonts_changed_p |= x_compute_min_glyph_bounds (f); |
fonts_changed_p |= x_compute_min_glyph_bounds (f); |
7388 |
/* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox |
/* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox |
7389 |
for processing before Emacs sees it. */ |
for processing before Emacs sees it. */ |
7390 |
Lisp_Object Vmac_pass_control_to_system; |
Lisp_Object Vmac_pass_control_to_system; |
7391 |
|
#endif |
7392 |
|
|
7393 |
/* Points to the variable `inev' in the function XTread_socket. It is |
/* Points to the variable `inev' in the function XTread_socket. It is |
7394 |
used for passing an input event to the function back from |
used for passing an input event to the function back from |
7395 |
Carbon/Apple event handlers. */ |
Carbon/Apple event handlers. */ |
7396 |
static struct input_event *read_socket_inev = NULL; |
static struct input_event *read_socket_inev = NULL; |
|
#endif |
|
7397 |
|
|
7398 |
/* Set in term/mac-win.el to indicate that event loop can now generate |
/* Set in term/mac-win.el to indicate that event loop can now generate |
7399 |
drag and drop events. */ |
drag and drop events. */ |
7678 |
{ |
{ |
7679 |
if (f->async_visible == 0) |
if (f->async_visible == 0) |
7680 |
{ |
{ |
7681 |
|
/* Update events may occur when a frame gets iconified. */ |
7682 |
|
#if 0 |
7683 |
f->async_visible = 1; |
f->async_visible = 1; |
7684 |
f->async_iconified = 0; |
f->async_iconified = 0; |
7685 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
7686 |
|
#endif |
|
/* An update event is equivalent to MapNotify on X, so report |
|
|
visibility changes properly. */ |
|
|
if (! NILP(Vframe_list) && ! NILP (XCDR (Vframe_list))) |
|
|
/* Force a redisplay sooner or later to update the |
|
|
frame titles in case this is the second frame. */ |
|
|
record_asynch_buffer_change (); |
|
7687 |
} |
} |
7688 |
else |
else |
7689 |
{ |
{ |
7690 |
Rect r; |
Rect r; |
|
|
|
7691 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
7692 |
{ |
RgnHandle region = NewRgn (); |
|
RgnHandle region = NewRgn (); |
|
7693 |
|
|
7694 |
GetPortVisibleRegion (GetWindowPort (win), region); |
GetPortVisibleRegion (GetWindowPort (win), region); |
7695 |
GetRegionBounds (region, &r); |
GetRegionBounds (region, &r); |
7696 |
expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); |
expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); |
7697 |
UpdateControls (win, region); |
UpdateControls (win, region); |
7698 |
DisposeRgn (region); |
DisposeRgn (region); |
|
} |
|
7699 |
#else |
#else |
7700 |
r = (*win->visRgn)->rgnBBox; |
r = (*win->visRgn)->rgnBBox; |
7701 |
expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); |
expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); |
7702 |
UpdateControls (win, win->visRgn); |
UpdateControls (win, win->visRgn); |
7703 |
#endif |
#endif |
7704 |
} |
} |
7705 |
} |
} |
7706 |
|
|
7707 |
EndUpdate (win); |
EndUpdate (win); |
8233 |
return noErr; |
return noErr; |
8234 |
} |
} |
8235 |
break; |
break; |
8236 |
|
|
8237 |
|
case kEventWindowShown: |
8238 |
|
case kEventWindowHidden: |
8239 |
|
case kEventWindowExpanded: |
8240 |
|
case kEventWindowCollapsed: |
8241 |
|
result = CallNextEventHandler (next_handler, event); |
8242 |
|
|
8243 |
|
mac_handle_visibility_change (mac_window_to_frame (wp)); |
8244 |
|
return noErr; |
8245 |
|
|
8246 |
|
break; |
8247 |
} |
} |
8248 |
|
|
8249 |
return eventNotHandledErr; |
return eventNotHandledErr; |
8319 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
8320 |
EventTypeSpec specs_window[] = |
EventTypeSpec specs_window[] = |
8321 |
{{kEventClassWindow, kEventWindowUpdate}, |
{{kEventClassWindow, kEventWindowUpdate}, |
8322 |
{kEventClassWindow, kEventWindowBoundsChanging}}; |
{kEventClassWindow, kEventWindowBoundsChanging}, |
8323 |
|
{kEventClassWindow, kEventWindowShown}, |
8324 |
|
{kEventClassWindow, kEventWindowHidden}, |
8325 |
|
{kEventClassWindow, kEventWindowExpanded}, |
8326 |
|
{kEventClassWindow, kEventWindowCollapsed}}; |
8327 |
EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; |
EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; |
8328 |
static EventHandlerUPP handle_window_eventUPP = NULL; |
static EventHandlerUPP handle_window_eventUPP = NULL; |
8329 |
static EventHandlerUPP handle_mouse_eventUPP = NULL; |
static EventHandlerUPP handle_mouse_eventUPP = NULL; |
9532 |
pending_autoraise_frame = 0; |
pending_autoraise_frame = 0; |
9533 |
} |
} |
9534 |
|
|
9535 |
|
#if !USE_CARBON_EVENTS |
9536 |
|
/* Check which frames are still visible. We do this here because |
9537 |
|
there doesn't seem to be any direct notification from the Window |
9538 |
|
Manager that the visibility of a window has changed (at least, |
9539 |
|
not in all cases). */ |
9540 |
|
{ |
9541 |
|
Lisp_Object tail, frame; |
9542 |
|
|
9543 |
|
FOR_EACH_FRAME (tail, frame) |
9544 |
|
{ |
9545 |
|
struct frame *f = XFRAME (frame); |
9546 |
|
|
9547 |
|
/* The tooltip has been drawn already. Avoid the |
9548 |
|
SET_FRAME_GARBAGED in mac_handle_visibility_change. */ |
9549 |
|
if (EQ (frame, tip_frame)) |
9550 |
|
continue; |
9551 |
|
|
9552 |
|
if (FRAME_MAC_P (f)) |
9553 |
|
mac_handle_visibility_change (f); |
9554 |
|
} |
9555 |
|
} |
9556 |
|
#endif |
9557 |
|
|
9558 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
9559 |
return count; |
return count; |
9560 |
} |
} |