unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41071: make-frame with internal-border face not working
@ 2020-05-04  7:30 王凯
  2020-05-04 14:38 ` Eli Zaretskii
  2020-09-23 13:03 ` Alan Third
  0 siblings, 2 replies; 4+ messages in thread
From: 王凯 @ 2020-05-04  7:30 UTC (permalink / raw)
  To: 41071

Message-ID: <m1pnbkupld.fsf@gmail.com>
--text follows this line--

(defface test
  '((t (:inherit default :background "green")))
  "Face used by the ivy-posframe."
  :group 'ivy-posframe)

(set-face-background
'internal-border
(face-attribute 'test :background)
(make-frame `((internal-border-width . 100)
               (parent-frame . ,(window-frame)))))

(set-face-background
'internal-border
(face-attribute 'test :background)
(make-frame `((internal-border-width . 100))))

Eval code above in emacs, internal-border-width works but the
:background not.



In GNU Emacs 26.3 (build 1, x86_64-apple-darwin19.3.0, NS appkit-1894.30 Version 10.15.3 (Build 19D76))
of 2020-05-04 built on venus
Windowing system distributor 'Apple', version 10.3.1894
Recent messages:
Reformatted!
Indenting region...done
Already formatted
Mark set
Saving file /Users/kai/.dotfiles/emacs/.emacs.d/lisp/init-base.el...
Wrote /Users/kai/.dotfiles/emacs/.emacs.d/lisp/init-base.el
(No changes need to be saved) [4 times]
Quit
Switched to ‘scratch’ state
Undo branch point! [3 times]
next-line: End of buffer [8 times]
Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs-plus/26.3/share/info/emacs
--prefix=/usr/local/Cellar/emacs-plus/26.3 --with-xml2 --without-dbus
--with-gnutls --with-imagemagick --with-modules --with-rsvg --with-ns
--disable-ns-self-contained'

Configured features:
JPEG RSVG IMAGEMAGICK GLIB NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS NS MODULES THREADS LCMS2

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: en_CN.UTF-8
  locale-coding-system: utf-8

Major mode: Lisp Interaction

Minor modes in effect:
  diredfl-global-mode: t
  diff-auto-refine-mode: t
  paredit-mode: t
  hl-todo-mode: t
  company-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  midnight-mode: t
  persp-mode: t
  electric-pair-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  auto-image-file-mode: t
  which-key-mode: t
  projectile-mode: t
  state-global-mode: t
  state-mode: t
  helm-descbinds-mode: t
  helm-mode: t
  async-bytecomp-package-mode: t
  helm-autoresize-mode: t
  helm--remap-mouse-mode: t
  global-page-break-lines-mode: t
  page-break-lines-mode: t
  shell-dirtrack-mode: t
  global-anzu-mode: t
  anzu-mode: t
  eval-sexp-fu-flash-mode: t
  savehist-mode: t
  save-place-mode: t
  super-save-mode: t
  global-auto-revert-mode: t
  delete-selection-mode: t
  show-paren-mode: t
  recentf-mode: t
  override-global-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/kai/.emacs.d/elpa-26.3/cmake-mode-20190710.1319/cmake-mode hides /usr/local/share/emacs/site-lisp/cmake/cmake-mode
/Users/kai/.emacs.d/elpa-26.3/password-store-20200328.1214/password-store hides /usr/local/share/emacs/site-lisp/pass/password-store
/Users/kai/.emacs.d/elpa-26.3/auth-source-pass-20191126.1242/auth-source-pass hides /usr/local/Cellar/emacs-plus/26.3/share/emacs/26.3/lisp/auth-source-pass
~/.emacs.d/lisp/loaddefs hides /usr/local/Cellar/emacs-plus/26.3/share/emacs/26.3/lisp/loaddefs
/Users/kai/.emacs.d/elpa-26.3/let-alist-1.0.6/let-alist hides /usr/local/Cellar/emacs-plus/26.3/share/emacs/26.3/lisp/emacs-lisp/let-alist

Features:
(shadow sort bbdb-message mail-extr hippie-exp erc-hl-nicks color
erc-button erc-fill erc-stamp erc-goodies erc erc-backend erc-compat
emacsbug message rmc puny rfc822 mml mml-sec gnus-util rmail
rmail-loaddefs mailabbrev gmm-utils mailheader sendmail mail-utils
helm-command executable winner diredfl ls-lisp dired dired-loaddefs
init-helm-dwim helm-x-files helm-for-files helm-bookmark helm-adaptive
bookmark pp helm-external helm-net browse-url xml url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap helm-ls-git vc-git diff-mode vc vc-dispatcher helm-ring
helm-elisp helm-eval edebug helm-info misearch multi-isearch format-all
language-id rect ido-completing-read+ memoize cus-edit cus-start
cus-load minibuf-eldef paredit hl-todo company-oddmuse company-keywords
company-gtags company-dabbrev-code company-dabbrev company-files
company-capf company-cmake company-xcode company-clang company-semantic
company-eclim company-template company-bbdb company-ctags find-file
company pcase undo-tree diff midnight perspective ido yasnippet-snippets
yasnippet elec-pair jka-compr server init-evil init-keybindings
init-other-tools vlf-setup init-emms init-news init-gnus init-email bbdb
bbdb-site timezone image-file init-eshell shell-pop term disp-table
ehelp init-documentation which-key init-translate init-flyspell
init-writting init-ide init-lsp init-web init-lang init-conf
init-functional init-rust init-go init-python virtualenvwrapper gud s
init-git init-projectile helm-projectile projectile ibuf-ext ibuffer
ibuffer-loaddefs init-state state init-flycheck flycheck json map
find-func dash init-yasnippet init-auto-complete init-helm
helm-descbinds helm-xref xref project init-helm-ui helm-mode helm-files
helm-buffers helm-occur helm-tags helm-locate helm-grep wgrep-helm wgrep
grep compile helm-regexp helm-utils helm-help helm-types helm-config
helm-easymenu async-bytecomp helm helm-source helm-multi-match helm-lib
async subr-x init-window windmove init-buffer init-dired init-appearance
default-dark-theme init-modeline page-break-lines init-editor init-tramp
docker-tramp tramp-cache tramp tramp-compat tramp-loaddefs trampver
shell pcomplete comint ansi-color ring parse-time format-spec anzu
thingatpt cl-extra eval-sexp-fu init-base init-preference savehist
saveplace super-save autorevert filenotify delsel paren recentf
tree-widget wid-edit epa-file epa derived epg dim no-littering bind-key
easy-mmode exec-path-from-shell auto-compile packed init-package
autoload quelpa mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr lisp-mnt help-fns radix-tree
help-mode finder-inf ede/auto tex-site fix-word gh-common marshal
eieio-compat slime-autoloads rx advice info package easymenu epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv init-utils global-variables edmacro kmacro
cl-loaddefs cl-lib time-date tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 625219 428710)
(symbols 48 48673 10)
(miscs 40 113 633)
(strings 32 155960 70216)
(string-bytes 1 4564328)
(vectors 16 76895)
(vector-slots 8 1254498 288474)
(floats 8 344 650)
(intervals 56 1479 391)
(buffers 992 15))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#41071: make-frame with internal-border face not working
  2020-05-04  7:30 bug#41071: make-frame with internal-border face not working 王凯
@ 2020-05-04 14:38 ` Eli Zaretskii
  2020-09-23 13:03 ` Alan Third
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2020-05-04 14:38 UTC (permalink / raw)
  To: 王凯; +Cc: 41071

> From: 王凯 <wangkai.kaiwk@bytedance.com>
> Date: Mon, 4 May 2020 15:30:09 +0800
> 
> (defface test
>   '((t (:inherit default :background "green")))
>   "Face used by the ivy-posframe."
>   :group 'ivy-posframe)
> 
> (set-face-background
> 'internal-border
> (face-attribute 'test :background)
> (make-frame `((internal-border-width . 100)
>                (parent-frame . ,(window-frame)))))
> 
> (set-face-background
> 'internal-border
> (face-attribute 'test :background)
> (make-frame `((internal-border-width . 100))))
> 
> Eval code above in emacs, internal-border-width works but the
> :background not.

It does here, so I guess this could be macOS specific.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#41071: make-frame with internal-border face not working
  2020-05-04  7:30 bug#41071: make-frame with internal-border face not working 王凯
  2020-05-04 14:38 ` Eli Zaretskii
@ 2020-09-23 13:03 ` Alan Third
  2020-09-25 16:23   ` Alan Third
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Third @ 2020-09-23 13:03 UTC (permalink / raw)
  To: 王凯; +Cc: 41071

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

On Mon, May 04, 2020 at 03:30:09PM +0800, 王凯 wrote:
> 
> (defface test
>   '((t (:inherit default :background "green")))
>   "Face used by the ivy-posframe."
>   :group 'ivy-posframe)
> 
> (set-face-background
> 'internal-border
> (face-attribute 'test :background)
> (make-frame `((internal-border-width . 100)
>                (parent-frame . ,(window-frame)))))
> 
> (set-face-background
> 'internal-border
> (face-attribute 'test :background)
> (make-frame `((internal-border-width . 100))))
> 
> Eval code above in emacs, internal-border-width works but the
> :background not.

Patch against master attached. It appears to work correctly here, but
I'm slightly concerned it may not work so well on older versions of
macOS, but we'll probably just have to wait and see if anyone
complains.
-- 
Alan Third

[-- Attachment #2: 0001-Implement-internal-border-colors-on-NS-bug-41071.patch --]
[-- Type: text/plain, Size: 3567 bytes --]

From 5f98e4703791b31ed4b94c16340170777e7a9374 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Wed, 23 Sep 2020 13:57:50 +0100
Subject: [PATCH] Implement internal border colors on NS (bug#41071)

* src/nsterm.m (ns_clear_under_internal_border): New function.
(ns_after_update_window_line): Use the correct background color.
(ns_redisplay_interface): Add ns_clear_under_internal_border.
---
 src/nsterm.m | 64 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 59 insertions(+), 5 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 5e5d09f058..4b1cf65964 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3052,6 +3052,40 @@ so some key presses (TAB) are swallowed by the system.  */
 }
 
 
+static void
+ns_clear_under_internal_border (struct frame *f)
+{
+  NSTRACE ("ns_clear_under_internal_border");
+
+  if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
+    {
+      int border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
+      NSView *view = FRAME_NS_VIEW (f);
+      NSRect edge_rect, frame_rect = [view bounds];
+      NSRectEdge edge[] = {NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge};
+
+      int face_id =
+	!NILP (Vface_remapping_alist)
+	? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+	: INTERNAL_BORDER_FACE_ID;
+      struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
+
+      if (!face)
+        face = FRAME_DEFAULT_FACE (f);
+
+      ns_focus (f, &frame_rect, 1);
+      [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+      for (int i = 0; i < 4 ; i++)
+        {
+          NSDivideRect (frame_rect, &edge_rect, &frame_rect, border_width, edge[i]);
+
+          NSRectFill (edge_rect);
+        }
+      ns_unfocus (f);
+    }
+}
+
+
 static void
 ns_after_update_window_line (struct window *w, struct glyph_row *desired_row)
 /* --------------------------------------------------------------------------
@@ -3080,12 +3114,32 @@ so some key presses (TAB) are swallowed by the system.  */
 	  height > 0))
     {
       int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
+      int face_id =
+        !NILP (Vface_remapping_alist)
+        ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+        : INTERNAL_BORDER_FACE_ID;
+      struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
 
       block_input ();
-      ns_clear_frame_area (f, 0, y, width, height);
-      ns_clear_frame_area (f,
-                           FRAME_PIXEL_WIDTH (f) - width,
-                           y, width, height);
+      if (face)
+        {
+          NSRect r = NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height);
+          ns_focus (f, &r, 1);
+
+          [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+          NSRectFill (NSMakeRect (0, y, width, height));
+          NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width,
+                                  y, width, height));
+
+          ns_unfocus (f);
+        }
+      else
+        {
+          ns_clear_frame_area (f, 0, y, width, height);
+          ns_clear_frame_area (f,
+                               FRAME_PIXEL_WIDTH (f) - width,
+                               y, width, height);
+        }
       unblock_input ();
     }
 }
@@ -5301,7 +5355,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s)
   ns_draw_glyph_string,
   ns_define_frame_cursor,
   ns_clear_frame_area,
-  0, /* clear_under_internal_border */
+  ns_clear_under_internal_border, /* clear_under_internal_border */
   ns_draw_window_cursor,
   ns_draw_vertical_window_border,
   ns_draw_window_divider,
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#41071: make-frame with internal-border face not working
  2020-09-23 13:03 ` Alan Third
@ 2020-09-25 16:23   ` Alan Third
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Third @ 2020-09-25 16:23 UTC (permalink / raw)
  To: 王凯, 41071-done

On Wed, Sep 23, 2020 at 02:03:27PM +0100, Alan Third wrote:
> On Mon, May 04, 2020 at 03:30:09PM +0800, 王凯 wrote:
> > 
> > (defface test
> >   '((t (:inherit default :background "green")))
> >   "Face used by the ivy-posframe."
> >   :group 'ivy-posframe)
> > 
> > (set-face-background
> > 'internal-border
> > (face-attribute 'test :background)
> > (make-frame `((internal-border-width . 100)
> >                (parent-frame . ,(window-frame)))))
> > 
> > (set-face-background
> > 'internal-border
> > (face-attribute 'test :background)
> > (make-frame `((internal-border-width . 100))))
> > 
> > Eval code above in emacs, internal-border-width works but the
> > :background not.
> 
> Patch against master attached. It appears to work correctly here, but
> I'm slightly concerned it may not work so well on older versions of
> macOS, but we'll probably just have to wait and see if anyone
> complains.

I've pushed the change to master and therefore am closing this bug
report.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-25 16:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04  7:30 bug#41071: make-frame with internal-border face not working 王凯
2020-05-04 14:38 ` Eli Zaretskii
2020-09-23 13:03 ` Alan Third
2020-09-25 16:23   ` Alan Third

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).