commit 381eb5d5a0c7ba9d4ef06f8be1636f882d7a7b78 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Fri Apr 22 05:42:09 2022 +0000 Fix default frame name on Haiku * src/haikufns.c (haiku_set_background_color) (haiku_set_cursor_color, haiku_get_pixel, haiku_put_pixel) (haiku_set_internal_border_width) (haiku_set_inhibit_double_buffering) (Fhaiku_mouse_absolute_pixel_position, Fxw_color_defined_p) (Fxw_color_values, Fx_double_buffered_p) (Fx_display_backing_store): Clean up coding style. (haiku_set_name): Use correct default name and don't cons extra string all the time. * src/haikuterm.c (haiku_read_socket): Remove unused variable. (haiku_term_init): Set default name. (mark_haiku_display): Mark new field. * src/haikuterm.h (struct haiku_display_info): New field `default_name'. diff --git a/src/haikufns.c b/src/haikufns.c index 5fca46c41b..14644be22b 100644 --- a/src/haikufns.c +++ b/src/haikufns.c @@ -1394,11 +1394,12 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute) void haiku_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { + Emacs_Color color; + struct face *defface; + CHECK_STRING (arg); block_input (); - Emacs_Color color; - if (haiku_get_color (SSDATA (arg), &color)) { store_frame_param (f, Qbackground_color, oldval); @@ -1411,8 +1412,6 @@ haiku_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval if (FRAME_HAIKU_VIEW (f)) { - struct face *defface; - BView_draw_lock (FRAME_HAIKU_VIEW (f), false, 0, 0, 0, 0); BView_SetViewColor (FRAME_HAIKU_VIEW (f), color.pixel); BView_draw_unlock (FRAME_HAIKU_VIEW (f)); @@ -1434,10 +1433,10 @@ haiku_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval void haiku_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - CHECK_STRING (arg); + Emacs_Color color, fore_pixel; + CHECK_STRING (arg); block_input (); - Emacs_Color color, fore_pixel; if (haiku_get_color (SSDATA (arg), &color)) { @@ -1478,11 +1477,7 @@ haiku_get_pixel (haiku bitmap, int x, int y) { unsigned char *data; int32_t bytes_per_row; - int mono_p; - int left; - int right; - int top; - int bottom; + int mono_p, left, right, top, bottom, byte; data = BBitmap_data (bitmap); BBitmap_dimensions (bitmap, &left, &top, &right, &bottom, @@ -1494,20 +1489,17 @@ haiku_get_pixel (haiku bitmap, int x, int y) if (!mono_p) return ((uint32_t *) (data + (bytes_per_row * y)))[x]; - int byte = y * bytes_per_row + x / 8; + byte = y * bytes_per_row + x / 8; return data[byte] & (1 << (x % 8)); } void haiku_put_pixel (haiku bitmap, int x, int y, unsigned long pixel) { - unsigned char *data; + unsigned char *data, *byte; int32_t bytes_per_row; - int mono_p; - int left; - int right; - int top; - int bottom; + int mono_p, left, right, top, bottom; + ptrdiff_t off, bit, xoff; data = BBitmap_data (bitmap); BBitmap_dimensions (bitmap, &left, &top, &right, &bottom, @@ -1518,11 +1510,11 @@ haiku_put_pixel (haiku bitmap, int x, int y, unsigned long pixel) if (mono_p) { - ptrdiff_t off = y * bytes_per_row; - ptrdiff_t bit = x % 8; - ptrdiff_t xoff = x / 8; + off = y * bytes_per_row; + bit = x % 8; + xoff = x / 8; - unsigned char *byte = data + off + xoff; + byte = data + off + xoff; if (!pixel) *byte &= ~(1 << bit); else @@ -1652,7 +1644,8 @@ haiku_unvisualize_frame (struct frame *f) } void -haiku_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) +haiku_set_internal_border_width (struct frame *f, Lisp_Object arg, + Lisp_Object oldval) { int old_width = FRAME_INTERNAL_BORDER_WIDTH (f); int new_width = check_int_nonnegative (arg); @@ -1707,28 +1700,33 @@ check_x_display_info (Lisp_Object object) return check_haiku_display_info (object); } -/* Rename frame F to NAME. If NAME is nil, set F's name to "GNU - Emacs". If EXPLICIT_P is non-zero, that indicates Lisp code is - setting the name, not redisplay; in that case, set F's name to NAME - and set F->explicit_name; if NAME is nil, clear F->explicit_name. +/* Rename frame F to NAME. If NAME is nil, set F's name to the + default name. If EXPLICIT_P is non-zero, that indicates Lisp code + is setting the name, not redisplay; in that case, set F's name to + NAME and set F->explicit_name; if NAME is nil, clear + F->explicit_name. If EXPLICIT_P is zero, it means redisplay is setting the name; the name provided will be ignored if explicit_name is set. */ void haiku_set_name (struct frame *f, Lisp_Object name, bool explicit_p) { + struct haiku_display_info *dpyinfo; + if (explicit_p) { if (f->explicit_name && NILP (name)) - update_mode_lines = 24; + update_mode_lines = 37; f->explicit_name = !NILP (name); } else if (f->explicit_name) return; + dpyinfo = FRAME_DISPLAY_INFO (f); + if (NILP (name)) - name = build_unibyte_string ("GNU Emacs"); + name = dpyinfo->default_name; if (!NILP (Fstring_equal (name, f->name))) return; @@ -1754,11 +1752,9 @@ haiku_set_inhibit_double_buffering (struct frame *f, { #endif EmacsView_set_up_double_buffering (FRAME_HAIKU_VIEW (f)); + if (!NILP (old_value)) - { - SET_FRAME_GARBAGED (f); - expose_frame (f, 0, 0, 0, 0); - } + expose_frame (f, 0, 0, 0, 0); #ifndef USE_BE_CAIRO } else @@ -1798,19 +1794,15 @@ the mouse cursor position in pixels relative to a position (0, 0) of the selected frame's display. */) (void) { - if (!x_display_list) - return Qnil; - struct frame *f = SELECTED_FRAME (); + void *view; + int x, y; - if (FRAME_INITIAL_P (f) || !FRAME_HAIKU_P (f) - || !FRAME_HAIKU_VIEW (f)) + if (FRAME_INITIAL_P (f) || !FRAME_HAIKU_P (f)) return Qnil; block_input (); - void *view = FRAME_HAIKU_VIEW (f); - - int x, y; + view = FRAME_HAIKU_VIEW (f); BView_get_mouse (view, &x, &y); BView_convert_to_screen (view, &x, &y); unblock_input (); @@ -1830,6 +1822,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, (Lisp_Object color, Lisp_Object frame) { Emacs_Color col; + CHECK_STRING (color); decode_window_system_frame (frame); @@ -1841,6 +1834,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, (Lisp_Object color, Lisp_Object frame) { Emacs_Color col; + CHECK_STRING (color); decode_window_system_frame (frame); @@ -1851,7 +1845,9 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, return Qnil; } unblock_input (); - return list3i (lrint (col.red), lrint (col.green), lrint (col.blue)); + + return list3i (lrint (col.red), lrint (col.green), + lrint (col.blue)); } DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, @@ -2346,8 +2342,7 @@ DEFUN ("x-double-buffered-p", Fx_double_buffered_p, Sx_double_buffered_p, doc: /* SKIP: real doc in xfns.c. */) (Lisp_Object frame) { - struct frame *f = decode_live_frame (frame); - check_window_system (f); + struct frame *f = decode_window_system_frame (frame); return EmacsView_double_buffered_p (FRAME_HAIKU_VIEW (f)) ? Qt : Qnil; } @@ -2357,13 +2352,14 @@ DEFUN ("x-display-backing-store", Fx_display_backing_store, Sx_display_backing_s doc: /* SKIP: real doc in xfns.c. */) (Lisp_Object terminal) { + struct frame *f; + if (FRAMEP (terminal)) { - CHECK_LIVE_FRAME (terminal); - struct frame *f = decode_window_system_frame (terminal); + f = decode_window_system_frame (terminal); - if (FRAME_HAIKU_VIEW (f) && - EmacsView_double_buffered_p (FRAME_HAIKU_VIEW (f))) + if (FRAME_HAIKU_VIEW (f) + && EmacsView_double_buffered_p (FRAME_HAIKU_VIEW (f))) return FRAME_PARENT_FRAME (f) ? Qwhen_mapped : Qalways; else return Qnot_useful; diff --git a/src/haikuterm.c b/src/haikuterm.c index 213641d607..8c6d620b0f 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -3121,7 +3121,6 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) || b->y < r.y || b->y >= r.y + r.height) { f->mouse_moved = true; - dpyinfo->last_mouse_scroll_bar = NULL; note_mouse_highlight (f, b->x, b->y); remember_mouse_glyph (f, b->x, b->y, &FRAME_DISPLAY_INFO (f)->last_mouse_glyph); @@ -3948,8 +3947,9 @@ haiku_term_init (void) { struct haiku_display_info *dpyinfo; struct terminal *terminal; - - Lisp_Object color_file, color_map; + Lisp_Object color_file, color_map, system_name; + ptrdiff_t nbytes; + void *name_buffer; block_input (); Fset_input_interrupt_mode (Qt); @@ -4026,6 +4026,23 @@ haiku_term_init (void) BCursor_from_id (CURSOR_ID_NO_CURSOR)); #undef ASSIGN_CURSOR + system_name = Fsystem_name (); + + if (STRINGP (system_name)) + { + nbytes = sizeof "GNU Emacs" + sizeof " at "; + + if (INT_ADD_WRAPV (nbytes, SBYTES (system_name), &nbytes)) + memory_full (SIZE_MAX); + + name_buffer = alloca (nbytes); + sprintf (name_buffer, "%s%s%s", "GNU Emacs", + " at ", SDATA (system_name)); + dpyinfo->default_name = build_string (name_buffer); + } + else + dpyinfo->default_name = build_string ("GNU Emacs"); + unblock_input (); return dpyinfo; @@ -4093,7 +4110,10 @@ void mark_haiku_display (void) { if (x_display_list) - mark_object (x_display_list->color_map); + { + mark_object (x_display_list->color_map); + mark_object (x_display_list->default_name); + } } void diff --git a/src/haikuterm.h b/src/haikuterm.h index 903a21d29f..d20d491838 100644 --- a/src/haikuterm.h +++ b/src/haikuterm.h @@ -81,6 +81,7 @@ struct haiku_display_info int color_p; Lisp_Object rdb; + Lisp_Object default_name; Emacs_Cursor vertical_scroll_bar_cursor; Emacs_Cursor horizontal_scroll_bar_cursor; @@ -96,8 +97,6 @@ struct haiku_display_info struct haiku_rect last_mouse_glyph; - void *last_mouse_scroll_bar; - haiku display; double resx, resy; commit 664da3e936010b5025b485b67969156ccadb0b44 Author: Po Lu Date: Fri Apr 22 09:06:44 2022 +0800 Add an option to disable XI2 for debugging purposes * src/xterm.c (handle_one_xevent): Accept resource `disableInputExtension', which means to skip setting up the X input extension. diff --git a/src/xterm.c b/src/xterm.c index 69e9302973..adfe3059d1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -23009,9 +23009,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) SynchronizeResize, Qnil, Qnil); - if (STRINGP (value) && - (!strcmp (SSDATA (value), "false") - || !strcmp (SSDATA (value), "off"))) + if (STRINGP (value) + && (!strcmp (SSDATA (value), "false") + || !strcmp (SSDATA (value), "off"))) dpyinfo->xsync_supported_p = false; } #endif @@ -23136,6 +23136,23 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) int major = 2; int xi_first_event, xi_first_error; +#ifndef HAVE_GTK3 + { + AUTO_STRING (disableInputExtension, "disableInputExtension"); + AUTO_STRING (DisableInputExtension, "DisableInputExtension"); + + Lisp_Object value = gui_display_get_resource (dpyinfo, + disableInputExtension, + DisableInputExtension, + Qnil, Qnil); + + if (STRINGP (value) + && (!strcmp (SSDATA (value), "on") + || !strcmp (SSDATA (value), "true"))) + goto skip_xi_setup; + } +#endif + #ifdef HAVE_XINPUT2_4 int minor = 4; #elif defined HAVE_XINPUT2_3 /* XInput 2.3 */ @@ -23231,6 +23248,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) } dpyinfo->xi2_version = minor; +#ifndef HAVE_GTK3 + skip_xi_setup: +#endif #endif #ifdef HAVE_XRANDR commit 390b637eed8eba29d0dc710a155a1e0b00f26e0b Author: Thomas Fitzsimmons Date: Thu Apr 21 17:24:29 2022 -0400 EUDC: Handle nil BOB button label * lisp/net/eudc-bob.el (eudc-bob-make-button): Do not throw error when label is nil. diff --git a/lisp/net/eudc-bob.el b/lisp/net/eudc-bob.el index 6a2cd13dd0..f543678fa2 100644 --- a/lisp/net/eudc-bob.el +++ b/lisp/net/eudc-bob.el @@ -124,7 +124,7 @@ LABEL." (let (overlay (p (point)) prop val) - (insert label) + (insert (or label "")) (put-text-property p (point) 'face 'bold) (setq overlay (make-overlay p (point))) (overlay-put overlay 'mouse-face 'highlight) commit f8aa771af3061ceb68aafacd55e8e9e048853f5d Author: Sean Whitton Date: Sat Apr 16 08:23:14 2022 -0700 New electric forward slash Eshell module * lisp/eshell/em-elecslash.el: New file. * etc/NEWS: * doc/misc/eshell.texi (Electric forward slash): Document the module. (Make / electric): Retitle to "Make / more electric", update, add "@noindent", and standardize terminology. diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index 411e696069..e539206166 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -1560,6 +1560,7 @@ Eshell module.} You also need to load the following as shown: * Key rebinding:: * Smart scrolling:: * Terminal emulation:: +* Electric forward slash:: @end menu @node Writing a module @@ -1592,6 +1593,61 @@ This section is not yet written. This section is not yet written. +@node Electric forward slash +@section Electric forward slash + +To help with supplying absolute file name arguments to remote +commands, you can add the @code{eshell-elecslash} module to +@code{eshell-modules-list}. Then, typing @kbd{/} as the first +character of a command line argument will automatically insert the +Tramp prefix @file{/method:host:}. If this is not what you want +(e.g.@: because you want to refer to a local file), you can type +another @kbd{/} to undo the automatic insertion. Typing @kbd{~/} also +inserts the Tramp prefix. The automatic insertion applies only when +@code{default-directory} is remote and the command is a Lisp function. +In particular, typing arguments to external commands doesn't insert +the prefix. + +The result is that in most cases of supplying absolute file name +arguments to commands you should see the Tramp prefix inserted +automatically only when that's what you'd reasonably expect. This +frees you from having to keep track of whether commands are Lisp +functions or external when typing command line arguments. For +example, suppose you execute + +@example + cd /ssh:root@@example.com: + find /etc -name "*gnu*" +@end example + +@noindent and in reviewing the output of the command, you identify a +file @file{/etc/gnugnu} that should be moved somewhere else. So you +type + +@example + mv /etc/gnugnu /tmp +@end example + +@noindent But since @command{mv} refers to the local Lisp function +@code{eshell/mv}, not a remote shell command, to say this is to +request that the local file @file{/etc/gnugnu} be moved into the local +@file{/tmp} directory. After you add @code{eshell-elecslash} to +@code{eshell-modules-list}, then when you type the above @command{mv} +invocation you will get the following input, which is what you +intended: + +@example + mv /ssh:root@@example.com:/etc/gnugnu /ssh:root@@example.com:/tmp +@end example + +The code that determines whether or not the Tramp prefix should be +inserted uses simple heuristics. A limitation of the current +implementation is that it inspects whether only the command at the +very beginning of input is a Lisp function or external program. Thus +when chaining commands with the operators @code{&&}, @code{||}, +@code{|} and @code{;}, the electric forward slash is active only +within the first command. + @node Bugs and ideas @chapter Bugs and ideas @cindex reporting bugs and ideas @@ -1995,11 +2051,12 @@ only. That way, it could be listed as a login shell. @item The first keypress after @kbd{M-x watson} triggers @code{eshell-send-input} -@item Make @kbd{/} electric +@item Make @kbd{/} more electric -So that it automatically expands and corrects pathnames. Or make -pathname completion for Pcomplete auto-expand @samp{/u/i/std@key{TAB}} to -@samp{/usr/include/std@key{TAB}}. +@noindent so that it automatically expands and corrects file names, +beyond what the @code{em-elecslash} module is able to do. Or make +file name completion for Pcomplete auto-expand +@samp{/u/i/std@key{TAB}} to @samp{/usr/include/std@key{TAB}}. @item Write the @command{pushd} stack to disk along with @code{last-dir-ring} diff --git a/etc/NEWS b/etc/NEWS index f8938534f3..c0b9ce654e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1251,6 +1251,16 @@ support for pipelines which will move a lot of data. See section "Running Shell Pipelines Natively" in the Eshell manual, node "(eshell) Input/Output". ++++ +*** New module to help supplying absolute file names to remote commands. +After enabling the new 'eshell-elecslash' module, typing a forward +slash as the first character of a command line argument will +automatically insert the Tramp prefix. The automatic insertion +applies only when 'default-directory' is remote and the command is a +Lisp function. This frees you from having to keep track of whether +commands are Lisp function or external when supplying absolute file +name arguments. See "Electric forward slash" in the Eshell manual. + ** Miscellaneous +++ diff --git a/lisp/eshell/em-elecslash.el b/lisp/eshell/em-elecslash.el new file mode 100644 index 0000000000..091acb9a86 --- /dev/null +++ b/lisp/eshell/em-elecslash.el @@ -0,0 +1,120 @@ +;;; em-elecslash.el --- electric forward slashes -*- lexical-binding:t -*- + +;; Copyright (C) 2022 Free Software Foundation, Inc. + +;; Author: Sean Whitton + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Electric forward slash in remote Eshells. + +;;; Code: + +(require 'tramp) +(require 'thingatpt) +(require 'esh-cmd) +(require 'esh-ext) +(require 'esh-mode) + +;; This makes us an option when customizing `eshell-modules-list'. +;;;###autoload +(progn +(defgroup eshell-elecslash nil + "Electric forward slash in remote Eshells. + +This module helps with supplying absolute file name arguments to +remote commands. After enabling it, typing a forward slash as +the first character of a command line argument will automatically +insert the Tramp prefix, /method:host:. The automatic insertion +applies only when `default-directory' is remote and the command +is a Lisp function. + +The result is that in most cases of supplying absolute file name +arguments to commands you should see the Tramp prefix inserted +automatically only when that's what you'd reasonably expect. +This frees you from having to keep track of whether commands are +Lisp functions or external when typing command line arguments." + :tag "Electric forward slash" + :group 'eshell-module)) + +;;; Functions: + +(defun eshell-elecslash-initialize () ;Called from `eshell-mode' via intern-soft! + "Initialize remote Eshell electric forward slash support." + (add-hook 'post-self-insert-hook + #'eshell-electric-forward-slash nil t)) + +(defun eshell-electric-forward-slash () + "Implementation of electric forward slash in remote Eshells. + +Initializing the `eshell-elecslash' module adds this function to +`post-self-insert-hook'. Typing / or ~/ as the first character +of a command line argument automatically inserts the Tramp prefix +in the case that `default-directory' is remote and the command is +a Lisp function. Typing a second forward slash undoes the +insertion." + (when (eq ?/ (char-before)) + (delete-char -1) + (let ((tilde-before (eq ?~ (char-before))) + (command (save-excursion + (eshell-bol) + (skip-syntax-forward " ") + (thing-at-point 'sexp)))) + (if (and (file-remote-p default-directory) + ;; We can't formally parse the input. But if there is + ;; one of these operators behind us, then looking at + ;; the first command would not be sensible. So be + ;; conservative: don't insert the Tramp prefix if there + ;; are any of these operators behind us. + (not (looking-back (regexp-opt '("&&" "|" ";")) + eshell-last-output-end)) + (or (= (point) eshell-last-output-end) + (and tilde-before + (= (1- (point)) eshell-last-output-end)) + (and (or tilde-before + (eq ?\s (char-syntax (char-before)))) + (or (eshell-find-alias-function command) + (and (fboundp (intern-soft command)) + (or eshell-prefer-lisp-functions + (not (eshell-search-path command)))))))) + (let ((map (make-sparse-keymap)) + (start (if tilde-before (1- (point)) (point))) + (localname + (tramp-file-name-localname + (tramp-dissect-file-name default-directory)))) + (when tilde-before (delete-char -1)) + (insert + (substring default-directory 0 + (string-search localname default-directory))) + (unless tilde-before (insert "/")) + ;; Typing a second slash undoes the insertion, for when + ;; you really do want to type a local absolute file name. + (define-key map "/" (lambda () + (interactive) + (delete-region start (point)) + (insert (if tilde-before "~/" "/")))) + (set-transient-map map)) + (insert "/"))))) + +(provide 'em-elecslash) + +;; Local Variables: +;; generated-autoload-file: "esh-groups.el" +;; End: + +;;; esh-elecslash.el ends here commit ad89ec84ee20a027e36922c187ad9f2dcb93bcaf Author: Sean Whitton Date: Thu Apr 14 07:12:41 2022 -0700 Bind 'imenu' to 'M-g i' globally Another candidate was 'M-s i'. Discussion on emacs-devel has led me to conclude that most people will find 'M-g i' more intuitive and thus easier to memorize. * lisp/bindings.el (goto-map): Bind 'imenu' to 'M-g i' globally. * etc/NEWS: Document the change. * doc/emacs/programs.texi (Imenu): * lisp/progmodes/cperl-mode.el: Replace 'M-x imenu' with 'M-g i'. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index ff4405f1fb..45bc4c79b4 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -250,8 +250,8 @@ where it treats each chapter, section, etc., as a definition. together.) @findex imenu - If you type @kbd{M-x imenu}, it reads the name of a definition using -the minibuffer, then moves point to that definition. You can use + If you type @kbd{M-g i}, it reads the name of a definition using the +minibuffer, then moves point to that definition. You can use completion to specify the name; the command always displays the whole list of valid names. diff --git a/etc/NEWS b/etc/NEWS index 36db29bbbe..f8938534f3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -546,6 +546,9 @@ Rcirc will use the default 'completion-at-point' mechanism. The conventional IRC behaviour of completing by cycling through the available options can be restored by enabling this option. ++++ +** 'imenu' is now bound to 'M-g i' globally. + * Editing Changes in Emacs 29.1 --- diff --git a/lisp/bindings.el b/lisp/bindings.el index 1913f82600..bfe5ba8623 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1127,6 +1127,7 @@ if `inhibit-field-text-motion' is non-nil." (define-key goto-map "p" 'previous-error) (define-key goto-map "\M-p" 'previous-error) (define-key goto-map "\t" 'move-to-column) +(define-key goto-map "i" 'imenu) (defvar search-map (make-sparse-keymap) "Keymap for search related commands.") diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 94ecc45b15..3742286e5d 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -64,7 +64,7 @@ ;; This mode supports font-lock, imenu and mode-compile. In the ;; hairy version font-lock is on, but you should activate imenu ;; yourself (note that mode-compile is not standard yet). Well, you -;; can use imenu from keyboard anyway (M-x imenu), but it is better +;; can use imenu from keyboard anyway (M-g i), but it is better ;; to bind it like that: ;; (define-key global-map [M-S-down-mouse-3] 'imenu) commit 783dd6da31e3f0387e110972c0b9fe1f5acc4bba Author: Tino Calancha Date: Thu Apr 21 17:27:50 2022 +0200 Respect user-emacs-directory-warning in startup * lisp/startup.el (command-line): If user-emacs-directory is not accessible, delay to show a warning until all command line args are processed (bug#25163). diff --git a/lisp/startup.el b/lisp/startup.el index 353b5c78f1..4391fdd996 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1292,11 +1292,13 @@ please check its value") ;; Re-evaluate predefined variables whose initial value depends on ;; the runtime context. - (when (listp custom-delayed-init-variables) - (mapc #'custom-reevaluate-setting - ;; Initialize them in the same order they were loaded, in - ;; case there are dependencies between them. - (reverse custom-delayed-init-variables))) + (let ((user-emacs-directory-warning nil)) ; Delay showing this + ; warning (Bug#25162). + (when (listp custom-delayed-init-variables) + (mapc #'custom-reevaluate-setting + ;; Initialize them in the same order they were loaded, in + ;; case there are dependencies between them. + (reverse custom-delayed-init-variables)))) (setq custom-delayed-init-variables t) ;; Warn for invalid user name. @@ -1557,9 +1559,18 @@ please check its value") (list 'error (substitute-command-keys "Memory exhausted--use \\[save-some-buffers] then exit and restart Emacs"))) + ;; Reevaluate `user-emacs-directory-warning' before process '--eval' + ;; args, so that the user can override that default (Bug#25162). + (custom-reevaluate-setting 'user-emacs-directory-warning) + ;; Process the remaining args. (command-line-1 (cdr command-line-args)) + ;; Check if `user-emacs-directory' is accessible (Bug#25162). + (when (and user-emacs-directory-warning + (not (file-accessible-directory-p user-emacs-directory))) + (locate-user-emacs-file "")) + ;; This is a problem because, e.g. if emacs.d/gnus.el exists, ;; trying to load gnus could load the wrong file. ;; OK, it would not matter if .emacs.d were at the end of load-path. commit f3a02858dccbac36bbf0fb19a29fab59013a56a0 Author: Lars Ingebrigtsen Date: Thu Apr 21 17:05:23 2022 +0200 Allow searching for regexps with a prefix * doc/misc/info.texi (Search Index): Mention it. * lisp/info.el (Info-find-node): Allow not signalling errors. (Info-apropos-matches): Allow taking a regexp. (info-apropos): Prefix now means looking for a regexp. diff --git a/doc/misc/info.texi b/doc/misc/info.texi index 6ebf60ce36..4db35ebf0f 100644 --- a/doc/misc/info.texi +++ b/doc/misc/info.texi @@ -1083,7 +1083,9 @@ If you aren't sure which manual documents the topic you are looking for, try the @kbd{M-x info-apropos} command in Emacs, or the @kbd{M-x index-apropos} command in the stand-alone reader. It prompts for a string and then looks up that string in all the indices of all the -Info documents installed on your system. +Info documents installed on your system. In Emacs, giving a prefix +argument to the command will try to search for a regular expression +instead of a string. @node Go to node @section @kbd{g} goes to a node by name diff --git a/etc/NEWS b/etc/NEWS index 3442ebd81b..36db29bbbe 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -763,6 +763,9 @@ This fills the region to be no wider than a specified pixel width. ** Info ++++ +*** 'M-x info-apropos' now takes a prefix argument to search for regexps. + --- *** New command 'Info-goto-node-web' and key binding 'G'. This will take you to the gnu.org web server's version of the current diff --git a/lisp/info.el b/lisp/info.el index 380a8e2780..8ca6c54979 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -907,17 +907,20 @@ find a node." filename))) filename)))) -(defun Info-find-node (filename nodename &optional no-going-back strict-case) +(defun Info-find-node (filename nodename &optional no-going-back strict-case + noerror) "Go to an Info node specified as separate FILENAME and NODENAME. NO-GOING-BACK is non-nil if recovering from an error in this function; it says do not attempt further (recursive) error recovery. This function first looks for a case-sensitive match for NODENAME; if none is found it then tries a case-insensitive match (unless -STRICT-CASE is non-nil)." +STRICT-CASE is non-nil). + +If NOERROR, inhibit error messages when we can't find the node." (info-initialize) (setq nodename (info--node-canonicalize-whitespace nodename)) - (setq filename (Info-find-file filename)) + (setq filename (Info-find-file filename noerror)) ;; Go into Info buffer. (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*")) ;; Record the node we are leaving, if we were in one. @@ -3613,13 +3616,16 @@ MATCHES is a list of index matches found by `Info-apropos-matches'.") (format " (line %s)" (nth 3 entry)) ""))))))))) -(defun Info-apropos-matches (string) +(defun Info-apropos-matches (string &optional regexp) "Collect STRING matches from all known Info files on your system. +If REGEXP, use regexp matching instead of literal matching. Return a list of matches where each element is in the format \((FILENAME INDEXTEXT NODENAME LINENUMBER))." (unless (string= string "") (let ((pattern (format "\n\\* +\\([^\n]*\\(%s\\)[^\n]*\\):[ \t]+\\([^\n]+\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" - (regexp-quote string))) + (if regexp + string + (regexp-quote string)))) (ohist Info-history) (ohist-list Info-history-list) (current-node Info-current-node) @@ -3644,9 +3650,9 @@ Return a list of matches where each element is in the format (dolist (manual (nreverse manuals)) (message "Searching %s" manual) (condition-case err - (if (setq nodes (Info-index-nodes (Info-find-file manual))) + (if (setq nodes (Info-index-nodes (Info-find-file manual t))) (save-excursion - (Info-find-node manual (car nodes)) + (Info-find-node manual (car nodes) nil nil t) (while (progn (goto-char (point-min)) @@ -3673,19 +3679,22 @@ Return a list of matches where each element is in the format (or (nreverse matches) t)))) ;;;###autoload -(defun info-apropos (string) - "Grovel indices of all known Info files on your system for STRING. -Build a menu of the possible matches." - (interactive "sIndex apropos: ") +(defun info-apropos (string &optional regexp) + "Search indices of all known Info files on your system for STRING. +If REGEXP (interactively, the prefix), use a regexp match. + +Display a menu of the possible matches." + (interactive "sIndex apropos: \nP") (if (equal string "") (Info-find-node Info-apropos-file "Top") - (let* ((nodes Info-apropos-nodes) nodename) + (let ((nodes Info-apropos-nodes) + nodename) (while (and nodes (not (equal string (nth 1 (car nodes))))) (setq nodes (cdr nodes))) (if nodes - (Info-find-node Info-apropos-file (car (car nodes))) + (Info-find-node Info-apropos-file (car (car nodes)) nil nil t) (setq nodename (format "Index for ā€˜%s’" string)) - (push (list nodename string (Info-apropos-matches string)) + (push (list nodename string (Info-apropos-matches string regexp)) Info-apropos-nodes) (Info-find-node Info-apropos-file nodename))))) commit 11f66e16ac909f3e820795e449d0848b8ec7c7e9 Author: Lars Ingebrigtsen Date: Thu Apr 21 16:23:02 2022 +0200 Fix indentation in copy-region-as-kill * lisp/simple.el (copy-region-as-kill): Fix indendation. diff --git a/lisp/simple.el b/lisp/simple.el index 7e964c9d1d..323d51dd2d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5457,7 +5457,7 @@ This command's old key binding has been given to `kill-ring-save'." (let ((str (if region (funcall region-extract-function nil) (filter-buffer-substring beg end)))) - (if (eq last-command 'kill-region) + (if (eq last-command 'kill-region) (kill-append str (< end beg)) (kill-new str))) (setq deactivate-mark t) commit 935f400a33d6ff0f5d61fc7ade688a4378613882 Author: Lars Ingebrigtsen Date: Thu Apr 21 15:11:25 2022 +0200 Clarify cl-incf/decf doc strings * lisp/emacs-lisp/cl-lib.el (cl-incf): (cl-decf): Clarify that nil isn't a valid value for X (bug#31715). diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 4e60a3c63d..3f40ab0760 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -114,7 +114,10 @@ a future Emacs interpreter will be able to use it.") (defmacro cl-incf (place &optional x) "Increment PLACE by X (1 by default). PLACE may be a symbol, or any generalized variable allowed by `setf'. -The return value is the incremented value of PLACE." +The return value is the incremented value of PLACE. + +If X is specified, it should be an expression that should +evaluate to a number." (declare (debug (place &optional form))) (if (symbolp place) (list 'setq place (if x (list '+ place x) (list '1+ place))) @@ -123,7 +126,10 @@ The return value is the incremented value of PLACE." (defmacro cl-decf (place &optional x) "Decrement PLACE by X (1 by default). PLACE may be a symbol, or any generalized variable allowed by `setf'. -The return value is the decremented value of PLACE." +The return value is the decremented value of PLACE. + +If X is specified, it should be an expression that should +evaluate to a number." (declare (debug cl-incf)) (if (symbolp place) (list 'setq place (if x (list '- place x) (list '1- place))) commit 6a50ce949b6d15a40bce44ea1bfd313b086130f8 Author: Po Lu Date: Thu Apr 21 12:41:09 2022 +0000 * src/haiku_support.cc (gui_abort): Get rid of extern "C" declarations. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 75c68f5541..2ec536729f 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -173,7 +173,7 @@ static bool drag_and_drop_in_progress; Rectifying that problem is simple: all code in a looper callback must lock the child frame data with this macro instead. - IOW, If some other code is already running with the child frame + IOW, if some other code is already running with the child frame lock held, don't interfere: wait until it's finished before continuing. */ #define CHILD_FRAME_LOCK_INSIDE_LOOPER_CALLBACK \ @@ -189,13 +189,7 @@ static bool drag_and_drop_in_progress; port, so it's probably here to stay. */ extern status_t get_subpixel_antialiasing (bool *); -extern "C" -{ - extern _Noreturn void emacs_abort (void); - /* Also defined in haikuterm.h. */ - extern void be_app_quit (void); -} - +/* The ID of the thread the BApplication is running in. */ static thread_id app_thread; _Noreturn void @@ -205,7 +199,7 @@ gui_abort (const char *msg) fprintf (stderr, "Under Haiku, Emacs cannot recover from errors in GUI code\n"); fprintf (stderr, "App Server disconnects usually manifest as bitmap " "initialization failures or lock failures."); - emacs_abort (); + abort (); } struct be_popup_menu_data commit fa9580d13b55314c48ec59b4f8b0378b120f5bb2 Author: Lars Ingebrigtsen Date: Thu Apr 21 13:48:16 2022 +0200 Link dired-do-find-regexp-and-replace to query-replace * lisp/dired-aux.el (dired-do-find-regexp-and-replace): Link to `query-replace' (bug#55050). diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 7edfde08f8..8170c7a084 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3356,7 +3356,10 @@ recursively. However, files matching `grep-find-ignored-files' and subdirectories matching `grep-find-ignored-directories' are skipped in the marked directories. -REGEXP should use constructs supported by your local `grep' command." +REGEXP should use constructs supported by your local `grep' command. + +Also see `query-replace' for user options that affect how this +function works." (interactive (let ((common (query-replace-read-args commit 6b9596fff8d2f458060703eb59def27b1e59a8c9 Author: Eli Zaretskii Date: Thu Apr 21 13:53:57 2022 +0300 Unbreak build with MinGW64. * src/w32.c (CONSOLE_FONT_INFO): Define only when _WIN32_WINNT is less than _WIN32_WINNT_WINXP, i.e. for building with mingw.org's MinGW. diff --git a/src/w32.c b/src/w32.c index a8f69565d6..25f5555af3 100644 --- a/src/w32.c +++ b/src/w32.c @@ -539,11 +539,15 @@ typedef DWORD (WINAPI *ExpandEnvironmentStringsW_Proc) (LPCWSTR,LPWSTR,DWORD); typedef LANGID (WINAPI *GetUserDefaultUILanguage_Proc) (void); typedef COORD (WINAPI *GetConsoleFontSize_Proc) (HANDLE, DWORD); + +#if _WIN32_WINNT < 0x0501 typedef struct { DWORD nFont; COORD dwFontSize; } CONSOLE_FONT_INFO; +#endif + typedef BOOL (WINAPI *GetCurrentConsoleFont_Proc) ( HANDLE, BOOL, commit 8ab20cd2d9d518a85e93785d6675cd321403f7d7 Author: Andreas Schwab Date: Wed Apr 20 17:05:32 2022 +0200 gnus: fix %a in topic line * lisp/gnus/gnus-topic.el (gnus-topic-insert-topic-line): Also bind `entries'. diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el index c079d889d9..479bba3a73 100644 --- a/lisp/gnus/gnus-topic.el +++ b/lisp/gnus/gnus-topic.el @@ -650,6 +650,7 @@ articles in the topic and its subtopics." (let* ((visible (if visiblep "" "...")) (level level) (name name) + (entries entries) (indentation (make-string (* gnus-topic-indent-level level) ? )) (total-number-of-articles unread) (number-of-groups (length entries)) commit cdf926371d5e414a6ec5125962de3a35ed99debc Author: Po Lu Date: Thu Apr 21 16:30:03 2022 +0800 Clean up PGTK code some more * src/pgtkterm.c (x_alloc_lighter_color): Simplify. Do not try to "allocate" colors, remove unused flag and impossible return value. (pgtk_clear_frame): Remove unused code from NS port and remove incorrect workaround for now-fixed double buffering. (pgtk_make_frame_visible_wait_for_map_event_cb) (x_clear_glyph_string_rect, x_draw_glyph_string_background) (x_draw_glyph_string_foreground) (x_draw_composite_glyph_string_foreground) (x_draw_glyphless_glyph_string_foreground) (x_fill_trapezoid_for_relief, x_erase_corners_for_relief) (pgtk_setup_relief_color, x_draw_relief_rect, x_draw_box_rect) (x_draw_glyph_string_box, x_get_scale_factor) (x_draw_horizontal_wave, pgtk_draw_horizontal_wave) (x_draw_underwave, x_draw_image_relief) (x_draw_glyph_string_bg_rect, x_cr_draw_image) (x_draw_image_foreground, x_draw_image_glyph_string) (x_draw_stretch_glyph_string, pgtk_draw_glyph_string) (x_draw_hollow_cursor, x_draw_bar_cursor, pgtk_draw_window_cursor) (pgtk_cr_draw_image, pgtk_draw_fringe_bitmap, hourglass_cb) (pgtk_show_hourglass, pgtk_redraw_scroll_bars, pgtk_flash) (x_create_toolkit_scroll_bar) (x_create_horizontal_toolkit_scroll_bar, x_scroll_bar_create) (x_scroll_bar_remove, pgtk_set_vertical_scroll_bar) (pgtk_set_horizontal_scroll_bar, pgtk_judge_scroll_bars) (x_new_focus_frame, x_focus_changed, enter_notify_event) (leave_notify_event, focus_in_event, focus_out_event) (pgtk_cr_accumulate_data): Clean up coding style, rename functions copied over from X and modified, and remove duplicate definition of at least one function. diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 2b04699fb3..cf8a7c4816 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -716,8 +716,8 @@ pgtk_iconify_frame (struct frame *f) } static gboolean -pgtk_make_frame_visible_wait_for_map_event_cb (GtkWidget * widget, - GdkEventAny * event, +pgtk_make_frame_visible_wait_for_map_event_cb (GtkWidget *widget, + GdkEventAny *event, gpointer user_data) { int *foundptr = user_data; @@ -1280,7 +1280,8 @@ pgtk_compute_glyph_string_overhangs (struct glyph_string *s) /* Fill rectangle X, Y, W, H with background color of glyph string S. */ static void -x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h) +pgtk_clear_glyph_string_rect (struct glyph_string *s, int x, int y, + int w, int h) { pgtk_fill_rectangle (s->f, s->xgcv.background, x, y, w, h, (s->first_glyph->type != STRETCH_GLYPH @@ -1331,7 +1332,7 @@ fill_background (struct glyph_string *s, int x, int y, int width, int height) contains the first component of a composition. */ static void -x_draw_glyph_string_background (struct glyph_string *s, bool force_p) +pgtk_draw_glyph_string_background (struct glyph_string *s, bool force_p) { /* Nothing to do if background has already been drawn or if it shouldn't be drawn in the first place. */ @@ -1358,9 +1359,9 @@ x_draw_glyph_string_background (struct glyph_string *s, bool force_p) || s->font_not_found_p || s->extends_to_end_of_line_p || force_p) { - x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, - s->background_width, - s->height - 2 * box_line_width); + pgtk_clear_glyph_string_rect (s, s->x, s->y + box_line_width, + s->background_width, + s->height - 2 * box_line_width); s->background_filled_p = true; } } @@ -1384,7 +1385,7 @@ pgtk_draw_rectangle (struct frame *f, unsigned long color, int x, int y, /* Draw the foreground of glyph string S. */ static void -x_draw_glyph_string_foreground (struct glyph_string *s) +pgtk_draw_glyph_string_foreground (struct glyph_string *s) { int i, x; @@ -1431,7 +1432,7 @@ x_draw_glyph_string_foreground (struct glyph_string *s) /* Draw the foreground of composite glyph string S. */ static void -x_draw_composite_glyph_string_foreground (struct glyph_string *s) +pgtk_draw_composite_glyph_string_foreground (struct glyph_string *s) { int i, j, x; struct font *font = s->font; @@ -1522,7 +1523,7 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s) /* Draw the foreground of glyph string S for glyphless characters. */ static void -x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) +pgtk_draw_glyphless_glyph_string_foreground (struct glyph_string *s) { struct glyph *glyph = s->first_glyph; unsigned char2b[8]; @@ -1617,20 +1618,18 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) #define HIGHLIGHT_COLOR_DARK_BOOST_LIMIT 48000 -/* Allocate a color which is lighter or darker than *PIXEL by FACTOR - or DELTA. Try a color with RGB values multiplied by FACTOR first. - If this produces the same color as PIXEL, try a color where all RGB - values have DELTA added. Return the allocated color in *PIXEL. - DISPLAY is the X display, CMAP is the colormap to operate on. - Value is non-zero if successful. */ +/* Compute a color which is lighter or darker than *PIXEL by FACTOR or + DELTA. Try a color with RGB values multiplied by FACTOR first. If + this produces the same color as PIXEL, try a color where all RGB + values have DELTA added. Return the computed color in *PIXEL. F + is the frame to act on. */ -static bool -x_alloc_lighter_color (struct frame *f, unsigned long *pixel, double factor, - int delta) +static void +pgtk_compute_lighter_color (struct frame *f, unsigned long *pixel, + double factor, int delta) { Emacs_Color color, new; long bright; - bool success_p; /* Get RGB color values. */ color.pixel = *pixel; @@ -1670,33 +1669,28 @@ x_alloc_lighter_color (struct frame *f, unsigned long *pixel, double factor, } } - /* Try to allocate the color. */ - new.pixel = new.red >> 8 << 16 | new.green >> 8 << 8 | new.blue >> 8; - success_p = true; - if (success_p) + new.pixel = (new.red >> 8 << 16 + | new.green >> 8 << 8 + | new.blue >> 8); + + if (new.pixel == *pixel) { - if (new.pixel == *pixel) - { - /* If we end up with the same color as before, try adding - delta to the RGB values. */ - new.red = min (0xffff, delta + color.red); - new.green = min (0xffff, delta + color.green); - new.blue = min (0xffff, delta + color.blue); - new.pixel = - new.red >> 8 << 16 | new.green >> 8 << 8 | new.blue >> 8; - success_p = true; - } - else - success_p = true; - *pixel = new.pixel; + /* If we end up with the same color as before, try adding + delta to the RGB values. */ + new.red = min (0xffff, delta + color.red); + new.green = min (0xffff, delta + color.green); + new.blue = min (0xffff, delta + color.blue); + new.pixel = (new.red >> 8 << 16 + | new.green >> 8 << 8 + | new.blue >> 8); } - return success_p; + *pixel = new.pixel; } static void -x_fill_trapezoid_for_relief (struct frame *f, unsigned long color, int x, - int y, int width, int height, int top_p) +pgtk_fill_trapezoid_for_relief (struct frame *f, unsigned long color, int x, + int y, int width, int height, int top_p) { cairo_t *cr; @@ -1720,9 +1714,9 @@ enum corners }; static void -x_erase_corners_for_relief (struct frame *f, unsigned long color, int x, - int y, int width, int height, double radius, - double margin, int corners) +pgtk_erase_corners_for_relief (struct frame *f, unsigned long color, int x, + int y, int width, int height, double radius, + double margin, int corners) { cairo_t *cr; int i; @@ -1752,13 +1746,6 @@ x_erase_corners_for_relief (struct frame *f, unsigned long color, int x, pgtk_end_cr_clip (f); } -/* Set up the foreground color for drawing relief lines of glyph - string S. RELIEF is a pointer to a struct relief containing the GC - with which lines will be drawn. Use a color that is FACTOR or - DELTA lighter or darker than the relief's background which is found - in S->f->output_data.pgtk->relief_background. If such a color cannot - be allocated, use DEFAULT_PIXEL, instead. */ - static void pgtk_setup_relief_color (struct frame *f, struct relief *relief, double factor, int delta, unsigned long default_pixel) @@ -1771,14 +1758,13 @@ pgtk_setup_relief_color (struct frame *f, struct relief *relief, double factor, /* Allocate new color. */ xgcv.foreground = default_pixel; pixel = background; - if (x_alloc_lighter_color (f, &pixel, factor, delta)) - xgcv.foreground = relief->pixel = pixel; + pgtk_compute_lighter_color (f, &pixel, factor, delta); + xgcv.foreground = relief->pixel = pixel; relief->xgcv = xgcv; } /* Set up colors for the relief lines around glyph string S. */ - static void pgtk_setup_relief_colors (struct glyph_string *s) { @@ -1807,7 +1793,6 @@ pgtk_setup_relief_colors (struct glyph_string *s) } } - static void pgtk_set_clip_rectangles (struct frame *f, cairo_t *cr, XRectangle *rectangles, int n) @@ -1834,11 +1819,11 @@ pgtk_set_clip_rectangles (struct frame *f, cairo_t *cr, when drawing. */ static void -x_draw_relief_rect (struct frame *f, - int left_x, int top_y, int right_x, int bottom_y, - int hwidth, int vwidth, bool raised_p, bool top_p, - bool bot_p, bool left_p, bool right_p, - XRectangle * clip_rect) +pgtk_draw_relief_rect (struct frame *f, + int left_x, int top_y, int right_x, int bottom_y, + int hwidth, int vwidth, bool raised_p, bool top_p, + bool bot_p, bool left_p, bool right_p, + XRectangle * clip_rect) { unsigned long top_left_color, bottom_right_color; int corners = 0; @@ -1882,8 +1867,8 @@ x_draw_relief_rect (struct frame *f, pgtk_fill_rectangle (f, top_left_color, left_x, top_y, right_x + 1 - left_x, hwidth, false); else - x_fill_trapezoid_for_relief (f, top_left_color, left_x, top_y, - right_x + 1 - left_x, hwidth, 1); + pgtk_fill_trapezoid_for_relief (f, top_left_color, left_x, top_y, + right_x + 1 - left_x, hwidth, 1); } if (bot_p) { @@ -1892,9 +1877,9 @@ x_draw_relief_rect (struct frame *f, bottom_y + 1 - hwidth, right_x + 1 - left_x, hwidth, false); else - x_fill_trapezoid_for_relief (f, bottom_right_color, - left_x, bottom_y + 1 - hwidth, - right_x + 1 - left_x, hwidth, 0); + pgtk_fill_trapezoid_for_relief (f, bottom_right_color, + left_x, bottom_y + 1 - hwidth, + right_x + 1 - left_x, hwidth, 0); } if (left_p && vwidth > 1) pgtk_fill_rectangle (f, bottom_right_color, left_x, top_y, @@ -1903,11 +1888,9 @@ x_draw_relief_rect (struct frame *f, pgtk_fill_rectangle (f, bottom_right_color, left_x, top_y, right_x + 1 - left_x, 1, false); if (corners) - { - x_erase_corners_for_relief (f, FRAME_BACKGROUND_PIXEL (f), left_x, - top_y, right_x - left_x + 1, - bottom_y - top_y + 1, 6, 1, corners); - } + pgtk_erase_corners_for_relief (f, FRAME_BACKGROUND_PIXEL (f), left_x, + top_y, right_x - left_x + 1, + bottom_y - top_y + 1, 6, 1, corners); pgtk_end_cr_clip (f); } @@ -1920,10 +1903,10 @@ x_draw_relief_rect (struct frame *f, rectangle to use when drawing. */ static void -x_draw_box_rect (struct glyph_string *s, - int left_x, int top_y, int right_x, int bottom_y, int hwidth, - int vwidth, bool left_p, bool right_p, - XRectangle * clip_rect) +pgtk_draw_box_rect (struct glyph_string *s, int left_x, + int top_y, int right_x, int bottom_y, int hwidth, + int vwidth, bool left_p, bool right_p, + XRectangle * clip_rect) { unsigned long foreground_backup; @@ -1965,7 +1948,7 @@ x_draw_box_rect (struct glyph_string *s, /* Draw a box around glyph string S. */ static void -x_draw_glyph_string_box (struct glyph_string *s) +pgtk_draw_glyph_string_box (struct glyph_string *s) { int hwidth, vwidth, left_x, right_x, top_y, bottom_y, last_x; bool raised_p, left_p, right_p; @@ -1998,26 +1981,20 @@ x_draw_glyph_string_box (struct glyph_string *s) get_glyph_string_clip_rect (s, &clip_rect); if (s->face->box == FACE_SIMPLE_BOX) - x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, hwidth, - vwidth, left_p, right_p, &clip_rect); + pgtk_draw_box_rect (s, left_x, top_y, right_x, bottom_y, hwidth, + vwidth, left_p, right_p, &clip_rect); else { pgtk_setup_relief_colors (s); - x_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y, hwidth, - vwidth, raised_p, true, true, left_p, right_p, - &clip_rect); + pgtk_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y, hwidth, + vwidth, raised_p, true, true, left_p, right_p, + &clip_rect); } } static void -x_get_scale_factor (int *scale_x, int *scale_y) -{ - *scale_x = *scale_y = 1; -} - -static void -x_draw_horizontal_wave (struct frame *f, unsigned long color, int x, int y, - int width, int height, int wave_length) +pgtk_draw_horizontal_wave (struct frame *f, unsigned long color, int x, int y, + int width, int height, int wave_length) { cairo_t *cr; double dx = wave_length, dy = height - 1; @@ -2056,34 +2033,19 @@ x_draw_horizontal_wave (struct frame *f, unsigned long color, int x, int y, pgtk_end_cr_clip (f); } -/* - Draw a wavy line under S. The wave fills wave_height pixels from y0. - - x0 wave_length = 2 - -- - y0 * * * * * - |* * * * * * * * * - wave_height = 3 | * * * * - -*/ static void -x_draw_underwave (struct glyph_string *s, unsigned long color) +pgtk_draw_underwave (struct glyph_string *s, unsigned long color) { - /* Adjust for scale/HiDPI. */ - int scale_x, scale_y; - - x_get_scale_factor (&scale_x, &scale_y); + int wave_height = 3, wave_length = 2; - int wave_height = 3 * scale_y, wave_length = 2 * scale_x; - - x_draw_horizontal_wave (s->f, color, s->x, s->ybase - wave_height + 3, - s->width, wave_height, wave_length); + pgtk_draw_horizontal_wave (s->f, color, s->x, s->ybase - wave_height + 3, + s->width, wave_height, wave_length); } /* Draw a relief around the image glyph string S. */ static void -x_draw_image_relief (struct glyph_string *s) +pgtk_draw_image_relief (struct glyph_string *s) { int x1, y1, thick; bool raised_p, top_p, bot_p, left_p, right_p; @@ -2168,16 +2130,16 @@ x_draw_image_relief (struct glyph_string *s) pgtk_setup_relief_colors (s); get_glyph_string_clip_rect (s, &r); - x_draw_relief_rect (s->f, x, y, x1, y1, thick, thick, raised_p, - top_p, bot_p, left_p, right_p, &r); + pgtk_draw_relief_rect (s->f, x, y, x1, y1, thick, thick, raised_p, + top_p, bot_p, left_p, right_p, &r); } /* Draw part of the background of glyph string S. X, Y, W, and H give the rectangle to draw. */ static void -x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, - int h) +pgtk_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, + int h) { if (s->stippled_p) { @@ -2186,13 +2148,13 @@ x_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, int w, fill_background (s, x, y, w, h); } else - x_clear_glyph_string_rect (s, x, y, w, h); + pgtk_clear_glyph_string_rect (s, x, y, w, h); } static void -x_cr_draw_image (struct frame *f, Emacs_GC *gc, cairo_pattern_t *image, - int src_x, int src_y, int width, int height, - int dest_x, int dest_y, bool overlay_p) +pgtk_cr_draw_image (struct frame *f, Emacs_GC *gc, cairo_pattern_t *image, + int src_x, int src_y, int width, int height, + int dest_x, int dest_y, bool overlay_p) { cairo_t *cr = pgtk_begin_cr_clip (f); @@ -2228,7 +2190,7 @@ x_cr_draw_image (struct frame *f, Emacs_GC *gc, cairo_pattern_t *image, /* Draw foreground of image glyph string S. */ static void -x_draw_image_foreground (struct glyph_string *s) +pgtk_draw_image_foreground (struct glyph_string *s) { int x = s->x; int y = s->ybase - image_ascent (s->img, s->face, &s->slice); @@ -2251,9 +2213,9 @@ x_draw_image_foreground (struct glyph_string *s) { cairo_t *cr = pgtk_begin_cr_clip (s->f); pgtk_set_glyph_string_clipping (s, cr); - x_cr_draw_image (s->f, &s->xgcv, s->img->cr_data, - s->slice.x, s->slice.y, s->slice.width, s->slice.height, - x, y, true); + pgtk_cr_draw_image (s->f, &s->xgcv, s->img->cr_data, + s->slice.x, s->slice.y, s->slice.width, s->slice.height, + x, y, true); if (!s->img->mask) { /* When the image has a mask, we can expect that at @@ -2293,7 +2255,7 @@ x_draw_image_foreground (struct glyph_string *s) */ static void -x_draw_image_glyph_string (struct glyph_string *s) +pgtk_draw_image_glyph_string (struct glyph_string *s) { int box_line_hwidth = max (s->face->box_vertical_line_width, 0); int box_line_vwidth = max (s->face->box_horizontal_line_width, 0); @@ -2331,26 +2293,26 @@ x_draw_image_glyph_string (struct glyph_string *s) if (s->slice.y == 0) y += box_line_vwidth; - x_draw_glyph_string_bg_rect (s, x, y, width, height); + pgtk_draw_glyph_string_bg_rect (s, x, y, width, height); } s->background_filled_p = true; } /* Draw the foreground. */ - x_draw_image_foreground (s); + pgtk_draw_image_foreground (s); /* If we must draw a relief around the image, do it. */ if (s->img->relief || s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN) - x_draw_image_relief (s); + pgtk_draw_image_relief (s); } /* Draw stretch glyph string S. */ static void -x_draw_stretch_glyph_string (struct glyph_string *s) +pgtk_draw_stretch_glyph_string (struct glyph_string *s) { eassert (s->first_glyph->type == STRETCH_GLYPH); @@ -2386,7 +2348,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) x -= width; /* Draw cursor. */ - x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); + pgtk_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); /* Clear rest using the GC of the original non-cursor face. */ if (width < background_width) @@ -2441,7 +2403,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) x = text_left_x; } if (background_width > 0) - x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); + pgtk_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); } s->background_filled_p = true; @@ -2469,9 +2431,9 @@ pgtk_draw_glyph_string (struct glyph_string *s) pgtk_set_glyph_string_gc (next); pgtk_set_glyph_string_clipping (next, cr); if (next->first_glyph->type == STRETCH_GLYPH) - x_draw_stretch_glyph_string (next); + pgtk_draw_stretch_glyph_string (next); else - x_draw_glyph_string_background (next, true); + pgtk_draw_glyph_string_background (next, true); next->num_clips = 0; pgtk_end_cr_clip (next->f); } @@ -2491,8 +2453,8 @@ pgtk_draw_glyph_string (struct glyph_string *s) { pgtk_set_glyph_string_clipping (s, cr); - x_draw_glyph_string_background (s, true); - x_draw_glyph_string_box (s); + pgtk_draw_glyph_string_background (s, true); + pgtk_draw_glyph_string_box (s); pgtk_set_glyph_string_clipping (s, cr); relief_drawn_p = true; } @@ -2510,7 +2472,7 @@ pgtk_draw_glyph_string (struct glyph_string *s) switch (s->first_glyph->type) { case IMAGE_GLYPH: - x_draw_image_glyph_string (s); + pgtk_draw_image_glyph_string (s); break; case XWIDGET_GLYPH: @@ -2518,15 +2480,15 @@ pgtk_draw_glyph_string (struct glyph_string *s) break; case STRETCH_GLYPH: - x_draw_stretch_glyph_string (s); + pgtk_draw_stretch_glyph_string (s); break; case CHAR_GLYPH: if (s->for_overlaps) s->background_filled_p = true; else - x_draw_glyph_string_background (s, false); - x_draw_glyph_string_foreground (s); + pgtk_draw_glyph_string_background (s, false); + pgtk_draw_glyph_string_foreground (s); break; case COMPOSITE_GLYPH: @@ -2534,16 +2496,16 @@ pgtk_draw_glyph_string (struct glyph_string *s) && !s->first_glyph->u.cmp.automatic)) s->background_filled_p = true; else - x_draw_glyph_string_background (s, true); - x_draw_composite_glyph_string_foreground (s); + pgtk_draw_glyph_string_background (s, true); + pgtk_draw_composite_glyph_string_foreground (s); break; case GLYPHLESS_GLYPH: if (s->for_overlaps) s->background_filled_p = true; else - x_draw_glyph_string_background (s, true); - x_draw_glyphless_glyph_string_foreground (s); + pgtk_draw_glyph_string_background (s, true); + pgtk_draw_glyphless_glyph_string_foreground (s); break; default: @@ -2554,7 +2516,7 @@ pgtk_draw_glyph_string (struct glyph_string *s) { /* Draw relief if not yet drawn. */ if (!relief_drawn_p && s->face->box != FACE_NO_BOX) - x_draw_glyph_string_box (s); + pgtk_draw_glyph_string_box (s); /* Draw underline. */ if (s->face->underline) @@ -2562,10 +2524,10 @@ pgtk_draw_glyph_string (struct glyph_string *s) if (s->face->underline == FACE_UNDER_WAVE) { if (s->face->underline_defaulted_p) - x_draw_underwave (s, s->xgcv.foreground); + pgtk_draw_underwave (s, s->xgcv.foreground); else { - x_draw_underwave (s, s->face->underline_color); + pgtk_draw_underwave (s, s->face->underline_color); } } else if (s->face->underline == FACE_UNDER_LINE) @@ -2700,9 +2662,9 @@ pgtk_draw_glyph_string (struct glyph_string *s) cairo_save (cr); pgtk_set_glyph_string_clipping_exactly (s, prev, cr); if (prev->first_glyph->type == CHAR_GLYPH) - x_draw_glyph_string_foreground (prev); + pgtk_draw_glyph_string_foreground (prev); else - x_draw_composite_glyph_string_foreground (prev); + pgtk_draw_composite_glyph_string_foreground (prev); prev->hl = save; prev->num_clips = 0; cairo_restore (cr); @@ -2726,9 +2688,9 @@ pgtk_draw_glyph_string (struct glyph_string *s) cairo_save (cr); pgtk_set_glyph_string_clipping_exactly (s, next, cr); if (next->first_glyph->type == CHAR_GLYPH) - x_draw_glyph_string_foreground (next); + pgtk_draw_glyph_string_foreground (next); else - x_draw_composite_glyph_string_foreground (next); + pgtk_draw_composite_glyph_string_foreground (next); cairo_restore (cr); next->hl = save; next->num_clips = 0; @@ -2793,7 +2755,7 @@ pgtk_clear_frame_area (struct frame *f, int x, int y, int width, int height) /* Draw a hollow box cursor on window W in glyph row ROW. */ static void -x_draw_hollow_cursor (struct window *w, struct glyph_row *row) +pgtk_draw_hollow_cursor (struct window *w, struct glyph_row *row) { struct frame *f = XFRAME (WINDOW_FRAME (w)); int x, y, wd, h; @@ -2826,7 +2788,8 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) } /* Set clipping, draw the rectangle, and reset clipping again. */ pgtk_clip_to_row (w, row, TEXT_AREA, cr); - pgtk_draw_rectangle (f, FRAME_X_OUTPUT (f)->cursor_color, x, y, wd, h - 1, false); + pgtk_draw_rectangle (f, FRAME_X_OUTPUT (f)->cursor_color, + x, y, wd, h - 1, false); pgtk_end_cr_clip (f); } @@ -2838,7 +2801,7 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) --gerd. */ static void -x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, +pgtk_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind) { struct frame *f = XFRAME (w->frame); @@ -2936,6 +2899,7 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int cursor_width, bool on_p, bool active_p) { struct frame *f = XFRAME (w->frame); + if (on_p) { w->phys_cursor_type = cursor_type; @@ -2954,7 +2918,7 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, switch (cursor_type) { case HOLLOW_BOX_CURSOR: - x_draw_hollow_cursor (w, glyph_row); + pgtk_draw_hollow_cursor (w, glyph_row); break; case FILLED_BOX_CURSOR: @@ -2962,11 +2926,11 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, break; case BAR_CURSOR: - x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR); + pgtk_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR); break; case HBAR_CURSOR: - x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR); + pgtk_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR); break; case NO_CURSOR: @@ -3552,41 +3516,6 @@ pgtk_clip_to_row (struct window *w, struct glyph_row *row, cairo_clip (cr); } -static void -pgtk_cr_draw_image (struct frame *f, Emacs_GC * gc, cairo_pattern_t * image, - int src_x, int src_y, int width, int height, - int dest_x, int dest_y, bool overlay_p) -{ - cairo_t *cr = pgtk_begin_cr_clip (f); - - if (overlay_p) - cairo_rectangle (cr, dest_x, dest_y, width, height); - else - { - pgtk_set_cr_source_with_gc_background (f, gc, false); - cairo_rectangle (cr, dest_x, dest_y, width, height); - cairo_fill_preserve (cr); - } - cairo_translate (cr, dest_x - src_x, dest_y - src_y); - - cairo_surface_t *surface; - cairo_pattern_get_surface (image, &surface); - cairo_format_t format = cairo_image_surface_get_format (surface); - if (format != CAIRO_FORMAT_A8 && format != CAIRO_FORMAT_A1) - { - cairo_set_source (cr, image); - cairo_fill (cr); - } - else - { - pgtk_set_cr_source_with_gc_foreground (f, gc, false); - cairo_clip (cr); - cairo_mask (cr, image); - } - - pgtk_end_cr_clip (f); -} - static void pgtk_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fringe_bitmap_params *p) @@ -3601,10 +3530,10 @@ pgtk_draw_fringe_bitmap (struct window *w, struct glyph_row *row, if (p->bx >= 0 && !p->overlay_p) { - /* In case the same realized face is used for fringes and - for something displayed in the text (e.g. face `region' on + /* In case the same realized face is used for fringes and for + something displayed in the text (e.g. face `region' on mono-displays, the fill style may have been changed to - FillSolid in x_draw_glyph_string_background. */ + FillSolid in pgtk_draw_glyph_string_background. */ if (face->stipple) { fill_background_by_face (f, face, p->bx, p->by, p->nx, p->ny); @@ -3652,7 +3581,8 @@ static int hourglass_enter_count = 0; static void hourglass_cb (struct atimer *timer) { - /*NOP*/} + +} static void pgtk_show_hourglass (struct frame *f) @@ -3660,7 +3590,9 @@ pgtk_show_hourglass (struct frame *f) struct pgtk_output *x = FRAME_X_OUTPUT (f); if (x->hourglass_widget != NULL) gtk_widget_destroy (x->hourglass_widget); - x->hourglass_widget = gtk_event_box_new (); /* gtk_event_box is GDK_INPUT_ONLY. */ + + /* This creates a GDK_INPUT_ONLY window. */ + x->hourglass_widget = gtk_event_box_new (); gtk_widget_set_has_window (x->hourglass_widget, true); gtk_fixed_put (GTK_FIXED (FRAME_GTK_WIDGET (f)), x->hourglass_widget, 0, 0); gtk_widget_show (x->hourglass_widget); @@ -3669,7 +3601,8 @@ pgtk_show_hourglass (struct frame *f) gdk_window_set_cursor (gtk_widget_get_window (x->hourglass_widget), x->hourglass_cursor); - /* For cursor animation, we receive signals, set pending_signals, and dispatch. */ + /* For cursor animation, we receive signals, set pending_signals, + and wait for the signal handler to run. */ if (hourglass_enter_count++ == 0) { struct timespec ts = make_timespec (0, 50 * 1000 * 1000); @@ -3740,35 +3673,19 @@ static struct redisplay_interface pgtk_redisplay_interface = { pgtk_default_font_parameter, }; -static void -pgtk_redraw_scroll_bars (struct frame *f) -{ -} - void pgtk_clear_frame (struct frame *f) -/* -------------------------------------------------------------------------- - External (hook): Erase the entire frame - -------------------------------------------------------------------------- */ { - /* comes on initial frame because we have - after-make-frame-functions = select-frame */ if (!FRAME_DEFAULT_FACE (f)) return; - /* mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); */ + mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); block_input (); - pgtk_clear_area (f, 0, 0, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); - - /* as of 2006/11 or so this is now needed */ - pgtk_redraw_scroll_bars (f); unblock_input (); } -/* Invert the middle quarter of the frame for .15 sec. */ - static void recover_from_visible_bell (struct atimer *timer) { @@ -3784,6 +3701,8 @@ recover_from_visible_bell (struct atimer *timer) FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL; } +/* Invert the middle quarter of the frame for .15 sec. */ + static void pgtk_flash (struct frame *f) { @@ -3797,9 +3716,9 @@ pgtk_flash (struct frame *f) int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f); int height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f); - cairo_surface_t *surface = - cairo_surface_create_similar (surface_orig, CAIRO_CONTENT_COLOR_ALPHA, - width, height); + cairo_surface_t *surface + = cairo_surface_create_similar (surface_orig, CAIRO_CONTENT_COLOR_ALPHA, + width, height); cairo_t *cr = cairo_create (surface); cairo_set_source_surface (cr, surface_orig, 0, 0); @@ -4053,7 +3972,7 @@ xg_end_scroll_callback (GtkWidget * widget, and X window of the scroll bar in BAR. */ static void -x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) +pgtk_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) { const char *scroll_bar_name = SCROLL_BAR_NAME; @@ -4064,8 +3983,8 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) } static void -x_create_horizontal_toolkit_scroll_bar (struct frame *f, - struct scroll_bar *bar) +pgtk_create_horizontal_toolkit_scroll_bar (struct frame *f, + struct scroll_bar *bar) { const char *scroll_bar_name = SCROLL_BAR_HORIZONTAL_NAME; @@ -4102,8 +4021,8 @@ pgtk_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar, scroll bar. */ static struct scroll_bar * -x_scroll_bar_create (struct window *w, int top, int left, - int width, int height, bool horizontal) +pgtk_scroll_bar_create (struct window *w, int top, int left, + int width, int height, bool horizontal) { struct frame *f = XFRAME (w->frame); struct scroll_bar *bar @@ -4113,9 +4032,9 @@ x_scroll_bar_create (struct window *w, int top, int left, block_input (); if (horizontal) - x_create_horizontal_toolkit_scroll_bar (f, bar); + pgtk_create_horizontal_toolkit_scroll_bar (f, bar); else - x_create_toolkit_scroll_bar (f, bar); + pgtk_create_toolkit_scroll_bar (f, bar); XSETWINDOW (bar->window, w); bar->top = top; @@ -4153,7 +4072,7 @@ x_scroll_bar_create (struct window *w, int top, int left, nil. */ static void -x_scroll_bar_remove (struct scroll_bar *bar) +pgtk_scroll_bar_remove (struct scroll_bar *bar) { struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); block_input (); @@ -4201,7 +4120,7 @@ pgtk_set_vertical_scroll_bar (struct window *w, int portion, int whole, unblock_input (); } - bar = x_scroll_bar_create (w, top, left, width, max (height, 1), false); + bar = pgtk_scroll_bar_create (w, top, left, width, max (height, 1), false); } else { @@ -4279,7 +4198,7 @@ pgtk_set_horizontal_scroll_bar (struct window *w, int portion, int whole, unblock_input (); } - bar = x_scroll_bar_create (w, top, left, width, height, true); + bar = pgtk_scroll_bar_create (w, top, left, width, height, true); } else { @@ -4466,7 +4385,7 @@ pgtk_judge_scroll_bars (struct frame *f) { struct scroll_bar *b = XSCROLL_BAR (bar); - x_scroll_bar_remove (b); + pgtk_scroll_bar_remove (b); next = b->next; b->next = b->prev = Qnil; @@ -4790,7 +4709,7 @@ pgtk_toggle_invisible_pointer (struct frame *f, bool invisible) Lisp code can tell when the switch took place by examining the events. */ static void -x_new_focus_frame (struct pgtk_display_info *dpyinfo, struct frame *frame) +pgtk_new_focus_frame (struct pgtk_display_info *dpyinfo, struct frame *frame) { struct frame *old_focus = dpyinfo->x_focus_frame; /* doesn't work on wayland */ @@ -5648,15 +5567,15 @@ delete_event (GtkWidget *widget, a FOCUS_IN_EVENT into *BUFP. */ static void -x_focus_changed (gboolean is_enter, int state, - struct pgtk_display_info *dpyinfo, struct frame *frame, - union buffered_input_event *bufp) +pgtk_focus_changed (gboolean is_enter, int state, + struct pgtk_display_info *dpyinfo, struct frame *frame, + union buffered_input_event *bufp) { if (is_enter) { if (dpyinfo->x_focus_event_frame != frame) { - x_new_focus_frame (dpyinfo, frame); + pgtk_new_focus_frame (dpyinfo, frame); dpyinfo->x_focus_event_frame = frame; /* Don't stop displaying the initial startup message @@ -5681,7 +5600,7 @@ x_focus_changed (gboolean is_enter, int state, if (dpyinfo->x_focus_event_frame == frame) { dpyinfo->x_focus_event_frame = 0; - x_new_focus_frame (dpyinfo, 0); + pgtk_new_focus_frame (dpyinfo, NULL); bufp->ie.kind = FOCUS_OUT_EVENT; XSETFRAME (bufp->ie.frame_or_window, frame); @@ -5697,10 +5616,12 @@ enter_notify_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data) { union buffered_input_event inev; - struct frame *frame = - pgtk_any_window_to_frame (gtk_widget_get_window (widget)); + struct frame *frame + = pgtk_any_window_to_frame (gtk_widget_get_window (widget)); + if (frame == NULL) return FALSE; + struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); struct frame *focus_frame = dpyinfo->x_focus_frame; int focus_state @@ -5712,7 +5633,7 @@ enter_notify_event (GtkWidget *widget, GdkEvent *event, if (event->crossing.detail != GDK_NOTIFY_INFERIOR && event->crossing.focus && !(focus_state & FOCUS_EXPLICIT)) - x_focus_changed (TRUE, FOCUS_IMPLICIT, dpyinfo, frame, &inev); + pgtk_focus_changed (TRUE, FOCUS_IMPLICIT, dpyinfo, frame, &inev); if (inev.ie.kind != NO_EVENT) evq_enqueue (&inev); return TRUE; @@ -5723,10 +5644,12 @@ leave_notify_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data) { union buffered_input_event inev; - struct frame *frame = - pgtk_any_window_to_frame (gtk_widget_get_window (widget)); + struct frame *frame + = pgtk_any_window_to_frame (gtk_widget_get_window (widget)); + if (frame == NULL) return FALSE; + struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame); struct frame *focus_frame = dpyinfo->x_focus_frame; int focus_state @@ -5747,7 +5670,7 @@ leave_notify_event (GtkWidget *widget, GdkEvent *event, if (event->crossing.detail != GDK_NOTIFY_INFERIOR && event->crossing.focus && !(focus_state & FOCUS_EXPLICIT)) - x_focus_changed (FALSE, FOCUS_IMPLICIT, dpyinfo, frame, &inev); + pgtk_focus_changed (FALSE, FOCUS_IMPLICIT, dpyinfo, frame, &inev); if (frame) { @@ -5766,11 +5689,11 @@ leave_notify_event (GtkWidget *widget, GdkEvent *event, } static gboolean -focus_in_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) +focus_in_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data) { union buffered_input_event inev; - struct frame *frame = - pgtk_any_window_to_frame (gtk_widget_get_window (widget)); + struct frame *frame + = pgtk_any_window_to_frame (gtk_widget_get_window (widget)); if (frame == NULL) return TRUE; @@ -5779,8 +5702,8 @@ focus_in_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) inev.ie.kind = NO_EVENT; inev.ie.arg = Qnil; - x_focus_changed (TRUE, FOCUS_EXPLICIT, - FRAME_DISPLAY_INFO (frame), frame, &inev); + pgtk_focus_changed (TRUE, FOCUS_EXPLICIT, + FRAME_DISPLAY_INFO (frame), frame, &inev); if (inev.ie.kind != NO_EVENT) evq_enqueue (&inev); @@ -5790,11 +5713,11 @@ focus_in_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) } static gboolean -focus_out_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) +focus_out_event (GtkWidget *widget, GdkEvent *event, gpointer *user_data) { union buffered_input_event inev; - struct frame *frame = - pgtk_any_window_to_frame (gtk_widget_get_window (widget)); + struct frame *frame + = pgtk_any_window_to_frame (gtk_widget_get_window (widget)); if (frame == NULL) return TRUE; @@ -5803,8 +5726,8 @@ focus_out_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) inev.ie.kind = NO_EVENT; inev.ie.arg = Qnil; - x_focus_changed (FALSE, FOCUS_EXPLICIT, - FRAME_DISPLAY_INFO (frame), frame, &inev); + pgtk_focus_changed (FALSE, FOCUS_EXPLICIT, + FRAME_DISPLAY_INFO (frame), frame, &inev); if (inev.ie.kind != NO_EVENT) evq_enqueue (&inev); @@ -7023,7 +6946,7 @@ pgtk_cr_draw_frame (cairo_t * cr, struct frame *f) static cairo_status_t pgtk_cr_accumulate_data (void *closure, const unsigned char *data, - unsigned int length) + unsigned int length) { Lisp_Object *acc = (Lisp_Object *) closure; @@ -7050,8 +6973,6 @@ pgtk_cr_destroy (void *cr) unblock_input (); } - - Lisp_Object pgtk_cr_export_frames (Lisp_Object frames, cairo_surface_type_t surface_type) { @@ -7145,7 +7066,6 @@ pgtk_cr_export_frames (Lisp_Object frames, cairo_surface_type_t surface_type) return CALLN (Fapply, intern ("concat"), Fnreverse (acc)); } - void init_pgtkterm (void) {