annotate src/redisplay-xlike-inc.c @ 4976:16112448d484

Rename xfree(FOO, TYPE) -> xfree(FOO) -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-04 Ben Wing <ben@xemacs.org> * alloc.c (release_breathing_space): * alloc.c (resize_string): * alloc.c (sweep_lcrecords_1): * alloc.c (SWEEP_FIXED_TYPE_BLOCK_1): * alloc.c (ADDITIONAL_FREE_compiled_function): * alloc.c (compact_string_chars): * alloc.c (ADDITIONAL_FREE_string): * alloc.c (sweep_strings): * alloca.c (xemacs_c_alloca): * alsaplay.c (alsa_play_sound_file): * buffer.c (init_initial_directory): * buffer.h: * buffer.h (BUFFER_FREE): * console-stream.c (stream_delete_console): * console-tty.c (free_tty_console_struct): * data.c (Fnumber_to_string): * device-gtk.c (gtk_init_device): * device-gtk.c (free_gtk_device_struct): * device-gtk.c (gtk_delete_device): * device-msw.c (mswindows_delete_device): * device-msw.c (msprinter_delete_device): * device-tty.c (free_tty_device_struct): * device-tty.c (tty_delete_device): * device-x.c (x_init_device): * device-x.c (free_x_device_struct): * device-x.c (x_delete_device): * dialog-msw.c (handle_directory_dialog_box): * dialog-x.c (dbox_descriptor_to_widget_value): * dired-msw.c (Fmswindows_insert_directory): * dired.c (free_user_cache): * dired.c (user_name_completion_unwind): * doc.c (unparesseuxify_doc_string): * doc.c (Fsubstitute_command_keys): * doprnt.c (emacs_doprnt_1): * dumper.c (pdump_load_finish): * dumper.c (pdump_file_free): * dumper.c (pdump_file_unmap): * dynarr.c: * dynarr.c (Dynarr_free): * editfns.c (uncache_home_directory): * editfns.c (Fset_time_zone_rule): * elhash.c: * elhash.c (pdump_reorganize_hash_table): * elhash.c (maphash_unwind): * emacs.c (make_arg_list_1): * emacs.c (free_argc_argv): * emacs.c (sort_args): * emacs.c (Frunning_temacs_p): * emodules.c (attempt_module_delete): * eval.c (free_pointer): * event-Xt.c (unselect_filedesc): * event-Xt.c (emacs_Xt_select_process): * event-gtk.c (unselect_filedesc): * event-gtk.c (dragndrop_data_received): * event-msw.c (winsock_closer): * event-msw.c (mswindows_dde_callback): * event-msw.c (mswindows_wnd_proc): * event-stream.c (finalize_command_builder): * event-stream.c (free_command_builder): * extents.c (free_gap_array): * extents.c (free_extent_list): * extents.c (free_soe): * extents.c (extent_fragment_delete): * extents.c (extent_priority_sort_function): * file-coding.c (make_coding_system_1): * file-coding.c (coding_finalizer): * file-coding.c (set_coding_stream_coding_system): * file-coding.c (chain_finalize_coding_stream_1): * file-coding.c (chain_finalize): * file-coding.c (free_detection_state): * file-coding.c (coding_category_symbol_to_id): * fileio.c: * fileio.c (Ffile_name_directory): * fileio.c (if): * fileio.c (Ffile_symlink_p): * filelock.c (FREE_LOCK_INFO): * filelock.c (current_lock_owner): * font-mgr.c (Ffc_name_unparse): * font-mgr.c (Ffc_pattern_duplicate): * frame-gtk.c (gtk_delete_frame): * frame-msw.c (mswindows_delete_frame): * frame-msw.c (msprinter_delete_frame): * frame-x.c (x_cde_destroy_callback): * frame-x.c (Fcde_start_drag_internal): * frame-x.c (x_cde_transfer_callback): * frame-x.c (x_delete_frame): * frame.c (update_frame_title): * frame.c (Fset_frame_pointer): * gc.c (register_for_finalization): * gccache-gtk.c (free_gc_cache): * gccache-gtk.c (gc_cache_lookup): * gccache-x.c (free_gc_cache): * gccache-x.c (gc_cache_lookup): * glyphs-eimage.c: * glyphs-eimage.c (jpeg_instantiate_unwind): * glyphs-eimage.c (gif_instantiate_unwind): * glyphs-eimage.c (png_instantiate_unwind): * glyphs-eimage.c (png_instantiate): * glyphs-eimage.c (tiff_instantiate_unwind): * glyphs-gtk.c (convert_EImage_to_GDKImage): * glyphs-gtk.c (gtk_finalize_image_instance): * glyphs-gtk.c (gtk_init_image_instance_from_eimage): * glyphs-gtk.c (gtk_xpm_instantiate): * glyphs-msw.c (convert_EImage_to_DIBitmap): * glyphs-msw.c (mswindows_init_image_instance_from_eimage): * glyphs-msw.c (mswindows_initialize_image_instance_mask): * glyphs-msw.c (xpm_to_eimage): * glyphs-msw.c (mswindows_xpm_instantiate): * glyphs-msw.c (xbm_create_bitmap_from_data): * glyphs-msw.c (mswindows_finalize_image_instance): * glyphs-x.c (convert_EImage_to_XImage): * glyphs-x.c (x_finalize_image_instance): * glyphs-x.c (x_init_image_instance_from_eimage): * glyphs-x.c (x_xpm_instantiate): * gui-x.c (free_popup_widget_value_tree): * hash.c (free_hash_table): * hash.c (grow_hash_table): * hash.c (pregrow_hash_table_if_necessary): * imgproc.c (build_EImage_quantable): * insdel.c (uninit_buffer_text): * intl-win32.c (convert_multibyte_to_internal_malloc): * intl.c: * intl.c (Fset_current_locale): * keymap.c: * keymap.c (where_is_recursive_mapper): * keymap.c (where_is_internal): * lisp.h: * lisp.h (xfree): * lstream.c (Lstream_close): * lstream.c (resizing_buffer_closer): * mule-coding.c: * mule-coding.c (iso2022_finalize_detection_state): * nt.c: * nt.c (mswindows_get_long_filename): * nt.c (nt_get_resource): * nt.c (init_mswindows_environment): * nt.c (get_cached_volume_information): * nt.c (mswindows_opendir): * nt.c (mswindows_closedir): * nt.c (mswindows_readdir): * nt.c (mswindows_stat): * nt.c (mswindows_getdcwd): * nt.c (Fmswindows_long_file_name): * ntplay.c (nt_play_sound_file): * ntplay.c (play_sound_data_1): * number-gmp.c (gmp_free): * number-gmp.c (init_number_gmp): * number-mp.c (bignum_to_string): * number-mp.c (BIGNUM_TO_TYPE): * number.c (bignum_print): * number.c (bignum_convfree): * number.c (ratio_print): * number.c (bigfloat_print): * number.c (bigfloat_finalize): * objects-gtk.c (gtk_finalize_color_instance): * objects-gtk.c (gtk_finalize_font_instance): * objects-msw.c (mswindows_finalize_color_instance): * objects-msw.c (mswindows_finalize_font_instance): * objects-tty.c (tty_finalize_color_instance): * objects-tty.c (tty_finalize_font_instance): * objects-tty.c (tty_font_list): * objects-x.c (x_finalize_color_instance): * objects-x.c (x_finalize_font_instance): * process.c: * process.c (finalize_process): * realpath.c: * redisplay.c (add_propagation_runes): * regex.c: * regex.c (xfree): * regex.c (REGEX_FREE_STACK): * regex.c (FREE_STACK_RETURN): * regex.c (regex_compile): * regex.c (regexec): * regex.c (regfree): * scrollbar-gtk.c (gtk_free_scrollbar_instance): * scrollbar-gtk.c (gtk_release_scrollbar_instance): * scrollbar-msw.c (mswindows_free_scrollbar_instance): * scrollbar-msw.c (unshow_that_mofo): * scrollbar-x.c (x_free_scrollbar_instance): * scrollbar-x.c (x_release_scrollbar_instance): * select-gtk.c (emacs_gtk_selection_handle): * select-msw.c (mswindows_own_selection): * select-x.c: * select-x.c (x_handle_selection_request): * select-x.c (unexpect_property_change): * select-x.c (x_handle_property_notify): * select-x.c (receive_incremental_selection): * select-x.c (x_get_window_property_as_lisp_data): * select-x.c (Fx_get_cutbuffer_internal): * specifier.c (finalize_specifier): * syntax.c (uninit_buffer_syntax_cache): * sysdep.c (qxe_allocating_getcwd): * sysdep.c (qxe_lstat): * sysdep.c (copy_in_passwd): * sysdep.c (qxe_ctime): * sysdep.c (closedir): * sysdep.c (DIRSIZ): * termcap.c (tgetent): * termcap.c (tprint): * tests.c (Ftest_data_format_conversion): * text.c (new_dfc_convert_copy_data): * text.h (eifree): * text.h (eito_alloca): * text.h (eito_external): * toolbar-msw.c (mswindows_output_toolbar): * ui-gtk.c (CONVERT_RETVAL): * ui-gtk.c (__allocate_object_storage): * unicode.c (free_from_unicode_table): * unicode.c (free_to_unicode_table): * unicode.c (free_charset_unicode_tables): * win32.c (mswindows_read_link_1): Rename: xfree(VAL, TYPE)->xfree(VAL) Command used: gr 'xfree *\((.*),.*\);' 'xfree (\1);' *.[ch] Followed by grepping for 'xfree.*,' and fixing anything left. Rationale: Having to specify the TYPE argument is annoying and error-prone. It was originally put in to work around warnings due to strict aliasing but years and years ago I rewrote it in a way that doesn't use the TYPE argument at all and no one has complained since then. (And anyway, XEmacs is far from ever being in compliance with strict aliasing and would require far-reaching changes to get that way.)
author Ben Wing <ben@xemacs.org>
date Thu, 04 Feb 2010 07:28:14 -0600
parents 0d4c9d0f6a8d
children 07dcc7000bbf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1 /* Common code between X and GTK -- redisplay-related.
4881
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
3 Copyright (C) 1994 Lucid, Inc.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
5 Copyright (C) 2002, 2003, 2005, 2009, 2010 Ben Wing.
4881
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
6
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
7 This file is part of XEmacs.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
8
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
12 later version.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
13
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
17 for more details.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
18
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
23
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
25
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
26 /* Author: Chuck Thompson */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
27 /* Gtk flavor by William Perry */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
28 /* X and GTK code merged by Ben Wing, 1-10 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
29
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
30 /* Lots of work done by Ben Wing for Mule */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
31
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
32 /* Before including this file, you need to define either THIS_IS_X or
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
33 THIS_IS_GTK. See comments in console-xlike-inc.h. */
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
34
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
35 #include <config.h>
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
36 #include "lisp.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
37
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
38 #include "buffer.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
39 #include "debug.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
40 #include "device-impl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
41 #include "faces.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
42 #include "file-coding.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
43 #include "frame-impl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
44 #include "gutter.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
45 #include "redisplay.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
46 #include "sysdep.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
47 #include "window.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
48
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
49 #ifdef MULE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
50 #include "mule-ccl.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
51 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
52 #include "charset.h"
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
53
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
54 #define NEED_GCCACHE_H
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
55 #define NEED_GLYPHS_H
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
56 #define NEED_OBJECTS_IMPL_H
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
57 #include "console-xlike-inc.h"
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
58
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
59 #include "sysproc.h" /* for select() */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
60
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
61 #ifdef THIS_IS_X
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
62 #include "EmacsFrame.h"
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
63 #include "EmacsFrameP.h"
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
64
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
65 #include <X11/bitmaps/gray>
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
66 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
67
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
68 #define EOL_CURSOR_WIDTH 5
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
69
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
70 /* Device methods */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
71
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
72 #define XLIKE_text_width XFUN (text_width)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
73 #define XLIKE_output_display_block XFUN (output_display_block)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
74 #define XLIKE_divider_height XFUN (divider_height)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
75 #define XLIKE_eol_cursor_width XFUN (eol_cursor_width)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
76 #define XLIKE_output_vertical_divider XFUN (output_vertical_divider)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
77 #define XLIKE_clear_region XFUN (clear_region)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
78 #define XLIKE_clear_frame XFUN (clear_frame)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
79 #define XLIKE_flash XFUN (flash)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
80 #define XLIKE_ring_bell XFUN (ring_bell)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
81 #define XLIKE_bevel_area XFUN (bevel_area)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
82 #define XLIKE_output_string XFUN (output_string)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
83 #define XLIKE_output_pixmap XFUN (output_pixmap)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
84 #define XLIKE_output_xlike_pixmap XFUN (output_xlike_pixmap)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
85 #define XLIKE_window_output_begin XFUN (window_output_begin)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
86 #define XLIKE_window_output_end XFUN (window_output_end)
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
87
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
88 /* Miscellaneous split functions */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
89
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
90 #define console_type_create_redisplay_XLIKE XLIKE_PASTE (console_type_create_redisplay, XLIKE_NAME)
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
91 #define XLIKE_get_gc XFUN (get_gc)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
92 #define XLIKE_output_blank XFUN (output_blank)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
93 #define XLIKE_text_width_single_run XFUN (text_width_single_run)
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
94
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
95 static void XLIKE_output_blank (struct window *w, struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
96 struct rune *rb, int start_pixpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
97 int cursor_start, int cursor_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
98 static void XLIKE_output_horizontal_line (struct window *w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
99 struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
100 struct rune *rb);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
101 static void XLIKE_output_eol_cursor (struct window *w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
102 struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
103 int xpos, face_index findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
104 static void XLIKE_clear_frame_windows (Lisp_Object window);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
105 static void XLIKE_bevel_area (struct window *w, face_index findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
106 int x, int y, int width, int height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
107 int shadow_thickness, int edges,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
108 enum edge_style style);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
109 static void XLIKE_ring_bell (struct device *d, int volume, int pitch,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
110 int duration);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
111
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
112 #ifdef THIS_IS_X
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
113 static void XLIKE_window_output_begin (struct window *UNUSED (w));
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
114 static void XLIKE_window_output_end (struct window *w);
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
115 #endif /* THIS_IS_X */
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
116
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
117
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
118 /****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
119 /* */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
120 /* Separate textual runs */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
121 /* */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
122 /****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
123
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
124
4881
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
125 /* Note: We do not use the Xmb*() functions and XFontSets, nor the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
126 Motif XFontLists and CompoundStrings.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
127 Those functions are generally losing for a number of reasons.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
128 Most important, they only support one locale (e.g. you could
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
129 display Japanese and ASCII text, but not mixed Japanese/Chinese
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
130 text). You could maybe call setlocale() frequently to try to deal
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
131 with this, but that would generally fail because an XFontSet is
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
132 tied to one locale and won't have the other character sets in it.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
133
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
134 fontconfig (the font database for Xft) has some specifier-like
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
135 properties, but it's not sufficient (witness the existence of
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
136 Pango). Pango might do the trick, but it's not a cross-platform
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
137 solution; it would need significant advantages to be worth the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
138 effort.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
139 */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
140
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
141 struct textual_run
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
142 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
143 Lisp_Object charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
144 unsigned char *ptr;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
145 int len;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
146 int dimension;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
147 };
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
148
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
149 /* Separate out the text in STR (an array of Ichars, not a string
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
150 representation) of length LEN into a series of runs, stored in
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
151 RUN_STORAGE. RUN_STORAGE is guaranteed to hold enough space for all
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
152 runs that could be generated from this text. Each run points to the a
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
153 stretch of text given simply by the position codes TEXT_STORAGE into a
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
154 series of textual runs of a particular charset. Also convert the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
155 characters as necessary into the format needed by XDrawImageString(),
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
156 XDrawImageString16(), et al. This means converting to one or two byte
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
157 format, possibly tweaking the high bits, and possibly running a CCL
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
158 program. You must pre-allocate the space used and pass it in. (This is
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
159 done so you can ALLOCA () the space.) (2 * len) bytes must be allocated
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
160 for TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
161 RUN_STORAGE, where LEN is the length of the dynarr.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
162
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
163 bufchar might not be fixed width (in the case of UTF-8).
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
164
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
165 Returns the number of runs actually used. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
166
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
167 /* Notes on Xft implementation
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
168
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
169 - With Unicode, we're no longer going to have repertoires reified as
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
170 charsets. (Not that we ever really did, what with corporate variants,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
171 and so on.) So we really should be querying the face for the desired
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
172 font, rather than the character for the charset, and that's what would
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
173 determine the separation into runs.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
174 - The widechar versions of fontconfig (and therefore Xft) functions
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
175 seem to be just bigendian Unicode. So there's actually no need to use
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
176 the 8-bit versions in computing runs and runes, it would seem.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
177 */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
178
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
179 #if !defined(USE_XFT) && !defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
180 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
181 separate_textual_runs_nomule (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
182 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
183 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
184 struct face_cachel *UNUSED(cachel))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
185 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
186 if (!len)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
187 return 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
188
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
189 run_storage[0].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
190 run_storage[0].len = len;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
191 run_storage[0].dimension = 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
192 run_storage[0].charset = Qnil;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
193
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
194 while (len--)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
195 *text_storage++ = *str++;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
196 return 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
197 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
198 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
199
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
200 #if defined(USE_XFT) && !defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
201 /*
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
202 Note that in this configuration the "Croatian hack" of using an 8-bit,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
203 non-Latin-1 font to get localized display without Mule simply isn't
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
204 available. That's by design -- Unicode does not aid or abet that kind
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
205 of punning.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
206 This means that the cast to XftChar16 gives the correct "conversion" to
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
207 UCS-2.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
208 #### Is there an alignment issue with text_storage?
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
209 */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
210 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
211 separate_textual_runs_xft_nomule (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
212 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
213 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
214 struct face_cachel *UNUSED(cachel))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
215 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
216 int i;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
217 if (!len)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
218 return 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
219
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
220 run_storage[0].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
221 run_storage[0].len = len;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
222 run_storage[0].dimension = 2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
223 run_storage[0].charset = Qnil;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
224
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
225 for (i = 0; i < len; i++)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
226 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
227 *(XftChar16 *)text_storage = str[i];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
228 text_storage += sizeof(XftChar16);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
229 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
230 return 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
231 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
232 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
233
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
234 #if defined(USE_XFT) && defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
235 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
236 separate_textual_runs_xft_mule (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
237 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
238 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
239 struct face_cachel *UNUSED(cachel))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
240 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
241 Lisp_Object prev_charset = Qunbound;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
242 int runs_so_far = 0, i;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
243
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
244 run_storage[0].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
245 run_storage[0].len = len;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
246 run_storage[0].dimension = 2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
247 run_storage[0].charset = Qnil;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
248
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
249 for (i = 0; i < len; i++)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
250 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
251 Ichar ch = str[i];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
252 Lisp_Object charset = ichar_charset(ch);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
253 int ucs = ichar_to_unicode(ch);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
254
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
255 /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
256 REPLACMENT CHARACTER. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
257 /* That means we can't handle characters outside of the BMP for now */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
258 ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
259
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
260 if (!EQ (charset, prev_charset))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
261 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
262 if (runs_so_far)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
263 run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
264 run_storage[runs_so_far].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
265 run_storage[runs_so_far].dimension = 2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
266 run_storage[runs_so_far].charset = charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
267 prev_charset = charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
268 runs_so_far++;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
269 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
270
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
271 *(XftChar16 *)text_storage = ucs;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
272 text_storage += sizeof(XftChar16);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
273 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
274
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
275 if (runs_so_far)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
276 run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
277 return runs_so_far;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
278 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
279 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
280
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
281 #if !defined(USE_XFT) && defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
282 /*
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
283 This is the most complex function of this group, due to the various
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
284 indexing schemes used by different fonts. For our purposes, they
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
285 fall into three classes. Some fonts are indexed compatibly with ISO
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
286 2022; those fonts just use the Mule internal representation directly
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
287 (typically the high bit must be reset; this is determined by the `graphic'
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
288 flag). Some fonts are indexed by Unicode, specifically by UCS-2. These
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
289 are all translated using `ichar_to_unicode'. Finally some fonts have
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
290 irregular indexes, and must be translated ad hoc. In XEmacs ad hoc
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
291 translations are accomplished with CCL programs. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
292 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
293 separate_textual_runs_mule (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
294 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
295 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
296 struct face_cachel *cachel)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
297 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
298 Lisp_Object prev_charset = Qunbound;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
299 int runs_so_far = 0, i;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
300 Ibyte charset_leading_byte = LEADING_BYTE_ASCII;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
301 int dimension = 1, graphic = 0, need_ccl_conversion = 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
302 Lisp_Object ccl_prog;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
303 struct ccl_program char_converter;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
304
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
305 int translate_to_ucs_2 = 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
306
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
307 for (i = 0; i < len; i++)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
308 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
309 Ichar ch = str[i];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
310 Lisp_Object charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
311 int byte1, byte2; /* BREAKUP_ICHAR dereferences the addresses
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
312 of its arguments as pointer to int. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
313 BREAKUP_ICHAR (ch, charset, byte1, byte2);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
314
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
315 if (!EQ (charset, prev_charset))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
316 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
317 /* At this point, dimension' and `prev_charset' refer to just-
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
318 completed run. `runs_so_far' and `text_storage' refer to the
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
319 run about to start. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
320 if (runs_so_far)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
321 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
322 /* Update metadata for previous run. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
323 run_storage[runs_so_far - 1].len =
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
324 text_storage - run_storage[runs_so_far - 1].ptr;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
325 if (2 == dimension) run_storage[runs_so_far - 1].len >>= 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
326 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
327
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
328 /* Compute metadata for current run.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
329 First, classify font.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
330 If the font is indexed by UCS-2, set `translate_to_ucs_2'.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
331 Else if the charset has a CCL program, set `need_ccl_conversion'.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
332 Else if the font is indexed by an ISO 2022 "graphic register",
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
333 set `graphic'.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
334 These flags are almost mutually exclusive, but we're sloppy
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
335 about resetting "shadowed" flags. So the flags must be checked
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
336 in the proper order in computing byte1 and byte2, below. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
337 charset_leading_byte = XCHARSET_LEADING_BYTE(charset);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
338 translate_to_ucs_2 =
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
339 bit_vector_bit (FACE_CACHEL_FONT_FINAL_STAGE (cachel),
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
340 charset_leading_byte - MIN_LEADING_BYTE);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
341 if (translate_to_ucs_2)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
342 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
343 dimension = 2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
344 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
345 else
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
346 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
347 dimension = XCHARSET_DIMENSION (charset);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
348
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
349 /* Check for CCL charset.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
350 If setup_ccl_program fails, we'll get a garbaged display.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
351 This should never happen, and even if it does, it should
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
352 be harmless (unless the X server has buggy handling of
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
353 characters undefined in the font). It may be marginally
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
354 more useful to users and debuggers than substituting a
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
355 fixed replacement character. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
356 ccl_prog = XCHARSET_CCL_PROGRAM (charset);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
357 if ((!NILP (ccl_prog))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
358 && (setup_ccl_program (&char_converter, ccl_prog) >= 0))
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
359 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
360 need_ccl_conversion = 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
361 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
362 else
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
363 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
364 /* The charset must have an ISO 2022-compatible font index.
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
365 There are 2 "registers" (what such fonts use as index).
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
366 GL (graphic == 0) has the high bit of each octet reset,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
367 GR (graphic == 1) has it set. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
368 graphic = XCHARSET_GRAPHIC (charset);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
369 need_ccl_conversion = 0;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
370 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
371 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
372
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
373 /* Initialize metadata for current run. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
374 run_storage[runs_so_far].ptr = text_storage;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
375 run_storage[runs_so_far].charset = charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
376 run_storage[runs_so_far].dimension = dimension;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
377
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
378 /* Update loop variables. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
379 prev_charset = charset;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
380 runs_so_far++;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
381 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
382
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
383 /* Must check flags in this order. See comment above. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
384 if (translate_to_ucs_2)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
385 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
386 int ucs = ichar_to_unicode(ch);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
387 /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
388 REPLACMENT CHARACTER. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
389 ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
390
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
391 byte1 = ucs >> 8;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
392 byte2 = ucs;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
393 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
394 else if (need_ccl_conversion)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
395 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
396 char_converter.reg[0] = charset_leading_byte;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
397 char_converter.reg[1] = byte1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
398 char_converter.reg[2] = byte2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
399 ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
400 byte1 = char_converter.reg[1];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
401 byte2 = char_converter.reg[2];
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
402 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
403 else if (graphic == 0)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
404 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
405 byte1 &= 0x7F;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
406 byte2 &= 0x7F;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
407 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
408 else
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
409 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
410 byte1 |= 0x80;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
411 byte2 |= 0x80;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
412 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
413
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
414 *text_storage++ = (unsigned char)byte1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
415
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
416 if (2 == dimension) *text_storage++ = (unsigned char)byte2;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
417 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
418
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
419 if (runs_so_far)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
420 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
421 run_storage[runs_so_far - 1].len =
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
422 text_storage - run_storage[runs_so_far - 1].ptr;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
423 /* Dimension retains the relevant value for the run before it. */
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
424 if (2 == dimension)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
425 run_storage[runs_so_far - 1].len >>= 1;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
426 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
427
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
428 return runs_so_far;
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
429 }
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
430 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
431
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
432 static int
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
433 separate_textual_runs (unsigned char *text_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
434 struct textual_run *run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
435 const Ichar *str, Charcount len,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
436 struct face_cachel *cachel)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
437 {
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
438 #if defined(USE_XFT) && defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
439 return separate_textual_runs_xft_mule (text_storage, run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
440 str, len, cachel);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
441 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
442 #if defined(USE_XFT) && !defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
443 return separate_textual_runs_xft_nomule (text_storage, run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
444 str, len, cachel);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
445 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
446 #if !defined(USE_XFT) && defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
447 return separate_textual_runs_mule (text_storage, run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
448 str, len, cachel);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
449 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
450 #if !defined(USE_XFT) && !defined(MULE)
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
451 return separate_textual_runs_nomule (text_storage, run_storage,
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
452 str, len, cachel);
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
453 #endif
a4322ac49e37 break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
diff changeset
454 }
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
455
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
456 /****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
457 /* */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
458 /* Xlike output routines */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
459 /* */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
460 /****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
461
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
462 static int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
463 XLIKE_text_width_single_run (struct frame * USED_IF_XFT (f),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
464 struct face_cachel *cachel,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
465 struct textual_run *run)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
466 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
467 Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
468 Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
469
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
470 if (!fi->proportional_p)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
471 return fi->width * run->len;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
472 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
473 else if (FONT_INSTANCE_X_XFTFONT (fi))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
474 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
475 static XGlyphInfo glyphinfo;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
476 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
477 Display *dpy = DEVICE_X_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
478
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
479 if (run->dimension == 2)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
480 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
481 XftTextExtents16 (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
482 FONT_INSTANCE_X_XFTFONT (fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
483 (XftChar16 *) run->ptr, run->len, &glyphinfo);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
484 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
485 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
486 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
487 XftTextExtents8 (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
488 FONT_INSTANCE_X_XFTFONT (fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
489 run->ptr, run->len, &glyphinfo);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
490 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
491
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
492 return glyphinfo.xOff;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
493 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
494 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
495 else if (FONT_INSTANCE_XLIKE_FONT (fi))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
496 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
497 if (run->dimension == 2)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
498 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
499 /* stderr_out ("Measuring wide characters\n"); */
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
500 return XLIKE_TEXT_WIDTH_WIDE (FONT_INSTANCE_XLIKE_FONT (fi),
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
501 run->ptr, run->len);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
502 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
503 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
504 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
505 return XLIKE_TEXT_WIDTH (FONT_INSTANCE_XLIKE_FONT (fi),
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
506 run->ptr, run->len);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
507 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
508 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
509 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
510 abort();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
511 return 0; /* shut up GCC */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
512 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
513
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
514
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
515 /*
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
516 XLIKE_text_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
517
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
518 Given a string and a merged face, return the string's length in pixels
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
519 when displayed in the fonts associated with the face.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
520 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
521
4928
ea701c23ed84 change text_width method to take a window, in preparation for unicode-internal changes
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
522 static int
ea701c23ed84 change text_width method to take a window, in preparation for unicode-internal changes
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
523 XLIKE_text_width (struct window *w, struct face_cachel *cachel,
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
524 const Ichar *str, Charcount len)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
525 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
526 /* !!#### Needs review */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
527 int width_so_far = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
528 unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
529 struct textual_run *runs = alloca_array (struct textual_run, len);
4928
ea701c23ed84 change text_width method to take a window, in preparation for unicode-internal changes
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
530 struct frame *f = WINDOW_XFRAME (w);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
531 int nruns;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
532 int i;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
533
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
534 nruns = separate_textual_runs (text_storage, runs, str, len,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
535 cachel);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
536
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
537 for (i = 0; i < nruns; i++)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
538 width_so_far += XLIKE_text_width_single_run (f, cachel, runs + i);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
539
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
540 return width_so_far;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
541 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
542
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
543 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
544 XLIKE_divider_height
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
545
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
546 Return the height of the horizontal divider. This is a function because
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
547 divider_height is a device method.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
548
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
549 #### If we add etched horizontal divider lines this will have to get
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
550 smarter.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
551 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
552 static int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
553 XLIKE_divider_height (void)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
554 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
555 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
556 return 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
557 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
558 return 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
559 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
560 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
561
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
562 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
563 XLIKE_eol_cursor_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
564
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
565 Return the width of the end-of-line cursor. This is a function
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
566 because eol_cursor_width is a device method.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
567 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
568 static int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
569 XLIKE_eol_cursor_width (void)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
570 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
571 return EOL_CURSOR_WIDTH;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
572 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
573
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
574 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
575 XLIKE_output_display_block
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
576
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
577 Given a display line, a block number for that start line, output all
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
578 runes between start and end in the specified display block.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
579 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
580 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
581 XLIKE_output_display_block (struct window *w, struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
582 int block, int start, int end, int start_pixpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
583 int cursor_start, int cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
584 int cursor_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
585 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
586 #ifndef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
587 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
588 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
589 Ichar_dynarr *buf;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
590 Lisp_Object window;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
591
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
592 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
593 rune_dynarr *rba = db->runes;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
594 struct rune *rb;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
595
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
596 int elt = start;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
597 face_index findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
598 int xpos, width = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
599 Lisp_Object charset = Qunbound; /* Qnil is a valid charset when
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
600 MULE is not defined */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
601
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
602 window = wrap_window (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
603 rb = Dynarr_atp (rba, start);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
604
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
605 if (!rb)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
606 /* Nothing to do so don't do anything. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
607 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
608
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
609 findex = rb->findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
610 xpos = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
611 if (rb->type == RUNE_CHAR)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
612 charset = ichar_charset (rb->object.chr.ch);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
613
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
614 if (end < 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
615 end = Dynarr_length (rba);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
616 buf = Dynarr_new (Ichar);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
617
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
618 while (elt < end)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
619 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
620 rb = Dynarr_atp (rba, elt);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
621
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
622 if (rb->findex == findex && rb->type == RUNE_CHAR
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
623 && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
624 && EQ (charset, ichar_charset (rb->object.chr.ch)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
625 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
626 Dynarr_add (buf, rb->object.chr.ch);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
627 width += rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
628 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
629 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
630 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
631 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
632 if (Dynarr_length (buf))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
633 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
634 XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos, width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
635 findex, 0, cursor_start, cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
636 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
637 xpos = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
638 width = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
639 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
640 Dynarr_reset (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
641 width = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
642
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
643 if (rb->type == RUNE_CHAR)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
644 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
645 findex = rb->findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
646 xpos = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
647 charset = ichar_charset (rb->object.chr.ch);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
648
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
649 if (rb->cursor_type == CURSOR_ON)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
650 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
651 if (rb->object.chr.ch == '\n')
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
652 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
653 XLIKE_output_eol_cursor (w, dl, xpos, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
654 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
655 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
656 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
657 Dynarr_add (buf, rb->object.chr.ch);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
658 XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
659 rb->width, findex, 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
660 cursor_start, cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
661 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
662 Dynarr_reset (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
663 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
664
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
665 xpos += rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
666 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
667 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
668 else if (rb->object.chr.ch == '\n')
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
669 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
670 /* Clear in case a cursor was formerly here. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
671 redisplay_clear_region (window, findex, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
672 XLIKE_DISPLAY_LINE_YPOS (dl),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
673 rb->width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
674 XLIKE_DISPLAY_LINE_HEIGHT (dl));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
675 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
676 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
677 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
678 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
679 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
680 if (rb->type == RUNE_BLANK)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
681 XLIKE_output_blank (w, dl, rb, start_pixpos, cursor_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
682 cursor_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
683 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
684 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
685 /* #### Our flagging of when we need to redraw the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
686 modeline shadows sucks. Since RUNE_HLINE is only used
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
687 by the modeline at the moment it is a good bet
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
688 that if it gets redrawn then we should also
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
689 redraw the shadows. This won't be true forever.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
690 We borrow the shadow_thickness_changed flag for
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
691 now. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
692 w->shadow_thickness_changed = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
693 XLIKE_output_horizontal_line (w, dl, rb);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
694 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
695
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
696 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
697 if (elt < end)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
698 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
699 rb = Dynarr_atp (rba, elt);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
700
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
701 findex = rb->findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
702 xpos = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
703 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
704 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
705 else if (rb->type == RUNE_DGLYPH)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
706 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
707 Lisp_Object instance;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
708 struct display_box dbox;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
709 struct display_glyph_area dga;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
710
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
711 redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
712 rb->object.dglyph.yoffset, start_pixpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
713 rb->width, &dbox, &dga);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
714
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
715 window = wrap_window (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
716 instance = glyph_image_instance (rb->object.dglyph.glyph,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
717 window, ERROR_ME_DEBUG_WARN, 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
718 findex = rb->findex;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
719
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
720 if (IMAGE_INSTANCEP (instance))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
721 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
722 switch (XIMAGE_INSTANCE_TYPE (instance))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
723 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
724 case IMAGE_TEXT:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
725 #ifdef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
726 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
727 /* !!#### Examine for Mule-izing */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
728 /* #### This is way losing. See the comment in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
729 add_glyph_rune(). */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
730 Lisp_Object string =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
731 XIMAGE_INSTANCE_TEXT_STRING (instance);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
732 convert_ibyte_string_into_ichar_dynarr
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
733 (XSTRING_DATA (string), XSTRING_LENGTH (string),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
734 buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
735
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
736 gtk_output_string (w, dl, buf, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
737 rb->object.dglyph.xoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
738 start_pixpos, -1, findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
739 (rb->cursor_type == CURSOR_ON),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
740 cursor_start, cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
741 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
742 Dynarr_reset (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
743 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
744 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
745 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
746 ABORT ();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
747 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
748 case IMAGE_MONO_PIXMAP:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
749 case IMAGE_COLOR_PIXMAP:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
750 redisplay_output_pixmap (w, instance, &dbox, &dga,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
751 findex, cursor_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
752 cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
753 cursor_height, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
754 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
755
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
756 case IMAGE_WIDGET:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
757 if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
758 Qlayout))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
759 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
760 redisplay_output_layout (window, instance, &dbox,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
761 &dga, findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
762 cursor_start, cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
763 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
764 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
765 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
766
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
767 case IMAGE_SUBWINDOW:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
768 redisplay_output_subwindow (w, instance, &dbox, &dga,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
769 findex, cursor_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
770 cursor_width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
771 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
772
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
773 case IMAGE_NOTHING:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
774 /* nothing is as nothing does */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
775 break;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
776
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
777 case IMAGE_POINTER:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
778 default:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
779 ABORT ();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
780 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
781 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
782 (XIMAGE_INSTANCE (instance)) = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
783 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
784
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
785 xpos += rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
786 elt++;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
787 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
788 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
789 ABORT ();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
790 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
791 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
792
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
793 if (Dynarr_length (buf))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
794 XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos, width, findex,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
795 0, cursor_start, cursor_width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
796
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
797 if (dl->modeline
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
798 && !EQ (Qzero, w->modeline_shadow_thickness)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
799 #ifndef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
800 /* This optimization doesn't work right with some Xft fonts, which
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
801 leave antialiasing turds at the boundary. I don't know if this
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
802 is an Xft bug or not, but I think it is. See x_output_string. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
803 && (f->clear
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
804 || f->windows_structure_changed
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
805 || w->shadow_thickness_changed)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
806 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
807 )
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
808 bevel_modeline (w, dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
809
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
810 Dynarr_free (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
811 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
812
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
813 /* Called as gtk_get_gc from gtk-glue.c */
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
814
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
815 XLIKE_GC XLIKE_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg,
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
816 Lisp_Object bg, Lisp_Object bg_pmap,
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
817 Lisp_Object lwidth);
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
818
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
819 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
820 XLIKE_get_gc
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
821
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
822 Given a number of parameters return a GC with those properties.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
823 ****************************************************************************/
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
824 XLIKE_GC
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
825 XLIKE_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
826 Lisp_Object bg, Lisp_Object bg_pmap, Lisp_Object lwidth)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
827 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
828 XLIKE_GCVALUES gcv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
829 unsigned long mask;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
830
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
831 memset (&gcv, ~0, sizeof (gcv));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
832 gcv.graphics_exposures = XLIKE_FALSE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
833 /* Make absolutely sure that we don't pick up a clipping region in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
834 the GC returned by this function. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
835 gcv.clip_mask = XLIKE_NONE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
836 gcv.clip_x_origin = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
837 gcv.clip_y_origin = 0;
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
838 XLIKE_SET_GC_FILL (gcv, XLIKE_FILL_SOLID);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
839 mask = XLIKE_GC_EXPOSURES | XLIKE_GC_CLIP_MASK | XLIKE_GC_CLIP_X_ORIGIN | XLIKE_GC_CLIP_Y_ORIGIN;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
840 mask |= XLIKE_GC_FILL;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
841
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
842 if (!NILP (font)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
843 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
844 /* Only set the font if it's a core font */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
845 /* the renderfont will be set elsewhere (not part of gc) */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
846 && !FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
847 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
848 )
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
849 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
850 gcv.font =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
851 XLIKE_FONT_NUM (FONT_INSTANCE_XLIKE_FONT (XFONT_INSTANCE (font)));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
852 mask |= XLIKE_GC_FONT;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
853 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
854
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
855 /* evil kludge! */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
856 if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
857 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
858 /* #### I fixed one case where this was getting hit. It was a
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
859 bad macro expansion (compiler bug). */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
860 stderr_out ("Help! x_get_gc got a bogus fg value! fg = ");
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
861 debug_print (fg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
862 fg = Qnil;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
863 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
864
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
865 if (!NILP (fg))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
866 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
867 if (COLOR_INSTANCEP (fg))
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
868 XLIKE_SET_GC_COLOR (gcv.foreground, XCOLOR_INSTANCE_XLIKE_COLOR (fg));
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
869 else
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
870 XLIKE_SET_GC_PIXEL (gcv.foreground, XINT (fg));
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
871 mask |= XLIKE_GC_FOREGROUND;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
872 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
873
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
874 if (!NILP (bg))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
875 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
876 if (COLOR_INSTANCEP (bg))
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
877 XLIKE_SET_GC_COLOR (gcv.background, XCOLOR_INSTANCE_XLIKE_COLOR (bg));
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
878 else
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
879 XLIKE_SET_GC_PIXEL (gcv.background, XINT (bg));
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
880 mask |= XLIKE_GC_BACKGROUND;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
881 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
883 /* This special case comes from a request to draw text with a face which has
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
884 the dim property. We'll use a stippled foreground GC. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
885 if (EQ (bg_pmap, Qdim))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
886 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
887 assert (DEVICE_XLIKE_GRAY_PIXMAP (d) != XLIKE_NONE);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
888
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
889 XLIKE_SET_GC_FILL (gcv, XLIKE_FILL_STIPPLED);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
890 gcv.stipple = DEVICE_XLIKE_GRAY_PIXMAP (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
891 mask |= (XLIKE_GC_FILL | XLIKE_GC_STIPPLE);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
892 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
893 else if (IMAGE_INSTANCEP (bg_pmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
894 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
895 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
896 if (XIMAGE_INSTANCE_PIXMAP_DEPTH (bg_pmap) == 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
897 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
898 XLIKE_SET_GC_FILL (gcv, XLIKE_FILL_OPAQUE_STIPPLED);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
899 gcv.stipple = XIMAGE_INSTANCE_XLIKE_PIXMAP (bg_pmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
900 mask |= (XLIKE_GC_STIPPLE | XLIKE_GC_FILL);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
901 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
902 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
903 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
904 XLIKE_SET_GC_FILL (gcv, XLIKE_FILL_TILED);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
905 gcv.tile = XIMAGE_INSTANCE_XLIKE_PIXMAP (bg_pmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
906 mask |= (XLIKE_GC_TILE | XLIKE_GC_FILL);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
907 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
908 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
909
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
910 if (!NILP (lwidth))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
911 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
912 gcv.line_width = XINT (lwidth);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
913 mask |= XLIKE_GC_LINE_WIDTH;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
914 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
915
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
916 #if 0
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
917 debug_out ("\nx_get_gc: calling gc_cache_lookup\n");
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
918 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
919 return gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, mask);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
920 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
921
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
922 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
923 XLIKE_output_string
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
924
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
925 Given a string and a starting position, output that string in the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
926 given face. If cursor is true, draw a cursor around the string.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
927 Correctly handles multiple charsets in the string.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
928
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
929 The meaning of the parameters is something like this:
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
930
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
931 W Window that the text is to be displayed in.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
932 DL Display line that this text is on. The values in the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
933 structure are used to determine the vertical position and
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
934 clipping range of the text.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
935 BUF Dynamic array of Ichars specifying what is actually to be
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
936 drawn.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
937 XPOS X position in pixels where the text should start being drawn.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
938 XOFFSET Number of pixels to be chopped off the left side of the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
939 text. The effect is as if the text were shifted to the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
940 left this many pixels and clipped at XPOS.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
941 CLIP_START Clip everything left of this X position.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
942 WIDTH Clip everything right of XPOS + WIDTH.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
943 FINDEX Index for the face cache element describing how to display
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
944 the text.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
945 CURSOR #### I don't understand this. There's something
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
946 strange and overcomplexified with this variable.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
947 Chuck, explain please?
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
948 CURSOR_START Starting X position of cursor.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
949 CURSOR_WIDTH Width of cursor in pixels.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
950 CURSOR_HEIGHT Height of cursor in pixels.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
951
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
952 Starting Y position of cursor is the top of the text line.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
953 The cursor is drawn sometimes whether or not CURSOR is set. ???
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
954 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
955 #ifdef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
956 static
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
957 void gdk_draw_text_image (GdkDrawable *drawable,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
958 GdkFont *font,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
959 GdkGC *gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
960 gint x,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
961 gint y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
962 const gchar *text,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
963 gint text_length);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
964
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
965 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
966 void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
967 XLIKE_output_string (struct window *w, struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
968 Ichar_dynarr *buf, int xpos, int xoffset, int clip_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
969 int width, face_index findex, int cursor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
970 int cursor_start, int cursor_width, int cursor_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
971 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
972 /* General variables */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
973 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
974 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
975 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
976 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
977 Lisp_Object window = wrap_window (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
978
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
979 int clip_end;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
980
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
981 /* Cursor-related variables */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
982 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
983 int cursor_clip;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
984 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
985 WINDOW_BUFFER (w));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
986 struct face_cachel *cursor_cachel = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
987
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
988 /* Text-related variables */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
989 Lisp_Object bg_pmap;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
990 XLIKE_GC bgc, gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
991 int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
992 int ypos = XLIKE_DISPLAY_LINE_YPOS (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
993 int len = Dynarr_length (buf);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
994 unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
995 struct textual_run *runs = alloca_array (struct textual_run, len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
996 int nruns;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
997 int i;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
998 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
999
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1000 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1001 int use_x_font = 1; /* #### bogus!!
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1002 The logic of this function needs review! */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1003 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1004 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1005 Colormap cmap = DEVICE_X_COLORMAP (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1006 Visual *visual = DEVICE_X_VISUAL (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1007 static XftColor fg, bg;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1008 XftDraw *xftDraw;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1009
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1010 /* Lazily initialize frame's xftDraw member. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1011 if (!FRAME_X_XFTDRAW (f)) {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1012 FRAME_X_XFTDRAW (f) = XftDrawCreate (dpy, x_win, visual, cmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1013 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1014 xftDraw = FRAME_X_XFTDRAW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1015
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1016 /* #### This will probably cause asserts when passed a Lisp integer for a
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1017 color. See ca. line 759 this file.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1018 #### Maybe xft_convert_color should take an XColor, not a pixel. */
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1019 #define XFT_FROB_LISP_COLOR(color, dim) \
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1020 xft_convert_color (dpy, cmap, visual, \
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1021 XCOLOR_INSTANCE_X_COLOR (color).pixel, (dim))
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1022 #endif /* USE_XFT */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1023
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1024 if (width < 0)
4967
0d4c9d0f6a8d rewrite dynarr code
Ben Wing <ben@xemacs.org>
parents: 4962
diff changeset
1025 width = XLIKE_text_width (w, cachel, Dynarr_begin (buf),
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1026 Dynarr_length (buf));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1027
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1028 /* Regularize the variables passed in. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1029
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1030 if (clip_start < xpos)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1031 clip_start = xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1032 clip_end = xpos + width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1033 if (clip_start >= clip_end)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1034 /* It's all clipped out. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1035 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1036
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1037 xpos -= xoffset;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1038
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1039 /* make sure the area we are about to display is subwindow free. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1040 redisplay_unmap_subwindows_maybe (f, clip_start, ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1041 clip_end - clip_start, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1042
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1043 cursor_clip = (cursor_start >= clip_start &&
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1044 cursor_start < clip_end);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1045
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1046 /* This cursor code is really a mess. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1047 if (!NILP (w->text_cursor_visible_p)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1048 && (cursor
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1049 || cursor_clip
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1050 || (cursor_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1051 && (cursor_start + cursor_width >= clip_start)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1052 && !NILP (bar_cursor_value))))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1053 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1054 /* These have to be in separate statements in order to avoid a
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1055 compiler bug. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1056 face_index sucks = get_builtin_face_cache_index (w, Vtext_cursor_face);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1057 cursor_cachel = WINDOW_FACE_CACHEL (w, sucks);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1058
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1059 /* We have to reset this since any call to WINDOW_FACE_CACHEL
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1060 may cause the cache to resize and any pointers to it to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1061 become invalid. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1062 cachel = WINDOW_FACE_CACHEL (w, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1063 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1064
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1065 #ifdef HAVE_XIM
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1066 if (cursor && focus && (cursor_start == clip_start) && cursor_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1067 XIM_SetSpotLocation (f, xpos - 2, dl->ypos + dl->descent - 2);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1068 #endif /* HAVE_XIM */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1069
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1070 bg_pmap = cachel->background_pixmap;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1071 if (!IMAGE_INSTANCEP (bg_pmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1072 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1073 bg_pmap = Qnil;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1074
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1075 if ((cursor && focus && NILP (bar_cursor_value)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1076 && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1077 bgc = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1078 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1079 bgc = XLIKE_get_gc (d, Qnil, cachel->foreground, cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1080 bg_pmap, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1081
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1082 if (bgc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1083 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1084 XLIKE_FILL_RECTANGLE (dpy, x_win, bgc, clip_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1085 ypos, clip_end - clip_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1086 height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1087 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1088
4967
0d4c9d0f6a8d rewrite dynarr code
Ben Wing <ben@xemacs.org>
parents: 4962
diff changeset
1089 nruns = separate_textual_runs (text_storage, runs, Dynarr_begin (buf),
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1090 Dynarr_length (buf), cachel);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1091
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1092 for (i = 0; i < nruns; i++)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1093 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1094 Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1095 Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1096 int this_width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1097 int need_clipping;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1098
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1099 if (EQ (font, Vthe_null_font_instance))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1100 continue;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1101
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1102 this_width = XLIKE_text_width_single_run (f, cachel, runs + i);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1103 need_clipping = (dl->clip || clip_start > xpos ||
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1104 clip_end < xpos + this_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1105
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1106 /* XDrawImageString only clears the area equal to the height of
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1107 the given font. It is possible that a font is being displayed
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1108 on a line taller than it is, so this would cause us to fail to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1109 clear some areas. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1110 if ((int) fi->height < (int) (height + dl->clip +
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1111 XLIKE_DISPLAY_LINE_TOP_CLIP (dl)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1112 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1113 int clear_start = max (xpos, clip_start);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1114 int clear_end = min (xpos + this_width, clip_end);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1115
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1116 if (cursor)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1117 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1118 int ypos1_line, ypos1_string, ypos2_line, ypos2_string;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1119
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1120 ypos1_string = dl->ypos - fi->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1121 ypos2_string = dl->ypos + fi->descent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1122 ypos1_line = ypos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1123 ypos2_line = ypos1_line + height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1124
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1125 /* Make sure we don't clear below the real bottom of the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1126 line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1127 if (ypos1_string > ypos2_line)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1128 ypos1_string = ypos2_line;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1129 if (ypos2_string > ypos2_line)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1130 ypos2_string = ypos2_line;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1131
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1132 if (ypos1_line < ypos1_string)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1133 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1134 redisplay_clear_region (window, findex, clear_start, ypos1_line,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1135 clear_end - clear_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1136 ypos1_string - ypos1_line);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1137 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1138
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1139 if (ypos2_line > ypos2_string)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1140 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1141 redisplay_clear_region (window, findex, clear_start, ypos2_string,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1142 clear_end - clear_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1143 ypos2_line - ypos2_string);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1144 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1145 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1146 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1147 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1148 redisplay_clear_region (window, findex, clear_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1149 ypos, clear_end - clear_start,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1150 height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1151 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1152 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1153
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1154 if (cursor && cursor_cachel && focus && NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1155 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1156 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1157 fg = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1158 bg = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1159 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1160 gc = XLIKE_get_gc (d, font, cursor_cachel->foreground,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1161 cursor_cachel->background, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1162 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1163 else if (cachel->dim)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1164 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1165 /* Ensure the gray bitmap exists */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1166 if (DEVICE_XLIKE_GRAY_PIXMAP (d) == XLIKE_NONE)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1167 DEVICE_XLIKE_GRAY_PIXMAP (d) =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1168 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1169 XCreateBitmapFromData (dpy, x_win, (char *)gray_bits,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1170 gray_width, gray_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1171 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1172 /* #### FIXME! Implement me! */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1173 XLIKE_NONE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1174 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1175 ;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1176
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1177 /* Request a GC with the gray stipple pixmap to draw dimmed text */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1178 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1179 fg = XFT_FROB_LISP_COLOR (cachel->foreground, 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1180 bg = XFT_FROB_LISP_COLOR (cachel->background, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1181 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1182 gc = XLIKE_get_gc (d, font, cachel->foreground, cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1183 Qdim, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1184 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1185 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1186 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1187 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1188 fg = XFT_FROB_LISP_COLOR (cachel->foreground, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1189 bg = XFT_FROB_LISP_COLOR (cachel->background, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1190 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1191 gc = XLIKE_get_gc (d, font, cachel->foreground, cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1192 Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1193 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1194 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1195 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1196 XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1197
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1198 if (rf)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1199 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1200 use_x_font = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1201 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1202 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1203 Region clip_reg = XCreateRegion();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1204 XRectangle clip_box = { clip_start, ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1205 clip_end - clip_start, height };
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1206
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1207 XUnionRectWithRegion (&clip_box, clip_reg, clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1208 XftDrawSetClip(xftDraw, clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1209 XDestroyRegion(clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1210 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1211
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1212 if (!bgc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1213 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1214 /* #### Neither rect_height nor XftTextExtents as computed
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1215 below handles the vertical space taken up by antialiasing,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1216 which for some fonts (eg, Bitstream Vera Sans Mono-16 on
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1217 my Mac PowerBook G4) leaves behind orphaned dots on
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1218 insertion or deletion earlier in the line, especially in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1219 the case of the underscore character.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1220 Interestingly, insertion or deletion of a single character
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1221 immediately after a refresh does not leave any droppings,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1222 but any further insertions or deletions do.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1223 While adding a pixel to rect_height (mostly) takes care of
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1224 this, it trashes aggressively laid-out elements like the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1225 modeline (overwriting part of the bevel).
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1226 OK, unconditionally redraw the bevel, and increment
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1227 rect_height by 1. See x_output_display_block. -- sjt */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1228 struct textual_run *run = &runs[i];
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1229 int rect_width = x_text_width_single_run (f, cachel, run);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1230 #ifndef USE_XFTTEXTENTS_TO_AVOID_FONT_DROPPINGS
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1231 int rect_height = FONT_INSTANCE_ASCENT(fi)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1232 + FONT_INSTANCE_DESCENT(fi) + 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1233 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1234 int rect_height = FONT_INSTANCE_ASCENT(fi)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1235 + FONT_INSTANCE_DESCENT(fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1236 XGlyphInfo gi;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1237 if (run->dimension == 2) {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1238 XftTextExtents16 (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1239 FONT_INSTANCE_X_XFTFONT(fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1240 (XftChar16 *) run->ptr, run->len, &gi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1241 } else {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1242 XftTextExtents8 (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1243 FONT_INSTANCE_X_XFTFONT(fi),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1244 run->ptr, run->len, &gi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1245 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1246 rect_height = rect_height > gi.height
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1247 ? rect_height : gi.height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1248 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1249
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1250 XftDrawRect (xftDraw, &bg,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1251 xpos, ypos, rect_width, rect_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1252 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1253
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1254 if (runs[i].dimension == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1255 XftDrawString8 (xftDraw, &fg, rf, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1256 runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1257 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1258 XftDrawString16 (xftDraw, &fg, rf, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1259 (XftChar16 *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1260 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1261 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1262 #endif /* USE_XFT */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1263
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1264 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1265 if (use_x_font)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1266 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1267 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1268 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1269 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1270 XLIKE_RECTANGLE clip_box;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1271
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1272 clip_box.x = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1273 clip_box.y = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1274 clip_box.width = clip_end - clip_start;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1275 clip_box.height = height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1276
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1277 XLIKE_SET_CLIP_RECTANGLE (dpy, gc, clip_start, ypos, &clip_box);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1278 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1279
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1280 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1281 if (runs[i].dimension == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1282 (bgc ? XDrawString : XDrawImageString)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1283 (dpy, x_win, gc, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1284 (char *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1285 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1286 (bgc ? XDrawString16 : XDrawImageString16)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1287 (dpy, x_win, gc, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1288 (XChar2b *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1289 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1290
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1291 /* The X specific called different functions (XDraw*String
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1292 vs. XDraw*String16), but apparently gdk_draw_text takes care
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1293 of that for us.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1294
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1295 BUT, gdk_draw_text also does too much, by dividing the length
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1296 by 2. So we fake them out my multiplying the length by the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1297 dimension of the text. This will do the right thing for
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1298 single-dimension runs as well of course.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1299 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1300 (bgc ? gdk_draw_text : gdk_draw_text_image)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1301 (GDK_DRAWABLE (x_win), FONT_INSTANCE_GTK_FONT (fi), gc, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1302 dl->ypos, (char *) runs[i].ptr, runs[i].len * runs[i].dimension);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1303 #endif /* (not) THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1304 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1305
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1306 /* We draw underlines in the same color as the text. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1307 if (cachel->underline)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1308 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1309 int upos, uthick;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1310 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1311 unsigned long upos_ext, uthick_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1312 XFontStruct *fs =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1313 use_x_font ? FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)) : 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1314 /* #### the logic of the next two may be suboptimal: we may want
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1315 to use the POSITION and/or THICKNESS information with Xft */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1316 if (fs && XGetFontProperty (fs, XA_UNDERLINE_POSITION, &upos_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1317 upos = (int) upos_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1318 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1319 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1320 /* Cannot get at font properties in Gtk, so we resort to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1321 guessing */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1322 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1323 upos = dl->descent / 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1324 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1325 if (fs && XGetFontProperty (fs, XA_UNDERLINE_THICKNESS, &uthick_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1326 uthick = (int) uthick_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1327 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1328 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1329 uthick = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1330 if (dl->ypos + upos < dl->ypos + dl->descent - dl->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1331 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1332 if (dl->ypos + upos + uthick > dl->ypos + dl->descent - dl->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1333 uthick = dl->descent - dl->clip - upos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1334
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1335 if (uthick == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1336 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1337 XLIKE_DRAW_LINE (dpy, x_win, gc, xpos, dl->ypos + upos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1338 xpos + this_width, dl->ypos + upos);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1339 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1340 else if (uthick > 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1341 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1342 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1343 dl->ypos + upos, this_width, uthick);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1344 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1345 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1346 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1347
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1348 if (cachel->strikethru)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1349 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1350 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1351 int ascent, descent, upos, uthick;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1352 unsigned long ascent_ext, descent_ext, uthick_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1353 XFontStruct *fs = FONT_INSTANCE_X_FONT (fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1354 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1355 gint ascent, descent, upos, uthick;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1356 GdkFont *gfont = FONT_INSTANCE_GTK_FONT (fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1357 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1358
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1359 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1360 if (!use_x_font)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1361 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1362 ascent = dl->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1363 descent = dl->descent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1364 uthick = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1365 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1366 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1367 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1368 if (!XGetFontProperty (fs, XA_STRIKEOUT_ASCENT, &ascent_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1369 ascent = fs->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1370 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1371 ascent = (int) ascent_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1372 if (!XGetFontProperty (fs, XA_STRIKEOUT_DESCENT, &descent_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1373 descent = fs->descent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1374 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1375 descent = (int) descent_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1376 if (!XGetFontProperty (fs, XA_UNDERLINE_THICKNESS, &uthick_ext))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1377 uthick = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1378 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1379 uthick = (int) uthick_ext;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1380 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1381 #else /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1382 /* Cannot get at font properties in Gtk, so we resort to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1383 guessing */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1384
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1385 ascent = gfont->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1386 descent = gfont->descent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1387 uthick = 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1388 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1389
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1390 upos = ascent - ((ascent + descent) / 2) + 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1391
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1392 /* Generally, upos will be positive (above the baseline),so
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1393 subtract */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1394 if (dl->ypos - upos < dl->ypos + dl->descent - dl->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1395 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1396 if (dl->ypos - upos + uthick > dl->ypos + dl->descent - dl->clip)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1397 uthick = dl->descent - dl->clip + upos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1398
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1399 if (uthick == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1400 XLIKE_DRAW_LINE (dpy, x_win, gc, xpos, dl->ypos - upos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1401 xpos + this_width, dl->ypos - upos);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1402 else if (uthick > 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1403 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, xpos, dl->ypos + upos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1404 this_width, uthick);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1405 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1406 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1407
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1408 /* Restore the GC */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1409 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1410 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1411 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1412 if (!use_x_font)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1413 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1414 XftDrawSetClip (xftDraw, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1415 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1416 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1417 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1418 XLIKE_CLEAR_CLIP_MASK (dpy, gc);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1419 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1420
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1421 /* If we are actually superimposing the cursor then redraw with just
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1422 the appropriate section highlighted. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1423 if (cursor_clip && !cursor && focus && cursor_cachel)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1424 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1425 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1426 if (!use_x_font) /* Xft */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1427 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1428 XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1429
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1430 { /* set up clipping */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1431 Region clip_reg = XCreateRegion();
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1432 XRectangle clip_box = { cursor_start, ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1433 cursor_width, height };
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1434
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1435 XUnionRectWithRegion (&clip_box, clip_reg, clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1436 XftDrawSetClip(xftDraw, clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1437 XDestroyRegion(clip_reg);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1438 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1439 { /* draw background rectangle & draw text */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1440 int rect_height = FONT_INSTANCE_ASCENT(fi)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1441 + FONT_INSTANCE_DESCENT(fi);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1442 int rect_width = x_text_width_single_run(f, cachel, &runs[i]);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1443 XftColor xft_color;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1444
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1445 xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1446 XftDrawRect (xftDraw, &xft_color,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1447 xpos, ypos, rect_width, rect_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1448
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1449 xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1450 if (runs[i].dimension == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1451 XftDrawString8 (xftDraw, &xft_color, rf, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1452 runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1453 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1454 XftDrawString16 (xftDraw, &xft_color, rf, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1455 (XftChar16 *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1456 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1457
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1458 XftDrawSetClip(xftDraw, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1459 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1460 else /* core font, not Xft */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1461 #endif /* USE_XFT */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1462 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1463 XLIKE_RECTANGLE clip_box;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1464 XLIKE_GC cgc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1465 cgc = XLIKE_get_gc (d, font, cursor_cachel->foreground,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1466 cursor_cachel->background, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1467
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1468 clip_box.x = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1469 clip_box.y = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1470 clip_box.width = cursor_width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1471 clip_box.height = height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1472
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1473 XLIKE_SET_CLIP_RECTANGLE (dpy, cgc, cursor_start, ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1474 &clip_box);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1475 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1476 if (runs[i].dimension == 1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1477 XDrawImageString (dpy, x_win, cgc, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1478 (char *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1479 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1480 XDrawImageString16 (dpy, x_win, cgc, xpos, dl->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1481 (XChar2b *) runs[i].ptr, runs[i].len);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1482 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1483 /* The X specific called different functions (XDraw*String
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1484 vs. XDraw*String16), but apparently gdk_draw_text takes care
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1485 of that for us.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1486
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1487 BUT, gdk_draw_text also does too much, by dividing the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1488 length by 2. So we fake them out my multiplying the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1489 length by the dimension of the text. This will do the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1490 right thing for single-dimension runs as well of course.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1491 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1492 gdk_draw_text_image (GDK_DRAWABLE (x_win),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1493 FONT_INSTANCE_GTK_FONT (fi), cgc, xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1494 dl->ypos, (char *) runs[i].ptr,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1495 runs[i].len * runs[i].dimension);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1496 #endif /* (not) THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1497
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1498 XLIKE_CLEAR_CLIP_MASK (dpy, cgc);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1499 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1500 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1501
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1502 xpos += this_width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1503 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1504
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1505 /* Draw the non-focus box or bar-cursor as needed. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1506 /* Can't this logic be simplified? */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1507 if (cursor_cachel
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1508 && ((cursor && !focus && NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1509 || (cursor_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1510 && (cursor_start + cursor_width >= clip_start)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1511 && !NILP (bar_cursor_value))))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1512 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1513 int tmp_height, tmp_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1514 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1515 int need_clipping = (cursor_start < clip_start
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1516 || clip_end < cursor_start + cursor_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1517
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1518 /* #### This value is correct (as far as I know) because
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1519 all of the times we need to draw this cursor, we will
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1520 be called with exactly one character, so we know we
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1521 can always use runs[0].
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1522
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1523 This is bogus as all hell, however. The cursor handling in
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1524 this function is way bogus and desperately needs to be
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1525 cleaned up. (In particular, the drawing of the cursor should
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1526 really really be separated out of this function. This may be
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1527 a bit tricky now because this function itself does way too
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1528 much stuff, a lot of which needs to be moved into
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1529 redisplay.c.) This is the only way to be able to easily add
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1530 new cursor types or (e.g.) make the bar cursor be able to
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1531 span two characters instead of overlaying just one. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1532 int bogusly_obtained_ascent_value =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1533 XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1534
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1535 if (!NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1536 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1537 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1538 make_int (bar_width));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1539 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1540 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1541 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1542 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1543 Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1544 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1545
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1546 tmp_y = dl->ypos - bogusly_obtained_ascent_value;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1547 tmp_height = cursor_height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1548 if (tmp_y + tmp_height > (int) (ypos + height))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1549 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1550 tmp_y = ypos + height - tmp_height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1551 if (tmp_y < (int) ypos)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1552 tmp_y = ypos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1553 tmp_height = ypos + height - tmp_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1554 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1555
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1556 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1557 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1558 XLIKE_RECTANGLE clip_box;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1559 clip_box.x = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1560 clip_box.y = 0;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1561 clip_box.width = clip_end - clip_start;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1562 clip_box.height = tmp_height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1563 XLIKE_SET_CLIP_RECTANGLE (dpy, gc, clip_start, tmp_y, &clip_box);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1564 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1565
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1566 if (!focus && NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1567 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1568 XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, tmp_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1569 cursor_width - 1, tmp_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1570 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1571 else if (focus && !NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1572 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1573 XLIKE_DRAW_LINE (dpy, x_win, gc, cursor_start + bar_width - 1, tmp_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1574 cursor_start + bar_width - 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1575 tmp_y + tmp_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1576 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1577
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1578 /* Restore the GC */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1579 if (need_clipping)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1580 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1581 XLIKE_CLEAR_CLIP_MASK (dpy, gc);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1582 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1583 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1584
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1585 #ifdef USE_XFT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1586 #undef XFT_FROB_LISP_COLOR
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1587 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1588 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1589
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1590 #ifdef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1591 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1592 our_draw_bitmap (GdkDrawable *drawable,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1593 GdkGC *gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1594 GdkPixmap *src,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1595 gint xsrc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1596 gint ysrc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1597 gint xdest,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1598 gint ydest,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1599 gint width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1600 gint height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1601 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1602
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1603
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1604 static void
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1605 XLIKE_output_xlike_pixmap (struct frame *f, Lisp_Image_Instance *p, int x,
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1606 int y, int xoffset, int yoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1607 int width, int height,
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1608 XLIKE_COLOR fg, XLIKE_COLOR bg,
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1609 XLIKE_GC override_gc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1610 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1611 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1612 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1613 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1614 XLIKE_GC gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1615 XLIKE_GCVALUES gcv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1616 unsigned long pixmap_mask;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1617
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1618 if (!override_gc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1619 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1620 memset (&gcv, ~0, sizeof (gcv));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1621 gcv.graphics_exposures = XLIKE_FALSE;
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1622 XLIKE_SET_GC_COLOR (gcv.foreground, fg);
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1623 XLIKE_SET_GC_COLOR (gcv.background, bg);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1624 pixmap_mask = XLIKE_GC_FOREGROUND | XLIKE_GC_BACKGROUND | XLIKE_GC_EXPOSURES;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1625
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1626 if (IMAGE_INSTANCE_XLIKE_MASK (p))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1627 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1628 gcv.function = XLIKE_GX_COPY;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1629 gcv.clip_mask = IMAGE_INSTANCE_XLIKE_MASK (p);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1630 gcv.clip_x_origin = x - xoffset;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1631 gcv.clip_y_origin = y - yoffset;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1632 pixmap_mask |= (XLIKE_GC_FUNCTION | XLIKE_GC_CLIP_MASK |
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1633 XLIKE_GC_CLIP_X_ORIGIN |
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1634 XLIKE_GC_CLIP_Y_ORIGIN);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1635 /* Can't set a clip rectangle below because we already have a mask.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1636 We could conceivably create a new clipmask by zeroing out
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1637 everything outside the clip region. Is it worth it?
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1638 Is it possible to get an equivalent effect by changing the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1639 args to XCopyArea below rather than messing with a clip box?
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1640 - dkindred@cs.cmu.edu
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1641 Yes. We don't clip at all now - andy@xemacs.org
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1642 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1643 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1644
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1645 gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, pixmap_mask);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1646 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1647 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1648 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1649 gc = override_gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1650 /* override_gc might have a mask already--we don't want to nuke it.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1651 Maybe we can insist that override_gc have no mask, or use
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1652 one of the suggestions above. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1653 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1654
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1655 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1656 /* depth of 0 means it's a bitmap, not a pixmap, and we should use
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1657 XCopyPlane (1 = current foreground color, 0 = background) instead
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1658 of XCopyArea, which means that the bits in the pixmap are actual
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1659 pixel values, instead of symbolic of fg/bg. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1660 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1661 if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1662 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1663 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1664 XCopyArea (dpy,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1665 IMAGE_INSTANCE_X_PIXMAP_SLICE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1666 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc, xoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1667 yoffset, width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1668 height, x, y);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1669 #else /* THIS_IS_GTK */
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1670 USED (dpy);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1671 gdk_draw_pixmap (GDK_DRAWABLE (x_win), gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1672 IMAGE_INSTANCE_GTK_PIXMAP (p),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1673 xoffset, yoffset, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1674 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1675 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1676 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1677 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1678 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1679 XCopyPlane (dpy, IMAGE_INSTANCE_X_PIXMAP_SLICE
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1680 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1681 xoffset, yoffset, width, height, x, y, 1L);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1682 #else /* THIS_IS_GTK */
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1683 USED (dpy);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1684 our_draw_bitmap (GDK_DRAWABLE (x_win), gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1685 IMAGE_INSTANCE_GTK_PIXMAP (p),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1686 xoffset, yoffset, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1687 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1688 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1689 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1690
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1691 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1692 XLIKE_output_pixmap (struct window *w, Lisp_Object image_instance,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1693 struct display_box *db, struct display_glyph_area *dga,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1694 face_index findex, int cursor_start, int cursor_width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1695 int cursor_height, int UNUSED (bg_pixmap))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1696 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1697 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1698 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1699 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1700 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1701 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1702
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1703 /* Output the pixmap. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1704 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1705 Lisp_Object tmp_pixel;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1706 XLIKE_COLOR tmp_bcolor, tmp_fcolor;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1707
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1708 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1709 tmp_fcolor = XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1710 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1711 tmp_bcolor = XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1712
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1713 XLIKE_output_xlike_pixmap (f, p, db->xpos, db->ypos,
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1714 dga->xoffset, dga->yoffset,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1715 dga->width, dga->height,
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1716 tmp_fcolor, tmp_bcolor, 0);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1717 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1718
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1719 /* Draw a cursor over top of the pixmap. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1720 if (cursor_width && cursor_height && (cursor_start >= db->xpos)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1721 && !NILP (w->text_cursor_visible_p)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1722 && (cursor_start < db->xpos + dga->width))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1723 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1724 XLIKE_GC gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1725 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1726 struct face_cachel *cursor_cachel =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1727 WINDOW_FACE_CACHEL (w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1728 get_builtin_face_cache_index
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1729 (w, Vtext_cursor_face));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1730
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1731 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1732
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1733 if (cursor_width > db->xpos + dga->width - cursor_start)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1734 cursor_width = db->xpos + dga->width - cursor_start;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1735
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1736 if (focus)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1737 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, cursor_start, db->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1738 cursor_width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1739 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1740 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1741 XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, db->ypos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1742 cursor_width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1743 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1744 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1745 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1746
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1747 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1748 XLIKE_output_vertical_divider
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1749
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1750 Draw a vertical divider down the right side of the given window.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1751 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1752 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1753 XLIKE_output_vertical_divider (struct window *w, int USED_IF_X(clear))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1754 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1755 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1756 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1757
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1758 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1759 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1760 Lisp_Object tmp_pixel;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1761 XLIKE_GCVALUES gcv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1762 XLIKE_GC background_gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1763 enum edge_style style;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1764 unsigned long mask;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1765 int x, y1, y2, width, shadow_thickness, spacing, line_width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1766 face_index div_face =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1767 get_builtin_face_cache_index (w, Vvertical_divider_face);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1768
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1769 width = window_divider_width (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1770 shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1771 spacing = XINT (w->vertical_divider_spacing);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1772 line_width = XINT (w->vertical_divider_line_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1773 x = WINDOW_RIGHT (w) - width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1774 y1 = WINDOW_TOP (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1775 y2 = WINDOW_BOTTOM (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1776
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1777 memset (&gcv, ~0, sizeof (gcv));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1778
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1779 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1780
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1781 /* First, get the GC's. */
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1782 XLIKE_SET_GC_COLOR (gcv.background, XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel));
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1783 gcv.foreground = gcv.background;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1784 gcv.graphics_exposures = XLIKE_FALSE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1785 mask = XLIKE_GC_FOREGROUND | XLIKE_GC_BACKGROUND | XLIKE_GC_EXPOSURES;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1786
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1787 background_gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, mask);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1788
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1789 /* Clear the divider area first. This needs to be done when a
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1790 window split occurs. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1791 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1792 if (clear)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1793 XClearArea (dpy, x_win, x, y1, width, y2 - y1, False);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1794 #else /* THIS_IS_GTK */
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1795 USED (dpy);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1796 /* if (clear) */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1797 gdk_draw_rectangle (GDK_DRAWABLE (x_win), background_gc, TRUE,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1798 x, y1, width, y2 - y1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1799 #endif /* THIS_IS_GTK */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1800
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1801 #ifndef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1802 /* #### FIXME Why not? Formerly '#if 0' in the GDK code */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1803 /* Draw the divider line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1804 XLIKE_FILL_RECTANGLE (dpy, x_win, background_gc,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1805 x + spacing + shadow_thickness, y1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1806 line_width, y2 - y1);
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1807 #endif /* not THIS_IS_GTK */
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1808
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1809 if (shadow_thickness < 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1810 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1811 shadow_thickness = -shadow_thickness;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1812 style = EDGE_BEVEL_IN;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1813 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1814 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1815 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1816 style = EDGE_BEVEL_OUT;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1817 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1818
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1819 /* Draw the shadows around the divider line */
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1820 XLIKE_bevel_area (w, div_face, x + spacing, y1,
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1821 width - 2 * spacing, y2 - y1,
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
1822 shadow_thickness, EDGE_ALL, style);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1823 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1824
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1825 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1826 XLIKE_output_blank
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1827
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1828 Output a blank by clearing the area it covers in the foreground color
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1829 of its face.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1830 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1831 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1832 XLIKE_output_blank (struct window *w, struct display_line *dl, struct rune *rb,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1833 int start_pixpos, int cursor_start, int cursor_width)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1834 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1835 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1836 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1837
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1838 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1839 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1840 XLIKE_GC gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1841 struct face_cachel *cursor_cachel =
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1842 WINDOW_FACE_CACHEL (w,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1843 get_builtin_face_cache_index
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1844 (w, Vtext_cursor_face));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1845 Lisp_Object bg_pmap;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1846 Lisp_Object buffer = WINDOW_BUFFER (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1847 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1848 buffer);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1849
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1850 int x = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1851 int y = XLIKE_DISPLAY_LINE_YPOS (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1852 int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1853 int width = rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1854
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1855 /* Unmap all subwindows in the area we are going to blank. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1856 redisplay_unmap_subwindows_maybe (f, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1857
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1858 if (start_pixpos > x)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1859 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1860 if (start_pixpos >= (x + width))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1861 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1862 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1863 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1864 width -= (start_pixpos - x);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1865 x = start_pixpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1866 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1867 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1868
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1869 bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1870 if (!IMAGE_INSTANCEP (bg_pmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1871 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1872 bg_pmap = Qnil;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1873
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1874 if (NILP (bg_pmap))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1875 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1876 Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1877 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1878 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1879 WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1880 Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1881
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1882 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1883
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1884 /* If this rune is marked as having the cursor, then it is actually
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1885 representing a tab. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1886 if (!NILP (w->text_cursor_visible_p)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1887 && (rb->cursor_type == CURSOR_ON
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1888 || (cursor_width
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1889 && (cursor_start + cursor_width > x)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1890 && cursor_start < (x + width))))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1891 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1892 int cursor_height, cursor_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1893 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1894 Lisp_Font_Instance *fi;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1895
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1896 fi = XFONT_INSTANCE (FACE_CACHEL_FONT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1897 (WINDOW_FACE_CACHEL (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1898 Vcharset_ascii));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1899
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1900 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1901
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1902 cursor_y = dl->ypos - fi->ascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1903 cursor_height = fi->height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1904 if (cursor_y + cursor_height > y + height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1905 cursor_height = y + height - cursor_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1906
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1907 if (focus)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1908 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1909 if (NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1910 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1911 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, cursor_start, cursor_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1912 fi->width, cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1913 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1914 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1915 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1916 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1917
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1918 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1919 Qnil, Qnil, make_int (bar_width));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1920 XLIKE_DRAW_LINE (dpy, x_win, gc, cursor_start + bar_width - 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1921 cursor_y, cursor_start + bar_width - 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1922 cursor_y + cursor_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1923 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1924 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1925 else if (NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1926 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1927 XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, cursor_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1928 fi->width - 1, cursor_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1929 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1930 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1931 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1932
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1933 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1934 XLIKE_output_horizontal_line
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1935
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1936 Output a horizontal line in the foreground of its face.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1937 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1938 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1939 XLIKE_output_horizontal_line (struct window *w, struct display_line *dl,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1940 struct rune *rb)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1941 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1942 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1943 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1944
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1945 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1946 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1947 XLIKE_GC gc;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1948
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1949 int x = rb->xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1950 int width = rb->width;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1951 int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1952 int ypos1, ypos2, ypos3, ypos4;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1953
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1954 ypos1 = XLIKE_DISPLAY_LINE_YPOS (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1955 ypos2 = ypos1 + rb->object.hline.yoffset;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1956 ypos3 = ypos2 + rb->object.hline.thickness;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1957 ypos4 = dl->ypos + dl->descent - dl->clip;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1958
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1959 /* First clear the area not covered by the line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1960 if (height - rb->object.hline.thickness > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1961 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1962 gc = XLIKE_get_gc (d, Qnil,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1963 WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1964 Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1965
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1966 if (ypos2 - ypos1 > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1967 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1968 if (ypos4 - ypos3 > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1969 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1970 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1971
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1972 #ifdef THIS_IS_GTK
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1973 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1974 GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1975 gtk_paint_hline (style, x_win, GTK_STATE_NORMAL, NULL,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1976 FRAME_GTK_TEXT_WIDGET (f), "hline", x, x + width, ypos2);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1977 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1978 #else /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1979 /* Now draw the line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1980 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1981 Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1982
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1983 if (ypos2 < ypos1)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1984 ypos2 = ypos1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1985 if (ypos3 > ypos4)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1986 ypos3 = ypos4;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1987
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1988 if (ypos3 - ypos2 > 0)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1989 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos2, width, ypos3 - ypos2);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1990 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1991 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1992
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1993 /****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1994 XLIKE_clear_region
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1995
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1996 Clear the area in the box defined by the given parameters using the
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1997 given face.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1998 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
1999 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2000 XLIKE_clear_region (Lisp_Object UNUSED (locale), struct device* d,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2001 struct frame* f, face_index UNUSED (findex), int x, int y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2002 int width, int height, Lisp_Object fcolor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2003 Lisp_Object bcolor, Lisp_Object background_pixmap)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2004 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2005 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2006 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2007 XLIKE_GC gc = NULL;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2008
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2009 if (!UNBOUNDP (background_pixmap))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2010 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2011 gc = XLIKE_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2012 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2013
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2014 if (gc)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2015 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2016 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2017 XLIKE_CLEAR_AREA (dpy, x_win, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2018 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2019
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2020 /*****************************************************************************
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2021 xlike_output_eol_cursor
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2022
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2023 Draw a cursor at the end of a line. The end-of-line cursor is
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2024 narrower than the normal cursor.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2025 ****************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2026 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2027 XLIKE_output_eol_cursor (struct window *w, struct display_line *dl, int xpos,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2028 face_index findex)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2029 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2030 struct frame *f = XFRAME (w->frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2031 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2032 Lisp_Object window;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2033
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2034 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2035 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2036 XLIKE_GC gc = NULL;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2037 face_index elt = get_builtin_face_cache_index (w, Vtext_cursor_face);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2038 struct face_cachel *cursor_cachel = WINDOW_FACE_CACHEL (w, elt);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2039
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2040 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2041 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2042 WINDOW_BUFFER (w));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2043
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2044 int x = xpos;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2045 int y = XLIKE_DISPLAY_LINE_YPOS (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2046 int width = EOL_CURSOR_WIDTH;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2047 int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2048 int cursor_height, cursor_y;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2049 int defheight, defascent;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2050
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2051 window = wrap_window (w);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2052 redisplay_clear_region (window, findex, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2053
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2054 if (NILP (w->text_cursor_visible_p))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2055 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2056
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2057 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2058
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2059 default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2060
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2061 /* make sure the cursor is entirely contained between y and y+height */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2062 cursor_height = min (defheight, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2063 cursor_y = max (y, min (y + height - cursor_height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2064 dl->ypos - defascent));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2065
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2066 if (focus)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2067 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2068 #ifdef HAVE_XIM
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2069 XIM_SetSpotLocation (f, x - 2 , cursor_y + cursor_height - 2);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2070 #endif /* HAVE_XIM */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2071
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2072 if (NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2073 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2074 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, cursor_y, width,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2075 cursor_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2076 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2077 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2078 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2079 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2080
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2081 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2082 make_int (bar_width));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2083 XLIKE_DRAW_LINE (dpy, x_win, gc, x + bar_width - 1, cursor_y,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2084 x + bar_width - 1, cursor_y + cursor_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2085 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2086 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2087 else if (NILP (bar_cursor_value))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2088 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2089 XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, x, cursor_y, width - 1,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2090 cursor_height - 1);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2091 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2092 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2093
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2094 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2095 XLIKE_clear_frame_window (Lisp_Object window)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2096 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2097 struct window *w = XWINDOW (window);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2098
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2099 if (!NILP (w->vchild))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2100 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2101 XLIKE_clear_frame_windows (w->vchild);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2102 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2103 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2104
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2105 if (!NILP (w->hchild))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2106 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2107 XLIKE_clear_frame_windows (w->hchild);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2108 return;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2109 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2110
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2111 redisplay_clear_to_window_end (w, WINDOW_TEXT_TOP (w),
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2112 WINDOW_TEXT_BOTTOM (w));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2113 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2114
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2115 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2116 XLIKE_clear_frame_windows (Lisp_Object window)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2117 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2118 for (; !NILP (window); window = XWINDOW (window)->next)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2119 XLIKE_clear_frame_window (window);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2120 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2121
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2122 static void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2123 XLIKE_clear_frame (struct frame *f)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2124 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2125 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (XDEVICE (f->device));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2126 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2127 int x, y, width, height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2128 Lisp_Object frame;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2129
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2130 x = FRAME_LEFT_BORDER_START (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2131 width = (FRAME_PIXWIDTH (f) - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2132 FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2133 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2134 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2135 /* #### This adjustment by 1 should be being done in the macros.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2136 There is some small differences between when the menubar is on
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2137 and off that we still need to deal with. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2138 y = FRAME_TOP_BORDER_START (f) - 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2139 height = (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2140 FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2141 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) -
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2142 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2143
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2144 XLIKE_CLEAR_AREA (dpy, x_win, x, y, width, height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2145
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2146 frame = wrap_frame (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2147
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2148 if (!UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vdefault_face, frame))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2149 || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vleft_margin_face, frame))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2150 || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vright_margin_face, frame)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2151 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2152 XLIKE_clear_frame_windows (f->root_window);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2153 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2154 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2155 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2156 struct device *d = XDEVICE (f->device);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2157 if (!(check_if_pending_expose_event (d)))
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2158 XFlush (DEVICE_X_DISPLAY (d));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2159 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2160 #endif /* THIS_IS_X */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2161 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2162
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2163 /* briefly swap the foreground and background colors.
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2164 */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2165
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2166 static int
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2167 XLIKE_flash (struct device *d)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2168 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2169 struct frame *f = device_selected_frame (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2170 XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2171 XLIKE_WINDOW win = GET_XLIKE_WINDOW (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2172 XLIKE_GC gc = NULL;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2173 XLIKE_GCVALUES gcv;
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
2174 XLIKE_PIXEL tmp_fcolor, tmp_bcolor;
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2175 Lisp_Object tmp_pixel, frame;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2176 struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f));
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2177 int flash_height;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2178
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2179 frame = wrap_frame (f);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2180
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2181 tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame);
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
2182 tmp_fcolor = XLIKE_COLOR_TO_PIXEL (XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel));
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2183 tmp_pixel = FACE_BACKGROUND (Vdefault_face, frame);
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
2184 tmp_bcolor = XLIKE_COLOR_TO_PIXEL (XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel));
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2185 memset (&gcv, ~0, sizeof (gcv)); /* initialize all slots to ~0 */
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4882
diff changeset
2186 XLIKE_SET_GC_PIXEL (gcv.foreground, tmp_fcolor ^ tmp_bcolor);
4882
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2187 gcv.function = XLIKE_GX_XOR;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2188 gcv.graphics_exposures = XLIKE_FALSE;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2189 gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (XDEVICE (f->device)), &gcv,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2190 XLIKE_GC_FOREGROUND | XLIKE_GC_FUNCTION | XLIKE_GC_EXPOSURES);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2191 default_face_height_and_width (frame, &flash_height, 0);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2192
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2193 /* If window is tall, flash top and bottom line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2194 if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2195 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2196 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2197 w->pixel_width, flash_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2198 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2199 w->pixel_top + w->pixel_height - flash_height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2200 w->pixel_width, flash_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2201 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2202 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2203 /* If it is short, flash it all. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2204 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2205 w->pixel_width, w->pixel_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2206
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2207 XLIKE_FLUSH (dpy);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2208
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2209 #ifdef HAVE_SELECT
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2210 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2211 int usecs = 100000;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2212 struct timeval tv;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2213 tv.tv_sec = usecs / 1000000L;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2214 tv.tv_usec = usecs % 1000000L;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2215 /* I'm sure someone is going to complain about this... */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2216 select (0, 0, 0, 0, &tv);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2217 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2218 #else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2219 #ifdef HAVE_POLL
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2220 poll (0, 0, 100);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2221 #else /* !HAVE_POLL */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2222 #error bite me
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2223 #endif /* HAVE_POLL */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2224 #endif /* HAVE_SELECT */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2225
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2226 /* If window is tall, flash top and bottom line. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2227 if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2228 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2229 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2230 w->pixel_width, flash_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2231 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2232 w->pixel_top + w->pixel_height - flash_height,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2233 w->pixel_width, flash_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2234 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2235 else
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2236 /* If it is short, flash it all. */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2237 XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2238 w->pixel_width, w->pixel_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2239
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2240 XLIKE_FLUSH (dpy);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2241
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2242 return 1;
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2243 }
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2244
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2245
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2246 /************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2247 /* initialization */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2248 /************************************************************************/
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2249
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2250 void
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2251 console_type_create_redisplay_XLIKE (void)
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2252 {
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2253 /* redisplay methods */
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2254 XLIKE_CONSOLE_HAS_METHOD (text_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2255 XLIKE_CONSOLE_HAS_METHOD (output_display_block);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2256 XLIKE_CONSOLE_HAS_METHOD (divider_height);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2257 XLIKE_CONSOLE_HAS_METHOD (eol_cursor_width);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2258 XLIKE_CONSOLE_HAS_METHOD (output_vertical_divider);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2259 XLIKE_CONSOLE_HAS_METHOD (clear_region);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2260 XLIKE_CONSOLE_HAS_METHOD (clear_frame);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2261 XLIKE_CONSOLE_HAS_METHOD (flash);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2262 XLIKE_CONSOLE_HAS_METHOD (ring_bell);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2263 XLIKE_CONSOLE_HAS_METHOD (bevel_area);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2264 XLIKE_CONSOLE_HAS_METHOD (output_string);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2265 XLIKE_CONSOLE_HAS_METHOD (output_pixmap);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2266
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2267 #ifdef THIS_IS_X
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2268 XLIKE_CONSOLE_HAS_METHOD (window_output_begin);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2269 XLIKE_CONSOLE_HAS_METHOD (window_output_end);
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2270 #endif
eab9498ecc0e merge most of rest of redisplay-x.c and redisplay-gtk.c into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4881
diff changeset
2271 }