unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: Chris Feng <chris.w.feng@gmail.com>, martin rudalics <rudalics@gmx.at>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Creating a "borderless" frame (without WM chrome) (was Re: Could x-show-tip be reimplemented in Elisp? How does one create borderless frames from Elisp?)
Date: Wed, 17 Feb 2016 09:55:55 -0500	[thread overview]
Message-ID: <56C489FB.7050506@gmail.com> (raw)
In-Reply-To: <CAP4=87FrHpEqPsaDsu6wfef-+NMxY_dQEKO89a900ORKLjPAhg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1467 bytes --]

On 02/17/2016 08:49 AM, Chris Feng wrote:
>>> * add a frame parameter to frame_parms in frame.c, say "chromeless"
>>
>> I'd prefer "decorated" as in gtk_window_set-decorated.
> 
> Agree.  We call it "decoration" in X almost exclusively.
> 
>>> * add an x_set_chromeless slot in each of frame_parm_handler
>>> x_frame_parm_handlers[], frame_parm_handler w32_frame_parm_handlers[],
>>> frame_parm_handler ns_frame_parm_handlers[]; for the last two point to 0 for
>>> now; for the first one point to a new function x_set_chromeless.
>>> * In x-create-frame, add something like
>>>      x_default_parameter (f, parms, Qchromeless, Qnil,
>>>                           "chromeless", "Chromeless", RES_TYPE_BOOLEAN);
> 
> I don't think we need to make this customizable through X resources,
> so the fifth and sixth parameters to x_default_parameter should be
> NULL.

Thanks. I've attached a rough patch draft (that is, frames are decorated by default, but (make-frame '((decorated . nil))) creates an undecorated frame), which works with --with-x-toolkit=none.

>> For X I doubt that it's always possible to add/remove the decorations of
>> an existing frame.
> 
> Yes but it may require remapping if it's already mapped.

Got it; is this why the attached patch doesn't do anything with Gtk? I looked at the Xlib documentation, but I'm not sure how to check if the window is already mapped, and only remap it in that case.

Cheers,
Clément.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Prototype-for-undecorated-frames.patch --]
[-- Type: text/x-diff; name="0001-Prototype-for-undecorated-frames.patch", Size: 3264 bytes --]

From e4cd5c03947a29e73fe7d75167a12ef0b2ed55f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Pit--Claudel?= <clement.pitclaudel@live.com>
Date: Tue, 16 Feb 2016 18:49:57 -0500
Subject: [PATCH] Prototype for undecorated frames

Only works with --with-x-toolkit=none
---
 src/frame.c  |  2 ++
 src/nsfns.m  |  1 +
 src/w32fns.c |  1 +
 src/xfns.c   | 14 ++++++++++++++
 4 files changed, 18 insertions(+)

diff --git a/src/frame.c b/src/frame.c
index 8c86afe..0c74dce 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3065,6 +3065,7 @@ static const struct frame_parm_table frame_parms[] =
   {"fullscreen",                SYMBOL_INDEX (Qfullscreen)},
   {"font-backend",		SYMBOL_INDEX (Qfont_backend)},
   {"alpha",			SYMBOL_INDEX (Qalpha)},
+  {"decorated",			SYMBOL_INDEX (Qdecorated)},
   {"sticky",			SYMBOL_INDEX (Qsticky)},
   {"tool-bar-position",		SYMBOL_INDEX (Qtool_bar_position)},
 };
@@ -4982,6 +4983,7 @@ syms_of_frame (void)
 #endif
 
   DEFSYM (Qalpha, "alpha");
+  DEFSYM (Qdecorated, "decorated");
   DEFSYM (Qauto_lower, "auto-lower");
   DEFSYM (Qauto_raise, "auto-raise");
   DEFSYM (Qborder_color, "border-color");
diff --git a/src/nsfns.m b/src/nsfns.m
index eda94c4..346c1a6 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1006,6 +1006,7 @@ frame_parm_handler ns_frame_parm_handlers[] =
   x_set_fullscreen, /* generic OK */
   x_set_font_backend, /* generic OK */
   x_set_alpha,
