mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-14 04:31:09 +00:00
Optimize gdk_x11_screen_supports_net_wm_hint()
Move the call to gdk_x11_atom_to_xatom_for_display() outside of the search loop in gdk_x11_screen_supports_net_wm_hint(). In my test case (running Audacious for about a minute), this reduced the total number of hash table lookups performed from 370,000 to 230,000. https://bugzilla.gnome.org/show_bug.cgi?id=702913
This commit is contained in:
parent
1107935d2b
commit
6eea6ddcc3
@ -1470,6 +1470,7 @@ gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
|
|||||||
GdkX11Screen *x11_screen;
|
GdkX11Screen *x11_screen;
|
||||||
NetWmSupportedAtoms *supported_atoms;
|
NetWmSupportedAtoms *supported_atoms;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
Atom atom;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
||||||
|
|
||||||
@ -1521,13 +1522,12 @@ gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
|
|||||||
if (supported_atoms->atoms == NULL)
|
if (supported_atoms->atoms == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
i = 0;
|
atom = gdk_x11_atom_to_xatom_for_display (display, property);
|
||||||
while (i < supported_atoms->n_atoms)
|
|
||||||
{
|
|
||||||
if (supported_atoms->atoms[i] == gdk_x11_atom_to_xatom_for_display (display, property))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
++i;
|
for (i = 0; i < supported_atoms->n_atoms; i++)
|
||||||
|
{
|
||||||
|
if (supported_atoms->atoms[i] == atom)
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user