mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
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. https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
This commit is contained in:
parent
8e510a07c4
commit
fa461525ee
@ -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;
|
||||
meta_prop_get_latin1_string (window->display->x11_display, window->xwindow,
|
||||
window->display->x11_display->atom_SM_CLIENT_ID,
|
||||
&window->sm_client_id);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user