static void x_update_window_begin P_ ((struct window *));
static void x_after_update_window_line P_ ((struct glyph_row *));
-void activate_scroll_bars (FRAME_PTR);
-void deactivate_scroll_bars (FRAME_PTR);
-
static int is_emacs_window (WindowPtr);
int x_bitmap_icon (struct frame *, Lisp_Object);
commands. Assume that the graphic port has already been set. */
static void
-mac_set_colors (GC gc)
+mac_set_colors (gc, bg_save)
+ GC gc;
+ RGBColor *bg_save;
{
+ if (bg_save)
+ GetBackColor (bg_save);
mac_set_forecolor (gc->foreground);
mac_set_backcolor (gc->background);
}
GC gc;
int x1, y1, x2, y2;
{
+ RGBColor old_bg;
+
SetPortWindowPort (w);
- mac_set_colors (gc);
+ mac_set_colors (gc, &old_bg);
MoveTo (x1, y1);
LineTo (x2, y2);
+
+ RGBBackColor (&old_bg);
}
void
GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
- mac_set_colors (gc);
+ mac_set_colors (gc, NULL);
LockPixels (GetGWorldPixMap (p));
MoveTo (x1, y1);
struct mac_output *mwp = (mac_output *) GetWRefCon (w);
Rect r;
XGCValues xgc;
+ RGBColor old_bg;
xgc.foreground = mwp->x_compatible.foreground_pixel;
xgc.background = mwp->x_compatible.background_pixel;
SetPortWindowPort (w);
- mac_set_colors (&xgc);
+ mac_set_colors (&xgc, &old_bg);
SetRect (&r, x, y, x + width, y + height);
EraseRect (&r);
+
+ RGBBackColor (&old_bg);
}
/* Mac version of XClearWindow. */
SetPortWindowPort (w);
- mac_set_colors (&xgc);
+ mac_set_colors (&xgc, NULL);
#if TARGET_API_MAC_CARBON
{
{
BitMap bitmap;
Rect r;
+ RGBColor old_bg;
bitmap.rowBytes = sizeof(unsigned short);
bitmap.baseAddr = (char *)bits;
SetPortWindowPort (w);
- mac_set_colors (gc);
+ mac_set_colors (gc, &old_bg);
SetRect (&r, x, y, x + width, y + height);
#if TARGET_API_MAC_CARBON
CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r,
overlay_p ? srcOr : srcCopy, 0);
#endif /* not TARGET_API_MAC_CARBON */
+
+ RGBBackColor (&old_bg);
}
unsigned int width, height;
{
Rect r;
+ RGBColor old_bg;
SetPortWindowPort (w);
- mac_set_colors (gc);
+ mac_set_colors (gc, &old_bg);
SetRect (&r, x, y, x + width, y + height);
PaintRect (&r); /* using foreground color of gc */
+
+ RGBBackColor (&old_bg);
}
GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
- mac_set_colors (gc);
+ mac_set_colors (gc, NULL);
SetRect (&r, x, y, x + width, y + height);
LockPixels (GetGWorldPixMap (p));
unsigned int width, height;
{
Rect r;
+ RGBColor old_bg;
SetPortWindowPort (w);
- mac_set_colors (gc);
+ mac_set_colors (gc, &old_bg);
SetRect (&r, x, y, x + width + 1, y + height + 1);
FrameRect (&r); /* using foreground color of gc */
+
+ RGBBackColor (&old_bg);
}
GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
- mac_set_colors (gc);
+ mac_set_colors (gc, NULL);
SetRect (&r, x, y, x + width + 1, y + height + 1);
LockPixels (GetGWorldPixMap (p));
char *buf;
int nchars, mode, bytes_per_char;
{
+ RGBColor old_bg;
+
SetPortWindowPort (w);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
UInt32 textFlags, savedFlags;
}
#endif
- mac_set_colors (gc);
+ mac_set_colors (gc, &old_bg);
TextFont (gc->font->mac_fontnum);
TextSize (gc->font->mac_fontsize);
MoveTo (x, y);
DrawText (buf, 0, nchars * bytes_per_char);
+
+ RGBBackColor (&old_bg);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
if (!NILP(Vmac_use_core_graphics))
SwapQDTextFlags(savedFlags);
SetPort (w);
#if 0
- mac_set_colors (gc);
+ mac_set_colors (gc, NULL);
#endif
SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
BackColor (whiteColor);
CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0);
- mac_set_colors (gc);
+ mac_set_colors (gc, NULL);
#endif
#endif /* not TARGET_API_MAC_CARBON */
}
FRAME_MAC_DISPLAY_INFO (f)->mouse_face_defer = 0;
BLOCK_INPUT;
- /* Reset the background color of Mac OS Window to that of the frame after
- update so that it is used by Mac Toolbox to clear the update region before
- an update event is generated. */
- SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
- mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
-
#if TARGET_API_MAC_CARBON
EnableScreenUpdates ();
#endif
}
-void
-activate_scroll_bars (frame)
- FRAME_PTR frame;
-{
- Lisp_Object bar;
- ControlHandle ch;
-
- bar = FRAME_SCROLL_BARS (frame);
- while (! NILP (bar))
- {
- ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar));
-#if 1 /* TARGET_API_MAC_CARBON */
- ActivateControl (ch);
-#else
- SetControlMaximum (ch,
- VERTICAL_SCROLL_BAR_TOP_RANGE (frame,
- XINT (XSCROLL_BAR (bar)
- ->height)) - 1);
-#endif
- bar = XSCROLL_BAR (bar)->next;
- }
-}
-
-
-void
-deactivate_scroll_bars (frame)
- FRAME_PTR frame;
-{
- Lisp_Object bar;
- ControlHandle ch;
-
- bar = FRAME_SCROLL_BARS (frame);
- while (! NILP (bar))
- {
- ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar));
-#if 1 /* TARGET_API_MAC_CARBON */
- DeactivateControl (ch);
-#else
- SetControlMaximum (ch, -1);
-#endif
- bar = XSCROLL_BAR (bar)->next;
- }
-}
-
/* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind
is set to something other than NO_EVENT, it is enqueued.
struct frame *f;
Cursor cursor;
{
-#if TARGET_API_MAC_CARBON
SetThemeCursor (cursor);
-#else
- SetCursor (*cursor);
-#endif
}
x_wm_set_size_hint (f, (long) 0, 0);
SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0);
+#if TARGET_API_MAC_CARBON
+ if (f->output_data.mac->hourglass_control)
+ MoveControl (f->output_data.mac->hourglass_control,
+ pixelwidth - HOURGLASS_WIDTH, 0);
+#endif
/* Now, strictly speaking, we can't be sure that this is accurate,
but the window manager will get around to dealing with the size
Point saved_menu_event_location;
-#if !TARGET_API_MAC_CARBON
-/* Place holder for the default arrow cursor. */
-CursPtr arrow_cursor;
-#endif
-
/* Apple Events */
static void init_required_apple_events (void);
static pascal OSErr
InitCursor ();
#if !TARGET_API_MAC_CARBON
- arrow_cursor = &qd.arrow;
-
/* set up some extra stack space for use by emacs */
SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC));
RgnHandle region = NewRgn ();
GetPortVisibleRegion (GetWindowPort (win), region);
- UpdateControls (win, region);
GetRegionBounds (region, &r);
+ expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top);
+ UpdateControls (win, region);
DisposeRgn (region);
}
#else
- UpdateControls (win, win->visRgn);
r = (*win->visRgn)->rgnBBox;
-#endif
expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top);
+ UpdateControls (win, win->visRgn);
+#endif
handling_window_update = 0;
}
EventRef event;
void *data;
{
- extern Lisp_Object Qcontrol;
-
WindowPtr wp;
OSStatus result;
UInt32 attributes;
Rect r;
struct frame *f = mac_window_to_frame (window);
- mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
GetWindowPortBounds (window, &r);
OffsetRect (&r, -r.left, -r.top);
RectRgn (hilite_rgn, &r);
{
struct frame *f = mac_window_to_frame (window);
- mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
HideDragHilite (theDrag);
SetThemeCursor (kThemeArrowCursor);
}
/* ticks to milliseconds */
if (dpyinfo->grabbed && tracked_scroll_bar
-#if TARGET_API_MAC_CARBON
- || ch != 0
-#else
- || control_part_code != 0
-#endif
- )
+ /* control_part_code becomes kControlNoPart if
+ a progress indicator is clicked. */
+ || ch != 0 && control_part_code != kControlNoPart)
{
struct scroll_bar *bar;
case activateEvt:
{
WindowPtr window_ptr = (WindowPtr) er.message;
+ ControlRef root_control;
#if USE_CARBON_EVENTS
if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
break;
f = mac_window_to_frame (window_ptr);
+ GetRootControl (window_ptr, &root_control);
if ((er.modifiers & activeFlag) != 0)
{
Point mouse_loc = er.where;
x_new_focus_frame (dpyinfo, f);
- activate_scroll_bars (f);
+ ActivateControl (root_control);
SetPortWindowPort (window_ptr);
GlobalToLocal (&mouse_loc);
if (f == dpyinfo->x_focus_frame)
{
x_new_focus_frame (dpyinfo, 0);
- deactivate_scroll_bars (f);
+ DeactivateControl (root_control);
}
f->output_data.mac->mouse_pixel = 0xff00ff;
f->output_data.mac->cursor_foreground_pixel = 0x0000ff;
-#if TARGET_API_MAC_CARBON
f->output_data.mac->text_cursor = kThemeIBeamCursor;
f->output_data.mac->nontext_cursor = kThemeArrowCursor;
f->output_data.mac->modeline_cursor = kThemeArrowCursor;
f->output_data.mac->hand_cursor = kThemePointingHandCursor;
f->output_data.mac->hourglass_cursor = kThemeWatchCursor;
f->output_data.mac->horizontal_drag_cursor = kThemeResizeLeftRightCursor;
-#else
- f->output_data.mac->text_cursor = GetCursor (iBeamCursor);
- f->output_data.mac->nontext_cursor = &arrow_cursor;
- f->output_data.mac->modeline_cursor = &arrow_cursor;
- f->output_data.mac->hand_cursor = &arrow_cursor;
- f->output_data.mac->hourglass_cursor = GetCursor (watchCursor);
- f->output_data.mac->horizontal_drag_cursor = &arrow_cursor;
-#endif
FRAME_FONTSET (f) = -1;
f->output_data.mac->explicit_parent = 0;