diff src/macterm.c @ 83119:6c46628776bc

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-287 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-288 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-289 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-159
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 08 May 2004 20:22:26 +0000
parents 1a68e4b22355 53a1a79a33f9
children ad01ab3c6f4d
line wrap: on
line diff
--- a/src/macterm.c	Sat May 08 16:20:28 2004 +0000
+++ b/src/macterm.c	Sat May 08 20:22:26 2004 +0000
@@ -383,6 +383,10 @@
      GC gc;
      int x1, y1, x2, y2;
 {
+  CGrafPtr old_port;
+  GDHandle old_gdh;
+
+  GetGWorld (&old_port, &old_gdh);
   SetGWorld (p, NULL);
 
   mac_set_colors (gc);
@@ -391,6 +395,8 @@
   MoveTo (x1, y1);
   LineTo (x2, y2);
   UnlockPixels (GetGWorldPixMap (p));
+
+  SetGWorld (old_port, old_gdh);
 }
 
 /* Mac version of XClearArea.  */
@@ -620,11 +626,14 @@
 {
   Pixmap pixmap;
   BitMap bitmap;
+  CGrafPtr old_port;
+  GDHandle old_gdh;
 
   pixmap = XCreatePixmap (display, w, width, height, depth);
   if (pixmap == NULL)
     return NULL;
 
+  GetGWorld (&old_port, &old_gdh);
   SetGWorld (pixmap, NULL);
   mac_create_bitmap_from_bitmap_data (&bitmap, data, width, height);
   mac_set_forecolor (fg);
@@ -638,6 +647,7 @@
 	    &bitmap.bounds, &bitmap.bounds, srcCopy, 0);
 #endif /* not TARGET_API_MAC_CARBON */
   UnlockPixels (GetGWorldPixMap (pixmap));
+  SetGWorld (old_port, old_gdh);
   mac_free_bitmap (&bitmap);
 
   return pixmap;
@@ -677,8 +687,11 @@
      int x, y;
      unsigned int width, height;
 {
+  CGrafPtr old_port;
+  GDHandle old_gdh;
   Rect r;
 
+  GetGWorld (&old_port, &old_gdh);
   SetGWorld (p, NULL);
   mac_set_colors (gc);
   SetRect (&r, x, y, x + width, y + height);
@@ -686,6 +699,8 @@
   LockPixels (GetGWorldPixMap (p));
   PaintRect (&r); /* using foreground color of gc */
   UnlockPixels (GetGWorldPixMap (p));
+
+  SetGWorld (old_port, old_gdh);
 }
 
 
@@ -724,8 +739,11 @@
      int x, y;
      unsigned int width, height;
 {
+  CGrafPtr old_port;
+  GDHandle old_gdh;
   Rect r;
 
+  GetGWorld (&old_port, &old_gdh);
   SetGWorld (p, NULL);
   mac_set_colors (gc);
   SetRect (&r, x, y, x + width + 1, y + height + 1);
@@ -733,6 +751,8 @@
   LockPixels (GetGWorldPixMap (p));
   FrameRect (&r); /* using foreground color of gc */
   UnlockPixels (GetGWorldPixMap (p));
+
+  SetGWorld (old_port, old_gdh);
 }
 
 
@@ -1003,8 +1023,11 @@
      unsigned int width, height;
      int dest_x, dest_y;
 {
+  CGrafPtr old_port;
+  GDHandle old_gdh;
   Rect src_r, dest_r;
 
+  GetGWorld (&old_port, &old_gdh);
   SetGWorld (dest, NULL);
   ForeColor (blackColor);
   BackColor (whiteColor);
@@ -1023,6 +1046,8 @@
 #endif /* not TARGET_API_MAC_CARBON */
   UnlockPixels (GetGWorldPixMap (dest));
   UnlockPixels (GetGWorldPixMap (src));
+
+  SetGWorld (old_port, old_gdh);
 }
 
 
@@ -1036,8 +1061,11 @@
      unsigned int width, height;
      int dest_x, dest_y;
 {
+  CGrafPtr old_port;
+  GDHandle old_gdh;
   Rect src_r, dest_r;
 
+  GetGWorld (&old_port, &old_gdh);
   SetGWorld (dest, NULL);
   ForeColor (blackColor);
   BackColor (whiteColor);
@@ -1058,6 +1086,8 @@
   UnlockPixels (GetGWorldPixMap (dest));
   UnlockPixels (GetGWorldPixMap (mask));
   UnlockPixels (GetGWorldPixMap (src));
+
+  SetGWorld (old_port, old_gdh);
 }
 
 
@@ -8980,9 +9010,11 @@
   mac_determine_quit_char_modifiers ();
 
   /* Fill the queue with events */
+  BLOCK_INPUT;
   ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event);
   event = FindSpecificEventInQueue (GetMainEventQueue (), quit_char_comp,
 				    NULL);
+  UNBLOCK_INPUT;
   if (event)
     {
       struct input_event e;