Mercurial > emacs
comparison src/xterm.c @ 88123:375f2633d815
New directory
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 08 Sep 2003 11:56:09 +0000 |
parents | 695cf19ef79e |
children | 2f877ed80fa6 |
comparison
equal
deleted
inserted
replaced
52428:27bc8b966642 | 88123:375f2633d815 |
---|---|
10118 && (*name1 == '.' || *name1 == '\0') | 10118 && (*name1 == '.' || *name1 == '\0') |
10119 && (*name2 == '.' || *name2 == '\0')); | 10119 && (*name2 == '.' || *name2 == '\0')); |
10120 } | 10120 } |
10121 #endif | 10121 #endif |
10122 | 10122 |
10123 /* Count number of set bits in mask and number of bits to shift to | |
10124 get to the first bit. With MASK 0x7e0, *BITS is set to 6, and *OFFSET | |
10125 to 5. */ | |
10126 static void | |
10127 get_bits_and_offset (mask, bits, offset) | |
10128 unsigned long mask; | |
10129 int *bits; | |
10130 int *offset; | |
10131 { | |
10132 int nr = 0; | |
10133 int off = 0; | |
10134 | |
10135 while (!(mask & 1)) | |
10136 { | |
10137 off++; | |
10138 mask >>= 1; | |
10139 } | |
10140 | |
10141 while (mask & 1) | |
10142 { | |
10143 nr++; | |
10144 mask >>= 1; | |
10145 } | |
10146 | |
10147 *offset = off; | |
10148 *bits = nr; | |
10149 } | |
10150 | |
10151 struct x_display_info * | 10123 struct x_display_info * |
10152 x_term_init (display_name, xrm_option, resource_name) | 10124 x_term_init (display_name, xrm_option, resource_name) |
10153 Lisp_Object display_name; | 10125 Lisp_Object display_name; |
10154 char *xrm_option; | 10126 char *xrm_option; |
10155 char *resource_name; | 10127 char *resource_name; |
10162 BLOCK_INPUT; | 10134 BLOCK_INPUT; |
10163 | 10135 |
10164 if (!x_initialized) | 10136 if (!x_initialized) |
10165 { | 10137 { |
10166 x_initialize (); | 10138 x_initialize (); |
10167 ++x_initialized; | 10139 x_initialized = 1; |
10168 } | 10140 } |
10169 | 10141 |
10170 #ifdef USE_GTK | 10142 #ifdef USE_GTK |
10171 { | 10143 { |
10172 #define NUM_ARGV 10 | 10144 #define NUM_ARGV 10 |
10178 /* GTK 2.0 can only handle one display, GTK 2.2 can handle more | 10150 /* GTK 2.0 can only handle one display, GTK 2.2 can handle more |
10179 than one, but this remains to be implemented. */ | 10151 than one, but this remains to be implemented. */ |
10180 if (x_initialized > 1) | 10152 if (x_initialized > 1) |
10181 return 0; | 10153 return 0; |
10182 | 10154 |
10155 x_initialized++; | |
10156 | |
10183 for (argc = 0; argc < NUM_ARGV; ++argc) | 10157 for (argc = 0; argc < NUM_ARGV; ++argc) |
10184 argv[argc] = 0; | 10158 argv[argc] = 0; |
10185 | 10159 |
10186 argc = 0; | 10160 argc = 0; |
10187 argv[argc++] = initial_argv[0]; | 10161 argv[argc++] = initial_argv[0]; |
10218 | 10192 |
10219 GCPRO2 (s, abs_file); | 10193 GCPRO2 (s, abs_file); |
10220 s = make_string (file, strlen (file)); | 10194 s = make_string (file, strlen (file)); |
10221 abs_file = Fexpand_file_name(s, Qnil); | 10195 abs_file = Fexpand_file_name(s, Qnil); |
10222 | 10196 |
10223 if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file))) | 10197 if (! NILP (abs_file) && Ffile_readable_p (abs_file)) |
10224 gtk_rc_parse (SDATA (abs_file)); | 10198 gtk_rc_parse (SDATA (abs_file)); |
10225 | 10199 |
10226 UNGCPRO; | 10200 UNGCPRO; |
10227 } | 10201 } |
10228 | 10202 |
10367 select_visual (dpyinfo); | 10341 select_visual (dpyinfo); |
10368 dpyinfo->cmap = DefaultColormapOfScreen (dpyinfo->screen); | 10342 dpyinfo->cmap = DefaultColormapOfScreen (dpyinfo->screen); |
10369 dpyinfo->height = HeightOfScreen (dpyinfo->screen); | 10343 dpyinfo->height = HeightOfScreen (dpyinfo->screen); |
10370 dpyinfo->width = WidthOfScreen (dpyinfo->screen); | 10344 dpyinfo->width = WidthOfScreen (dpyinfo->screen); |
10371 dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen); | 10345 dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen); |
10372 dpyinfo->client_leader_window = 0; | |
10373 dpyinfo->grabbed = 0; | 10346 dpyinfo->grabbed = 0; |
10374 dpyinfo->reference_count = 0; | 10347 dpyinfo->reference_count = 0; |
10375 dpyinfo->icon_bitmap_id = -1; | 10348 dpyinfo->icon_bitmap_id = -1; |
10376 dpyinfo->font_table = NULL; | 10349 dpyinfo->font_table = NULL; |
10377 dpyinfo->n_fonts = 0; | 10350 dpyinfo->n_fonts = 0; |
10393 dpyinfo->x_focus_frame = 0; | 10366 dpyinfo->x_focus_frame = 0; |
10394 dpyinfo->x_focus_event_frame = 0; | 10367 dpyinfo->x_focus_event_frame = 0; |
10395 dpyinfo->x_highlight_frame = 0; | 10368 dpyinfo->x_highlight_frame = 0; |
10396 dpyinfo->image_cache = make_image_cache (); | 10369 dpyinfo->image_cache = make_image_cache (); |
10397 | 10370 |
10398 /* See if we can construct pixel values from RGB values. */ | |
10399 dpyinfo->red_bits = dpyinfo->blue_bits = dpyinfo->green_bits = 0; | |
10400 dpyinfo->red_offset = dpyinfo->blue_offset = dpyinfo->green_offset = 0; | |
10401 | |
10402 if (dpyinfo->visual->class == TrueColor) | |
10403 { | |
10404 get_bits_and_offset (dpyinfo->visual->red_mask, | |
10405 &dpyinfo->red_bits, &dpyinfo->red_offset); | |
10406 get_bits_and_offset (dpyinfo->visual->blue_mask, | |
10407 &dpyinfo->blue_bits, &dpyinfo->blue_offset); | |
10408 get_bits_and_offset (dpyinfo->visual->green_mask, | |
10409 &dpyinfo->green_bits, &dpyinfo->green_offset); | |
10410 } | |
10411 | |
10412 /* See if a private colormap is requested. */ | 10371 /* See if a private colormap is requested. */ |
10413 if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) | 10372 if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) |
10414 { | 10373 { |
10415 if (dpyinfo->visual->class == PseudoColor) | 10374 if (dpyinfo->visual->class == PseudoColor) |
10416 { | 10375 { |
10451 = XInternAtom (dpyinfo->display, "WM_CHANGE_STATE", False); | 10410 = XInternAtom (dpyinfo->display, "WM_CHANGE_STATE", False); |
10452 dpyinfo->Xatom_wm_configure_denied | 10411 dpyinfo->Xatom_wm_configure_denied |
10453 = XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); | 10412 = XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); |
10454 dpyinfo->Xatom_wm_window_moved | 10413 dpyinfo->Xatom_wm_window_moved |
10455 = XInternAtom (dpyinfo->display, "WM_MOVED", False); | 10414 = XInternAtom (dpyinfo->display, "WM_MOVED", False); |
10456 dpyinfo->Xatom_wm_client_leader | |
10457 = XInternAtom (dpyinfo->display, "WM_CLIENT_LEADER", False); | |
10458 dpyinfo->Xatom_editres | 10415 dpyinfo->Xatom_editres |
10459 = XInternAtom (dpyinfo->display, "Editres", False); | 10416 = XInternAtom (dpyinfo->display, "Editres", False); |
10460 dpyinfo->Xatom_CLIPBOARD | 10417 dpyinfo->Xatom_CLIPBOARD |
10461 = XInternAtom (dpyinfo->display, "CLIPBOARD", False); | 10418 = XInternAtom (dpyinfo->display, "CLIPBOARD", False); |
10462 dpyinfo->Xatom_TIMESTAMP | 10419 dpyinfo->Xatom_TIMESTAMP |
10607 || !strcmp (XSTRING (value)->data, "on"))) | 10564 || !strcmp (XSTRING (value)->data, "on"))) |
10608 use_xim = 1; | 10565 use_xim = 1; |
10609 #endif | 10566 #endif |
10610 } | 10567 } |
10611 | 10568 |
10612 #ifdef HAVE_X_SM | |
10613 /* Only do this for the first display. */ | |
10614 if (x_initialized == 1) | |
10615 x_session_initialize (dpyinfo); | |
10616 #endif | |
10617 | |
10618 UNBLOCK_INPUT; | 10569 UNBLOCK_INPUT; |
10619 | 10570 |
10620 return dpyinfo; | 10571 return dpyinfo; |
10621 } | 10572 } |
10622 | 10573 |
10826 #ifdef SIGWINCH | 10777 #ifdef SIGWINCH |
10827 signal (SIGWINCH, SIG_DFL); | 10778 signal (SIGWINCH, SIG_DFL); |
10828 #endif /* SIGWINCH */ | 10779 #endif /* SIGWINCH */ |
10829 | 10780 |
10830 signal (SIGPIPE, x_connection_signal); | 10781 signal (SIGPIPE, x_connection_signal); |
10782 | |
10783 #ifdef HAVE_X_SM | |
10784 x_session_initialize (); | |
10785 #endif | |
10831 } | 10786 } |
10832 | 10787 |
10833 | 10788 |
10834 void | 10789 void |
10835 syms_of_xterm () | 10790 syms_of_xterm () |
10928 make_float (DEFAULT_REHASH_THRESHOLD), | 10883 make_float (DEFAULT_REHASH_THRESHOLD), |
10929 Qnil, Qnil, Qnil); | 10884 Qnil, Qnil, Qnil); |
10930 } | 10885 } |
10931 | 10886 |
10932 #endif /* HAVE_X_WINDOWS */ | 10887 #endif /* HAVE_X_WINDOWS */ |
10933 | |
10934 /* arch-tag: 6d4e4cb7-abc1-4302-9585-d84dcfb09d0f | |
10935 (do not change this comment) */ |