Re: Firefox field autocomplete drop-down menu annoying problem

Stefan Monnier <[email protected]>
Newsgroups gmane.comp.window-managers.ctwm
Message-ID <[email protected]>
>> Does anyone know what _NET_FRAME_EXTENTS is supposed to mean?
> It is used to notify the client about the width(s) of the
> window decoration added by the window manager.
> https://standards.freedesktop.org/wm-spec/wm-spec-latest.html
[...]

Thanks.
AFAICT, that doesn't explain why this is needed for Firefox's popups.
Oh well.

In any case, I'm now running with the patch below (i.e. Maxime's but
without the KDE part, with a few comments added, and using the {...}
syntax to initialize the array) and it also fixes the problem for me.


        Stefan


diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..378eac25
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/add_window.c b/add_window.c
index 72da035d..b3bc2faa 100644
--- a/add_window.c
+++ b/add_window.c
@@ -575,6 +575,9 @@ AddWindow(Window w, AWType wtype, IconMgr *iconp, VirtualScreen *vs)
 		else {
 			tmp_win->title_height = 0;
 		}
+#ifdef EWMH
+		EwmhSet_NET_FRAME_EXTENTS(tmp_win);
+#endif /* EWMH */
 	}
 
 
diff --git a/ewmh.c b/ewmh.c
index 6d88e27f..6444792d 100644
--- a/ewmh.c
+++ b/ewmh.c
@@ -2048,6 +2048,26 @@ static void EwmhRemoveStrut(TwmWindow *twm_win)
 	}
 }
 
+void EwmhSet_NET_FRAME_EXTENTS(TwmWindow *twm_win)
+{
+	long w = twm_win->frame_bw3D + twm_win->frame_bw;
+
+	/* Apparently, it's important to set this property to indicate
+	 * to applications like Firefox where their content starts/ends,
+         * otherwise, popup menus appear at the wrong place, typically
+         * right over the text you're typing!  */
+	unsigned long data[4]
+	  /* left, right, top, bottom  */
+	  = { w, w, twm_win->title_height + w, w};
+
+	/* This is take from fvwm, which also sets _KDE_NET_WM_FRAME_STRUT to
+         * the same value, tho in my tests, it seems this is sufficient.  */
+	XChangeProperty(dpy, twm_win->w,
+	                XA__NET_FRAME_EXTENTS, XA_CARDINAL,
+	                32, PropModeReplace,
+	                (unsigned char *)data, 4);
+}
+
 void EwmhSet_NET_SHOWING_DESKTOP(int state)
 {
 	unsigned long prop[1];
diff --git a/ewmh.h b/ewmh.h
index 5d9d4fe0..1d9e70f0 100644
--- a/ewmh.h
+++ b/ewmh.h
@@ -77,6 +77,7 @@ int EwmhGetInitPriority(TwmWindow *twm_win);
 bool EwmhHasBorder(TwmWindow *twm_win);
 bool EwmhHasTitle(TwmWindow *twm_win);
 bool EwmhOnWindowRing(TwmWindow *twm_win);
+void EwmhSet_NET_FRAME_EXTENTS(TwmWindow *twm_win);
 void EwmhSet_NET_SHOWING_DESKTOP(int state);
 void EwmhSet_NET_WM_STATE(TwmWindow *twm_win, int changes);
 
diff --git a/ewmh_atoms.in b/ewmh_atoms.in
index 6cd5397e..0a6e24f9 100644
--- a/ewmh_atoms.in
+++ b/ewmh_atoms.in
@@ -31,3 +31,4 @@ _NET_WM_WINDOW_TYPE_DESKTOP
 _NET_WM_WINDOW_TYPE_DOCK
 _NET_WM_WINDOW_TYPE_NORMAL
 _NET_WORKAREA
+_NET_FRAME_EXTENTS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.