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

[wmx] Patch for no window decorations

Scott Jann - Wed May 23 21:05:25 2001

Greetings,

I am a recent convert to wmx, I just subscribed to the list and this is my
first post.

One of the things in the documentation is that one can use 'xnodecor' to
prevent the window manager from putting borders on windows such as clocks.
Once I finally found it, I had no luck ever getting it to work.  I simply
wanted my borderless Eterms and my gkrellm to have no borders.

Simple solution: make windows with the MWM decorations hint set to 0 be
treated as shaped/transient windows, so wmx won't add a border.  This is
what the code for Eterm sets to remove borders, and it appears to work for
gkrellm too.  Below is a patch which adds a noDecorations check to
Client.C, and modifies isTransient and isShaped to call it.

It works for my configuration, and it may be useful for someone else...

-Scott

diff -c wmx-6/Client.C wmx-6.new/Client.C
*** wmx-6/Client.C	Fri May 12 02:40:20 2000
--- wmx-6.new/Client.C	Wed May 23 11:28:30 2001
***************
*** 9,18 ****
  #include <X11/Xmu/Atoms.h>
  #endif

- #if CONFIG_GNOME_COMPLIANCE != False
  // needed this to be able to use CARD32
  #include <X11/Xmd.h>
! #endif

  const char *const Client::m_defaultLabel = "incognito";

--- 9,28 ----
  #include <X11/Xmu/Atoms.h>
  #endif

  // needed this to be able to use CARD32
  #include <X11/Xmd.h>
!
!
! typedef struct _mwmhints {
!   CARD32 flags;
!   CARD32 functions;
!   CARD32 decorations;
!   INT32  input_mode;
!   CARD32 status;
! } MWMHints;
!
! #define MWM_HINT_LEN (sizeof(MWMHints) / sizeof(INT32))
!

  const char *const Client::m_defaultLabel = "incognito";

***************
*** 1307,1309 ****
--- 1317,1343 ----

  }
  #endif
+
+ Boolean Client::noDecorations() {
+     Boolean ret = False;
+     Atom type_return;
+     int format_return;
+     unsigned long nitems, bytes_after;
+     MWMHints *mwmhints;
+     Atom prop = None;
+
+     prop = XInternAtom(display(), "_MOTIF_WM_HINTS", True);
+     if(prop == None)
+ 	return(ret);
+
+     if(XGetWindowProperty(display(), m_window, prop,
+ 	0, MWM_HINT_LEN, False, AnyPropertyType, &type_return, &format_return,
+ 	&nitems, &bytes_after, (unsigned char**)&mwmhints) == Success)
+     {
+ 	if(nitems == MWM_HINT_LEN)
+ 	    ret = True;
+ 	XFree((unsigned char*)mwmhints);
+     }
+     return(ret);
+ }
+
diff -c wmx-6/Client.h wmx-6.new/Client.h
*** wmx-6/Client.h	Fri May 12 02:40:20 2000
--- wmx-6.new/Client.h	Wed May 23 11:28:00 2001
***************
*** 50,56 ****
      Boolean isWithdrawn()  { return (m_state == WithdrawnState); }
      Boolean isNormal()     { return (m_state == NormalState);    }
      Boolean isKilled()     { return (m_window == None);          }
!     Boolean isTransient()  { return ((m_transient != None)||(m_shaped)); }
      Boolean isSticky()    { return m_sticky; }
      Window  transientFor() { return m_transient; }
  #ifdef CONFIG_USE_WINDOW_GROUPS
--- 50,56 ----
      Boolean isWithdrawn()  { return (m_state == WithdrawnState); }
      Boolean isNormal()     { return (m_state == NormalState);    }
      Boolean isKilled()     { return (m_window == None);          }
!     Boolean isTransient()  { return ((m_transient != None)||isShaped()); }
      Boolean isSticky()    { return m_sticky; }
      Window  transientFor() { return m_transient; }
  #ifdef CONFIG_USE_WINDOW_GROUPS
***************
*** 58,64 ****
      Boolean isGroupParent() { return m_window == m_groupParent; }
  #endif
      Boolean isFixedSize()  { return m_fixedSize; }
!     Boolean isShaped()     { return m_shaped; }

      const char *label()    { return m_label;    }
      const char *name()     { return m_name;     }
--- 58,65 ----
      Boolean isGroupParent() { return m_window == m_groupParent; }
  #endif
      Boolean isFixedSize()  { return m_fixedSize; }
!     Boolean isShaped()     { return(m_shaped || noDecorations()); }
!     Boolean noDecorations();

      const char *label()    { return m_label;    }
      const char *name()     { return m_name;     }



Next: