]> code.delx.au - gnu-emacs/blobdiff - src/xterm.h
Update copyright year to 2016
[gnu-emacs] / src / xterm.h
index 300a8b769f212651d5db98c1a4760c3b286acd60..3a78292907a48a9d2b231f2d650fb311f7ed2929 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication with X protocol.
-   Copyright (C) 1989, 1993-1994, 1998-2015 Free Software Foundation,
+   Copyright (C) 1989, 1993-1994, 1998-2016 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -87,6 +87,10 @@ typedef GtkWidget *xt_or_gtk_widget;
 #include <X11/Xlocale.h>
 #endif
 
+#ifdef USE_XCB
+#include <X11/Xlib-xcb.h>
+#endif
+
 #include "dispextern.h"
 #include "termhooks.h"
 
@@ -458,6 +462,10 @@ struct x_display_info
 #ifdef USE_CAIRO
   XExtCodes *ext_codes;
 #endif
+
+#ifdef USE_XCB
+  xcb_connection_t *xcb_connection;
+#endif
 };
 
 #ifdef HAVE_X_I18N
@@ -1024,12 +1032,18 @@ XrmDatabase x_load_resources (Display *, const char *, const char *,
 
 /* Defined in xterm.c */
 
+typedef void (*x_special_error_handler)(Display *, XErrorEvent *, char *,
+                                       void *);
+
 extern bool x_text_icon (struct frame *, const char *);
 extern void x_catch_errors (Display *);
+extern void x_catch_errors_with_handler (Display *, x_special_error_handler,
+                                        void *);
 extern void x_check_errors (Display *, const char *)
   ATTRIBUTE_FORMAT_PRINTF (2, 0);
 extern bool x_had_errors_p (Display *);
 extern void x_uncatch_errors (void);
+extern void x_uncatch_errors_after_check (void);
 extern void x_clear_errors (Display *);
 extern void xembed_request_focus (struct frame *);
 extern void x_ewmh_activate_frame (struct frame *);
@@ -1085,6 +1099,33 @@ x_display_set_last_user_time (struct x_display_info *dpyinfo, Time t)
   dpyinfo->last_user_time = t;
 }
 
+INLINE unsigned long
+x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
+{
+  unsigned long pr, pg, pb;
+
+  /* Scale down RGB values to the visual's bits per RGB, and shift
+     them to the right position in the pixel color.  Note that the
+     original RGB values are 16-bit values, as usual in X.  */
+  pr = (r >> (16 - dpyinfo->red_bits))   << dpyinfo->red_offset;
+  pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
+  pb = (b >> (16 - dpyinfo->blue_bits))  << dpyinfo->blue_offset;
+
+  /* Assemble the pixel color.  */
+  return pr | pg | pb;
+}
+
+/* If display has an immutable color map, freeing colors is not
+   necessary and some servers don't allow it, so we won't do it.  That
+   also allows us to make other optimizations relating to server-side
+   reference counts.  */
+INLINE bool
+x_mutable_colormap (Visual *visual)
+{
+  int class = visual->class;
+  return (class != StaticColor && class != StaticGray && class != TrueColor);
+}
+
 extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object);
 extern bool x_wm_supports (struct frame *, Atom);
 extern void x_wait_for_event (struct frame *, int);