emacs-devel
[Top][All Lists]
Advanced

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

Re: GTK "decorated" and "deletable" properties


From: Jan Djärv
Subject: Re: GTK "decorated" and "deletable" properties
Date: Fri, 03 Jun 2011 19:39:05 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10



Ted Zlatanov skrev 2011-06-03 18.29:
On Fri, 03 Jun 2011 17:21:19 +0200 Jan Djärv<address@hidden>  wrote:


JD>  These functions just set the MotifWMHints.  So we should make sure it
JD>  works on all X11 ports, not just Gtk+.  Also, can these new frame
JD>  parameters be generalized into something that makes sense on all ports
JD>  (W32, Nextstep)?

GTK on W32 respects the decorated hint and passes it on correctly,
according to the docs.  It's not clear from the docs if W32 itself will
display the window without decorations, but it seems so: "On Windows,
this function always works, since there's no window manager policy
involved."


Emacs does not suppoty Gtk+ on anything but X11.

On NextStep / Cocoa, according to
http://www.cocoadev.com/index.pl?BorderlessWindow it's possible but such
a window can't have a toolbar (does it crash or simply ignore the
toolbar?  that's not clear).  For my purposes that's OK, the pop-up
frames I need won't have toolbars.

It would be nice if each port offered even more control through native
frame properties, of course, e.g. ns-borderless and gtk-deletable.  I
can then set each native property and it has no effect otherwise.  But a
general name convention is useful too.


For X11 you can do it in lisp. Here is a function from an earlier bug report about Motif WM Hints (4363). Gtk+ (as far as I know) only manipulates functions and decorations.

Motif wm hits is just a property with 5 values. Just use 
x-change-window-property.

(defun make-special-frame (data)
  (let ((ff (make-frame '((visibility . nil)))))
    (progn
      (x-change-window-property "_MOTIF_WM_HINTS" data ff
                                "_MOTIF_WM_HINTS" 32 t)
       (make-frame-visible ff))))

To make a frame without decoration (gtk_window_decorated):

(make-special-frame '(2 0 0 0 0))

To make a frame without delete (gtk_window_deletable):

(make-special-frame '(1 33 0 0 0))

The first value tells what to change (from /usr/include/Xm/MwmUtils.h):
#define MWM_HINTS_FUNCTIONS     (1L << 0)
#define MWM_HINTS_DECORATIONS   (1L << 1)
#define MWM_HINTS_INPUT_MODE    (1L << 2)
#define MWM_HINTS_STATUS        (1L << 3)

The second is the functions:
#define MWM_FUNC_ALL            (1L << 0)
#define MWM_FUNC_RESIZE         (1L << 1)
#define MWM_FUNC_MOVE           (1L << 2)
#define MWM_FUNC_MINIMIZE       (1L << 3)
#define MWM_FUNC_MAXIMIZE       (1L << 4)
#define MWM_FUNC_CLOSE          (1L << 5)

The third is the decorations:
#define MWM_DECOR_ALL           (1L << 0)
#define MWM_DECOR_BORDER        (1L << 1)
#define MWM_DECOR_RESIZEH       (1L << 2)
#define MWM_DECOR_TITLE         (1L << 3)
#define MWM_DECOR_MENU          (1L << 4)
#define MWM_DECOR_MINIMIZE      (1L << 5)
#define MWM_DECOR_MAXIMIZE      (1L << 6)

Note that most wm:s just check MWM_HINTS when the window is mapped, thats why the function creates it invisible at first. If a frame is visible, you must (make-frame-invisble), (x-change-window-properties...) (make-frame-visible).

        Jan D.




reply via email to

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