unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller.no1@gmail.com>
To: "Clément Pit--Claudel" <clement.pit@gmail.com>
Cc: 25408@debbugs.gnu.org
Subject: bug#25408: Remove Decorations Around Emacs Frame (Windows OS)
Date: Wed, 11 Jan 2017 08:48:31 +0100	[thread overview]
Message-ID: <CAHk_L7ojbuZKQY9t2Db-exYZwuFQZWCMF4aLp4p0B+WoPiwecw@mail.gmail.com> (raw)
In-Reply-To: <CAHk_L7ppcVz=6eCWU5uM_kky-RJxNS81gHFkfyTwd5eEg75qOg@mail.gmail.com>

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

There is a slightly cosmetic issue with above function. When one switches
back on decorations,
the frame will not resize properly and minibuffer will be not visible. It's
there but just
covered by frame. Just resizing emacs framefixes it.

Adding call to PostMessage(hwnd, WM_SIZE,0,0) in Martins function fixes it.

void
x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object
old_value)
{
  HWND hwnd = FRAME_W32_WINDOW (f);
  DWORD dwStyle = GetWindowLong (hwnd, GWL_STYLE);
  /*Lisp_Object border_width = Fcdr (Fassq (Qborder_width,
f->param_alist));*/
  /*Lisp_Object undecorated = Fcdr (Fassq (Qundecorated, f->param_alist));*/

  block_input ();
  if (!NILP (new_value) && !FRAME_UNDECORATED (f))
    {
      dwStyle = (dwStyle & ~WS_THICKFRAME & ~WS_CAPTION);
      SetWindowLong (hwnd, GWL_STYLE, dwStyle);
      SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
                    SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE
                    | SWP_FRAMECHANGED);
      FRAME_UNDECORATED (f) = true;
    }
  else if (!NILP (new_value) && FRAME_UNDECORATED (f))
    {
      SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_THICKFRAME | WS_CAPTION
                     | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU);
      SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
                    SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE
                    | SWP_FRAMECHANGED);
      PostMessage(hwnd, WM_SIZE,0,0);
      FRAME_UNDECORATED (f) = false;
    }
  unblock_input ();
}


2017-01-11 8:24 GMT+01:00 Arthur Miller <arthur.miller.no1@gmail.com>:

