Commit fa461525 authored by Hans de Goede's avatar Hans de Goede Committed by Jonas Ådahl

window-x11: Refactor meta_prop_get_latin1_string() calls

Instead of storing the result of meta_prop_get_latin1_string() into
a temporary string value, g_strdup-ing that temp value storing the
g_strdup result into window->sm_client_id and then g_free-ing the
temporary string, we can pass window->sm_client_id as the place where
meta_prop_get_latin1_string() stores its result, since the result
from meta_prop_get_latin1_string() is itself a g_strdup-ed string,
so there is no need to g_strdup it again.

Note this drops the check to only issue the
"Window %s sets SM_CLIENT_ID on itself ..." warning once. This check is
not necessary as update_sm_hints() is only called once at window
creation time and is never called again.

!786
parent 8e510a07
Pipeline #120477 passed with stages
in 13 minutes and 25 seconds
......@@ -171,17 +171,11 @@ update_sm_hints (MetaWindow *window)
if (leader != None)
{
char *str;
window->xclient_leader = leader;
if (meta_prop_get_latin1_string (window->display->x11_display, leader,
window->display->x11_display->atom_SM_CLIENT_ID,
&str))
{
window->sm_client_id = g_strdup (str);
g_free (str);
}
meta_prop_get_latin1_string (window->display->x11_display, leader,
window->display->x11_display->atom_SM_CLIENT_ID,
&window->sm_client_id);
}
else
{
......@@ -192,20 +186,13 @@ update_sm_hints (MetaWindow *window)
/* Some broken apps (kdelibs fault?) set SM_CLIENT_ID on the app
* instead of the client leader
*/
char *str;
str = NULL;
if (meta_prop_get_latin1_string (window->display->x11_display, window->xwindow,
window->display->x11_display->atom_SM_CLIENT_ID,
&str))
{
if (window->sm_client_id == NULL) /* first time through */
meta_warning ("Window %s sets SM_CLIENT_ID on itself, instead of on the WM_CLIENT_LEADER window as specified in the ICCCM.\n",
window->desc);
meta_prop_get_latin1_string (window->display->x11_display, window->xwindow,
window->display->x11_display->atom_SM_CLIENT_ID,
&window->sm_client_id);
window->sm_client_id = g_strdup (str);
g_free (str);
}
if (window->sm_client_id)
meta_warning ("Window %s sets SM_CLIENT_ID on itself, instead of on the WM_CLIENT_LEADER window as specified in the ICCCM.\n",
window->desc);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment