* bug#6563: [PATCH] 24.0.50; Set EWMH WM NAME properties
@ 2010-07-04 17:18 James Cloos
2010-07-05 10:31 ` Jan Djärv
0 siblings, 1 reply; 2+ messages in thread
From: James Cloos @ 2010-07-04 17:18 UTC (permalink / raw)
To: 6563
When compiled with gtk+, by calling gtk_window_set_title(), Emacs sets
both the WM_NAME, WM_ICON_NAME and the _NET_WM_NAME, _NET_WM_ICON_NAME
properties.
Many current window managers prefer the _NET properties, which are
defined to always be UTF8_STRING. Some may even lack support for
COMPOUND_TEXT.
Like the _NET_* properties which Emacs already supports, _NET_WM_NAME
and _NET_WM_ICON_NAME are specified at:
http://specs.freedesktop.org/wm-spec/wm-spec-latest.html
The patch adds support for the _NET_WM_NAME and _NET_WM_ICON_NAME
properties to the non-gtk+ builds.
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2010-07-03 14:35:54 +0000
+++ src/ChangeLog 2010-07-04 17:09:04 +0000
@@ -1,3 +1,12 @@
+2010-07-04 James Cloos <cloos@jhcloos.com
+
+ * xterm.c (x_term_init): Intern the _NET_WM_NAME and
+ _NET_WM_ICON_NAME atoms.
+
+ * xfns.c (x_set_name_internal): Set the EWMH _NET_WM_NAME
+ and _NET_WM_ICON_NAME properties, too, matching what is
+ done in the gtk+ case.
+
2010-07-03 Eli Zaretskii <eliz@gnu.org>
* msdos.c (IT_set_frame_parameters): Fix setting of colors in
=== modified file 'src/xfns.c'
--- src/xfns.c 2010-07-02 12:19:29 +0000
+++ src/xfns.c 2010-07-04 16:32:36 +0000
@@ -1613,8 +1613,8 @@
int bytes, stringp;
int do_free_icon_value = 0, do_free_text_value = 0;
Lisp_Object coding_system;
-#ifdef USE_GTK
Lisp_Object encoded_name;
+ Lisp_Object encoded_icon_name;
struct gcpro gcpro1;
/* As ENCODE_UTF_8 may cause GC and relocation of string data,
@@ -1622,7 +1622,6 @@
GCPRO1 (name);
encoded_name = ENCODE_UTF_8 (name);
UNGCPRO;
-#endif
coding_system = Qcompound_text;
/* Note: Encoding strategy
@@ -1638,7 +1637,12 @@
We may also be able to use "UTF8_STRING" in text.encoding
in the future which can encode all Unicode characters.
But, for the moment, there's no way to know that the
- current window manager supports it or not. */
+ current window manager supports it or not.
+
+ Either way, we also set the _NET_WM_NAME and _NET_WM_ICON_NAME
+ properties. Per the EWMH specification, those two properties
+ are always UTF8_STRING. This matches what gtk_window_set_title()
+ does in the USE_GTK case. */
text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp,
&do_free_text_value);
text.encoding = (stringp ? XA_STRING
@@ -1649,6 +1653,7 @@
if (!STRINGP (f->icon_name))
{
icon = text;
+ encoded_icon_name = encoded_name;
}
else
{
@@ -1659,6 +1664,8 @@
: FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
icon.format = 8;
icon.nitems = bytes;
+
+ encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
}
#ifdef USE_GTK
@@ -1666,9 +1673,21 @@
(char *) SDATA (encoded_name));
#else /* not USE_GTK */
XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text);
+ XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
+ FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_name,
+ FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING,
+ 8, PropModeReplace,
+ (char *) SDATA (encoded_name),
+ SBYTES (encoded_name));
#endif /* not USE_GTK */
XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon);
+ XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
+ FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_icon_name,
+ FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING,
+ 8, PropModeReplace,
+ (char *) SDATA (encoded_icon_name),
+ SBYTES (encoded_icon_name));
if (do_free_icon_value)
xfree (icon.value);
=== modified file 'src/xterm.c'
--- src/xterm.c 2010-07-02 12:19:29 +0000
+++ src/xterm.c 2010-07-04 16:32:36 +0000
@@ -10493,6 +10493,10 @@
= XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False);
dpyinfo->Xatom_net_window_type_tooltip
= XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False);
+ dpyinfo->Xatom_net_wm_icon_name
+ = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False);
+ dpyinfo->Xatom_net_wm_name
+ = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False);
dpyinfo->cut_buffers_initialized = 0;
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#6563: [PATCH] 24.0.50; Set EWMH WM NAME properties
2010-07-04 17:18 bug#6563: [PATCH] 24.0.50; Set EWMH WM NAME properties James Cloos
@ 2010-07-05 10:31 ` Jan Djärv
0 siblings, 0 replies; 2+ messages in thread
From: Jan Djärv @ 2010-07-05 10:31 UTC (permalink / raw)
To: James Cloos; +Cc: 6563-done
Applied, thanks.
Jan D.
James Cloos skrev 2010-07-04 19.18:
> When compiled with gtk+, by calling gtk_window_set_title(), Emacs sets
> both the WM_NAME, WM_ICON_NAME and the _NET_WM_NAME, _NET_WM_ICON_NAME
> properties.
>
> Many current window managers prefer the _NET properties, which are
> defined to always be UTF8_STRING. Some may even lack support for
> COMPOUND_TEXT.
>
> Like the _NET_* properties which Emacs already supports, _NET_WM_NAME
> and _NET_WM_ICON_NAME are specified at:
>
> http://specs.freedesktop.org/wm-spec/wm-spec-latest.html
>
> The patch adds support for the _NET_WM_NAME and _NET_WM_ICON_NAME
> properties to the non-gtk+ builds.
>
> === modified file 'src/ChangeLog'
> --- src/ChangeLog 2010-07-03 14:35:54 +0000
> +++ src/ChangeLog 2010-07-04 17:09:04 +0000
> @@ -1,3 +1,12 @@
> +2010-07-04 James Cloos<cloos@jhcloos.com
> +
> + * xterm.c (x_term_init): Intern the _NET_WM_NAME and
> + _NET_WM_ICON_NAME atoms.
> +
> + * xfns.c (x_set_name_internal): Set the EWMH _NET_WM_NAME
> + and _NET_WM_ICON_NAME properties, too, matching what is
> + done in the gtk+ case.
> +
> 2010-07-03 Eli Zaretskii<eliz@gnu.org>
>
> * msdos.c (IT_set_frame_parameters): Fix setting of colors in
>
> === modified file 'src/xfns.c'
> --- src/xfns.c 2010-07-02 12:19:29 +0000
> +++ src/xfns.c 2010-07-04 16:32:36 +0000
> @@ -1613,8 +1613,8 @@
> int bytes, stringp;
> int do_free_icon_value = 0, do_free_text_value = 0;
> Lisp_Object coding_system;
> -#ifdef USE_GTK
> Lisp_Object encoded_name;
> + Lisp_Object encoded_icon_name;
> struct gcpro gcpro1;
>
> /* As ENCODE_UTF_8 may cause GC and relocation of string data,
> @@ -1622,7 +1622,6 @@
> GCPRO1 (name);
> encoded_name = ENCODE_UTF_8 (name);
> UNGCPRO;
> -#endif
>
> coding_system = Qcompound_text;
> /* Note: Encoding strategy
> @@ -1638,7 +1637,12 @@
> We may also be able to use "UTF8_STRING" in text.encoding
> in the future which can encode all Unicode characters.
> But, for the moment, there's no way to know that the
> - current window manager supports it or not. */
> + current window manager supports it or not.
> +
> + Either way, we also set the _NET_WM_NAME and _NET_WM_ICON_NAME
> + properties. Per the EWMH specification, those two properties
> + are always UTF8_STRING. This matches what gtk_window_set_title()
> + does in the USE_GTK case. */
> text.value = x_encode_text (name, coding_system, 0,&bytes,&stringp,
> &do_free_text_value);
> text.encoding = (stringp ? XA_STRING
> @@ -1649,6 +1653,7 @@
> if (!STRINGP (f->icon_name))
> {
> icon = text;
> + encoded_icon_name = encoded_name;
> }
> else
> {
> @@ -1659,6 +1664,8 @@
> : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
> icon.format = 8;
> icon.nitems = bytes;
> +
> + encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
> }
>
> #ifdef USE_GTK
> @@ -1666,9 +1673,21 @@
> (char *) SDATA (encoded_name));
> #else /* not USE_GTK */
> XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),&text);
> + XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
> + FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_name,
> + FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING,
> + 8, PropModeReplace,
> + (char *) SDATA (encoded_name),
> + SBYTES (encoded_name));
> #endif /* not USE_GTK */
>
> XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),&icon);
> + XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
> + FRAME_X_DISPLAY_INFO (f)->Xatom_net_wm_icon_name,
> + FRAME_X_DISPLAY_INFO (f)->Xatom_UTF8_STRING,
> + 8, PropModeReplace,
> + (char *) SDATA (encoded_icon_name),
> + SBYTES (encoded_icon_name));
>
> if (do_free_icon_value)
> xfree (icon.value);
>
> === modified file 'src/xterm.c'
> --- src/xterm.c 2010-07-02 12:19:29 +0000
> +++ src/xterm.c 2010-07-04 16:32:36 +0000
> @@ -10493,6 +10493,10 @@
> = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False);
> dpyinfo->Xatom_net_window_type_tooltip
> = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False);
> + dpyinfo->Xatom_net_wm_icon_name
> + = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False);
> + dpyinfo->Xatom_net_wm_name
> + = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False);
>
> dpyinfo->cut_buffers_initialized = 0;
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-05 10:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-04 17:18 bug#6563: [PATCH] 24.0.50; Set EWMH WM NAME properties James Cloos
2010-07-05 10:31 ` Jan Djärv
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.