> I appologize, I was too fast to answer, I made a bad call from
> modify-frame-parameters
> when I tested it. It works like a charm as you say it in english. I have
> also changed
> the else-if statement in Martins method to else if (!NILP (new_value) &&
> FRAME_UNDECORATED (f))
> (check for !NILP) so I can switch back decorations. It works. Thanks all,
> it was great
> exercise to learn a bit of emacs internals and to make a simple hack.
>
> 2017-01-11 8:08 GMT+01:00 Arthur Miller <arthur.miller.no1@gmail.com>:
>
>> "We call it "Losedows" or "Lose OS", because if you use it, you lose
>> your freedom.
>>
>> We're glad if Emacs gives you a taste of freedom, but a taste is
>> all it can give you.  To escape from Microsoft's power, you need to
>> stop using Losedows."
>>
>> Haha :-) Indeed.
>>
>> I do run Arch Linux otherwise, but I do some consulting with programming
>> databases and GUIs in access & spss and I also play some games
>> occasionally, so I still need losedows. I know I could run it in wine and
>> pass through vga, but I feel a bit too old for that :).
>>
>> This was a great excursion in Emacs src code. I added above mention
>> method to my w32fns.c, added FRAME_DECORATED() macro to frame.h
>> a boolean_bf undecorated :1, to frame struct, initiated it to false in
>> "make_frame"
>> added an entry to frame_parms: {"undecorated",        SYMBOL_INDEX
>> (Qundecorated)},
>> added connecction to w32_frame_parm_handlers[] to x_set_undecorated at
>> same
>> place where symbol is declared in frame_parms (last in the list), added an
>> INLINE void fset_undecorated( ... ) to frame.h (not sure if it is
>> needed), and now
>> I can change my new param with lisp from emacs, but my connection seem
>> never to be called.
>>
>> By the way, I think world is better without borders, so I have modified
>> Martin's
>> x_set_undecorated to
>>
>> void
>> x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object
>> old_value)
>> {
>>   HWND hwnd = FRAME_W32_WINDOW (f);
>>   DWORD dwStyle = GetWindowLong (hwnd, GWL_STYLE);
>>   /*Lisp_Object border_width = Fcdr (Fassq (Qborder_width,
>> f->param_alist));*/
>>   /*Lisp_Object undecorated = Fcdr (Fassq (Qundecorated,
>> f->param_alist));*/
>>
>>   block_input ();
>>   if (!NILP (new_value) && !FRAME_UNDECORATED (f))
>>     {
>>       dwStyle = (dwStyle & ~WS_THICKFRAME & ~WS_CAPTION);
>>       SetWindowLong (hwnd, GWL_STYLE, dwStyle);
>>       SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
>>                     SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER |
>> SWP_NOACTIVATE
>>                     | SWP_FRAMECHANGED);
>>       FRAME_UNDECORATED (f) = true;
>>     }
>>   else if (NILP (new_value) && FRAME_UNDECORATED (f))
>>     {
>>       SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_THICKFRAME | WS_CAPTION
>>                      | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU);
>>       SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
>>                     SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER |
>> SWP_NOACTIVATE
>>                     | SWP_FRAMECHANGED);
>>       FRAME_UNDECORATED (f) = false;
>>     }
>>   unblock_input ();
>> }
>>
>> So it should just switch on "undecorated" param and ignore borders (at
>> least I hope). I am not sure where do
>> I have to make change more to get it to work.
>>
>> 2017-01-10 21:39 GMT+01:00 Clément Pit--Claudel <clement.pit@gmail.com>:
>>
>>> On 2017-01-10 13:27, Eli Zaretskii wrote:
>>> > Then I suggest to add this to Emacs.  That some wm's ignore it is not
>>> > a reason to avoid having the feature for those that don't ignore it.
>>>
>>> Indeed, it would be wonderful!
>>>
>>>
>>
>

