bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25408: Remove Decorations Around Emacs Frame (Windows OS)


From: martin rudalics
Subject: bug#25408: Remove Decorations Around Emacs Frame (Windows OS)
Date: Tue, 10 Jan 2017 09:23:02 +0100

> I suggest either
> to implement this in a "border-width" property when border width
> is set to 0, or to implement a new variable/function that can be set in
> init file, such as for example "no-frame-borders t".

I'm using a frame parameter "undecorated" for this.  On Windows it is
handled by the following function in w32fns.c:

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));

  block_input ();
  if (!NILP (new_value) && !FRAME_UNDECORATED (f))
    {
      dwStyle = ((dwStyle & ~WS_THICKFRAME & ~WS_CAPTION)
                 | ((NUMBERP (border_width) && (XINT (border_width) > 0))
                    ? WS_BORDER : false));
      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 ();
}

where FRAME_UNDECORATED (f) returns false if f is currently decorated.
If the `border-width' parameter is 0 the frame gets no border, otherwise
it gets the standard Windows thin-line border.

> Care has to be taken to note that when removing caption bar and borders
> it will be no longer possible to move and resize window unless user
> have other means of performing those applications.

You can use the `left', `top', `width' and `height' frame parameters for
that.

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]