changeset 83504:7aa43f830ce4

Fix tooltip border color. * src/xterm.h (x_output): Remove background_pixel and foreground_pixel fields. * src/widget.c (update_from_various_frame_slots): Use FRAME_BACKGROUND_PIXEL and FRAME_FOREGROUND_PIXEL. * src/xfns.c (x_set_foreground_color): Ditto. * src/xfns.c (x_set_background_color): Ditto. * src/xfns.c (x_set_mouse_color): Ditto. * src/xfns.c (x_set_cursor_color): Ditto. * src/xfns.c (x_make_gc): Ditto. * src/xfns.c (Fx_create_frame): Ditto. * src/xfns.c (x_create_tip_frame): Ditto. * src/xfns.c (build_string): Ditto. * src/xterm.c (XTflash): Ditto. * src/xterm.c (x_free_frame_resources): Ditto. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-544
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 01 Apr 2006 16:11:29 +0000
parents ad1fbeffe3cb
children 57e924639750
files README.multi-tty src/widget.c src/xfns.c src/xterm.c src/xterm.h
diffstat 5 files changed, 56 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/README.multi-tty	Sat Apr 01 13:36:08 2006 +0000
+++ b/README.multi-tty	Sat Apr 01 16:11:29 2006 +0000
@@ -404,8 +404,11 @@
 THINGS TO DO
 ------------
 
-** emacsclient -t on the console does not work after su:
+** emacsclient -t on the console does not work after su.  You have to
+   use non-root accounts or start as root to see this.
 
+   	Login: root
+	Password:
 	# su lorentey
 	$ emacsclient -t
 	*ERROR*: Could not open file: /dev/tty1
@@ -415,6 +418,12 @@
    bring back the ugly pty proxy hack from the initial versions of
    multi-tty.  Suggestions would be appreciated.
 
