aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c556
1 files changed, 326 insertions, 230 deletions
diff --git a/src/xterm.c b/src/xterm.c
index d9d908d4396..a571d025571 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,7 +1,8 @@
1/* X Communication module for terminals which understand the X protocol. 1/* X Communication module for terminals which understand the X protocol.
2 Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2
3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4 Free Software Foundation, Inc. 4 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -46,9 +47,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46#include <sys/types.h> 47#include <sys/types.h>
47#endif /* makedev */ 48#endif /* makedev */
48 49
49#ifdef HAVE_SYS_IOCTL_H
50#include <sys/ioctl.h> 50#include <sys/ioctl.h>
51#endif /* ! defined (HAVE_SYS_IOCTL_H) */
52 51
53#include "systime.h" 52#include "systime.h"
54 53
@@ -441,7 +440,6 @@ x_display_info_for_display (Display *dpy)
441} 440}
442 441
443#define OPAQUE 0xffffffff 442#define OPAQUE 0xffffffff
444#define OPACITY "_NET_WM_WINDOW_OPACITY"
445 443
446void 444void
447x_set_frame_alpha (struct frame *f) 445x_set_frame_alpha (struct frame *f)
@@ -485,7 +483,7 @@ x_set_frame_alpha (struct frame *f)
485 unsigned long n, left; 483 unsigned long n, left;
486 484
487 x_catch_errors (dpy); 485 x_catch_errors (dpy);
488 rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False), 486 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
489 0L, 1L, False, XA_CARDINAL, 487 0L, 1L, False, XA_CARDINAL,
490 &actual, &format, &n, &left, 488 &actual, &format, &n, &left,
491 &data); 489 &data);
@@ -503,7 +501,7 @@ x_set_frame_alpha (struct frame *f)
503 } 501 }
504 502
505 x_catch_errors (dpy); 503 x_catch_errors (dpy);
506 XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False), 504 XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
507 XA_CARDINAL, 32, PropModeReplace, 505 XA_CARDINAL, 32, PropModeReplace,
508 (unsigned char *) &opac, 1L); 506 (unsigned char *) &opac, 1L);
509 x_uncatch_errors (); 507 x_uncatch_errors ();
@@ -547,22 +545,22 @@ static void
547x_update_window_begin (struct window *w) 545x_update_window_begin (struct window *w)
548{ 546{
549 struct frame *f = XFRAME (WINDOW_FRAME (w)); 547 struct frame *f = XFRAME (WINDOW_FRAME (w));
550 struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f); 548 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
551 549
552 updated_window = w; 550 updated_window = w;
553 set_output_cursor (&w->cursor); 551 set_output_cursor (&w->cursor);
554 552
555 BLOCK_INPUT; 553 BLOCK_INPUT;
556 554
557 if (f == display_info->mouse_face_mouse_frame) 555 if (f == hlinfo->mouse_face_mouse_frame)
558 { 556 {
559 /* Don't do highlighting for mouse motion during the update. */ 557 /* Don't do highlighting for mouse motion during the update. */
560 display_info->mouse_face_defer = 1; 558 hlinfo->mouse_face_defer = 1;
561 559
562 /* If F needs to be redrawn, simply forget about any prior mouse 560 /* If F needs to be redrawn, simply forget about any prior mouse
563 highlighting. */ 561 highlighting. */
564 if (FRAME_GARBAGED_P (f)) 562 if (FRAME_GARBAGED_P (f))
565 display_info->mouse_face_window = Qnil; 563 hlinfo->mouse_face_window = Qnil;
566 } 564 }
567 565
568 UNBLOCK_INPUT; 566 UNBLOCK_INPUT;
@@ -602,7 +600,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
602static void 600static void
603x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) 601x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p)
604{ 602{
605 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); 603 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
606 604
607 if (!w->pseudo_window_p) 605 if (!w->pseudo_window_p)
608 { 606 {
@@ -623,9 +621,9 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt
623 XTframe_up_to_date to redisplay the mouse highlight. */ 621 XTframe_up_to_date to redisplay the mouse highlight. */
624 if (mouse_face_overwritten_p) 622 if (mouse_face_overwritten_p)
625 { 623 {
626 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 624 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
627 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 625 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
628 dpyinfo->mouse_face_window = Qnil; 626 hlinfo->mouse_face_window = Qnil;
629 } 627 }
630 628
631 updated_window = NULL; 629 updated_window = NULL;
@@ -639,7 +637,7 @@ static void
639x_update_end (struct frame *f) 637x_update_end (struct frame *f)
640{ 638{
641 /* Mouse highlight may be displayed again. */ 639 /* Mouse highlight may be displayed again. */
642 FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0; 640 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
643 641
644#ifndef XFlush 642#ifndef XFlush
645 BLOCK_INPUT; 643 BLOCK_INPUT;
@@ -658,17 +656,17 @@ XTframe_up_to_date (struct frame *f)
658{ 656{
659 if (FRAME_X_P (f)) 657 if (FRAME_X_P (f))
660 { 658 {
661 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 659 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
662 660
663 if (dpyinfo->mouse_face_deferred_gc 661 if (hlinfo->mouse_face_deferred_gc
664 || f == dpyinfo->mouse_face_mouse_frame) 662 || f == hlinfo->mouse_face_mouse_frame)
665 { 663 {
666 BLOCK_INPUT; 664 BLOCK_INPUT;
667 if (dpyinfo->mouse_face_mouse_frame) 665 if (hlinfo->mouse_face_mouse_frame)
668 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 666 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
669 dpyinfo->mouse_face_mouse_x, 667 hlinfo->mouse_face_mouse_x,
670 dpyinfo->mouse_face_mouse_y); 668 hlinfo->mouse_face_mouse_y);
671 dpyinfo->mouse_face_deferred_gc = 0; 669 hlinfo->mouse_face_deferred_gc = 0;
672 UNBLOCK_INPUT; 670 UNBLOCK_INPUT;
673 } 671 }
674 } 672 }
@@ -969,7 +967,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
969 struct face *face; 967 struct face *face;
970 968
971 /* What face has to be used last for the mouse face? */ 969 /* What face has to be used last for the mouse face? */
972 face_id = FRAME_X_DISPLAY_INFO (s->f)->mouse_face_face_id; 970 face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
973 face = FACE_FROM_ID (s->f, face_id); 971 face = FACE_FROM_ID (s->f, face_id);
974 if (face == NULL) 972 if (face == NULL)
975 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 973 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
@@ -1329,6 +1327,83 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s)
1329} 1327}
1330 1328
1331 1329
1330/* Draw the foreground of glyph string S for glyphless characters. */
1331
1332static void
1333x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
1334{
1335 struct glyph *glyph = s->first_glyph;
1336 XChar2b char2b[8];
1337 int x, i, j;
1338
1339 /* If first glyph of S has a left box line, start drawing the text
1340 of S to the right of that box line. */
1341 if (s->face && s->face->box != FACE_NO_BOX
1342 && s->first_glyph->left_box_line_p)
1343 x = s->x + eabs (s->face->box_line_width);
1344 else
1345 x = s->x;
1346
1347 s->char2b = char2b;
1348
1349 for (i = 0; i < s->nchars; i++, glyph++)
1350 {
1351 char buf[7], *str = NULL;
1352 int len = glyph->u.glyphless.len;
1353
1354 if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM)
1355 {
1356 if (len > 0
1357 && CHAR_TABLE_P (Vglyphless_char_display)
1358 && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display))
1359 >= 1))
1360 {
1361 Lisp_Object acronym
1362 = (! glyph->u.glyphless.for_no_font
1363 ? CHAR_TABLE_REF (Vglyphless_char_display,
1364 glyph->u.glyphless.ch)
1365 : XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
1366 if (STRINGP (acronym))
1367 str = (char *) SDATA (acronym);
1368 }
1369 }
1370 else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
1371 {
1372 sprintf ((char *) buf, "%0*X",
1373 glyph->u.glyphless.ch < 0x10000 ? 4 : 6,
1374 glyph->u.glyphless.ch);
1375 str = buf;
1376 }
1377
1378 if (str)
1379 {
1380 int upper_len = (len + 1) / 2;
1381 unsigned code;
1382
1383 /* It is assured that all LEN characters in STR is ASCII. */
1384 for (j = 0; j < len; j++)
1385 {
1386 code = s->font->driver->encode_char (s->font, str[j]);
1387 STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF);
1388 }
1389 s->font->driver->draw (s, 0, upper_len,
1390 x + glyph->slice.glyphless.upper_xoff,
1391 s->ybase + glyph->slice.glyphless.upper_yoff,
1392 0);
1393 s->font->driver->draw (s, upper_len, len,
1394 x + glyph->slice.glyphless.lower_xoff,
1395 s->ybase + glyph->slice.glyphless.lower_yoff,
1396 0);
1397 }
1398 if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
1399 XDrawRectangle (s->display, s->window, s->gc,
1400 x, s->ybase - glyph->ascent,
1401 glyph->pixel_width - 1,
1402 glyph->ascent + glyph->descent - 1);
1403 x += glyph->pixel_width;
1404 }
1405}
1406
1332#ifdef USE_X_TOOLKIT 1407#ifdef USE_X_TOOLKIT
1333 1408
1334static struct frame *x_frame_of_widget (Widget); 1409static struct frame *x_frame_of_widget (Widget);
@@ -2655,6 +2730,14 @@ x_draw_glyph_string (struct glyph_string *s)
2655 x_draw_composite_glyph_string_foreground (s); 2730 x_draw_composite_glyph_string_foreground (s);
2656 break; 2731 break;
2657 2732
2733 case GLYPHLESS_GLYPH:
2734 if (s->for_overlaps)
2735 s->background_filled_p = 1;
2736 else
2737 x_draw_glyph_string_background (s, 1);
2738 x_draw_glyphless_glyph_string_foreground (s);
2739 break;
2740
2658 default: 2741 default:
2659 abort (); 2742 abort ();
2660 } 2743 }
@@ -5702,6 +5785,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
5702 struct frame *f = NULL; 5785 struct frame *f = NULL;
5703 struct coding_system coding; 5786 struct coding_system coding;
5704 XEvent event = *eventp; 5787 XEvent event = *eventp;
5788 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5705 5789
5706 *finish = X_EVENT_NORMAL; 5790 *finish = X_EVENT_NORMAL;
5707 5791
@@ -6151,12 +6235,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6151 6235
6152 /* If mouse-highlight is an integer, input clears out 6236 /* If mouse-highlight is an integer, input clears out
6153 mouse highlighting. */ 6237 mouse highlighting. */
6154 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 6238 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
6155 && (f == 0 6239 && (f == 0
6156 || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) 6240 || !EQ (f->tool_bar_window, hlinfo->mouse_face_window)))
6157 { 6241 {
6158 clear_mouse_face (dpyinfo); 6242 clear_mouse_face (hlinfo);
6159 dpyinfo->mouse_face_hidden = 1; 6243 hlinfo->mouse_face_hidden = 1;
6160 } 6244 }
6161 6245
6162#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS 6246#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
@@ -6513,12 +6597,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6513 f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); 6597 f = x_top_window_to_frame (dpyinfo, event.xcrossing.window);
6514 if (f) 6598 if (f)
6515 { 6599 {
6516 if (f == dpyinfo->mouse_face_mouse_frame) 6600 if (f == hlinfo->mouse_face_mouse_frame)
6517 { 6601 {
6518 /* If we move outside the frame, then we're 6602 /* If we move outside the frame, then we're
6519 certainly no longer on any text in the frame. */ 6603 certainly no longer on any text in the frame. */
6520 clear_mouse_face (dpyinfo); 6604 clear_mouse_face (hlinfo);
6521 dpyinfo->mouse_face_mouse_frame = 0; 6605 hlinfo->mouse_face_mouse_frame = 0;
6522 } 6606 }
6523 6607
6524 /* Generate a nil HELP_EVENT to cancel a help-echo. 6608 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -6551,10 +6635,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6551 else 6635 else
6552 f = x_window_to_frame (dpyinfo, event.xmotion.window); 6636 f = x_window_to_frame (dpyinfo, event.xmotion.window);
6553 6637
6554 if (dpyinfo->mouse_face_hidden) 6638 if (hlinfo->mouse_face_hidden)
6555 { 6639 {
6556 dpyinfo->mouse_face_hidden = 0; 6640 hlinfo->mouse_face_hidden = 0;
6557 clear_mouse_face (dpyinfo); 6641 clear_mouse_face (hlinfo);
6558 } 6642 }
6559 6643
6560#ifdef USE_GTK 6644#ifdef USE_GTK
@@ -6572,7 +6656,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6572 6656
6573 window = window_from_coordinates (f, 6657 window = window_from_coordinates (f,
6574 event.xmotion.x, event.xmotion.y, 6658 event.xmotion.x, event.xmotion.y,
6575 0, 0, 0, 0); 6659 0, 0);
6576 6660
6577 /* Window will be selected only when it is not selected now and 6661 /* Window will be selected only when it is not selected now and
6578 last mouse movement event was not in it. Minibuffer window 6662 last mouse movement event was not in it. Minibuffer window
@@ -6609,7 +6693,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6609 6693
6610 /* If we move outside the frame, then we're 6694 /* If we move outside the frame, then we're
6611 certainly no longer on any text in the frame. */ 6695 certainly no longer on any text in the frame. */
6612 clear_mouse_face (dpyinfo); 6696 clear_mouse_face (hlinfo);
6613 } 6697 }
6614 6698
6615 /* If the contents of the global variable help_echo_string 6699 /* If the contents of the global variable help_echo_string
@@ -6711,7 +6795,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6711 int x = event.xbutton.x; 6795 int x = event.xbutton.x;
6712 int y = event.xbutton.y; 6796 int y = event.xbutton.y;
6713 6797
6714 window = window_from_coordinates (f, x, y, 0, 0, 0, 1); 6798 window = window_from_coordinates (f, x, y, 0, 1);
6715 tool_bar_p = EQ (window, f->tool_bar_window); 6799 tool_bar_p = EQ (window, f->tool_bar_window);
6716 6800
6717 if (tool_bar_p && event.xbutton.button < 4) 6801 if (tool_bar_p && event.xbutton.button < 4)
@@ -7669,44 +7753,43 @@ x_connection_closed (Display *dpy, const char *error_message)
7669 delete_frame (frame, Qnoelisp); 7753 delete_frame (frame, Qnoelisp);
7670 } 7754 }
7671 7755
7672 /* We have to close the display to inform Xt that it doesn't 7756 /* If DPYINFO is null, this means we didn't open the display in the
7673 exist anymore. If we don't, Xt will continue to wait for 7757 first place, so don't try to close it. */
7674 events from the display. As a consequence, a sequence of
7675
7676 M-x make-frame-on-display RET :1 RET
7677 ...kill the new frame, so that we get an IO error...
7678 M-x make-frame-on-display RET :1 RET
7679
7680 will indefinitely wait in Xt for events for display `:1', opened
7681 in the first call to make-frame-on-display.
7682
7683 Closing the display is reported to lead to a bus error on
7684 OpenWindows in certain situations. I suspect that is a bug
7685 in OpenWindows. I don't know how to circumvent it here. */
7686
7687 if (dpyinfo) 7758 if (dpyinfo)
7688 { 7759 {
7689#ifdef USE_X_TOOLKIT 7760#ifdef USE_X_TOOLKIT
7690 /* If DPYINFO is null, this means we didn't open the display 7761 /* We have to close the display to inform Xt that it doesn't
7691 in the first place, so don't try to close it. */ 7762 exist anymore. If we don't, Xt will continue to wait for
7692 { 7763 events from the display. As a consequence, a sequence of
7693 fatal_error_signal_hook = x_fatal_error_signal; 7764
7694 XtCloseDisplay (dpy); 7765 M-x make-frame-on-display RET :1 RET
7695 fatal_error_signal_hook = NULL; 7766 ...kill the new frame, so that we get an IO error...
7696 } 7767 M-x make-frame-on-display RET :1 RET
7697#endif 7768
7769 will indefinitely wait in Xt for events for display `:1',
7770 opened in the first call to make-frame-on-display.
7771
7772 Closing the display is reported to lead to a bus error on
7773 OpenWindows in certain situations. I suspect that is a bug
7774 in OpenWindows. I don't know how to circumvent it here. */
7775 fatal_error_signal_hook = x_fatal_error_signal;
7776 XtCloseDisplay (dpy);
7777 fatal_error_signal_hook = NULL;
7778#endif /* USE_X_TOOLKIT */
7698 7779
7699#ifdef USE_GTK 7780#ifdef USE_GTK
7700 /* Due to bugs in some Gtk+ versions, just exit here if this 7781 /* A long-standing GTK bug prevents proper disconnect handling
7701 is the last display/terminal. */ 7782 (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once,
7702 if (terminal_list->next_terminal == NULL) 7783 the resulting Glib error message loop filled a user's disk.
7703 { 7784 To avoid this, kill Emacs unconditionally on disconnect. */
7704 fprintf (stderr, "%s\n", error_msg); 7785 shut_down_emacs (0, 0, Qnil);
7705 Fkill_emacs (make_number (70)); 7786 fprintf (stderr, "%s\n\
7706 /* NOTREACHED */ 7787When compiled with GTK, Emacs cannot recover from X disconnects.\n\
7707 } 7788This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\
7708 xg_display_close (dpyinfo->display); 7789For details, see etc/PROBLEMS.\n",
7709#endif 7790 error_msg);
7791 abort ();
7792#endif /* USE_GTK */
7710 7793
7711 /* Indicate that this display is dead. */ 7794 /* Indicate that this display is dead. */
7712 dpyinfo->display = 0; 7795 dpyinfo->display = 0;
@@ -8199,12 +8282,11 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8199 http://freedesktop.org/wiki/Specifications/wm-spec. */ 8282 http://freedesktop.org/wiki/Specifications/wm-spec. */
8200 8283
8201static int 8284static int
8202wm_supports (struct frame *f, const char *atomname) 8285wm_supports (struct frame *f, Atom want_atom)
8203{ 8286{
8204 Atom actual_type; 8287 Atom actual_type;
8205 unsigned long actual_size, bytes_remaining; 8288 unsigned long actual_size, bytes_remaining;
8206 int i, rc, actual_format; 8289 int i, rc, actual_format;
8207 Atom prop_atom;
8208 Window wmcheck_window; 8290 Window wmcheck_window;
8209 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 8291 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8210 Window target_window = dpyinfo->root_window; 8292 Window target_window = dpyinfo->root_window;
@@ -8212,15 +8294,13 @@ wm_supports (struct frame *f, const char *atomname)
8212 Display *dpy = FRAME_X_DISPLAY (f); 8294 Display *dpy = FRAME_X_DISPLAY (f);
8213 unsigned char *tmp_data = NULL; 8295 unsigned char *tmp_data = NULL;
8214 Atom target_type = XA_WINDOW; 8296 Atom target_type = XA_WINDOW;
8215 Atom want_atom;
8216 8297
8217 BLOCK_INPUT; 8298 BLOCK_INPUT;
8218 8299
8219 prop_atom = XInternAtom (dpy, "_NET_SUPPORTING_WM_CHECK", False);
8220
8221 x_catch_errors (dpy); 8300 x_catch_errors (dpy);
8222 rc = XGetWindowProperty (dpy, target_window, 8301 rc = XGetWindowProperty (dpy, target_window,
8223 prop_atom, 0, max_len, False, target_type, 8302 dpyinfo->Xatom_net_supporting_wm_check,
8303 0, max_len, False, target_type,
8224 &actual_type, &actual_format, &actual_size, 8304 &actual_type, &actual_format, &actual_size,
8225 &bytes_remaining, &tmp_data); 8305 &bytes_remaining, &tmp_data);
8226 8306
@@ -8255,10 +8335,10 @@ wm_supports (struct frame *f, const char *atomname)
8255 dpyinfo->net_supported_window = 0; 8335 dpyinfo->net_supported_window = 0;
8256 8336
8257 target_type = XA_ATOM; 8337 target_type = XA_ATOM;
8258 prop_atom = XInternAtom (dpy, "_NET_SUPPORTED", False);
8259 tmp_data = NULL; 8338 tmp_data = NULL;
8260 rc = XGetWindowProperty (dpy, target_window, 8339 rc = XGetWindowProperty (dpy, target_window,
8261 prop_atom, 0, max_len, False, target_type, 8340 dpyinfo->Xatom_net_supported,
8341 0, max_len, False, target_type,
8262 &actual_type, &actual_format, &actual_size, 8342 &actual_type, &actual_format, &actual_size,
8263 &bytes_remaining, &tmp_data); 8343 &bytes_remaining, &tmp_data);
8264 8344
@@ -8276,7 +8356,6 @@ wm_supports (struct frame *f, const char *atomname)
8276 } 8356 }
8277 8357
8278 rc = 0; 8358 rc = 0;
8279 want_atom = XInternAtom (dpy, atomname, False);
8280 8359
8281 for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i) 8360 for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i)
8282 rc = dpyinfo->net_supported_atoms[i] == want_atom; 8361 rc = dpyinfo->net_supported_atoms[i] == want_atom;
@@ -8288,31 +8367,33 @@ wm_supports (struct frame *f, const char *atomname)
8288} 8367}
8289 8368
8290static void 8369static void
8291set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2) 8370set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value)
8292{ 8371{
8293 const char *atom = "_NET_WM_STATE"; 8372 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame));
8294 Fx_send_client_event (frame, make_number (0), frame, 8373
8295 make_unibyte_string (atom, strlen (atom)), 8374 x_send_client_event (frame, make_number (0), frame,
8296 make_number (32), 8375 dpyinfo->Xatom_net_wm_state,
8297 /* 1 = add, 0 = remove */ 8376 make_number (32),
8377 /* 1 = add, 0 = remove */
8378 Fcons
8379 (make_number (add ? 1 : 0),
8298 Fcons 8380 Fcons
8299 (make_number (add ? 1 : 0), 8381 (make_fixnum_or_float (atom),
8300 Fcons 8382 value != 0
8301 (make_unibyte_string (what, strlen (what)), 8383 ? Fcons (make_fixnum_or_float (value), Qnil)
8302 what2 != 0 8384 : Qnil)));
8303 ? Fcons (make_unibyte_string (what2, strlen (what2)),
8304 Qnil)
8305 : Qnil)));
8306} 8385}
8307 8386
8308void 8387void
8309x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) 8388x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
8310{ 8389{
8311 Lisp_Object frame; 8390 Lisp_Object frame;
8391 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8312 8392
8313 XSETFRAME (frame, f); 8393 XSETFRAME (frame, f);
8394
8314 set_wm_state (frame, NILP (new_value) ? 0 : 1, 8395 set_wm_state (frame, NILP (new_value) ? 0 : 1,
8315 "_NET_WM_STATE_STICKY", NULL); 8396 dpyinfo->Xatom_net_wm_state_sticky, None);
8316} 8397}
8317 8398
8318/* Return the current _NET_WM_STATE. 8399/* Return the current _NET_WM_STATE.
@@ -8320,7 +8401,7 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
8320 STICKY is set to 1 if the sticky state is set, 0 if not. */ 8401 STICKY is set to 1 if the sticky state is set, 0 if not. */
8321 8402
8322static void 8403static void
8323get_current_vm_state (struct frame *f, 8404get_current_wm_state (struct frame *f,
8324 Window window, 8405 Window window,
8325 int *size_state, 8406 int *size_state,
8326 int *sticky) 8407 int *sticky)
@@ -8371,7 +8452,7 @@ get_current_vm_state (struct frame *f,
8371 else 8452 else
8372 *size_state = FULLSCREEN_HEIGHT; 8453 *size_state = FULLSCREEN_HEIGHT;
8373 } 8454 }
8374 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom) 8455 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen)
8375 *size_state = FULLSCREEN_BOTH; 8456 *size_state = FULLSCREEN_BOTH;
8376 else if (a == dpyinfo->Xatom_net_wm_state_sticky) 8457 else if (a == dpyinfo->Xatom_net_wm_state_sticky)
8377 *sticky = 1; 8458 *sticky = 1;
@@ -8386,23 +8467,21 @@ get_current_vm_state (struct frame *f,
8386static int 8467static int
8387do_ewmh_fullscreen (struct frame *f) 8468do_ewmh_fullscreen (struct frame *f)
8388{ 8469{
8389 int have_net_atom = wm_supports (f, "_NET_WM_STATE"); 8470 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8471 int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state);
8390 Lisp_Object lval = get_frame_param (f, Qfullscreen); 8472 Lisp_Object lval = get_frame_param (f, Qfullscreen);
8391 int cur, dummy; 8473 int cur, dummy;
8392 8474
8393 get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); 8475 get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
8394 8476
8395 /* Some window managers don't say they support _NET_WM_STATE, but they do say 8477 /* Some window managers don't say they support _NET_WM_STATE, but they do say
8396 they support _NET_WM_STATE_FULLSCREEN. Try that also. */ 8478 they support _NET_WM_STATE_FULLSCREEN. Try that also. */
8397 if (!have_net_atom) 8479 if (!have_net_atom)
8398 have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN"); 8480 have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen);
8399 8481
8400 if (have_net_atom && cur != f->want_fullscreen) 8482 if (have_net_atom && cur != f->want_fullscreen)
8401 { 8483 {
8402 Lisp_Object frame; 8484 Lisp_Object frame;
8403 const char *fs = "_NET_WM_STATE_FULLSCREEN";
8404 const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ";
8405 const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT";
8406 8485
8407 XSETFRAME (frame, f); 8486 XSETFRAME (frame, f);
8408 8487
@@ -8414,33 +8493,38 @@ do_ewmh_fullscreen (struct frame *f)
8414 case FULLSCREEN_BOTH: 8493 case FULLSCREEN_BOTH:
8415 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED 8494 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED
8416 || cur == FULLSCREEN_HEIGHT) 8495 || cur == FULLSCREEN_HEIGHT)
8417 set_wm_state (frame, 0, fw, fh); 8496 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz,
8418 set_wm_state (frame, 1, fs, NULL); 8497 dpyinfo->Xatom_net_wm_state_maximized_vert);
8498 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_fullscreen, None);
8419 break; 8499 break;
8420 case FULLSCREEN_WIDTH: 8500 case FULLSCREEN_WIDTH:
8421 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT 8501 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT
8422 || cur == FULLSCREEN_MAXIMIZED) 8502 || cur == FULLSCREEN_MAXIMIZED)
8423 set_wm_state (frame, 0, fs, fh); 8503 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen,
8504 dpyinfo->Xatom_net_wm_state_maximized_vert);
8424 if (cur != FULLSCREEN_MAXIMIZED) 8505 if (cur != FULLSCREEN_MAXIMIZED)
8425 set_wm_state (frame, 1, fw, NULL); 8506 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, None);
8426 break; 8507 break;
8427 case FULLSCREEN_HEIGHT: 8508 case FULLSCREEN_HEIGHT:
8428 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH 8509 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH
8429 || cur == FULLSCREEN_MAXIMIZED) 8510 || cur == FULLSCREEN_MAXIMIZED)
8430 set_wm_state (frame, 0, fs, fw); 8511 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen,
8512 dpyinfo->Xatom_net_wm_state_maximized_horz);
8431 if (cur != FULLSCREEN_MAXIMIZED) 8513 if (cur != FULLSCREEN_MAXIMIZED)
8432 set_wm_state (frame, 1, fh, NULL); 8514 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_vert, None);
8433 break; 8515 break;
8434 case FULLSCREEN_MAXIMIZED: 8516 case FULLSCREEN_MAXIMIZED:
8435 if (cur == FULLSCREEN_BOTH) 8517 if (cur == FULLSCREEN_BOTH)
8436 set_wm_state (frame, 0, fs, NULL); 8518 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None);
8437 set_wm_state (frame, 1, fw, fh); 8519 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz,
8520 dpyinfo->Xatom_net_wm_state_maximized_vert);
8438 break; 8521 break;
8439 case FULLSCREEN_NONE: 8522 case FULLSCREEN_NONE:
8440 if (cur == FULLSCREEN_BOTH) 8523 if (cur == FULLSCREEN_BOTH)
8441 set_wm_state (frame, 0, fs, NULL); 8524 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None);
8442 else 8525 else
8443 set_wm_state (frame, 0, fw, fh); 8526 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz,
8527 dpyinfo->Xatom_net_wm_state_maximized_vert);
8444 } 8528 }
8445 8529
8446 f->want_fullscreen = FULLSCREEN_NONE; 8530 f->want_fullscreen = FULLSCREEN_NONE;
@@ -8470,7 +8554,7 @@ x_handle_net_wm_state (struct frame *f, XPropertyEvent *event)
8470 Lisp_Object lval; 8554 Lisp_Object lval;
8471 int sticky = 0; 8555 int sticky = 0;
8472 8556
8473 get_current_vm_state (f, event->window, &value, &sticky); 8557 get_current_wm_state (f, event->window, &value, &sticky);
8474 lval = Qnil; 8558 lval = Qnil;
8475 switch (value) 8559 switch (value)
8476 { 8560 {
@@ -8880,17 +8964,17 @@ x_ewmh_activate_frame (FRAME_PTR f)
8880 /* See Window Manager Specification/Extended Window Manager Hints at 8964 /* See Window Manager Specification/Extended Window Manager Hints at
8881 http://freedesktop.org/wiki/Specifications/wm-spec */ 8965 http://freedesktop.org/wiki/Specifications/wm-spec */
8882 8966
8883 const char *atom = "_NET_ACTIVE_WINDOW"; 8967 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8884 if (f->async_visible && wm_supports (f, atom)) 8968 if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window))
8885 { 8969 {
8886 Lisp_Object frame; 8970 Lisp_Object frame;
8887 XSETFRAME (frame, f); 8971 XSETFRAME (frame, f);
8888 Fx_send_client_event (frame, make_number (0), frame, 8972 x_send_client_event (frame, make_number (0), frame,
8889 make_unibyte_string (atom, strlen (atom)), 8973 dpyinfo->Xatom_net_active_window,
8890 make_number (32), 8974 make_number (32),
8891 Fcons (make_number (1), 8975 Fcons (make_number (1),
8892 Fcons (make_number (last_user_time), 8976 Fcons (make_number (last_user_time),
8893 Qnil))); 8977 Qnil)));
8894 } 8978 }
8895} 8979}
8896 8980
@@ -8910,13 +8994,13 @@ xembed_set_info (struct frame *f, enum xembed_info flags)
8910{ 8994{
8911 Atom atom; 8995 Atom atom;
8912 unsigned long data[2]; 8996 unsigned long data[2];
8913 8997 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8914 atom = XInternAtom (FRAME_X_DISPLAY (f), "_XEMBED_INFO", False);
8915 8998
8916 data[0] = XEMBED_VERSION; 8999 data[0] = XEMBED_VERSION;
8917 data[1] = flags; 9000 data[1] = flags;
8918 9001
8919 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), atom, atom, 9002 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
9003 dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO,
8920 32, PropModeReplace, (unsigned char *) data, 2); 9004 32, PropModeReplace, (unsigned char *) data, 2);
8921} 9005}
8922 9006
@@ -9300,6 +9384,7 @@ x_free_frame_resources (struct frame *f)
9300 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 9384 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
9301 Lisp_Object bar; 9385 Lisp_Object bar;
9302 struct scroll_bar *b; 9386 struct scroll_bar *b;
9387 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
9303 9388
9304 BLOCK_INPUT; 9389 BLOCK_INPUT;
9305 9390
@@ -9393,15 +9478,15 @@ x_free_frame_resources (struct frame *f)
9393 if (f == dpyinfo->x_highlight_frame) 9478 if (f == dpyinfo->x_highlight_frame)
9394 dpyinfo->x_highlight_frame = 0; 9479 dpyinfo->x_highlight_frame = 0;
9395 9480
9396 if (f == dpyinfo->mouse_face_mouse_frame) 9481 if (f == hlinfo->mouse_face_mouse_frame)
9397 { 9482 {
9398 dpyinfo->mouse_face_beg_row 9483 hlinfo->mouse_face_beg_row
9399 = dpyinfo->mouse_face_beg_col = -1; 9484 = hlinfo->mouse_face_beg_col = -1;
9400 dpyinfo->mouse_face_end_row 9485 hlinfo->mouse_face_end_row
9401 = dpyinfo->mouse_face_end_col = -1; 9486 = hlinfo->mouse_face_end_col = -1;
9402 dpyinfo->mouse_face_window = Qnil; 9487 hlinfo->mouse_face_window = Qnil;
9403 dpyinfo->mouse_face_deferred_gc = 0; 9488 hlinfo->mouse_face_deferred_gc = 0;
9404 dpyinfo->mouse_face_mouse_frame = 0; 9489 hlinfo->mouse_face_mouse_frame = 0;
9405 } 9490 }
9406 9491
9407 UNBLOCK_INPUT; 9492 UNBLOCK_INPUT;
@@ -9778,6 +9863,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9778 struct terminal *terminal; 9863 struct terminal *terminal;
9779 struct x_display_info *dpyinfo; 9864 struct x_display_info *dpyinfo;
9780 XrmDatabase xrdb; 9865 XrmDatabase xrdb;
9866 Mouse_HLInfo *hlinfo;
9781 9867
9782 BLOCK_INPUT; 9868 BLOCK_INPUT;
9783 9869
@@ -9908,6 +9994,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9908 9994
9909 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); 9995 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
9910 memset (dpyinfo, 0, sizeof *dpyinfo); 9996 memset (dpyinfo, 0, sizeof *dpyinfo);
9997 hlinfo = &dpyinfo->mouse_highlight;
9911 9998
9912 terminal = x_create_terminal (dpyinfo); 9999 terminal = x_create_terminal (dpyinfo);
9913 10000
@@ -10030,16 +10117,16 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10030 dpyinfo->bitmaps_size = 0; 10117 dpyinfo->bitmaps_size = 0;
10031 dpyinfo->bitmaps_last = 0; 10118 dpyinfo->bitmaps_last = 0;
10032 dpyinfo->scratch_cursor_gc = 0; 10119 dpyinfo->scratch_cursor_gc = 0;
10033 dpyinfo->mouse_face_mouse_frame = 0; 10120 hlinfo->mouse_face_mouse_frame = 0;
10034 dpyinfo->mouse_face_deferred_gc = 0; 10121 hlinfo->mouse_face_deferred_gc = 0;
10035 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 10122 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
10036 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 10123 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
10037 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 10124 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
10038 dpyinfo->mouse_face_window = Qnil; 10125 hlinfo->mouse_face_window = Qnil;
10039 dpyinfo->mouse_face_overlay = Qnil; 10126 hlinfo->mouse_face_overlay = Qnil;
10040 dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; 10127 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
10041 dpyinfo->mouse_face_defer = 0; 10128 hlinfo->mouse_face_defer = 0;
10042 dpyinfo->mouse_face_hidden = 0; 10129 hlinfo->mouse_face_hidden = 0;
10043 dpyinfo->x_focus_frame = 0; 10130 dpyinfo->x_focus_frame = 0;
10044 dpyinfo->x_focus_event_frame = 0; 10131 dpyinfo->x_focus_event_frame = 0;
10045 dpyinfo->x_highlight_frame = 0; 10132 dpyinfo->x_highlight_frame = 0;
@@ -10107,88 +10194,97 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10107 dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; 10194 dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm;
10108 } 10195 }
10109 10196
10110 dpyinfo->Xatom_wm_protocols 10197 {
10111 = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False); 10198 const struct
10112 dpyinfo->Xatom_wm_take_focus 10199 {
10113 = XInternAtom (dpyinfo->display, "WM_TAKE_FOCUS", False); 10200 const char *name;
10114 dpyinfo->Xatom_wm_save_yourself 10201 Atom *atom;
10115 = XInternAtom (dpyinfo->display, "WM_SAVE_YOURSELF", False); 10202 } atom_refs[] = {
10116 dpyinfo->Xatom_wm_delete_window 10203 { "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols },
10117 = XInternAtom (dpyinfo->display, "WM_DELETE_WINDOW", False); 10204 { "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus },
10118 dpyinfo->Xatom_wm_change_state 10205 { "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself },
10119 = XInternAtom (dpyinfo->display, "WM_CHANGE_STATE", False); 10206 { "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window },
10120 dpyinfo->Xatom_wm_configure_denied 10207 { "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state },
10121 = XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); 10208 { "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied },
10122 dpyinfo->Xatom_wm_window_moved 10209 { "WM_MOVED", &dpyinfo->Xatom_wm_window_moved },
10123 = XInternAtom (dpyinfo->display, "WM_MOVED", False); 10210 { "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader },
10124 dpyinfo->Xatom_wm_client_leader 10211 { "Editres", &dpyinfo->Xatom_editres },
10125 = XInternAtom (dpyinfo->display, "WM_CLIENT_LEADER", False); 10212 { "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD },
10126 dpyinfo->Xatom_editres 10213 { "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP },
10127 = XInternAtom (dpyinfo->display, "Editres", False); 10214 { "TEXT", &dpyinfo->Xatom_TEXT },
10128 dpyinfo->Xatom_CLIPBOARD 10215 { "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT },
10129 = XInternAtom (dpyinfo->display, "CLIPBOARD", False); 10216 { "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING },
10130 dpyinfo->Xatom_TIMESTAMP 10217 { "DELETE", &dpyinfo->Xatom_DELETE },
10131 = XInternAtom (dpyinfo->display, "TIMESTAMP", False); 10218 { "MULTIPLE", &dpyinfo->Xatom_MULTIPLE },
10132 dpyinfo->Xatom_TEXT 10219 { "INCR", &dpyinfo->Xatom_INCR },
10133 = XInternAtom (dpyinfo->display, "TEXT", False); 10220 { "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP },
10134 dpyinfo->Xatom_COMPOUND_TEXT 10221 { "TARGETS", &dpyinfo->Xatom_TARGETS },
10135 = XInternAtom (dpyinfo->display, "COMPOUND_TEXT", False); 10222 { "NULL", &dpyinfo->Xatom_NULL },
10136 dpyinfo->Xatom_UTF8_STRING 10223 { "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR },
10137 = XInternAtom (dpyinfo->display, "UTF8_STRING", False); 10224 { "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO },
10138 dpyinfo->Xatom_DELETE 10225 /* For properties of font. */
10139 = XInternAtom (dpyinfo->display, "DELETE", False); 10226 { "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE },
10140 dpyinfo->Xatom_MULTIPLE 10227 { "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH },
10141 = XInternAtom (dpyinfo->display, "MULTIPLE", False); 10228 { "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET },
10142 dpyinfo->Xatom_INCR 10229 { "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE },
10143 = XInternAtom (dpyinfo->display, "INCR", False); 10230 { "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT },
10144 dpyinfo->Xatom_EMACS_TMP 10231 /* Ghostscript support. */
10145 = XInternAtom (dpyinfo->display, "_EMACS_TMP_", False); 10232 { "DONE", &dpyinfo->Xatom_DONE },
10146 dpyinfo->Xatom_TARGETS 10233 { "PAGE", &dpyinfo->Xatom_PAGE },
10147 = XInternAtom (dpyinfo->display, "TARGETS", False); 10234 { "SCROLLBAR", &dpyinfo->Xatom_Scrollbar },
10148 dpyinfo->Xatom_NULL 10235 { "_XEMBED", &dpyinfo->Xatom_XEMBED },
10149 = XInternAtom (dpyinfo->display, "NULL", False); 10236 /* EWMH */
10150 dpyinfo->Xatom_ATOM_PAIR 10237 { "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state },
10151 = XInternAtom (dpyinfo->display, "ATOM_PAIR", False); 10238 { "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen },
10152 /* For properties of font. */ 10239 { "_NET_WM_STATE_MAXIMIZED_HORZ",
10153 dpyinfo->Xatom_PIXEL_SIZE 10240 &dpyinfo->Xatom_net_wm_state_maximized_horz },
10154 = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False); 10241 { "_NET_WM_STATE_MAXIMIZED_VERT",
10155 dpyinfo->Xatom_AVERAGE_WIDTH 10242 &dpyinfo->Xatom_net_wm_state_maximized_vert },
10156 = XInternAtom (dpyinfo->display, "AVERAGE_WIDTH", False); 10243 { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky },
10157 dpyinfo->Xatom_MULE_BASELINE_OFFSET 10244 { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type },
10158 = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False); 10245 { "_NET_WM_WINDOW_TYPE_TOOLTIP",
10159 dpyinfo->Xatom_MULE_RELATIVE_COMPOSE 10246 &dpyinfo->Xatom_net_window_type_tooltip },
10160 = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False); 10247 { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name },
10161 dpyinfo->Xatom_MULE_DEFAULT_ASCENT 10248 { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name },
10162 = XInternAtom (dpyinfo->display, "_MULE_DEFAULT_ASCENT", False); 10249 { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported },
10163 10250 { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supporting_wm_check },
10164 /* Ghostscript support. */ 10251 { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity },
10165 dpyinfo->Xatom_PAGE = XInternAtom (dpyinfo->display, "PAGE", False); 10252 { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window },
10166 dpyinfo->Xatom_DONE = XInternAtom (dpyinfo->display, "DONE", False); 10253 { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents },
10167 10254 /* Session management */
10168 dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR", 10255 { "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID },
10169 False); 10256 { "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop },
10170 10257 { "MANAGER", &dpyinfo->Xatom_xsettings_mgr },
10171 dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED", 10258 };
10172 False); 10259
10173 10260 int i;
10174 dpyinfo->Xatom_net_wm_state 10261 const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]);
10175 = XInternAtom (dpyinfo->display, "_NET_WM_STATE", False); 10262 /* 1 for _XSETTINGS_SN */
10176 dpyinfo->Xatom_net_wm_state_fullscreen_atom 10263 const int total_atom_count = 1 + atom_count;
10177 = XInternAtom (dpyinfo->display, "_NET_WM_STATE_FULLSCREEN", False); 10264 Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count);
10178 dpyinfo->Xatom_net_wm_state_maximized_horz 10265 char **atom_names = xmalloc (sizeof (char *) * total_atom_count);
10179 = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); 10266 char xsettings_atom_name[64];
10180 dpyinfo->Xatom_net_wm_state_maximized_vert 10267
10181 = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_VERT", False); 10268 for (i = 0; i < atom_count; i++)
10182 dpyinfo->Xatom_net_wm_state_sticky 10269 atom_names[i] = (char *) atom_refs[i].name;
10183 = XInternAtom (dpyinfo->display, "_NET_WM_STATE_STICKY", False); 10270
10184 dpyinfo->Xatom_net_window_type 10271 /* Build _XSETTINGS_SN atom name */
10185 = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False); 10272 snprintf (xsettings_atom_name, sizeof (xsettings_atom_name),
10186 dpyinfo->Xatom_net_window_type_tooltip 10273 "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen));
10187 = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); 10274 atom_names[i] = xsettings_atom_name;
10188 dpyinfo->Xatom_net_wm_icon_name 10275
10189 = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False); 10276 XInternAtoms (dpyinfo->display, atom_names, total_atom_count,
10190 dpyinfo->Xatom_net_wm_name 10277 False, atoms_return);
10191 = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); 10278
10279 for (i = 0; i < atom_count; i++)
10280 *atom_refs[i].atom = atoms_return[i];
10281
10282 /* Manual copy of last atom */
10283 dpyinfo->Xatom_xsettings_sel = atoms_return[i];
10284
10285 xfree (atom_names);
10286 xfree (atoms_return);
10287 }
10192 10288
10193 dpyinfo->x_dnd_atoms_size = 8; 10289 dpyinfo->x_dnd_atoms_size = 8;
10194 dpyinfo->x_dnd_atoms_length = 0; 10290 dpyinfo->x_dnd_atoms_length = 0;
@@ -10682,9 +10778,11 @@ selected window or cursor position is preserved. */);
10682 x_mouse_click_focus_ignore_position = 0; 10778 x_mouse_click_focus_ignore_position = 0;
10683 10779
10684 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 10780 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
10685 doc: /* What X toolkit scroll bars Emacs uses. 10781 doc: /* Which toolkit scroll bars Emacs uses, if any.
10686A value of nil means Emacs doesn't use X toolkit scroll bars. 10782A value of nil means Emacs doesn't use toolkit scroll bars.
10687Otherwise, value is a symbol describing the X toolkit. */); 10783With the X Window system, the value is a symbol describing the
10784X toolkit. Possible values are: gtk, motif, xaw, or xaw3d.
10785With MS Windows, the value is t. */);
10688#ifdef USE_TOOLKIT_SCROLL_BARS 10786#ifdef USE_TOOLKIT_SCROLL_BARS
10689#ifdef USE_MOTIF 10787#ifdef USE_MOTIF
10690 Vx_toolkit_scroll_bars = intern_c_string ("motif"); 10788 Vx_toolkit_scroll_bars = intern_c_string ("motif");
@@ -10750,5 +10848,3 @@ default is nil, which is the same as `super'. */);
10750 10848
10751#endif /* HAVE_X_WINDOWS */ 10849#endif /* HAVE_X_WINDOWS */
10752 10850
10753/* arch-tag: 6d4e4cb7-abc1-4302-9585-d84dcfb09d0f
10754 (do not change this comment) */