[-- Attachment #2: Type: text/html, Size: 7349 bytes --]

  reply	other threads:[~2017-01-11  7:48 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 22:20 bug#25408: Remove Decorations Around Emacs Frame (Windows OS) Arthur Miller
2017-01-10  8:23 ` martin rudalics
2017-01-10 17:07   ` Eli Zaretskii
2017-01-10 18:07     ` martin rudalics
2017-01-10 18:27       ` Eli Zaretskii
2017-01-10 20:39         ` Clément Pit--Claudel
2017-01-11  7:08           ` Arthur Miller
2017-01-11  7:24             ` Arthur Miller
2017-01-11  7:48               ` Arthur Miller [this message]
2017-01-11  7:50                 ` Arthur Miller
2017-01-11  8:15                   ` Arthur Miller
2017-01-11  8:39                 ` martin rudalics
2017-01-11  9:17                   ` Arthur Miller
2017-01-11 10:20                     ` Arthur Miller
2017-01-11 13:55                       ` martin rudalics
2017-02-07  5:28                   ` Clément Pit--Claudel
2017-02-07  6:53                     ` martin rudalics
2017-02-07 13:05                       ` Clément Pit--Claudel
2017-02-11 14:27                         ` martin rudalics
2017-02-11 21:02                           ` Clément Pit--Claudel
2017-02-11 21:10                             ` Clément Pit--Claudel
2017-02-12 11:13                             ` martin rudalics
2017-02-15 19:49                               ` Arthur Miller
2017-02-16  8:04                                 ` martin rudalics
2017-02-16 13:22                                   ` Arthur Miller
2017-02-16 14:06                                     ` Arthur Miller
2017-02-17  7:03                                       ` martin rudalics
2017-02-17  7:03                                     ` martin rudalics
2017-04-12  9:27                               ` martin rudalics
2017-05-06  0:06                                 ` Clément Pit-Claudel
2017-05-06  7:13                                   ` Eli Zaretskii
2017-05-06 13:26                                     ` Clément Pit-Claudel
2017-05-06  7:40                                   ` martin rudalics
2017-05-06  9:41                                     ` martin rudalics
2017-05-06 13:28                                       ` Clément Pit-Claudel
2017-05-06 14:20                                         ` Eli Zaretskii
2017-05-06 21:01                                           ` Clément Pit-Claudel
2017-05-07  2:30                                             ` Eli Zaretskii
2017-05-07  8:41                                           ` martin rudalics
2017-05-07  8:40                                         ` martin rudalics
2017-05-07 17:19                                           ` Eli Zaretskii
2017-05-07 18:07                                             ` martin rudalics
2017-05-07 18:33                                               ` Eli Zaretskii
2017-05-08  6:48                                                 ` martin rudalics
2017-05-08 14:41                                                   ` Eli Zaretskii
2017-06-25 11:02                                   ` martin rudalics
2017-06-25 16:23                                     ` Clément Pit-Claudel
2017-04-12 17:38                           ` Alan Third
2017-04-12 19:13                             ` martin rudalics
2017-04-12 19:51                               ` Alan Third
2017-04-13  7:10                                 ` martin rudalics
2017-04-13 10:30                                   ` Alan Third
2017-04-13 11:56                                     ` martin rudalics
2017-04-15 16:29                                   ` Alan Third
2017-04-15 19:39                                     ` martin rudalics
2017-04-17 14:56                                       ` bug#25408: Remove Decorations Around Emacs Frame (NS port) Alan Third
2017-04-17 15:43                                         ` martin rudalics
2017-04-17 16:21                                           ` Alan Third
2017-04-17 17:20                                             ` martin rudalics
2017-04-17 18:55                                               ` Alan Third
2017-04-19  7:26                                                 ` martin rudalics
2017-04-19 14:33                                                   ` Alan Third
2017-04-19 16:01                                                     ` martin rudalics
2017-04-19 17:04                                                       ` Alan Third
2017-04-19 18:07                                                         ` martin rudalics
2017-06-10 15:38                                                           ` Alan Third
2017-06-11  8:10                                                             ` martin rudalics
2017-06-11 16:35                                                               ` Alan Third
2017-06-12  6:09                                                                 ` martin rudalics
2017-06-12 17:59                                                                   ` Alan Third
2017-06-13  7:24                                                                     ` martin rudalics
2017-06-22  9:10                                                                     ` martin rudalics
2017-06-25 14:22                                                                       ` Alan Third
2017-06-25 15:58                                                                         ` martin rudalics
2017-07-15 21:27                                                                           ` Alan Third
2017-07-16  8:28                                                                             ` martin rudalics
2017-04-19 11:24                                         ` Anders Lindgren
2017-04-19 12:50                                           ` martin rudalics
2017-04-19 13:51                                           ` Alan Third
2017-01-11  8:38             ` bug#25408: Remove Decorations Around Emacs Frame (Windows OS) martin rudalics
2017-01-11 16:39             ` Richard Stallman
2017-01-10 19:36 ` Richard Stallman
2017-01-11 13:50 ` bug#25408: SV: " arthur.miller.no1
2017-01-11 13:57   ` martin rudalics
2017-01-11 14:59 ` arthur.miller.no1

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=CAHk_L7ojbuZKQY9t2Db-exYZwuFQZWCMF4aLp4p0B+WoPiwecw@mail.gmail.com \
    --to=arthur.miller.no1@gmail.com \
    --cc=25408@debbugs.gnu.org \
    --cc=clement.pit@gmail.com \
    /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).