+   Update: we could change emacsclient to pass its open file
+   descriptor to the Emacs process.  Unfortunately, this requires a
+   new Lisp-level Emacs API, and as file descriptors are not otherwise
+   exported to Lisp, this approach seems at least as ugly as the pty
+   proxy idea.
+
 ** Understand how `quit_throw_to_read_char' works, and fix any bugs
    that come to light.
 
@@ -1494,5 +1503,19 @@
 
    (Done in patch-539.)
 
+-- The borders on tooltip frames on X are messed up.  More
+   specifically, the frame's internal border (internal-border-width
+   frame parameter) is not filled with the correct background color.
+
+   It seems the border contents are drawn onto by the
+   update_single_window call in `x-show-tip'.  After some debugging, I
+   think the window's background color is not set up
+   correctly---calling `x_clear_area' fills the specified area with
+   black, not light yellow.
+
+   (Done in patch-544.  A background_pixel field was defined both in
+   struct frame and struct x_output, and Emacs got confused between
+   them.)
+
 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
 
--- a/src/widget.c	Sat Apr 01 13:36:08 2006 +0000
+++ b/src/widget.c	Sat Apr 01 16:11:29 2006 +0000
@@ -659,10 +659,10 @@
   struct x_output *x = f->output_data.x;
   ew->core.height = FRAME_PIXEL_HEIGHT (f) - x->menubar_height;
   ew->core.width = FRAME_PIXEL_WIDTH (f);
-  ew->core.background_pixel = x->background_pixel;
+  ew->core.background_pixel = FRAME_BACKGROUND_PIXEL (f);
   ew->emacs_frame.internal_border_width = f->internal_border_width;
   ew->emacs_frame.font = x->font;
-  ew->emacs_frame.foreground_pixel = x->foreground_pixel;
+  ew->emacs_frame.foreground_pixel = FRAME_FOREGROUND_PIXEL (f);
   ew->emacs_frame.cursor_color = x->cursor_pixel;
   ew->core.border_pixel = x->border_pixel;
 }
--- a/src/xfns.c	Sat Apr 01 13:36:08 2006 +0000
+++ b/src/xfns.c	Sat Apr 01 16:11:29 2006 +0000
@@ -865,8 +865,8 @@
   unsigned long fg, old_fg;
 
   fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
-  old_fg = x->foreground_pixel;
-  x->foreground_pixel = fg;
+  old_fg = FRAME_FOREGROUND_PIXEL (f);
+  FRAME_FOREGROUND_PIXEL (f) = fg;
 
   if (FRAME_X_WINDOW (f) != 0)
     {
@@ -903,8 +903,8 @@
   unsigned long bg;
 
   bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
-  unload_color (f, x->background_pixel);
-  x->background_pixel = bg;
+  unload_color (f, FRAME_BACKGROUND_PIXEL (f));
+  FRAME_BACKGROUND_PIXEL (f) = bg;
 
   if (FRAME_X_WINDOW (f) != 0)
     {
@@ -952,13 +952,13 @@
   Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
   Cursor hourglass_cursor, horizontal_drag_cursor;
   unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
-  unsigned long mask_color = x->background_pixel;
+  unsigned long mask_color = FRAME_BACKGROUND_PIXEL (f);
 
   /* Don't let pointers be invisible.  */
   if (mask_color == pixel)
     {
       x_free_colors (f, &pixel, 1);
-      pixel = x_copy_color (f, x->foreground_pixel);
+      pixel = x_copy_color (f, FRAME_FOREGROUND_PIXEL (f));
     }
 
   unload_color (f, x->mouse_pixel);
@@ -1101,13 +1101,13 @@
       fore_pixel_allocated_p = 1;
     }
   else
-    fore_pixel = x->background_pixel;
+    fore_pixel = FRAME_BACKGROUND_PIXEL (f);
 
   pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
   pixel_allocated_p = 1;
 
   /* Make sure that the cursor color differs from the background color.  */
-  if (pixel == x->background_pixel)
+  if (pixel == FRAME_BACKGROUND_PIXEL (f))
     {
       if (pixel_allocated_p)
 	{
@@ -1123,7 +1123,7 @@
 	      x_free_colors (f, &fore_pixel, 1);
 	      fore_pixel_allocated_p = 0;
 	    }
-	  fore_pixel = x->background_pixel;
+	  fore_pixel = FRAME_BACKGROUND_PIXEL (f);
 	}
     }
 
@@ -2868,8 +2868,8 @@
 
   /* Normal video */
   gc_values.font = FRAME_FONT (f)->fid;
-  gc_values.foreground = f->output_data.x->foreground_pixel;
-  gc_values.background = f->output_data.x->background_pixel;
+  gc_values.foreground = FRAME_FOREGROUND_PIXEL (f);
+  gc_values.background = FRAME_BACKGROUND_PIXEL (f);
   gc_values.line_width = 0;	/* Means 1 using fast algorithm.  */
   f->output_data.x->normal_gc
     = XCreateGC (FRAME_X_DISPLAY (f),
@@ -2878,8 +2878,8 @@
 		 &gc_values);
 
   /* Reverse video style.  */
-  gc_values.foreground = f->output_data.x->background_pixel;
-  gc_values.background = f->output_data.x->foreground_pixel;
+  gc_values.foreground = FRAME_BACKGROUND_PIXEL (f);
+  gc_values.background = FRAME_FOREGROUND_PIXEL (f);
   f->output_data.x->reverse_gc
     = XCreateGC (FRAME_X_DISPLAY (f),
 		 FRAME_X_WINDOW (f),
@@ -2887,7 +2887,7 @@
 		 &gc_values);
 
   /* Cursor has cursor-color background, background-color foreground.  */
-  gc_values.foreground = f->output_data.x->background_pixel;
+  gc_values.foreground = FRAME_BACKGROUND_PIXEL (f);
   gc_values.background = f->output_data.x->cursor_pixel;
   gc_values.fill_style = FillOpaqueStippled;
   gc_values.stipple
@@ -2911,8 +2911,8 @@
     = (XCreatePixmapFromBitmapData
        (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
 	gray_bits, gray_width, gray_height,
-	f->output_data.x->foreground_pixel,
-	f->output_data.x->background_pixel,
+	FRAME_FOREGROUND_PIXEL (f),
+	FRAME_BACKGROUND_PIXEL (f),
 	DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))));
 
   UNBLOCK_INPUT;
@@ -3116,8 +3116,8 @@
     /* Function x_decode_color can signal an error.  Make
        sure to initialize color slots so that we won't try
        to free colors we haven't allocated.  */
-    f->output_data.x->foreground_pixel = -1;
-    f->output_data.x->background_pixel = -1;
+    FRAME_FOREGROUND_PIXEL (f) = -1;
+    FRAME_BACKGROUND_PIXEL (f) = -1;
     f->output_data.x->cursor_pixel = -1;
     f->output_data.x->cursor_foreground_pixel = -1;
     f->output_data.x->border_pixel = -1;
@@ -3125,9 +3125,9 @@
 
     black = build_string ("black");
     GCPRO1 (black);
-    f->output_data.x->foreground_pixel
+    FRAME_FOREGROUND_PIXEL (f)
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
-    f->output_data.x->background_pixel
+    FRAME_BACKGROUND_PIXEL (f)
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
     f->output_data.x->cursor_pixel
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
@@ -4698,8 +4698,8 @@
     /* Function x_decode_color can signal an error.  Make
        sure to initialize color slots so that we won't try
        to free colors we haven't allocated.  */
-    f->output_data.x->foreground_pixel = -1;
-    f->output_data.x->background_pixel = -1;
+    FRAME_FOREGROUND_PIXEL (f) = -1;
+    FRAME_BACKGROUND_PIXEL (f) = -1;
     f->output_data.x->cursor_pixel = -1;
     f->output_data.x->cursor_foreground_pixel = -1;
     f->output_data.x->border_pixel = -1;
@@ -4707,9 +4707,9 @@
 
     black = build_string ("black");
     GCPRO1 (black);
-    f->output_data.x->foreground_pixel
+    FRAME_FOREGROUND_PIXEL (f)
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
-    f->output_data.x->background_pixel
+    FRAME_BACKGROUND_PIXEL (f)
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
     f->output_data.x->cursor_pixel
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
--- a/src/xterm.c	Sat Apr 01 13:36:08 2006 +0000
+++ b/src/xterm.c	Sat Apr 01 16:11:29 2006 +0000
@@ -2888,8 +2888,8 @@
       XGCValues values;
 
       values.function = GXxor;
-      values.foreground = (f->output_data.x->foreground_pixel
-			   ^ f->output_data.x->background_pixel);
+      values.foreground = (FRAME_FOREGROUND_PIXEL (f)
+			   ^ FRAME_BACKGROUND_PIXEL (f));
 
       gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
 		      GCFunction | GCForeground, &values);
@@ -9017,8 +9017,8 @@
 	XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
 #endif /* !USE_X_TOOLKIT */
 
-      unload_color (f, f->output_data.x->foreground_pixel);
-      unload_color (f, f->output_data.x->background_pixel);
+      unload_color (f, FRAME_FOREGROUND_PIXEL (f));
+      unload_color (f, FRAME_BACKGROUND_PIXEL (f));
       unload_color (f, f->output_data.x->cursor_pixel);
       unload_color (f, f->output_data.x->cursor_foreground_pixel);
       unload_color (f, f->output_data.x->border_pixel);
--- a/src/xterm.h	Sat Apr 01 13:36:08 2006 +0000
+++ b/src/xterm.h	Sat Apr 01 16:11:29 2006 +0000
@@ -521,8 +521,10 @@
 
   /* Pixel values used for various purposes.
      border_pixel may be -1 meaning use a gray tile.  */
+#if 0 /* These are also defined in struct frame.  Use that instead.  */
   unsigned long background_pixel;
   unsigned long foreground_pixel;
+#endif
   unsigned long cursor_pixel;
   unsigned long border_pixel;
   unsigned long mouse_pixel;