+  0, /* x_set_decorated */
   0, /* x_set_sticky */
   0, /* x_set_tool_bar_position */
 };
diff --git a/src/w32fns.c b/src/w32fns.c
index a5018ae..226246b 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -9258,6 +9258,7 @@ frame_parm_handler w32_frame_parm_handlers[] =
   x_set_fullscreen,
   x_set_font_backend,
   x_set_alpha,
+  0, /* x_set_decorated */
   0, /* x_set_sticky */
   0, /* x_set_tool_bar_position */
 };
diff --git a/src/xfns.c b/src/xfns.c
index 20ac627..56bae7ce 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3511,6 +3511,8 @@ This function is an internal primitive--use `make-frame' instead.  */)
 		       RES_TYPE_NUMBER);
   x_default_parameter (f, parms, Qalpha, Qnil,
 		       "alpha", "Alpha", RES_TYPE_NUMBER);
+  x_default_parameter (f, parms, Qdecorated, Qt,
+                       NULL, NULL, RES_TYPE_BOOLEAN);
 
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
   /* Create the menu bar.  */
@@ -5773,6 +5775,17 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object
     *root_x = min_x;
 }
 
+void
+x_set_decorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
+{
+  XSetWindowAttributes attributes;
+  attributes.override_redirect = NILP(new_value) ? True : False;
+
+  block_input ();
+  XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+                           CWOverrideRedirect, &attributes);
+  unblock_input ();
+}
 
 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
        doc: /* Show STRING in a "tooltip" window on frame FRAME.
@@ -6791,6 +6804,7 @@ frame_parm_handler x_frame_parm_handlers[] =
   x_set_fullscreen,
   x_set_font_backend,
   x_set_alpha,
+  x_set_decorated,
   x_set_sticky,
   x_set_tool_bar_position,
 };
-- 
2.7.1


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2016-02-17 14:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 15:01 Could x-show-tip be reimplemented in Elisp? How does one create borderless frames from Elisp? Clément Pit--Claudel
2016-02-13  2:15 ` Chris Feng
2016-02-13  3:35   ` Clément Pit--Claudel
2016-02-13  3:57     ` Chris Feng
2016-02-16 20:12       ` Creating a "borderless" frame (without WM chrome) (was Re: Could x-show-tip be reimplemented in Elisp? How does one create borderless frames from Elisp?) Clément Pit--Claudel
2016-02-16 22:41         ` Chris Feng
2016-02-16 22:55           ` Clément Pit--Claudel
2016-02-16 23:14             ` Chris Feng
2016-02-16 23:46               ` Clément Pit--Claudel
2016-02-17  9:13                 ` martin rudalics
2016-02-17 13:49                   ` Chris Feng
2016-02-17 14:55                     ` Clément Pit--Claudel [this message]
2016-02-18  1:28                       ` Chris Feng
2016-02-17 14:57                   ` Clément Pit--Claudel
2016-02-18 10:51                     ` martin rudalics
2016-02-14 14:05     ` Could x-show-tip be reimplemented in Elisp? How does one create borderless frames from Elisp? Stefan Monnier
2016-02-14 16:44       ` Eli Zaretskii
2016-02-14 17:19         ` Stefan Monnier
2016-02-14 18:00           ` Eli Zaretskii
2016-02-16 20:06       ` Clément Pit--Claudel
2016-02-15 10:57 ` martin rudalics
2016-02-15 13:31   ` Stefan Monnier
2016-02-16 20:06     ` Clément Pit--Claudel
2016-02-16 20:05   ` Clément Pit--Claudel
2016-02-16 21:33     ` Johan Bockgård
2016-02-16 22:18       ` Clément Pit--Claudel
2016-02-17  9:12     ` martin rudalics
2016-02-17 14:26       ` Clément Pit--Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56C489FB.7050506@gmail.com \
    --to=clement.pit@gmail.com \
    --cc=chris.w.feng@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).